yyl
5 天以前 eba6c39cc97723bfe2056e2eac2c2d1cf59ab12a
Main/System/Battle/StoryBossBattleWin.cs
@@ -41,6 +41,10 @@
    public TotalDamageDisplayer totalDamageDisplayer;
    public SkillTips skillTipsRed;
    public SkillTips skillTipsBlue;
    private BattleObject bossBattleObject = null;
    [SerializeField] public List<BattleBuffCell> buffCells;
@@ -90,6 +94,7 @@
        // SetBattleField(BattleManager.Instance.storyBattleField);
        BattleManager.Instance.onBattleFieldCreate += OnCreateBattleField;
        EventBroadcast.Instance.AddListener<BattleDmgInfo>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken);
        EventBroadcast.Instance.AddListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnCastSkill);
        UIManager.Instance.CloseWindow<MainWin>();
    }
@@ -101,6 +106,7 @@
        base.OnPreClose();
        BattleManager.Instance.onBattleFieldCreate -= OnCreateBattleField;
        EventBroadcast.Instance.RemoveListener<BattleDmgInfo>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken);
        EventBroadcast.Instance.RemoveListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnCastSkill);
        UIManager.Instance.CloseWindow<BattleHUDWin>();
@@ -112,6 +118,29 @@
            bossBattleObject.buffMgr.onBuffChanged -= OnBuffChanged;
            bossBattleObject = null;
        }
        if (battleField != null)
        {
            battleField.OnRoundChange -= OnRoundChange;
            battleField = null;
        }
    }
    private void OnCastSkill(string guid, SkillConfig skillConfig, TeamHero teamHero)
    {
        if (battleField == null)
            return;
        if (battleField.guid != guid)
            return;
        BattleObject battleObject = battleField.battleObjMgr.GetBattleObject(teamHero.ObjID);
        bool isRed = battleObject.Camp == BattleCamp.Red;
        SkillTips tips = isRed ? skillTipsRed : skillTipsBlue;
        tips.PlayMotion(battleField, isRed, teamHero, skillConfig);
    }
    private void OnCreateBattleField(string arg1, BattleField field)
@@ -165,11 +194,14 @@
            Debug.LogError("找不到boss");
        }
        txtBattleRound.text = string.Format("{0}/{1}", battleField.round, battleField.turnMax);
        OnRoundChange(battleField.round, battleField.turnMax);
        OnBuffChanged();
        totalDamageDisplayer.SetActive(false);
        skillTipsBlue.SetActive(false);
        skillTipsRed.SetActive(false);
    }
    private void OnBuffChanged()
@@ -231,6 +263,12 @@
    public void SetBattleField(StoryBossBattleField _battleField)
    {
        if (battleField != null)
        {
            battleField.OnRoundChange -= OnRoundChange;
            battleField = null;
        }
        battleField = _battleField;
        if (battleRootNode != null)
        {
@@ -256,6 +294,8 @@
        buttonsAdjuster.SetSortingOrder(BattleConst.ActiveHeroActionSortingOrder);
        Refresh();
        battleField.OnRoundChange += OnRoundChange;
        textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
    }
@@ -312,4 +352,9 @@
            }
        }
    }
    private void OnRoundChange(int round, int maxRound)
    {
        txtBattleRound.text = string.Format("{0}/{1}", round, maxRound);
    }
}