| Main/System/Battle/BattleField/BattleField.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/Battle/StoryBossBattleWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/Battle/UIComp/SkillTips.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/Battle/UIComp/SkillTips.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Main/System/Battle/BattleField/BattleField.cs
@@ -7,6 +7,8 @@ public class BattleField { public Action<int, int> OnRoundChange; public BattleObjMgr battleObjMgr; public BattleEffectMgr battleEffectMgr; @@ -108,6 +110,7 @@ blueTeamList = _blueTeamList; FuncLineID = _FuncLineID; extendData = _extendData; round = 0; this.turnMax = turnMax; redTeamIndex = 0; @@ -140,6 +143,7 @@ } SetRootNodePosition(); rejectNewPackage = false; OnRoundChange?.Invoke(round, turnMax); } public void SetSpeedRatio(float ratio) @@ -271,6 +275,7 @@ uint FuncLineID, JsonData extendData) { round = TurnNum; OnRoundChange?.Invoke(round, turnMax); } public virtual void OnTurnFightObjAction(int turnNum, int ObjID) 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); } } Main/System/Battle/UIComp/SkillTips.cs
New file @@ -0,0 +1,99 @@ using System.Collections; using System.Collections.Generic; using DG.Tweening; using UnityEngine.UI; using UnityEngine; public class SkillTips : MonoBehaviour { public const float tweenDuration = 1f; public const float delayDuration = 0.4f; public const float beginingX = 400f; [SerializeField]public Image imgIcon; [SerializeField]public Image imgSkillName; [SerializeField] public Image imageBg; private Tween tween1; private Tween tween2; private Tween tween3; public void PlayMotion(BattleField battleField, bool isRed, TeamHero teamHero, SkillConfig skillConfig) { if (teamHero == null || skillConfig == null) { return; } if (skillConfig.FuncType != 2) return; KillAllTweens(); imgIcon.sprite = UILoader.LoadSprite("HeroHead", teamHero.skinConfig.SquareIcon); imgSkillName.sprite = UILoader.LoadSprite("SkillNameIcon", skillConfig.SkillTipsName); // 保证开始时所有图片为可见(alpha=1) if (imageBg != null) { var c = imageBg.color; c.a = 1f; imageBg.color = c; } if (imgIcon != null) { var c = imgIcon.color; c.a = 1f; imgIcon.color = c; } if (imgSkillName != null) { var c = imgSkillName.color; c.a = 1f; imgSkillName.color = c; } gameObject.SetActive(true); float posY = transform.localPosition.y; transform.localPosition = isRed ? new Vector3(-beginingX, posY, 0f) : new Vector3(beginingX, posY, 0f); tween1 = transform.DOLocalMoveX(0, tweenDuration / battleField.speedRatio, false).SetEase(Ease.Linear).OnComplete(() => { tween1 = null; tween3 = DOVirtual.DelayedCall(delayDuration / battleField.speedRatio, () => { tween3 = null; // tween2 改为做减淡(对 imageBg、imgIcon、imgSkillName 同步淡出) float fadeDuration = tweenDuration / battleField.speedRatio; Sequence seq = DOTween.Sequence(); if (imageBg != null) seq.Join(imageBg.DOFade(0f, fadeDuration).SetEase(Ease.InQuad)); if (imgIcon != null) seq.Join(imgIcon.DOFade(0f, fadeDuration).SetEase(Ease.InQuad)); if (imgSkillName != null) seq.Join(imgSkillName.DOFade(0f, fadeDuration).SetEase(Ease.InQuad)); seq.OnComplete(() => { tween2 = null; transform.localPosition = isRed ? new Vector3(-beginingX, posY, 0f) : new Vector3(beginingX, posY, 0f); gameObject.SetActive(false); }); tween2 = seq; battleField.battleTweenMgr.OnPlayTween(tween2); }); battleField.battleTweenMgr.OnPlayTween(tween3); }); battleField.battleTweenMgr.OnPlayTween(tween1); } public void KillAllTweens() { if (tween1 != null) { tween1.Kill(); tween1 = null; } if (tween2 != null) { tween2.Kill(); tween2 = null; } if (tween3 != null) { tween3.Kill(); tween3 = null; } } } Main/System/Battle/UIComp/SkillTips.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: f240ee927c9d417439aa146953d50208 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: