| | |
| | | Clear(); |
| | | } |
| | | |
| | | public virtual void Play(bool showLog = true) |
| | | public virtual void Play(bool showLog = true, bool closePMA = false) |
| | | { |
| | | isPlaying = true; |
| | | if (!isInit) |
| | |
| | | //防范effeid 为0 |
| | | if (effectConfig != null && effectConfig.isSpine != 0) |
| | | { |
| | | PlaySpineEffect(); |
| | | PlaySpineEffect(closePMA); |
| | | } |
| | | return; |
| | | } |
| | | if (effectConfig == null) |
| | | return; |
| | | |
| | | if (EffectMgr.IsNotShowBySetting(effectId)) |
| | | { |
| | | return; |
| | | } |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (null != effectTarget) |
| | | { |
| | |
| | | // 加载spine特效资源 |
| | | if (effectConfig.isSpine != 0) |
| | | { |
| | | PlaySpineEffect(); |
| | | PlaySpineEffect(closePMA); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | protected void PlaySpineEffect() |
| | | protected void PlaySpineEffect(bool closePMA = false) |
| | | { |
| | | |
| | | // 从特效预制体池获取特效 |
| | |
| | | { |
| | | //LoadAsset 已经有缓存SkeletonDataAsset |
| | | spineComp.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/" + effectConfig.packageName, effectConfig.fxName); |
| | | |
| | | spineComp.MeshGenerator.settings.pmaVertexColors = !closePMA; //为true时会有部分特效不显示 如主界面装备特效 |
| | | spineComp.raycastTarget = false; |
| | | spineComp.Initialize(true); |
| | | spineComp.timeScale = speedRate; |
| | |
| | | // 播放指定动画 |
| | | void PlayerTheSpineAnim() |
| | | { |
| | | |
| | | spineComp.enabled = true; |
| | | var skeletonData = spineComp.Skeleton.Data; |
| | | if (skeletonData.Animations.Count > 0) |
| | | { |
| | | //按配置或者默认第一个 |
| | | int defaultAnimIndex = Math.Max(0, effectConfig.animIndex.Length == 0 ? 0 : effectConfig.animIndex[0]); |
| | | if (playSpineAnimIndex >= skeletonData.Animations.Count) |
| | | { |
| | | playSpineAnimIndex = -1; |
| | | Debug.LogError("特效:" + effectConfig.id + " 索引超出播放默认动画。 error:" + playSpineAnimIndex); |
| | | } |
| | | string defaultAnimationName = skeletonData.Animations.Items[playSpineAnimIndex == -1 ? defaultAnimIndex : playSpineAnimIndex].Name; |
| | | spineAnimationState.SetAnimation(0, defaultAnimationName, isPlaySpineLoop); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public async UniTask PlayAsync(bool showLog = true) |
| | | public async UniTask PlayAsync(bool showLog = true, bool closePMA = false) |
| | | { |
| | | await UniTask.Delay(playDelayTime); |
| | | try |
| | | { |
| | | Play(showLog); |
| | | Play(showLog, closePMA); |
| | | } |
| | | catch (Exception e) |
| | | { |