| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779 | using System;using System.Collections.Generic;using System.Linq;using Core.Language;using Core.Utility;using Excel2Json;using Fort23.Core;using Fort23.Mono;using Fort23.UTool;using GameLogic.Bag;using GameLogic.Combat.CombatTool;using GameLogic.CombatScenesTool;using GameLogic.Hero;using GameLogic.Player;using Mono.Player;using UnityEngine;using Utility;using Random = UnityEngine.Random;public class PlayerManager : Singleton<PlayerManager>{    public GameConstantConfig gameConstantConfig;    public GongFaControl GongFaControl;    public FaBaoControl FaBaoControl;    public BagController BagController;    public PlayerGuideDataComponent PlayerGuideDataComponent = new PlayerGuideDataComponent();    public SummonManager SummonManager = new SummonManager();    // public Map<long, List<AccountFileInfo.DaoYouGuaiJiData>> GuaijiDaoYou = new Map<long, List<AccountFileInfo.DaoYouGuaiJiData>>();    public bool isTest;    /// <summary>    /// 玩家角色属性    /// </summary>    public HeroInfo myHero;    public HeroInfo yindaoHeroData;    private string playerName;    public string PlayerName    {        get { return AccountFileInfo.Instance.playerData.playerName; }        set        {            playerName = value;            AccountFileInfo.Instance.playerData.playerName = value;            AccountFileInfo.Instance.SavePlayerData();        }    }    private CTask _cTask;    public long serverTime => TimeHelper.ServerNow();    private AccountFileInfo.SmallPlacesData currentPlaces;    public AccountFileInfo.SmallPlacesData CurrentsmallPlaces    {        get { return currentPlaces; }        set { currentPlaces = value; }    }    public float PlacesBl => GetMapBl(CurrentsmallPlaces.id);    private TimerEntity _timerEntity;    public bool isLogin;    /// <summary>    /// 当前引导id    /// </summary>    public int curGuideGroupId;    public void Init()    {        AccountFileInfo.Instance.LoadPlayerData();        SetConfigs();        InitGameData();        // int m = Random.Range(0, 4 * 60 * 1000);        RandownDaoYou(gameConstantConfig.Daoyoushowuptime + 1000);        QiankundaiConfig[] qiankundaiConfigs = ConfigComponent.Instance.GetAll<QiankundaiConfig>();        foreach (var qiankundaiConfig in qiankundaiConfigs)        {            if (qiankundaiConfig.dropType == 1)            {                AccountFileInfo.QiankundaiData qiankundaiData =                    AccountFileInfo.Instance.playerData.QiankundaiDatas.FirstOrDefault(q =>                        q.id == qiankundaiConfig.ID);                if (qiankundaiData == null)                {                    qiankundaiData = new AccountFileInfo.QiankundaiData();                    qiankundaiData.id = qiankundaiConfig.ID;                    if (qiankundaiConfig.dropPara1 == 1)                    {                        qiankundaiData.refenceTime = TimeHelper.ClientNow() + 60 * 60 * 1000;                    }                    else if (qiankundaiConfig.dropPara1 == 2)                    {                        qiankundaiData.refenceTime = TimeHelper.GetBaseRefreshTime(TimeHelper.ClientNow());                    }                    else if (qiankundaiConfig.dropPara1 == 3)                    {                    }                    AccountFileInfo.Instance.playerData.QiankundaiDatas.Add(qiankundaiData);                }            }        }        CalculateOfflineRewards();        AccountFileInfo.Instance.SavePlayerData();        SummonManager.CustomInit();        isLogin = true;    }    /// <summary>    /// 获得固定时间乾坤袋表    /// </summary>    /// <returns></returns>    public List<QiankundaiConfig> GetFixedTimeQiankundaiConfigs()    {        List<QiankundaiConfig> configs = new List<QiankundaiConfig>();        QiankundaiConfig[] qiankundaiConfigs = ConfigComponent.Instance.GetAll<QiankundaiConfig>();        foreach (var qiankundaiConfig in qiankundaiConfigs)        {            if (qiankundaiConfig.dropType == 2)            {                if (myHero.powerUpConfig.ID >= qiankundaiConfig.dropLevel[0] &&                    myHero.powerUpConfig.ID <= qiankundaiConfig.dropLevel[1])                {                    configs.Add(qiankundaiConfig);                }            }        }        return configs;    }    //添加心境    public void AddSentimentData(int id)    {        AccountFileInfo.SentimentData sentimentData =            AccountFileInfo.Instance.playerData.SentimentDatas.FirstOrDefault(sd => sd.id == id);        if (sentimentData != null)        {            LogTool.Error("已经用心境 id:" + id);            return;        }        SentimentConfig sentimentConfig = ConfigComponent.Instance.Get<SentimentConfig>(id);        sentimentData = new AccountFileInfo.SentimentData();        sentimentData.id = id;        sentimentData.mainSentiment = new AccountFileInfo.SentimentProperty();        sentimentData.mainSentiment.groupId = sentimentConfig.mainSentimentEffect;        foreach (var i in sentimentConfig.sentimentEffect)        {            AccountFileInfo.SentimentProperty sentimentProperty = new AccountFileInfo.SentimentProperty();            sentimentProperty.groupId = i;            sentimentData.sentimentProperties.Add(sentimentProperty);        }        AccountFileInfo.Instance.playerData.SentimentDatas.Add(sentimentData);        AccountFileInfo.Instance.SavePlayerData();    }    List<AccountFileInfo.DaoYouData> removerDaoYou = new List<AccountFileInfo.DaoYouData>();    public void RandownDaoYou(int m)    {        _timerEntity?.Dispose();        _timerEntity = null;        _timerEntity = TimerComponent.Instance.AddTimer(m, () =>        {            List<AccountFileInfo.DaoYouData> daoYouDatas = AccountFileInfo.Instance.playerData.daoYouDatas.ToList();            foreach (var daoYouData in daoYouDatas)            {                if (daoYouData.favorabilityLv <= 1)                {                    removerDaoYou.Add(daoYouData);                    continue;                }                foreach (var keyValuePair in AccountFileInfo.Instance.playerData.daoYouGuaiJiDatas)                {                    if (daoYouData.id == keyValuePair.daoyouDataID)                    {                        removerDaoYou.Add(daoYouData);                        break;                    }                }            }            foreach (var daoYouData in removerDaoYou)            {                daoYouDatas.Remove(daoYouData);            }            removerDaoYou.Clear();            int count = Random.Range(0, daoYouDatas.Count + 1);            List<AccountFileInfo.DaoYouGuaiJiData> daoyou = new List<AccountFileInfo.DaoYouGuaiJiData>();            for (int i = 0; i < count; i++)            {                int index = Random.Range(0, daoYouDatas.Count);                AccountFileInfo.DaoYouGuaiJiData daoYouGuaiJiData = new AccountFileInfo.DaoYouGuaiJiData();                int time = Random.Range(gameConstantConfig.DaoyouguajiDuration[0],                    gameConstantConfig.DaoyouguajiDuration[1]) * 1000;                daoYouGuaiJiData.leaveTime = TimeHelper.ClientNow() + time;                daoYouGuaiJiData.guajiTime = time;                daoYouGuaiJiData.daoyouDataID = daoYouDatas[index].id;                daoyou.Add(daoYouGuaiJiData);                daoYouDatas.RemoveAt(index);                _timerEntity?.Dispose();                _timerEntity = null;            }            if (daoyou.Count > 0)            {                AccountFileInfo.Instance.playerData.daoYouGuaiJiDatas.AddRange(daoyou);                EventManager.Instance.Dispatch(CustomEventType.DaoYouCounUpdate, null);            }            RandownDaoYou(gameConstantConfig.Daoyoushowuptime * 1000);        });    }    public int GetDaoYouLevel(AccountFileInfo.DaoYouData daoYouData)    {        DaoyouModelConfig daoyouModelConfig = ConfigComponent.Instance.Get<DaoyouModelConfig>(daoYouData.id);        int level = (int)(myHero.level.Value * daoyouModelConfig.growupRate * 0.01f);        if (level < 1) level = 1;        return level;    }    public int GetBl(AccountFileInfo.DaoYouData daoYouData, int guajibuffId)    {        DaoyouLevelupConfig daoyouLevelupConfig =            ConfigComponent.Instance.Get<DaoyouLevelupConfig>(daoYouData.favorabilityLv);        int level = GetDaoYouLevel(daoYouData);        DaoyouguajiResourcLevel daoyouguajiResourcLevel = ConfigComponent.Instance.Get<DaoyouguajiResourcLevel>(level);        guajibuff guajibuff = ConfigComponent.Instance.Get<guajibuff>(guajibuffId);        int levelBl = 0;        int bl = 0;        switch (guajibuff.paraValue)        {            case 1:                levelBl = daoyouguajiResourcLevel.para1;                bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.01f);                return bl;                break;            case 2:                levelBl = daoyouguajiResourcLevel.para2;                bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.01f);                return bl;                break;            case 3:                levelBl = daoyouguajiResourcLevel.para3;                bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.01f);                return bl;                break;            case 4:                levelBl = daoyouguajiResourcLevel.para4;                bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.01f);                return bl;                break;            case 5:                levelBl = daoyouguajiResourcLevel.para5;                bl = (int)(guajibuff.GivingRate * levelBl * daoyouLevelupConfig.guajiGrowup * 0.01f * 0.001f);                return bl;                break;            default:                return 0;        }    }    private void SetConfigs()    {        gameConstantConfig = ConfigComponent.Instance.Get<GameConstantConfig>(1);    }    private void InitGameData()    {        GongFaControl = new GongFaControl();        FaBaoControl = new FaBaoControl();        BagController = new BagController();        HeroInfo heroInfo = new HeroInfo();        AccountFileInfo.Instance.playerData.heroData.TaoismSkillId = 601011;        heroInfo.InitHero(AccountFileInfo.Instance.playerData.heroData);        myHero = heroInfo;        myHero.TaoismSkillId = 601011;        yindaoHeroData = new HeroInfo();        yindaoHeroData.InitMonster(102, 200);        yindaoHeroData.isMonster = false;        // yindaoHeroData = heroInfo;        yindaoHeroData.TaoismSkillId = 601011;        // myHero= yindaoHeroData;        BagController.Init();        //初始化关卡        CurrentsmallPlaces = GetSmallPlacesData(GetMaxSmallPlacesId());        StaticUpdater.Instance.RemoveRenderUpdateCallBack(Update);        StaticUpdater.Instance.AddRenderUpdateCallBack(Update);        EventManager.Instance.AddEventListener(CustomEventType.CloseLoadingUI, CloseLoadingUI);    }    private void CloseLoadingUI(IEventData e)    {        _cTask?.SetResult();    }    private float timer;    public int GetMaxSmallPlacesId()    {        int placesId = AccountFileInfo.Instance.playerData.smallPlacesDatas.Max(p => p.id);        return placesId;    }    public AccountFileInfo.PlacesData GetPlacesData(int placesId)    {        return AccountFileInfo.Instance.playerData.placesDatas.FirstOrDefault(p => p.id == placesId);    }    public AccountFileInfo.SmallPlacesData GetSmallPlacesData(int smallPlacesId)    {        return AccountFileInfo.Instance.playerData.smallPlacesDatas.FirstOrDefault(p => p.id == smallPlacesId);    }    public float GetMapBl(int map)    {        SmallPlacesConfig smallPlacesConfig = ConfigComponent.Instance.Get<SmallPlacesConfig>(map);        AccountFileInfo.PlacesData placesData = GetPlacesData(smallPlacesConfig.PlacesId);        if (placesData == null)            return 0;        PlacesConfig placesConfig = ConfigComponent.Instance.Get<PlacesConfig>(smallPlacesConfig.PlacesId);        if (placesConfig.TotalScore == 0)        {            return 0;        }        return (float)Math.Round(((float)placesData.progress / placesConfig.TotalScore) * 100, 1);    }    private bool isUpdate = false;    private void Update()    {        timer += Time.deltaTime;        if (timer > 1)        {            timer = 0;            // PlayerManager.Instance.myHero.heroData.exp += myHero.powerUpConfig.AutoXiuwei;            // AccountFileInfo.Instance.SavePlayerData();            if (AccountFileInfo.Instance.playerData.QiankundaiDropTimer <= gameConstantConfig.qiankundaiMaxTime)            {                AccountFileInfo.Instance.playerData.QiankundaiDropTimer++;                QianKunDaiAward();                AccountFileInfo.Instance.SavePlayerData();            }        }        //每天刷新        if (TimeHelper.ClientNow() > AccountFileInfo.Instance.playerData.nextRefence)        {            AccountFileInfo.Instance.playerData.nextRefence =                TimeHelper.GetBaseRefreshTime(TimeHelper.ClientNow());            AccountFileInfo.Instance.playerData.todayUseExpElixrPanelCount = 0;            AccountFileInfo.Instance.playerData.todayDivineSensePoint = 0;            foreach (var playerDataSummonData in AccountFileInfo.Instance.playerData.SummonDatas)            {                playerDataSummonData.onePayCount = 0;                playerDataSummonData.tenPayCount = 0;                playerDataSummonData.oneFreeCount = 0;                playerDataSummonData.nextOneFreeTime = 0;                playerDataSummonData.tenFreeCount = 0;                playerDataSummonData.nextTenFreeTime = 0;            }            AccountFileInfo.Instance.SavePlayerData();        }        foreach (var keyValuePair in AccountFileInfo.Instance.playerData.daoYouGuaiJiDatas)        {            if (!keyValuePair.isLeave && TimeHelper.ClientNow() > keyValuePair.leaveTime)            {                //判断概率给奖励                isUpdate = true;                keyValuePair.isLeave = true;                AccountFileInfo.DaoYouData daoYouData =                    AccountFileInfo.Instance.playerData.daoYouDatas.FirstOrDefault(d =>                        d.id == keyValuePair.daoyouDataID);                DaoyouModelConfig daoyouModelConfig =                    ConfigComponent.Instance.Get<DaoyouModelConfig>(daoYouData.id);                int bl = GetBl(daoYouData, daoyouModelConfig.guajiBuffID[0]);                int randomValue1 = Random.Range(0, 101);                LogTool.Log("道友随机怪率:" + randomValue1 + " 比例:" + bl);                List<AccountFileInfo.ItemData> itemDatas = new List<AccountFileInfo.ItemData>();                if (randomValue1 >= bl)                {                    for (var i = 1; i < daoyouModelConfig.guajiBuffID.Length; i++)                    {                        int count = GetBl(daoYouData, daoyouModelConfig.guajiBuffID[i]);                        guajibuff guajibuff =                            ConfigComponent.Instance.Get<guajibuff>(daoyouModelConfig.guajiBuffID[i]);                        switch (guajibuff.paraValue)                        {                            case 1:                                itemDatas.Add(new AccountFileInfo.ItemData(1003, count));                                LogTool.Log("道友获得道具id:" + 1003 + " 数量:" + count);                                break;                            case 2:                                itemDatas.Add(new AccountFileInfo.ItemData(1001, count));                                LogTool.Log("道友获得道具id:" + 1001 + " 数量:" + count);                                break;                            case 3:                                itemDatas.Add(new AccountFileInfo.ItemData(1005, count));                                LogTool.Log("道友获得道具id:" + 1005 + " 数量:" + count);                                break;                            case 4:                                itemDatas.Add(new AccountFileInfo.ItemData(1006, count));                                LogTool.Log("道友获得道具id:" + 1006 + " 数量:" + count);                                break;                        }                    }                }                keyValuePair.items.AddRange(itemDatas);            }        }        if (isUpdate)        {            AccountFileInfo.Instance.SavePlayerData();            EventManager.Instance.Dispatch(CustomEventType.DaoYouCounUpdate, null);            isUpdate = false;        }    }    public async CTask ChangeMap(int mapId)    {        SmallPlacesConfig currentSmallPlacesConfig = ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);        SmallPlacesConfig smallPlacesConfig = ConfigComponent.Instance.Get<SmallPlacesConfig>(mapId);        if (smallPlacesConfig.ID == 0)            return;        AccountFileInfo.SmallPlacesData lastSmallPlacesData =            PlayerManager.Instance.GetSmallPlacesData(smallPlacesConfig.ID - 1);        SmallPlacesConfig lastSmallPlacesConfig =            ConfigComponent.Instance.Get<SmallPlacesConfig>(smallPlacesConfig.ID - 1);        if (smallPlacesConfig.ID > 1 && (lastSmallPlacesData == null ||                                         lastSmallPlacesData.completionEventCount <                                         lastSmallPlacesConfig.CompletionEventCount))        {            return;        }        if (lastSmallPlacesConfig.UnlockEnvetid != 0)        {            AccountFileInfo.EventList eventList =                AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce =>                    ce.eventID == lastSmallPlacesConfig.UnlockEnvetid);            if (eventList == null || !eventList.isCompleted)            {                return;            }        }        UIManager.Instance.HindCurrAllShowPanel();        _cTask = CTask.Create();        AccountFileInfo.SmallPlacesData smallPlacesData =            PlayerManager.Instance.GetSmallPlacesData(smallPlacesConfig.ID);        if (smallPlacesData == null)        {            smallPlacesData = new AccountFileInfo.SmallPlacesData();            smallPlacesData.id = smallPlacesConfig.ID;            AccountFileInfo.Instance.playerData.smallPlacesDatas.Add(smallPlacesData);        }        AccountFileInfo.PlacesData currentPlacesData = PlayerManager.Instance.GetPlacesData(smallPlacesConfig.ID);        if (currentPlacesData == null)        {            currentPlacesData = new AccountFileInfo.PlacesData();            currentPlacesData.id = smallPlacesConfig.PlacesId;            AccountFileInfo.Instance.playerData.placesDatas.Add(currentPlacesData);        }        PlayerManager.Instance.CurrentsmallPlaces = smallPlacesData;        if (currentSmallPlacesConfig.PlacesId == smallPlacesConfig.PlacesId)        {                    CombatController.currActiveCombat.ChangeState(CombatController.miniSceneSwitch);        }        else        {            CombatController.currActiveCombat.ChangeState(CombatController.sceneSwitch);        }            await _cTask;        UIManager.Instance.ShowLastHindAllShowPanel();        EventManager.Instance.Dispatch(CustomEventType.ChangeMap, null);    }    public void QianKunDaiAward()    {        foreach (var playerDataQiankundaiData in AccountFileInfo.Instance.playerData.QiankundaiDatas)        {            //重置掉落次数            QiankundaiConfig qiankundaiConfig =                ConfigComponent.Instance.Get<QiankundaiConfig>(playerDataQiankundaiData.id);            if (qiankundaiConfig.dropType != 2 &&                TimeHelper.ClientNow() >= playerDataQiankundaiData.refenceTime)            {                if (qiankundaiConfig.dropPara1 == 1)                {                    playerDataQiankundaiData.refenceTime = TimeHelper.ClientNow() + 60 * 60 * 1000;                }                else if (qiankundaiConfig.dropPara1 == 2)                {                    playerDataQiankundaiData.refenceTime =                        TimeHelper.GetBaseRefreshTime(TimeHelper.ClientNow());                }                else if (qiankundaiConfig.dropPara1 == 3)                {                }                playerDataQiankundaiData.dropCount = 0;            }            if (myHero.powerUpConfig.ID >= qiankundaiConfig.dropLevel[0] &&                myHero.powerUpConfig.ID <= qiankundaiConfig.dropLevel[1])            {                if (playerDataQiankundaiData.dropCount < qiankundaiConfig.dropPara2 ||                    qiankundaiConfig.dropPara2 == -1)                {                    playerDataQiankundaiData.dropTime++;                    if (playerDataQiankundaiData.dropTime >= qiankundaiConfig.dropTypePara)                    {                        //发放奖励                        for (var i = 0; i < qiankundaiConfig.ChoukaID.Length; i++)                        {                            List<ItemInfo> itemInfos = DropManager.Instance.Drop(qiankundaiConfig.ChoukaID[i],                                qiankundaiConfig.DropCount[i]);                            foreach (var itemInfo in itemInfos)                            {                                AccountFileInfo.ItemData itemData =                                    AccountFileInfo.Instance.playerData.QiankundaiItemDatas.FirstOrDefault(i =>                                        i.itemId == itemInfo.itemID);                                if (itemData != null)                                {                                    itemData.itemCount += itemInfo.count.Value;                                }                                else                                {                                    itemData = itemInfo.ToItemData();                                    AccountFileInfo.Instance.playerData.QiankundaiItemDatas.Add(itemData);                                }                            }                        }                        playerDataQiankundaiData.dropCount = 0;                        playerDataQiankundaiData.dropTime = 0;                    }                }            }            // AccountFileInfo.Instance.SavePlayerData();        }    }    public void CalculateOfflineRewards()    {        // return;        if (AccountFileInfo.Instance.playerData.QiankundaiDropTimer <=            PlayerManager.Instance.gameConstantConfig.qiankundaiMaxTime &&            AccountFileInfo.Instance.playerData.ExitTime > 0)        {            int miao = (int)((TimeHelper.ClientNow() - AccountFileInfo.Instance.playerData.ExitTime) / 1000);            miao = AccountFileInfo.Instance.playerData.QiankundaiDropTimer + miao >=                   PlayerManager.Instance.gameConstantConfig.qiankundaiMaxTime                ? PlayerManager.Instance.gameConstantConfig.qiankundaiMaxTime - miao                : miao;            AccountFileInfo.Instance.playerData.QiankundaiDropTimer += miao;            for (int i = 0; i < miao; i++)            {                QianKunDaiAward();            }        }        AccountFileInfo.Instance.playerData.ExitTime = 0;        AccountFileInfo.Instance.SavePlayerData();    }    public void AddTestHeroInfo(TestCombatHeroConfig.TestHeroInfoConfig testHeroInfoConfig)    {        isTest = true;        GongFaControl.allSkill.Clear();        SkillConfig[] allSkillConfig = ConfigComponent.Instance.GetAll<SkillConfig>();        for (int i = 0; i < allSkillConfig.Length; i++)        {            SkillConfig skillConfig = allSkillConfig[i];            if (skillConfig.level == testHeroInfoConfig.skillStart)            {                SkillInfo skillInfo = new SkillInfo(skillConfig.ID, testHeroInfoConfig.skillLevel);                skillInfo.index = -1;                GongFaControl.AddSkillInfo(skillInfo);            }        }        AccountFileInfo.HeroData heroData = new AccountFileInfo.HeroData();        heroData.heroModelId = testHeroInfoConfig.heroID;        heroData.heroPowerId = testHeroInfoConfig.level;        myHero = new HeroInfo();        myHero.InitHero(heroData);        if (testHeroInfoConfig.skill.Count > 0)        {            GongFaControl.allSkill.Clear();            for (int i = 0; i < testHeroInfoConfig.skill.Count; i++)            {                SkillInfo skillInfo = new SkillInfo(testHeroInfoConfig.skill[i], testHeroInfoConfig.skillLevel,                    testHeroInfoConfig.skillStart);                skillInfo.index = i;                GongFaControl.AddSkillInfo(skillInfo);            }        }        else        {            SkillInfo[] skillInfos = GongFaControl.allUseSkill;            for (int i = 0; i < skillInfos.Length; i++)            {                if (skillInfos[i] != null)                {                    SkillInfo skillInfo = new SkillInfo(skillInfos[i].skillConfig.IDGroup,                        testHeroInfoConfig.skillLevel,                        testHeroInfoConfig.skillStart);                    skillInfo.index = i;                    GongFaControl.allUseSkill[i] = skillInfo;                }            }        }        if (testHeroInfoConfig.magicWeaponId.Count > 0)        {            int fbLevel = ((testHeroInfoConfig.level - 1) / 10) + 1;            if (fbLevel <= 0)            {                fbLevel = 1;            }            for (int i = 0; i < testHeroInfoConfig.magicWeaponId.Count; i++)            {                FaBaoInfo faBaoInfo = new FaBaoInfo(testHeroInfoConfig.magicWeaponId[i], fbLevel);                faBaoInfo.FaBaoData.useIndex = i;                FaBaoControl.FightFaBao[i] = faBaoInfo;                FaBaoControl.AddFaBao(faBaoInfo);            }        }        float[] qiangDu = new float[] { 0, 35.7f, 98f, 138.7f, 199.3f, 216f };        int qiangDuLevelId = Mathf.CeilToInt(testHeroInfoConfig.level / 5f);        HeroQiangDuAddConfig heroQiangDuAddConfig = ConfigComponent.Instance.Get<HeroQiangDuAddConfig>(qiangDuLevelId);        int index = Mathf.RoundToInt(heroQiangDuAddConfig.qiangDuZhi) - 1;        myHero.hp = (EncryptionLong)(myHero.hp.Value * (qiangDu[index] / 100f + 1));        myHero.attack = (EncryptionLong)(myHero.attack.Value * (qiangDu[index] / 100f + 1));        myHero.defense = (EncryptionLong)(myHero.defense.Value * (qiangDu[index] / 100f + 1));        // for (int i = 0; i < 4; i++)        // {        //     FaBaoControl.FightFaBao[i] = FaBaoControl.myAllFaBao[i];        // }        myHero.hp += testHeroInfoConfig.hp;        myHero.attack += testHeroInfoConfig.att;        myHero.defense += testHeroInfoConfig.def;        myHero.Metal += testHeroInfoConfig.jing;        myHero.Wood += testHeroInfoConfig.mu;        myHero.Water += testHeroInfoConfig.shui;        myHero.Fire += testHeroInfoConfig.huo;        myHero.Earth += testHeroInfoConfig.tu;        myHero.TaoismSkillId = 601011;        myHero.MagicWeaponID.Clear();        myHero.MagicWeaponID.AddRange(FaBaoControl.FightFaBao);        // for (int i = 0; i < FaBaoControl.FightFaBao.Length; i++)        // {        //     FaBaoInfo faBaoInfo = FaBaoControl.FightFaBao[i];        //     if (faBaoInfo != null)        //     {        //         foreach (var VARIABLE in faBaoInfo.attriButedIC)        //         {        //             switch (VARIABLE.Key)        //             {        //                 case 1:        //                     myHero.hp += VARIABLE.Value;        //                     break;        //                 case 2:        //                     myHero.defense += VARIABLE.Value;        //                     break;        //                 case 3:        //                     myHero.attack += VARIABLE.Value;        //                     break;        //             }        //         }        //     }        // }    }    /// <summary>    /// 保存英雄数据    /// </summary>    /// <param name="heroInfo"></param>    public void SaveHeroData(HeroInfo heroInfo)    {        AccountFileInfo.Instance.playerData.heroData = heroInfo.heroData;        AccountFileInfo.Instance.SavePlayerData();    }    /// <summary>    /// 时间(秒)转换位小时分钟秒    /// </summary>    /// <param name="miao"></param>    /// <returns></returns>    public static string TimeToHSM(long miao)    {        long fen = miao / 60;        miao = miao % 60;        long xiaoShi = fen / 60;        long tian = xiaoShi / 24;        xiaoShi = xiaoShi % 24;        fen = fen % 60;        if (tian > 0)        {            return $"{tian}天{xiaoShi}小時";        }        else        {            if (xiaoShi <= 0 && fen <= 59)            {                return $"{fen}分{miao}秒";            }            else            {                return $"{xiaoShi}小時{fen}分";            }        }    }}
 |