From 5cb359503badbf01cb90ea9e733fa3ec5c0832f2 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期一, 27 十月 2025 19:58:55 +0800
Subject: [PATCH] 143 演武场-客户端 ArenaBattleWin BoneFieldBattleWin StoryBossBattleWin 使用基类

---
 Main/System/Battle/BaseBattleWin.cs.meta |   11 
 Main/System/Battle/StoryBossBattleWin.cs |  229 +-------------
 Main/System/Battle/BoneFieldBattleWin.cs |  184 +----------
 Main/System/Battle/BaseBattleWin.cs      |  279 ++++++++++++++++++
 Main/System/Battle/ArenaBattleWin.cs     |  163 +---------
 5 files changed, 352 insertions(+), 514 deletions(-)

diff --git a/Main/System/Battle/ArenaBattleWin.cs b/Main/System/Battle/ArenaBattleWin.cs
index d50ae8b..eafff77 100644
--- a/Main/System/Battle/ArenaBattleWin.cs
+++ b/Main/System/Battle/ArenaBattleWin.cs
@@ -1,20 +1,10 @@
 锘縰sing System.Collections.Generic;
 using LitJson;
 using UnityEngine;
-using UnityEngine.UI;
 
-public class ArenaBattleWin : UIBase
+public class ArenaBattleWin : BaseBattleWin
 {
-    // 缁勪欢寮曠敤
-    [SerializeField] Transform mountPoint;
     [SerializeField] Transform transButtons;
-    [SerializeField] Button btnSpeed;
-    [SerializeField] Text textSpeed;
-    [SerializeField] Button btnPass;
-    [SerializeField] Button btnPause;
-    private BattleRootNode battleRootNode = null;
-    private BattleField battleField;
-
     [SerializeField] HeroCountryComponent myCountry;
     [SerializeField] TextEx txtMyLV;
     [SerializeField] TextEx txtMyName;
@@ -33,55 +23,30 @@
     [SerializeField] AvatarCell enemyAvatarCell;
     [SerializeField] List<ArenaHeroHead> enemyHeroHeads;
 
-    [SerializeField] TextEx txtWaveInfo;
-
-    public TotalDamageDisplayer totalDamageDisplayer;
-
-    public SkillTips skillTipsRed;
-    public SkillTips skillTipsBlue;
-
-    // 鐢熷懡鍛ㄦ湡
-    protected override void InitComponent()
+    protected override void RegisterBattleEvents()
     {
-        base.InitComponent();
-        // 鍒濆鍖栫粍浠跺紩鐢� 缁戝畾鎸夐挳绛塙I缁勪欢浜嬩欢
-        btnSpeed.AddListener(ChangeSpeed);
-        btnPass.AddListener(OnClickPass);
-        btnPause.AddListener(OnClickPause);
+        base.RegisterBattleEvents();
+        EventBroadcast.Instance.AddListener<string, JsonData>(EventName.BATTLE_END, OnBattleEnd);
     }
 
-    private void OnClickPause()
+    protected override void UnregisterBattleEvents()
     {
-        if (null == battleField)
-            return;
-        battleField.IsPause = !battleField.IsPause;
+        base.UnregisterBattleEvents();
+        EventBroadcast.Instance.RemoveListener<string, JsonData>(EventName.BATTLE_END, OnBattleEnd);
     }
 
-    private void OnClickPass()
+    protected virtual void OnBattleEnd(string guid, JsonData endData)
     {
-        if (null == battleField)
-            return;
-        battleField.ForceFinish();
-    }
-
-    private void ChangeSpeed()
-    {
-        if (null == battleField)
-            return;
-        BattleManager.Instance.speedIndex = (BattleManager.Instance.speedIndex + 1) % BattleManager.Instance.speedGear.Length;
-        battleField.SetSpeedRatio(BattleManager.Instance.speedGear[BattleManager.Instance.speedIndex]);
-        textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
+        if (battleField != null && guid == battleField.guid)
+        {
+            DisplayHpInfo();
+        }
     }
 
     protected override void OnPreOpen()
     {
         base.OnPreOpen();
         MainWin.TabChangeEvent += OnTabChangeEvent;
-        BattleManager.Instance.onBattleFieldCreate += OnCreateBattleField;
-        EventBroadcast.Instance.AddListener<BattleDmgInfo>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken);
-        EventBroadcast.Instance.AddListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnCastSkill);
-        EventBroadcast.Instance.AddListener<string, JsonData>(EventName.BATTLE_END, OnBattleEnd);
-        BattleManager.Instance.storyBattleField.IsPause = true;
         bool isOpenBattleChangeTab = IsOpenBattleChangeTab();
         transButtons.localPosition = new Vector3(0, isOpenBattleChangeTab ? 130 : 0, 0);
         if (isOpenBattleChangeTab)
@@ -97,14 +62,7 @@
     protected override void OnPreClose()
     {
         base.OnPreClose();
-        UIManager.Instance.CloseWindow<BattleHUDWin>();
         MainWin.TabChangeEvent -= OnTabChangeEvent;
-        BattleManager.Instance.onBattleFieldCreate -= OnCreateBattleField;
-        EventBroadcast.Instance.RemoveListener<BattleDmgInfo>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken);
-        EventBroadcast.Instance.RemoveListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnCastSkill);
-        EventBroadcast.Instance.RemoveListener<string, JsonData>(EventName.BATTLE_END, OnBattleEnd);
-        BattleManager.Instance.storyBattleField.IsPause = false;
-
         bool isOpenBattleChangeTab = IsOpenBattleChangeTab();
         if (isOpenBattleChangeTab)
         {
@@ -121,109 +79,29 @@
         UIManager.Instance.CloseWindow<ArenaBattleWin>();
     }
 
-    private void OnBattleEnd(string guid, JsonData endData)
+    protected override void OnDamageTaken(BattleDmgInfo damageInfo)
     {
-        if (battleField != null && guid == battleField.guid)
-        {
-            DisplayHpInfo();
-        }
-    }
-
-    private void OnDamageTaken(BattleDmgInfo damageInfo)
-    {
+        base.OnDamageTaken(damageInfo);
         if (battleField == null)
             return;
         if (damageInfo.battleFieldGuid == battleField.guid)
         {
             DisplayHpInfo();
-            totalDamageDisplayer.SetDamage(damageInfo);
         }
     }
 
-    private void OnCreateBattleField(string arg1, BattleField field)
+    protected override void OnCreateBattleField(string guid, BattleField field)
     {
-        if (field.GetType() == battleField.GetType())
+        if (field is ArenaBattleField)
         {
             SetBattleField(field);
         }
     }
 
-    protected override void OnClose()
+    protected override void RefreshSpecific()
     {
-        base.OnClose();
-        if (battleRootNode != null)
-        {
-            battleRootNode.transform.SetParent(Launch.Instance.transform);
-            battleRootNode.transform.localPosition = new Vector3(-10000, -10000, 0);
-        }
-
-        if (battleField != null)
-        {
-            battleField.OnRoundChange -= OnRoundChange;
-            battleField = null;
-        }
-    }
-
-    public void SetBattleField(BattleField _battleField)
-    {
-        if (battleField != null)
-        {
-            battleField.OnRoundChange -= OnRoundChange;
-            battleField = null;
-        }
-
-        battleField = _battleField;
-        if (battleRootNode != null)
-        {
-            battleRootNode.transform.localPosition = Vector3.zero;
-            battleRootNode.transform.SetParent(Launch.Instance.transform);
-        }
-
-        battleRootNode = battleField.battleRootNode;
-        battleRootNode.transform.SetParent(mountPoint);
-        battleRootNode.transform.localPosition = Vector3.zero;
-        battleRootNode.transform.localScale = Vector3.one;
-        BattleHUDWin ui = UIManager.Instance.GetUI<BattleHUDWin>();
-
-        if (null == ui)
-        {
-            ui = UIManager.Instance.OpenWindow<BattleHUDWin>();
-        }
-        ui.SetBattleField(battleField);
-        battleField.UpdateCanvas(canvas);
-        textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
-        Refresh();
-
-        battleField.OnRoundChange -= OnRoundChange;
-        battleField.OnRoundChange += OnRoundChange;
-        OnRoundChange(battleField.round, battleField.turnMax);
-    }
-
-    public override void Refresh()
-    {
-        base.Refresh();
         DisplayHpInfo();
         DisplayPlayerInfo();
-        totalDamageDisplayer.SetActive(false);
-        skillTipsBlue.SetActive(false);
-        skillTipsRed.SetActive(false);
-    }
-
-    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 DisplayHpInfo()
@@ -346,13 +224,8 @@
 
     }
 
-    private void OnRoundChange(int round, int maxRound)
-    {
-        txtWaveInfo.text = string.Format("{0}/{1}", round, maxRound);
-    }
-
     bool IsOpenBattleChangeTab()
     {
         return FuncOpen.Instance.IsFuncOpen(ArenaManager.Instance.BattleChangeTabFuncId);
     }
-}
+}
\ No newline at end of file
diff --git a/Main/System/Battle/BaseBattleWin.cs b/Main/System/Battle/BaseBattleWin.cs
new file mode 100644
index 0000000..ec9484d
--- /dev/null
+++ b/Main/System/Battle/BaseBattleWin.cs
@@ -0,0 +1,279 @@
+锘縰sing UnityEngine;
+using UnityEngine.UI;
+
+/// <summary>
+/// 鎴樻枟绐楀彛鍩虹被
+/// </summary>
+public abstract class BaseBattleWin : UIBase
+{
+    [Header("鎴樻枟鍦烘櫙鎸傝浇鐐�")]
+    [SerializeField]
+    protected Transform mountPoint;
+
+    [Header("鎴樻枟鎺у埗鎸夐挳")]
+    [SerializeField] protected Button btnSpeed; // 閫熷害鎺у埗
+    [SerializeField] protected Text textSpeed; // 閫熷害鏄剧ず
+    [SerializeField] protected Button btnPass; // 璺宠繃鎴樻枟
+    [SerializeField] protected Button btnPause; // 鏆傚仠鎸夐挳 (BattleWin涓殑btnStop鍙搴旀鎸夐挳)
+
+    [Header("鎴樻枟UI缁勪欢")]
+    [SerializeField] protected TotalDamageDisplayer totalDamageDisplayer; // 浼ゅ缁熻
+    [SerializeField] protected SkillTips skillTipsRed; // 绾㈡柟鎶�鑳芥彁绀�
+    [SerializeField] protected SkillTips skillTipsBlue; // 钃濇柟鎶�鑳芥彁绀�
+    [SerializeField] protected Text txtBattleRound; // 鍥炲悎淇℃伅 (Arena鐨則xtWaveInfo, Story/Bone鐨則xtBattleRound)
+    protected BattleRootNode battleRootNode = null;
+    protected BattleField battleField; // 褰撳墠鎴樻枟鐨勬垬鍦哄疄渚�
+
+    protected override void InitComponent()
+    {
+        base.InitComponent();
+        // 缁戝畾閫氱敤鎸夐挳浜嬩欢
+        if (btnSpeed != null)
+            btnSpeed.AddListener(ChangeSpeed);
+
+        if (btnPass != null)
+            btnPass.AddListener(OnClickPass);
+
+        if (btnPause != null)
+            btnPause.AddListener(OnClickPause);
+    }
+
+    protected override void OnPreOpen()
+    {
+        base.OnPreOpen();
+        BattleManager.Instance.onBattleFieldCreate += OnCreateBattleField;
+        RegisterBattleEvents();
+
+        // 鍦ㄦ墦寮�鏃堕渶瑕佹殏鍋滀富绾挎垬鏂�
+        if (BattleManager.Instance.storyBattleField != null)
+            BattleManager.Instance.storyBattleField.IsPause = true;
+    }
+
+    protected override void OnPreClose()
+    {
+        base.OnPreClose();
+        UIManager.Instance.CloseWindow<BattleHUDWin>();
+        BattleManager.Instance.onBattleFieldCreate -= OnCreateBattleField;
+        UnregisterBattleEvents();
+
+        // 鍦ㄥ叧闂椂鎭㈠涓荤嚎鎴樻枟
+        if (BattleManager.Instance.storyBattleField != null)
+            BattleManager.Instance.storyBattleField.IsPause = false;
+
+        if (battleField != null)
+        {
+            battleField.OnRoundChange -= OnRoundChange;
+        }
+    }
+
+    protected override void OnClose()
+    {
+        base.OnClose();
+        if (battleRootNode != null)
+        {
+            battleRootNode.transform.SetParent(Launch.Instance.transform);
+            battleRootNode.transform.localPosition = new Vector3(-10000, -10000, 0);
+        }
+        battleField = null;
+    }
+
+    /// <summary>
+    /// 閫氱敤鍒锋柊閫昏緫 (妯℃澘鏂规硶)
+    /// </summary>
+    public override void Refresh()
+    {
+        base.Refresh();
+
+        // 1. 鎵ц鍩虹被閫氱敤鍒锋柊閫昏緫 (娓呯┖鏃х姸鎬�)
+        if (totalDamageDisplayer != null)
+            totalDamageDisplayer.SetActive(false);
+
+        if (skillTipsBlue != null)
+            skillTipsBlue.SetActive(false);
+
+        if (skillTipsRed != null)
+            skillTipsRed.SetActive(false);
+
+        // 鍒锋柊閫熷害鏄剧ず
+        if (textSpeed != null && BattleManager.Instance != null)
+            textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
+
+        // 2. 璋冪敤瀛愮被鐗瑰畾鐨勫埛鏂伴�昏緫
+        if (battleField != null) // 纭繚鎴樺満瀛樺湪鍚庡啀璋冪敤鐗瑰畾鍒锋柊
+        {
+            RefreshSpecific();
+        }
+    }
+
+    /// <summary>
+    /// 瀛愮被瀹炵幇鐨勭壒瀹氬埛鏂伴�昏緫
+    /// </summary>
+    protected abstract void RefreshSpecific();
+
+
+    /// <summary>
+    /// 褰撴垬鏂楀瓧娈靛垱寤烘椂 (瀛愮被蹇呴』閲嶅啓, 浠ュ尮閰嶇壒瀹氱殑鎴樺満绫诲瀷)
+    /// </summary>
+    /// <param name="guid"></param>
+    /// <param name="field"></param>
+    protected abstract void OnCreateBattleField(string guid, BattleField field);
+    // 绀轰緥:
+    // protected override void OnCreateBattleField(string guid, BattleField field)
+    // {
+    //     // 妫�鏌ユ槸鍚︽槸褰撳墠绐楀彛鍏冲績鐨勬垬鍦虹被鍨�
+    //     if (field is ArenaBattleField arenaField)
+    //     {
+    //         SetBattleField(arenaField); // 璋冪敤SetBattleField
+    //     }
+    // }
+
+    /// <summary>
+    /// 璁剧疆鎴樻枟瀛楁
+    /// </summary>
+    public virtual void SetBattleField(BattleField _battleField)
+    {
+        // 1. 娓呯悊鏃х殑鎴樺満
+        if (battleField != null)
+        {
+            battleField.OnRoundChange -= OnRoundChange;
+            battleField = null;
+        }
+
+        // 2. 璁剧疆鏂扮殑鎴樺満
+        battleField = _battleField;
+        if (battleField == null) return;
+
+        // 3. 鍏宠仈鎴樻枟鍦烘櫙鏍硅妭鐐�
+        if (battleRootNode != null) // 褰掕繕鏃х殑
+        {
+            battleRootNode.transform.localPosition = Vector3.zero;
+            battleRootNode.transform.SetParent(Launch.Instance.transform);
+        }
+
+        battleRootNode = battleField.battleRootNode;
+        if (battleRootNode == null) return;
+
+        battleRootNode.transform.SetParent(mountPoint); // 鎸傝浇鏂扮殑
+        battleRootNode.transform.localPosition = Vector3.zero;
+        battleRootNode.transform.localScale = Vector3.one;
+
+        // 4. 鎵撳紑鎴栬幏鍙朒UD
+        BattleHUDWin ui = UIManager.Instance.GetUI<BattleHUDWin>();
+        if (null == ui)
+        {
+            ui = UIManager.Instance.OpenWindow<BattleHUDWin>();
+        }
+        ui.SetBattleField(battleField);
+
+        // 5. 鏇存柊Canvas
+        battleField.UpdateCanvas(canvas);
+
+        // 6. 鍒锋柊UI
+        Refresh();
+
+        // 7. 鐩戝惉鍥炲悎鍙樻洿
+        battleField.OnRoundChange -= OnRoundChange;
+        battleField.OnRoundChange += OnRoundChange;
+        OnRoundChange(battleField.round, battleField.turnMax); // 绔嬪嵆鎵ц涓�娆′互鏄剧ず鍒濆鍥炲悎
+    }
+
+
+    /// <summary>
+    /// 鏆傚仠/缁х画
+    /// </summary>
+    protected virtual void OnClickPause()
+    {
+        if (null == battleField)
+            return;
+        battleField.IsPause = !battleField.IsPause;
+    }
+
+    /// <summary>
+    /// 璺宠繃鎴樻枟
+    /// </summary>
+    protected virtual void OnClickPass()
+    {
+        if (null == battleField)
+            return;
+        battleField.ForceFinish();
+    }
+
+    /// <summary>
+    /// 鏀瑰彉閫熷害
+    /// </summary>
+    protected virtual void ChangeSpeed()
+    {
+        if (null == battleField)
+            return;
+
+        BattleManager.Instance.speedIndex = (BattleManager.Instance.speedIndex + 1) % BattleManager.Instance.speedGear.Length;
+        battleField.SetSpeedRatio(BattleManager.Instance.speedGear[BattleManager.Instance.speedIndex]);
+
+        if (textSpeed != null)
+            textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
+    }
+
+
+    /// <summary>
+    /// 娉ㄥ唽鎴樻枟浜嬩欢
+    /// </summary>
+    protected virtual void RegisterBattleEvents()
+    {
+        EventBroadcast.Instance.AddListener<BattleDmgInfo>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken);
+        EventBroadcast.Instance.AddListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnCastSkill);
+    }
+
+    /// <summary>
+    /// 娉ㄩ攢鎴樻枟浜嬩欢
+    /// (BattleWin 搴旇閲嶅啓姝ゆ柟娉曞苟缃┖)
+    /// </summary>
+    protected virtual void UnregisterBattleEvents()
+    {
+        EventBroadcast.Instance.RemoveListener<BattleDmgInfo>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken);
+        EventBroadcast.Instance.RemoveListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnCastSkill);
+    }
+
+    /// <summary>
+    /// 閫犳垚浼ゅ
+    /// </summary>
+    protected virtual void OnDamageTaken(BattleDmgInfo damageInfo)
+    {
+        if (battleField == null || damageInfo.battleFieldGuid != battleField.guid)
+            return;
+
+        // 閫氱敤閫昏緫锛氭樉绀轰激瀹虫暟瀛�
+        if (totalDamageDisplayer != null)
+            totalDamageDisplayer.SetDamage(damageInfo);
+    }
+
+    /// <summary>
+    /// 閲婃斁鎶�鑳� (閫氱敤锛氭樉绀烘妧鑳絋ips)
+    /// </summary>
+    protected virtual void OnCastSkill(string guid, SkillConfig skillConfig, TeamHero teamHero)
+    {
+        if (battleField == null || battleField.guid != guid)
+            return;
+
+        BattleObject battleObject = battleField.battleObjMgr.GetBattleObject(teamHero.ObjID);
+        if (battleObject == null)
+            return;
+
+        bool isRed = battleObject.Camp == BattleCamp.Red;
+        SkillTips tips = isRed ? skillTipsRed : skillTipsBlue;
+
+        if (tips != null)
+            tips.PlayMotion(battleField, isRed, teamHero, skillConfig);
+    }
+
+    /// <summary>
+    /// 鍥炲悎鍙樻洿 (閫氱敤锛氬埛鏂板洖鍚堟樉绀�)
+    /// </summary>
+    protected virtual void OnRoundChange(int round, int maxRound)
+    {
+        if (txtBattleRound != null)
+        {
+            txtBattleRound.text = string.Format("{0}/{1}", round, maxRound);
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/Main/System/Battle/BaseBattleWin.cs.meta b/Main/System/Battle/BaseBattleWin.cs.meta
new file mode 100644
index 0000000..bd51b53
--- /dev/null
+++ b/Main/System/Battle/BaseBattleWin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d8f186c2bc4af9b40b734d732c37322b
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Main/System/Battle/BoneFieldBattleWin.cs b/Main/System/Battle/BoneFieldBattleWin.cs
index 344b5a4..e20cd7c 100644
--- a/Main/System/Battle/BoneFieldBattleWin.cs
+++ b/Main/System/Battle/BoneFieldBattleWin.cs
@@ -2,72 +2,20 @@
 using UnityEngine;
 using UnityEngine.UI;
 
-public class BoneFieldBattleWin : UIBase
+public class BoneFieldBattleWin : BaseBattleWin
 {
     [SerializeField] Transform transButtons;
-    public Transform mountPoint;
-    private BattleRootNode battleRootNode = null;
-    private BoneBattleField battleField;
-    [SerializeField] private Button btnSpeed;
-
-    [SerializeField] private Text textSpeed;
-
-    [SerializeField] private Button btnPass;
-
-    [SerializeField] private Button btnPause;
-
-    public BossLifeBar bossLifeBar;
-    public SkillWordCell[] skillWordCells;
-    public BossHeadCell bossHeadCell;
-    public Text txtBossName;
-    public Text txtBattleRound;
-    public TotalDamageDisplayer totalDamageDisplayer;
-    public SkillTips skillTipsRed;
-    public SkillTips skillTipsBlue;
+    [SerializeField] public BossLifeBar bossLifeBar;
+    [SerializeField] public SkillWordCell[] skillWordCells;
+    [SerializeField] public BossHeadCell bossHeadCell;
+    [SerializeField] public Text txtBossName;
     private BattleObject bossBattleObject = null;
     [SerializeField] public List<BattleBuffCell> buffCells;
-
-    // 鐢熷懡鍛ㄦ湡
-    protected override void InitComponent()
-    {
-        base.InitComponent();
-        // 鍒濆鍖栫粍浠跺紩鐢� 缁戝畾鎸夐挳绛塙I缁勪欢浜嬩欢
-        btnSpeed.AddListener(ChangeSpeed);
-        btnPass.AddListener(OnClickPass);
-        btnPause.AddListener(OnClickPause);
-    }
-
-    private void OnClickPause()
-    {
-        if (null == battleField)
-            return;
-        battleField.IsPause = !battleField.IsPause;
-    }
-
-    private void OnClickPass()
-    {
-        if (null == battleField)
-            return;
-        battleField.ForceFinish();
-    }
-
-    private void ChangeSpeed()
-    {
-        if (null == battleField)
-            return;
-        BattleManager.Instance.speedIndex = (BattleManager.Instance.speedIndex + 1) % BattleManager.Instance.speedGear.Length;
-        battleField.SetSpeedRatio(BattleManager.Instance.speedGear[BattleManager.Instance.speedIndex]);
-        textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
-    }
 
     protected override void OnPreOpen()
     {
         base.OnPreOpen();
         MainWin.TabChangeEvent += OnTabChangeEvent;
-        BattleManager.Instance.onBattleFieldCreate += OnCreateBattleField;
-        EventBroadcast.Instance.AddListener<BattleDmgInfo>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken);
-        EventBroadcast.Instance.AddListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnCastSkill);
-        BattleManager.Instance.storyBattleField.IsPause = true;
         bool isOpenBattleChangeTab = IsOpenBattleChangeTab();
         transButtons.localPosition = new Vector3(0, isOpenBattleChangeTab ? 130 : 0, 0);
         if (isOpenBattleChangeTab)
@@ -80,17 +28,11 @@
         }
     }
 
-
-
     protected override void OnPreClose()
     {
         base.OnPreClose();
+
         MainWin.TabChangeEvent -= OnTabChangeEvent;
-        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>();
-        BattleManager.Instance.storyBattleField.IsPause = false;
         bool isOpenBattleChangeTab = IsOpenBattleChangeTab();
         if (isOpenBattleChangeTab)
         {
@@ -110,45 +52,27 @@
             bossBattleObject = null;
         }
 
-        if (battleField != null)
-        {
-            battleField.OnRoundChange -= OnRoundChange;
-            battleField = null;
-        }
     }
 
     private void OnTabChangeEvent()
     {
         UIManager.Instance.CloseWindow<BoneFieldBattleWin>();
     }
-    
-    private void OnCastSkill(string guid, SkillConfig skillConfig, TeamHero teamHero)
+
+    protected override void OnCreateBattleField(string guid, BattleField field)
     {
-        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)
-    {
-        if (field.GetType() == battleField.GetType())
+        if (field is BoneBattleField)
         {
-            SetBattleField(field as BoneBattleField);
+            SetBattleField(field);
         }
     }
 
-
-    public void Display()
+    protected override void RefreshSpecific()
     {
+        BoneBattleField boneField = battleField as BoneBattleField;
+        if (boneField == null) return;
 
-        NPCLineupConfig lineupConfig = battleField.GetBossLineupConfig();
+        NPCLineupConfig lineupConfig = boneField.GetBossLineupConfig();
 
         if (bossBattleObject != null)
         {
@@ -159,7 +83,7 @@
             bossBattleObject = null;
         }
 
-        bossBattleObject = battleField.FindBoss();
+        bossBattleObject = boneField.FindBoss();
 
         DisplaySkillWordsList(lineupConfig);
 
@@ -181,14 +105,8 @@
             Debug.LogError("鎵句笉鍒癰oss");
         }
 
-        OnRoundChange(battleField.round, battleField.turnMax);
-
+        OnRoundChange(battleField.round, battleField.turnMax); // 纭繚鍥炲悎鏄剧ず琚皟鐢�
         OnBuffChanged();
-
-        totalDamageDisplayer.SetActive(false);
-
-        skillTipsBlue.SetActive(false);
-        skillTipsRed.SetActive(false);
     }
 
     private void OnBuffChanged()
@@ -211,76 +129,23 @@
     }
 
 
-    private void OnDamageTaken(BattleDmgInfo info)
+    protected override void OnDamageTaken(BattleDmgInfo info)
     {
-        if (info.battleFieldGuid != battleField.guid)
+        base.OnDamageTaken(info);
+
+        if (battleField == null || info.battleFieldGuid != battleField.guid)
             return;
 
-        if (info.hurtObj.ObjID == bossBattleObject.ObjID)
+        if (bossBattleObject != null && info.hurtObj.ObjID == bossBattleObject.ObjID)
         {
-            // Update the boss's health bar
             RefreshHP();
         }
 
-        totalDamageDisplayer.SetDamage(info);
     }
 
     protected override void OnClose()
     {
         base.OnClose();
-
-        if (battleRootNode != null)
-        {
-            battleRootNode.transform.SetParent(Launch.Instance.transform);
-            battleRootNode.transform.localPosition = new Vector3(-10000, -10000, 0);
-        }
-
-        battleField = null;
-    }
-
-    protected override void NextFrameAfterOpen()
-    {
-        base.NextFrameAfterOpen();
-    }
-
-    protected override void CompleteClose()
-    {
-        base.CompleteClose();
-    }
-
-    public void SetBattleField(BoneBattleField _battleField)
-    {
-        if (battleField != null)
-        {
-            battleField.OnRoundChange -= OnRoundChange;
-            battleField = null;
-        }
-
-        battleField = _battleField;
-        if (battleRootNode != null)
-        {
-            battleRootNode.transform.localPosition = Vector3.zero;
-            battleRootNode.transform.SetParent(Launch.Instance.transform);
-        }
-
-        battleRootNode = battleField.battleRootNode;
-
-        battleRootNode.transform.SetParent(mountPoint);
-        battleRootNode.transform.localPosition = Vector3.zero;
-        battleRootNode.transform.localScale = Vector3.one;
-
-        BattleHUDWin ui = UIManager.Instance.GetUI<BattleHUDWin>();
-
-        if (null == ui)
-        {
-            ui = UIManager.Instance.OpenWindow<BattleHUDWin>();
-        }
-
-        ui.SetBattleField(battleField);
-        battleField.UpdateCanvas(canvas);
-        Display();
-        battleField.OnRoundChange += OnRoundChange;
-        textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
     }
 
     public void DisplaySkillWordsList(NPCLineupConfig lineUPConfig)
@@ -336,13 +201,8 @@
         }
     }
 
-    private void OnRoundChange(int round, int maxRound)
-    {
-        txtBattleRound.text = string.Format("{0}/{1}", round, maxRound);
-    }
     bool IsOpenBattleChangeTab()
     {
         return FuncOpen.Instance.IsFuncOpen(ArenaManager.Instance.BattleChangeTabFuncId);
     }
-
-}
+}
\ No newline at end of file
diff --git a/Main/System/Battle/StoryBossBattleWin.cs b/Main/System/Battle/StoryBossBattleWin.cs
index 1352eef..78815d4 100644
--- a/Main/System/Battle/StoryBossBattleWin.cs
+++ b/Main/System/Battle/StoryBossBattleWin.cs
@@ -1,112 +1,33 @@
-锘縰sing System;
-using System.Collections.Generic;
+锘縰sing System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
-public class StoryBossBattleWin : UIBase
+public class StoryBossBattleWin : BaseBattleWin
 {
-
-    // 缁勪欢寮曠敤
-    public Transform mountPoint;
-
-    private BattleRootNode battleRootNode = null;
-
-
-    private StoryBossBattleField battleField;
-
     [SerializeField]
-    private Button btnSpeed;
-
-    [SerializeField]
-    private Text textSpeed;
-
-    [SerializeField]
-    private Button btnPass;
-
-    [SerializeField]
-    private Button btnPause;
-
     public BossLifeBar bossLifeBar;
-
+    [SerializeField]
     public SkillWordCell[] skillWordCells;
-
+    [SerializeField]
     public BossHeadCell bossHeadCell;
-
+    [SerializeField]
     public Text txtBossName;
-
-    public Text txtBattleRound;
-
-    public TotalDamageDisplayer totalDamageDisplayer;
-
-    public SkillTips skillTipsRed;
-
-    public SkillTips skillTipsBlue;
 
     private BattleObject bossBattleObject = null;
 
     [SerializeField] public List<BattleBuffCell> buffCells;
 
-    // 鐢熷懡鍛ㄦ湡
-    protected override void InitComponent()
-    {
-        base.InitComponent();
-        // 鍒濆鍖栫粍浠跺紩鐢� 缁戝畾鎸夐挳绛塙I缁勪欢浜嬩欢
-
-        btnSpeed.AddListener(ChangeSpeed);
-
-        btnPass.AddListener(OnClickPass);
-
-        btnPause.AddListener(OnClickPause);
-    }
-
-    private void OnClickPause()
-    {
-        if (null == battleField)
-            return;
-
-        battleField.IsPause = !battleField.IsPause;
-    }
-
-    private void OnClickPass()
-    {
-        if (null == battleField)
-            return;
-
-        battleField.ForceFinish();
-    }
-
-    private void ChangeSpeed()
-    {
-        if (null == battleField)
-            return;
-
-        BattleManager.Instance.speedIndex = (BattleManager.Instance.speedIndex + 1) % BattleManager.Instance.speedGear.Length;
-        battleField.SetSpeedRatio(BattleManager.Instance.speedGear[BattleManager.Instance.speedIndex]);
-        textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
-    }
-
     protected override void OnPreOpen()
     {
         base.OnPreOpen();
-        // 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);
-        BattleManager.Instance.storyBattleField.IsPause = true;
+
         UIManager.Instance.CloseWindow<MainWin>();
     }
-
-
 
     protected override void OnPreClose()
     {
         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>();
-        BattleManager.Instance.storyBattleField.IsPause = false;
         if (!UIManager.Instance.IsOpened<MainWin>())
             UIManager.Instance.OpenWindow<MainWin>();
 
@@ -115,53 +36,22 @@
             bossBattleObject.buffMgr.onBuffChanged -= OnBuffChanged;
             bossBattleObject = null;
         }
+    }
 
-        if (battleField != null)
+    protected override void OnCreateBattleField(string guid, BattleField field)
+    {
+        if (field is StoryBossBattleField)
         {
-            battleField.OnRoundChange -= OnRoundChange;
-            battleField = null;
+            SetBattleField(field);
         }
     }
 
-    private void OnCastSkill(string guid, SkillConfig skillConfig, TeamHero teamHero)
+    protected override void RefreshSpecific()
     {
-        if (battleField == null)
-            return;
+        StoryBossBattleField storyBossField = battleField as StoryBossBattleField;
+        if (storyBossField == 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)
-    {
-        if (field.GetType() == battleField.GetType())
-        {
-            SetBattleField(field as StoryBossBattleField);
-        }
-    }
-
-    protected override void OnOpen()
-    {
-        base.OnOpen();
-    }
-
-    public override void Refresh()
-    {
-        base.Refresh();
-
-        // bossLifeBar.SetBaseInfo(battleField);
-
-        // skillWordCells;
-
-        NPCLineupConfig lineupConfig = battleField.GetBossLineupConfig();
+        NPCLineupConfig lineupConfig = storyBossField.GetBossLineupConfig();
 
         if (null != bossBattleObject)
         {
@@ -169,7 +59,7 @@
             bossBattleObject = null;
         }
 
-        bossBattleObject = battleField.FindBoss();
+        bossBattleObject = storyBossField.FindBoss();
 
         DisplaySkillWordsList(lineupConfig);
 
@@ -191,14 +81,8 @@
             Debug.LogError("鎵句笉鍒癰oss");
         }
 
-        OnRoundChange(battleField.round, battleField.turnMax);
-
+        OnRoundChange(battleField.round, battleField.turnMax); // 纭繚鍥炲悎鏄剧ず琚皟鐢�
         OnBuffChanged();
-
-        totalDamageDisplayer.SetActive(false);
-
-        skillTipsBlue.SetActive(false);
-        skillTipsRed.SetActive(false);
     }
 
     private void OnBuffChanged()
@@ -220,82 +104,17 @@
         }
     }
 
-
-    private void OnDamageTaken(BattleDmgInfo info)
+    protected override void OnDamageTaken(BattleDmgInfo info)
     {
-        if (info.battleFieldGuid != battleField.guid)
+        base.OnDamageTaken(info);
+        if (battleField == null || info.battleFieldGuid != battleField.guid)
             return;
-
-        if (info.hurtObj.ObjID == bossBattleObject.ObjID)
+        if (bossBattleObject != null && info.hurtObj.ObjID == bossBattleObject.ObjID)
         {
-            // Update the boss's health bar
             RefreshHP();
         }
-
-        totalDamageDisplayer.SetDamage(info);
     }
 
-    protected override void OnClose()
-    {
-        base.OnClose();
-
-        if (battleRootNode != null)
-        {
-            battleRootNode.transform.SetParent(Launch.Instance.transform);
-            battleRootNode.transform.localPosition = new Vector3(-10000, -10000, 0);
-        }
-
-        battleField = null;
-    }
-
-    protected override void NextFrameAfterOpen()
-    {
-        base.NextFrameAfterOpen();
-    }
-
-    protected override void CompleteClose()
-    {
-        base.CompleteClose();
-    }
-
-    public void SetBattleField(StoryBossBattleField _battleField)
-    {
-        if (battleField != null)
-        {
-            battleField.OnRoundChange -= OnRoundChange;
-            battleField = null;
-        }
-
-        battleField = _battleField;
-        if (battleRootNode != null)
-        {
-            battleRootNode.transform.localPosition = Vector3.zero;
-            battleRootNode.transform.SetParent(Launch.Instance.transform);
-        }
-
-        battleRootNode = battleField.battleRootNode;
-
-        battleRootNode.transform.SetParent(mountPoint);
-        battleRootNode.transform.localPosition = Vector3.zero;
-        battleRootNode.transform.localScale = Vector3.one;
-
-        BattleHUDWin ui = UIManager.Instance.GetUI<BattleHUDWin>();
-
-        if (null == ui)
-        {
-            ui = UIManager.Instance.OpenWindow<BattleHUDWin>();
-        }
-
-        ui.SetBattleField(battleField);
-        battleField.UpdateCanvas(canvas);
-
-        Refresh();
-
-        battleField.OnRoundChange -= OnRoundChange;
-        battleField.OnRoundChange += OnRoundChange;
-
-        textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
-    }
 
     public void DisplaySkillWordsList(NPCLineupConfig lineUPConfig)
     {
@@ -350,8 +169,4 @@
         }
     }
 
-    private void OnRoundChange(int round, int maxRound)
-    {
-        txtBattleRound.text = string.Format("{0}/{1}", round, maxRound);
-    }
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0