| | |
| | | |
| | | protected void PlaySpineEffect(bool closePMA = false) |
| | | { |
| | | |
| | | // 从特效预制体池获取特效 |
| | | if (spineComp == null) |
| | | { |
| | | spineComp = gameObject.AddMissingComponent<SkeletonGraphic>(); |
| | | } |
| | | |
| | | if (spineComp.skeletonDataAsset == null || spineAnimationState == null) |
| | | try |
| | | { |
| | | //LoadAsset 已经有缓存SkeletonDataAsset |
| | | spineComp.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/" + effectConfig.packageName, effectConfig.fxName); |
| | | //为true时会有部分特效不显示 如满级经验条;改成伽马后部分特效正常,还有部分依然要改此设置 |
| | | spineComp.MeshGenerator.settings.pmaVertexColors = !closePMA; |
| | | spineComp.raycastTarget = false; |
| | | spineComp.Initialize(true); |
| | | // 检查动画是否有相加模式 |
| | | // bool hasAdditiveBlend = CheckForAdditiveBlend(spineComp.Skeleton); |
| | | // if (hasAdditiveBlend) |
| | | // { |
| | | // spineComp.material = ResManager.Instance.LoadAsset<Material>("UIEffect/" + effectConfig.packageName, effectConfig.fxName.Split('_')[0] + "_Material-Additive"); |
| | | // } |
| | | // else |
| | | // { |
| | | // spineComp.material = null; |
| | | // } |
| | | spineComp.material = ResManager.Instance.LoadAsset<Material>("Materials", "SkeletonGraphicDefault-Straight"); |
| | | // 从特效预制体池获取特效 |
| | | if (spineComp == null) |
| | | { |
| | | spineComp = gameObject.AddMissingComponent<SkeletonGraphic>(); |
| | | } |
| | | |
| | | spineAnimationState = spineComp.AnimationState; |
| | | spineAnimationState.TimeScale = speedRate; |
| | | spineAnimationState.Data.DefaultMix = 0f; |
| | | spineAnimationState.Complete -= OnSpineAnimationComplete; |
| | | spineAnimationState.Complete += OnSpineAnimationComplete; |
| | | if (spineComp.skeletonDataAsset == null || spineAnimationState == null) |
| | | { |
| | | //LoadAsset 已经有缓存SkeletonDataAsset |
| | | spineComp.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/" + effectConfig.packageName, effectConfig.fxName); |
| | | //为true时会有部分特效不显示 如满级经验条;改成伽马后部分特效正常,还有部分依然要改此设置 |
| | | spineComp.MeshGenerator.settings.pmaVertexColors = !closePMA; |
| | | spineComp.raycastTarget = false; |
| | | spineComp.Initialize(true); |
| | | // 检查动画是否有相加模式 |
| | | // bool hasAdditiveBlend = CheckForAdditiveBlend(spineComp.Skeleton); |
| | | // if (hasAdditiveBlend) |
| | | // { |
| | | // spineComp.material = ResManager.Instance.LoadAsset<Material>("UIEffect/" + effectConfig.packageName, effectConfig.fxName.Split('_')[0] + "_Material-Additive"); |
| | | // } |
| | | // else |
| | | // { |
| | | // spineComp.material = null; |
| | | // } |
| | | spineComp.material = ResManager.Instance.LoadAsset<Material>("Materials", "SkeletonGraphicDefault-Straight"); |
| | | |
| | | spineAnimationState = spineComp.AnimationState; |
| | | spineAnimationState.TimeScale = speedRate; |
| | | spineAnimationState.Data.DefaultMix = 0f; |
| | | spineAnimationState.Complete -= OnSpineAnimationComplete; |
| | | spineAnimationState.Complete += OnSpineAnimationComplete; |
| | | } |
| | | |
| | | spineComp.enabled = true; |
| | | PlayerTheSpineAnim(); |
| | | SoundPlayer.Instance.PlayUIAudioDelay(effectConfig.audio).Forget(); |
| | | } |
| | | |
| | | spineComp.enabled = true; |
| | | PlayerTheSpineAnim(); |
| | | SoundPlayer.Instance.PlayUIAudioDelay(effectConfig.audio).Forget(); |
| | | catch (Exception e) |
| | | { |
| | | Debug.LogError(e); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 播放指定动画 |