Main/Component/UI/Common/RendererAdjuster.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/Component/UI/Effect/BattleEffectPlayer.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/System/Battle/BattleConst.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/System/Battle/BattleObject/BattleObject.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/System/Battle/BattleObject/BattleObjectFactory.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/System/Battle/Motion/MotionBase.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Main/Component/UI/Common/RendererAdjuster.cs
@@ -2,6 +2,7 @@ using System.Collections.Generic; using UnityEngine; using System; using Spine.Unity; public class RendererAdjuster : MonoBehaviour { @@ -11,6 +12,8 @@ public string customSortingLayer = "UI"; public List<Renderer> renderers = new List<Renderer>(); // private List<SkeletonAnimation> skeletonAnimations = new List<SkeletonAnimation>(); protected Canvas canvas; @@ -33,7 +36,10 @@ renderers.Clear(); renderers.AddRange(gameObject.GetComponentsInChildren<Renderer>(true)); canvas = GetComponent<Canvas>(); // skeletonAnimations.Clear(); // skeletonAnimations.AddRange(gameObject.GetComponentsInChildren<SkeletonAnimation>(true)); canvas = GetComponentInChildren<Canvas>(); } public void UpdateSortingOrder() @@ -59,13 +65,18 @@ if (null != canvas) { canvas.sortingOrder = sortingOrder; canvas.sortingOrder = sortingOrder + 1; if (!string.IsNullOrEmpty(sortingLayer)) { canvas.sortingLayerName = sortingLayer; } } // foreach (var skeletonAnim in skeletonAnimations) // { // } onSortingChanged?.Invoke(sortingLayer, sortingOrder); } } Main/Component/UI/Effect/BattleEffectPlayer.cs
@@ -58,8 +58,6 @@ protected SkeletonAnimation spineComp; protected Spine.AnimationState spineAnimationState; protected int heroSetedSortingOrder; public GameObjectPoolManager.GameObjectPool pool; public Action onComplete; @@ -75,6 +73,8 @@ //隐藏,会有静态显示问题 spineComp.enabled = false; } ApplySortingOrder(); } @@ -159,24 +159,29 @@ onComplete?.Invoke(); } public void SetSortingOrder(int _heroSetedSortingOrder) public Func<bool> funcIsHeroFront; public void SetSortingOrder(Func<bool> _isHeroFrontCallback) { heroSetedSortingOrder = _heroSetedSortingOrder; funcIsHeroFront = _isHeroFrontCallback; int so = heroSetedSortingOrder; ApplySortingOrder(); } if (null != blocker && effectConfig != null) public void ApplySortingOrder() { if (null != blocker && effectConfig != null && funcIsHeroFront != null) { if (BattleConst.UnactiveHeroSortingOrder == heroSetedSortingOrder) { so = effectConfig.frontBack == 1 ? BattleConst.UnactiveHeroFrontSortingOrder : BattleConst.UnactiveHeroBackSortingOrder; } else { so = effectConfig.frontBack == 1 ? BattleConst.ActiveHeroFrontSortingOrder : BattleConst.ActiveHeroBackSortingOrder; } bool isEffectFront = effectConfig.frontBack == 1; blocker.SetSortingOrder(so); bool isHeroFront = funcIsHeroFront(); int finalSortingOrder = isHeroFront ? (isEffectFront ? BattleConst.ActiveHeroActionSortingOrder : BattleConst.ActiveHeroBackSortingOrder) : (isEffectFront ? BattleConst.UnactiveHeroFrontSortingOrder : BattleConst.UnactiveHeroBackSortingOrder); blocker.SetSortingOrder(finalSortingOrder); } } @@ -295,19 +300,7 @@ blocker.onSortingChanged = OnSortingChanged; if (0 != heroSetedSortingOrder) { if (BattleConst.UnactiveHeroSortingOrder == heroSetedSortingOrder) { heroSetedSortingOrder = effectConfig.frontBack == 1 ? BattleConst.UnactiveHeroFrontSortingOrder : BattleConst.UnactiveHeroBackSortingOrder; } else { heroSetedSortingOrder = effectConfig.frontBack == 1 ? BattleConst.ActiveHeroFrontSortingOrder : BattleConst.ActiveHeroBackSortingOrder; } blocker.SetSortingOrder(heroSetedSortingOrder); } ApplySortingOrder(); spineComp.enabled = true; Main/System/Battle/BattleConst.cs
@@ -99,6 +99,7 @@ } } // 释放技能钟的英雄层级 public static int ActiveHeroActionSortingOrder { get Main/System/Battle/BattleObject/BattleObject.cs
@@ -83,7 +83,7 @@ teamHero = _teamHero; Camp = _camp; motionBase = new MotionBase(); motionBase.Init(heroGo.GetComponentInChildren<SkeletonGraphic>(true)); motionBase.Init(heroGo.GetComponentInChildren<SkeletonAnimation>(true)); buffMgr = new BattleObjectBuffMgr(); buffMgr.Init(this); Main/System/Battle/BattleObject/BattleObjectFactory.cs
@@ -30,7 +30,7 @@ battleObject.ObjID = teamHero.ObjID; GameObject realGO = GameObject.Instantiate(battleGO, goParent.transform); SkeletonGraphic skeletonGraphic = realGO.GetComponentInChildren<SkeletonGraphic>(true); SkeletonAnimation skeletonAnimation = realGO.GetComponentInChildren<SkeletonAnimation>(true); var skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("Hero/SpineRes/", skinCfg.SpineRes); if (skeletonDataAsset == null) @@ -42,8 +42,8 @@ float finalScaleRate = modelScaleRate * teamHero.modelScale; skeletonGraphic.skeletonDataAsset = skeletonDataAsset; skeletonGraphic.Initialize(true); skeletonAnimation.skeletonDataAsset = skeletonDataAsset; skeletonAnimation.Initialize(true); realGO.name = battleObject.ObjID.ToString(); realGO.transform.localScale = new Vector3(finalScaleRate, finalScaleRate, finalScaleRate); RectTransform rectTrans = realGO.GetComponent<RectTransform>(); Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs
@@ -36,7 +36,7 @@ { effectPlayers.Add(effectPlayer); } effectPlayer.SetSortingOrder(rendererAdjuster.sortingOrder); effectPlayer.SetSortingOrder(IsFront); } public void RemoveEffect(BattleEffectPlayer effectPlayer) @@ -69,4 +69,9 @@ int order = isFront ? BattleConst.ActiveHeroSortingOrder : BattleConst.UnactiveHeroSortingOrder; SetSortingOrder(order); } public bool IsFront() { return isFront; } } Main/System/Battle/Motion/MotionBase.cs
@@ -29,7 +29,7 @@ #region 组件引用 protected SkeletonGraphic skeletonGraphic; protected SkeletonAnimation skeletonAnimation; protected Spine.AnimationState spineAnimationState; protected Spine.Skeleton skeleton; @@ -51,17 +51,17 @@ /// 初始化动画组件 /// </summary> /// <param name="skeletonGraphic">骨骼动画组件</param> public virtual void Init(SkeletonGraphic skeletonGraphic) public virtual void Init(SkeletonAnimation _skeletonAnimation) { this.skeletonGraphic = skeletonGraphic; this.skeletonAnimation = _skeletonAnimation; if (skeletonGraphic != null) if (skeletonAnimation != null) { spineAnimationState = skeletonGraphic.AnimationState; spineAnimationState = skeletonAnimation.AnimationState; spineAnimationState.TimeScale = MotionTimeScale; skeletonGraphic.timeScale = MotionTimeScale; skeletonAnimation.timeScale = MotionTimeScale; skeleton = skeletonGraphic.Skeleton; skeleton = skeletonAnimation.Skeleton; // 设置动画混合时间 if (spineAnimationState != null) @@ -93,7 +93,7 @@ spineAnimationState = null; } skeletonGraphic = null; skeletonAnimation = null; skeleton = null; currentTrackEntry = null; } @@ -395,13 +395,13 @@ public virtual void Pause() { spineAnimationState.TimeScale = 0f; skeletonGraphic.timeScale = 0f; skeletonAnimation.timeScale = 0f; } public virtual void Resume() { spineAnimationState.TimeScale = MotionTimeScale; skeletonGraphic.timeScale = MotionTimeScale; skeletonAnimation.timeScale = MotionTimeScale; } public void HaveRest() @@ -415,7 +415,7 @@ { MotionTimeScale = ratio; spineAnimationState.TimeScale = ratio; skeletonGraphic.timeScale = ratio; skeletonAnimation.timeScale = ratio; } #endregion