From ed98029a88cd89702980ac7c40b711afddc5aeb2 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 20 十一月 2025 14:44:59 +0800
Subject: [PATCH] Merge branch 'master' of http://mobile.secondworld.net.cn:10010/r/Project_SG_scripts
---
Main/Component/UI/Effect/EffectPlayer.cs | 45 +++++++++++++++++++++++++++++----------------
1 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/Main/Component/UI/Effect/EffectPlayer.cs b/Main/Component/UI/Effect/EffectPlayer.cs
index 22b7ab3..eec97f3 100644
--- a/Main/Component/UI/Effect/EffectPlayer.cs
+++ b/Main/Component/UI/Effect/EffectPlayer.cs
@@ -24,6 +24,7 @@
{
if (value != m_EffectID)
{
+ Stop();
isInit = false;
m_EffectID = value;
}
@@ -60,7 +61,11 @@
protected EffectPenetrationBlocker blocker = null;
protected bool isInit = false;
- protected bool isPlaying = false;
+ public bool isPlaying
+ {
+ get;
+ protected set;
+ }
protected List<ParticleSystem> particleList = new List<ParticleSystem>();
@@ -167,7 +172,7 @@
Clear();
}
- public virtual void Play(bool showLog = true)
+ public virtual void Play(bool showLog = true, bool closePMA = false)
{
isPlaying = true;
if (!isInit)
@@ -186,15 +191,17 @@
//闃茶寖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)
{
@@ -211,7 +218,7 @@
// 鍔犺浇spine鐗规晥璧勬簮
if (effectConfig.isSpine != 0)
{
- PlaySpineEffect();
+ PlaySpineEffect(closePMA);
}
else
{
@@ -240,7 +247,7 @@
- protected void PlaySpineEffect()
+ protected void PlaySpineEffect(bool closePMA = false)
{
// 浠庣壒鏁堥鍒朵綋姹犺幏鍙栫壒鏁�
@@ -253,7 +260,8 @@
{
//LoadAsset 宸茬粡鏈夌紦瀛楽keletonDataAsset
spineComp.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
-
+ //涓簍rue鏃朵細鏈夐儴鍒嗙壒鏁堜笉鏄剧ず 濡傛弧绾х粡楠屾潯锛涙敼鎴愪冀椹悗閮ㄥ垎鐗规晥姝e父锛岃繕鏈夐儴鍒嗕緷鐒惰鏀规璁剧疆
+ spineComp.MeshGenerator.settings.pmaVertexColors = !closePMA;
spineComp.raycastTarget = false;
spineComp.Initialize(true);
spineComp.timeScale = speedRate;
@@ -282,13 +290,17 @@
// 鎾斁鎸囧畾鍔ㄧ敾
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);
}
@@ -365,12 +377,12 @@
}
}
- 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)
{
@@ -404,10 +416,11 @@
spineComp.enabled = false;
isPlaying = false;
onComplete?.Invoke();
- if (isReleaseImmediately)
- {
- Release();
- }
+ // TODO 浼氭姤閿欐殏鏃舵敞閲�
+ // if (isReleaseImmediately)
+ // {
+ // Release();
+ // }
}
}
--
Gitblit v1.8.0