| | |
| | | public int maxCost; //最高消耗 |
| | | public int[] autoCostWithBlessLV; //自动战斗消耗倍数关联祝福等级 |
| | | public int speed2UnlockMissionID; |
| | | public int speed3UnlockCTGID; |
| | | |
| | | |
| | | public override void Init() |
| | | { |
| | | ParseConfig(); |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerInit; |
| | | BattleManager.Instance.onBattleFieldCreate += OnCreateBattleField; |
| | | EventBroadcast.Instance.AddListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnSkillCast); |
| | | BlessLVManager.Instance.OnBlessLVUpdateEvent += UpdateRedpint; |
| | | TaskManager.Instance.OnTaskUpdate += OnTaskUpdate; |
| | | InvestModel.Instance.onInvestUpdate += OnInvestUpdate; |
| | | |
| | | } |
| | | |
| | |
| | | BattleManager.Instance.onBattleFieldCreate -= OnCreateBattleField; |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= BeforePlayerInit; |
| | | EventBroadcast.Instance.RemoveListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnSkillCast); |
| | | BlessLVManager.Instance.OnBlessLVUpdateEvent -= UpdateRedpint; |
| | | TaskManager.Instance.OnTaskUpdate -= OnTaskUpdate; |
| | | InvestModel.Instance.onInvestUpdate -= OnInvestUpdate; |
| | | |
| | | } |
| | | |
| | |
| | | var config = FuncConfigConfig.Get("AutoGuaji"); |
| | | autoCostWithBlessLV = JsonMapper.ToObject<int[]>(config.Numerical1); |
| | | speed2UnlockMissionID = int.Parse(config.Numerical2); |
| | | speed3UnlockCTGID = int.Parse(config.Numerical3); |
| | | maxCost = autoCostWithBlessLV.Length; |
| | | } |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | //新增消耗倍数红点 |
| | | Redpoint redpoint1 = new Redpoint(MainRedDot.RedPoint_AutoBattleKey, MainRedDot.RedPoint_AutoBattleKey * 10 + 1); |
| | | //新增战斗倍数红点 |
| | | Redpoint redpoint2 = new Redpoint(MainRedDot.RedPoint_AutoBattleKey, MainRedDot.RedPoint_AutoBattleKey * 10 + 2); |
| | | void UpdateRedpint() |
| | | { |
| | | //提示红点记录到第几个索引,每次解锁新的消耗红点都提示 |
| | | var costIndex = LocalSave.GetInt("redcost" + PlayerDatas.Instance.baseData.PlayerID); |
| | | if (costIndex + 1 < autoCostWithBlessLV.Length) |
| | | { |
| | | redpoint1.state = autoCostWithBlessLV[Math.Min(costIndex + 1, autoCostWithBlessLV.Length - 1)] <= BlessLVManager.Instance.m_TreeLV ? |
| | | RedPointState.Simple : RedPointState.None; |
| | | } |
| | | else |
| | | { |
| | | redpoint1.state = RedPointState.None; |
| | | } |
| | | |
| | | var speedIndex = LocalSave.GetInt("redspeed" + PlayerDatas.Instance.baseData.PlayerID); |
| | | redpoint2.state = RedPointState.None; |
| | | if (speedIndex == 0 && TaskManager.Instance.mainTask.TaskID > speed2UnlockMissionID && |
| | | !InvestModel.Instance.IsActiveFightSpeed(3)) |
| | | { |
| | | redpoint2.state = RedPointState.Simple; |
| | | } |
| | | else if (speedIndex < 2 && InvestModel.Instance.IsActiveFightSpeed(3)) |
| | | { |
| | | redpoint2.state = RedPointState.Simple; |
| | | } |
| | | } |
| | | |
| | | public void ClickCostRed() |
| | | { |
| | | int index = 0; |
| | | for (int i = 0; i < autoCostWithBlessLV.Length; i++) |
| | | { |
| | | if (autoCostWithBlessLV[i] <= BlessLVManager.Instance.m_TreeLV) |
| | | { |
| | | index = i; |
| | | } |
| | | else |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | LocalSave.SetInt("redcost" + PlayerDatas.Instance.baseData.PlayerID, index); |
| | | UpdateRedpint(); |
| | | } |
| | | |
| | | public void ClickSpeedRed() |
| | | { |
| | | int index = 0; |
| | | if (!InvestModel.Instance.IsActiveFightSpeed(3)) |
| | | { |
| | | if (TaskManager.Instance.mainTask.TaskID > speed2UnlockMissionID) |
| | | { |
| | | index = 1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | index = 2; |
| | | } |
| | | LocalSave.SetInt("redspeed" + PlayerDatas.Instance.baseData.PlayerID, index); |
| | | UpdateRedpint(); |
| | | |
| | | } |
| | | |
| | | void OnTaskUpdate() |
| | | { |
| | | //任务刷新比较频繁 |
| | | if (TaskManager.Instance.mainTask.TaskID < speed2UnlockMissionID) |
| | | { |
| | | return; |
| | | } |
| | | if (LocalSave.GetInt("redspeed" + PlayerDatas.Instance.baseData.PlayerID) > 0) |
| | | return; |
| | | if (redpoint2.state == RedPointState.Simple) |
| | | return; |
| | | UpdateRedpint(); |
| | | } |
| | | |
| | | void OnInvestUpdate(int type) |
| | | { |
| | | if (type > 2) |
| | | return; |
| | | UpdateRedpint(); |
| | | } |
| | | } |