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/StoryBossBattleWin.cs | 229 +++++---------------------------------------------------
1 files changed, 22 insertions(+), 207 deletions(-)
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