存
This commit is contained in:
@@ -97,22 +97,17 @@ public class BJRedPacketEvent : BJEventBase
|
||||
{
|
||||
base.ResetState();
|
||||
|
||||
// 清理上次残留的分数面板(如果上次流程未正常跑完 OnScoreEnd)
|
||||
// ⭐ 同时重置 tMP_Score:所有预制体 tMP_Score 都是 {fileID:0}(未在 Inspector 赋值),
|
||||
// 由 EnsureScoreBoard 从 _scoreBoard 子级动态获取。_scoreBoard 被销毁后
|
||||
// tMP_Score 变成"假 null"(Unity 已销毁但 C# 引用仍在),EnsureScoreBoard 的
|
||||
// if (tMP_Score != null) 判断在 Destroy 延迟销毁的同一帧内仍为 true,导致跳过创建新面板。
|
||||
// 必须显式置 null 让 EnsureScoreBoard 下次重建。
|
||||
// 只清理上次"自动创建"的分数面板(_scoreBoard != null 说明是 EnsureScoreBoard 创建的)。
|
||||
// ⭐ 不能无条件清空 tMP_Score:金龙这类预制体在 Inspector 上拖好了 tMP_Score
|
||||
// 且 useScorePanel=false(自带分数显示、不自动创建面板),清掉后 Update 访问直接 NRE。
|
||||
// Inspector 自带的引用随预制体本身存活(对象池复用也不会失效),无需重置。
|
||||
// (自动创建的面板销毁点只有 CleanupBeforeDie 一处,销毁时已同步置空引用,不会残留)
|
||||
if (_scoreBoard != null)
|
||||
{
|
||||
Destroy(_scoreBoard);
|
||||
_scoreBoard = null;
|
||||
tMP_Score = null;
|
||||
}
|
||||
else if (tMP_Score != null)
|
||||
{
|
||||
// 上次 die() → CleanupBeforeDie 已销毁 _scoreBoard,但 tMP_Score 引用残留
|
||||
tMP_Score = null;
|
||||
_bjImage = null;
|
||||
}
|
||||
|
||||
// 重置状态标志
|
||||
|
||||
@@ -9,6 +9,33 @@ using Random = UnityEngine.Random;
|
||||
public class FLZY_JL_Boss : MonsterControl_BossBase
|
||||
{
|
||||
public Animator animator;
|
||||
|
||||
[Header("金龙/雷龙爆奖激活延迟")]
|
||||
[Tooltip("爆奖特效默认不激活,Init 设置好参数后收起,延迟固定秒数后 SetActive(true) 激活爆奖")]
|
||||
public float delayActivateSeconds = 7f;
|
||||
|
||||
/// <summary>
|
||||
/// 延迟 SetActive 激活爆奖特效(由 Boss 控制,不在 Event 里用协程等待)。
|
||||
/// Init 设置完参数后立即 SetActive(false) 收起 → delayActivateSeconds 后 SetActive(true),
|
||||
/// 触发 Event 的 OnEnable → _ready==true → GoldEffect 开始发红包加分。
|
||||
/// ⭐ 必须用常驻体 GameManager 起延迟协程:Boss 怪物死亡后会被对象池禁用/回收,
|
||||
/// 挂它自身的协程会随失活中断,导致 SetActive(true) 永不执行。
|
||||
/// </summary>
|
||||
private void DelayActivateAward(GameObject award)
|
||||
{
|
||||
if (award == null) return;
|
||||
award.SetActive(false); // 默认不激活(隐藏爆奖表现)
|
||||
if (GameManager.Instance != null)
|
||||
GameManager.Instance.StartCoroutine(DelaySetActive(award));
|
||||
}
|
||||
|
||||
private IEnumerator DelaySetActive(GameObject award)
|
||||
{
|
||||
yield return new WaitForSeconds(delayActivateSeconds);
|
||||
if (award != null)
|
||||
award.SetActive(true); // 激活 → OnEnable → 爆奖
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
@@ -37,8 +64,6 @@ public class FLZY_JL_Boss : MonsterControl_BossBase
|
||||
{
|
||||
|
||||
GetComponent<Animator>().enabled = false;
|
||||
if (currEffect_DieAward != null)
|
||||
currEffect_DieAward.SetActive(true);
|
||||
}
|
||||
|
||||
public override void DieFish(RoomKillNotice obj = null)
|
||||
@@ -107,6 +132,10 @@ public class FLZY_JL_Boss : MonsterControl_BossBase
|
||||
JiaFen // action<int>
|
||||
);
|
||||
}
|
||||
|
||||
// ⭐ 爆奖特效默认不激活:Init 设置好参数后立即收起,
|
||||
// 延迟 delayActivateSeconds 秒后 SetActive(true) 才激活爆奖(Event.OnEnable 触发)
|
||||
DelayActivateAward(o);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,34 +60,39 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
bjEndUI: {fileID: 4300126860111980404, guid: ee64541cedf5f2b409b6c5846977aa06, type: 3}
|
||||
useScorePanel: 0
|
||||
tMP_Score: {fileID: 1728322933195366793}
|
||||
scorePanelPrefab: {fileID: 0}
|
||||
currScore: 0
|
||||
maxScore: 0
|
||||
scoreCount: 0
|
||||
bjEndUIOffsetY: 150
|
||||
posID: 0
|
||||
paoBei: 0
|
||||
fishScore: 0
|
||||
bJbeishu: 0
|
||||
maxScore: 0
|
||||
startOffset: {x: 0, y: 0, z: -100}
|
||||
isSelf: 0
|
||||
isScoreEnd: 0
|
||||
useScorePanel: 0
|
||||
tMP_Score: {fileID: 1728322933195366793}
|
||||
scorePanelPrefab: {fileID: 0}
|
||||
currScore: 0
|
||||
scoreCount: 0
|
||||
bigPrizeFishMode: 1
|
||||
showDelay: 3
|
||||
moveDuration: 0.5
|
||||
moveEase: 6
|
||||
startOffset: {x: 0, y: 0, z: -100}
|
||||
bjEndUIOffsetY: 150
|
||||
coinFlyDuration: 0.5
|
||||
coinArrivalInterval: 0.1
|
||||
isSelf: 0
|
||||
showAddScoreFX: 1
|
||||
autoFinishOnScoreFull: 1
|
||||
totalBJCount: 0
|
||||
currBJCount: 0
|
||||
isEffEnd: 0
|
||||
isScoreStart: 0
|
||||
isScoreEnd: 0
|
||||
isGoldEffectStart: 0
|
||||
skeletonGraphic: {fileID: 4542576658867070012}
|
||||
goldAddCount: 0
|
||||
currGoldCount: 0
|
||||
tmp_CoinNum: {fileID: 0}
|
||||
tmp_goldSprite: {fileID: 0}
|
||||
tmp_SilverSprite: {fileID: 0}
|
||||
--- !u!1 &2935493953481445700
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -11,6 +11,11 @@ public class JinLongEvent : BJRedPacketEvent
|
||||
{
|
||||
public SkeletonGraphic skeletonGraphic;
|
||||
|
||||
// ⭐ 爆奖激活时机由 BossControl(FLZY_JL_Boss) 延迟 SetActive 控制:
|
||||
// Init 设置好参数后会被 SetActive(false) 收起,delayActivateSeconds 之后 SetActive(true),
|
||||
// OnEnable 检测到 _ready 才真正触发爆奖(发红包加分)。这里不跑协程等待。
|
||||
private bool _ready = false;
|
||||
|
||||
public int goldAddCount;
|
||||
public int currGoldCount;
|
||||
public void Awake()
|
||||
@@ -25,9 +30,10 @@ public class JinLongEvent : BJRedPacketEvent
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
// ⭐ isAddScore 不在登场动画回调里置 true,统一由 Init 的延迟协程(delayActivateSeconds=7s)激活,
|
||||
// 否则 stand01 播完(可能早于 7 秒)就提前开始加分,破坏"默认不激活 + 固定 7 秒"。
|
||||
PlayThen("stand01", "stand02", () =>
|
||||
{
|
||||
isAddScore = true;
|
||||
tMP_Score.gameObject.SetActive(true);
|
||||
});
|
||||
}
|
||||
@@ -70,7 +76,30 @@ public class JinLongEvent : BJRedPacketEvent
|
||||
public override void Init(long goldCount, int posID, long paobei, long fishScore, int beishu, Action<int> action, Action action1 = null)
|
||||
{
|
||||
base.Init(goldCount, posID, paobei, fishScore, beishu, action, action1);
|
||||
GoldEffect();
|
||||
// ⭐ 只设置参数、标记就绪,不立即触发爆奖。
|
||||
// 真正的激活由 BossControl 延迟 SetActive(true) → OnEnable 触发。
|
||||
_ready = true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 对象池复用:重置加分滚动进度。
|
||||
/// ⭐ 不重置的话 elapsed 残留上次的大值,t = elapsed / a 会立刻 >= 1,
|
||||
/// Update 直接跳到最终分,加分动画(从 0 一点一点加)就没了。
|
||||
/// </summary>
|
||||
protected override void ResetState()
|
||||
{
|
||||
base.ResetState();
|
||||
_ready = false;
|
||||
isAddScore = false;
|
||||
elapsed = 0f;
|
||||
currGoldCount = 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// 由 BossControl 延迟 SetActive(true) 触发:仅当参数已就绪(_ready)才激活爆奖。
|
||||
/// 首次从对象池 Get 时 OnEnable 先于 Init(_ready=false)不会误触发,保证"默认不激活"。
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
if (_ready) GoldEffect();
|
||||
}
|
||||
public override void GoldEffect()
|
||||
{
|
||||
|
||||
@@ -930,7 +930,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1361653457580592, guid: 055ba0a273a3d0c48a43f4fb3f92dc4d, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1361653457580592, guid: 055ba0a273a3d0c48a43f4fb3f92dc4d, type: 3}
|
||||
propertyPath: m_TagString
|
||||
@@ -7335,6 +7335,8 @@ MonoBehaviour:
|
||||
end: {x: 0, y: 0}
|
||||
moveTime: 0
|
||||
moveSpeed: 0
|
||||
cachedCamera: {fileID: 0}
|
||||
cachedUirootRect: {fileID: 0}
|
||||
skeleton: {fileID: 0}
|
||||
isSpine: 1
|
||||
fishTypeID: 11027
|
||||
@@ -7354,6 +7356,7 @@ MonoBehaviour:
|
||||
colliderList: []
|
||||
lockPoint: {fileID: 7181217104733412390}
|
||||
bingDongEffect: {fileID: 0}
|
||||
needLockEvent: 0
|
||||
createVideoClip: {fileID: 0}
|
||||
rotationPY: 60
|
||||
baseMmove: 0
|
||||
@@ -7361,6 +7364,8 @@ MonoBehaviour:
|
||||
isNot1: 0
|
||||
ischild0: 0
|
||||
depthOffset: 0
|
||||
is2DFish: 0
|
||||
sortOrder2D: 0
|
||||
bossName:
|
||||
isToUI: 1
|
||||
tMP_CurrBossScore: {fileID: 0}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,12 @@ using Random = UnityEngine.Random;
|
||||
public class LeiLongEvent : BJRedPacketEvent
|
||||
{
|
||||
public SkeletonGraphic skeletonGraphic;
|
||||
|
||||
// ⭐ 爆奖激活时机由 BossControl(FLZY_JL_Boss) 延迟 SetActive 控制:
|
||||
// Init 设置好参数后会被 SetActive(false) 收起,delayActivateSeconds 之后 SetActive(true),
|
||||
// OnEnable 检测到 _ready 才真正触发爆奖(发红包加分)。这里不跑协程等待。
|
||||
private bool _ready = false;
|
||||
|
||||
public TextMeshProUGUI tMP_longzhu1;
|
||||
public TextMeshProUGUI tMP_longzhu2;
|
||||
public TextMeshProUGUI tMP_longzhu3;
|
||||
@@ -59,7 +65,33 @@ public class LeiLongEvent : BJRedPacketEvent
|
||||
this.fishScore = (int)fishScore;
|
||||
bJbeishu = beishu;
|
||||
action1?.Invoke();
|
||||
|
||||
|
||||
// ⭐ 只设置参数、标记就绪,不立即触发爆奖。
|
||||
// 真正的激活由 BossControl 延迟 SetActive(true) → OnEnable 触发。
|
||||
// ⭐ Init 手动赋值不走 base.Init/ResetState,这里手动重置滚动状态:
|
||||
// 否则对象池复用会残留上次的 currScore/elapsed,导致 Update 一步跳到最终分、没有加分动画。
|
||||
currScore = 0;
|
||||
elapsed = 0f;
|
||||
isAddScore = false;
|
||||
_ready = true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 对象池复用:重置就绪标记和加分滚动进度。
|
||||
/// </summary>
|
||||
protected override void ResetState()
|
||||
{
|
||||
base.ResetState();
|
||||
_ready = false;
|
||||
isAddScore = false;
|
||||
elapsed = 0f;
|
||||
}
|
||||
/// <summary>
|
||||
/// 由 BossControl 延迟 SetActive(true) 触发:仅当参数已就绪(_ready)才激活爆奖。
|
||||
/// 首次从对象池 Get 时 OnEnable 先于 Init(_ready=false)不会误触发,保证"默认不激活"。
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
if (_ready) GoldEffect();
|
||||
}
|
||||
public override void GoldEffect()
|
||||
{
|
||||
|
||||
@@ -66,5 +66,72 @@ PrefabInstance:
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 5074584353305122566, guid: fd17b534669cc3145bf3e8af1d9cf09a,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: -4909820503675488447}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fd17b534669cc3145bf3e8af1d9cf09a, type: 3}
|
||||
--- !u!1 &1093432214310145427 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 5074584353305122566, guid: fd17b534669cc3145bf3e8af1d9cf09a,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 5278268634264574613}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &-4909820503675488447
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1093432214310145427}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4b0f192d26ab62f41b2cfd8cd607ebd5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
bjEndUI: {fileID: 0}
|
||||
bjEndUIOffsetY: 150
|
||||
posID: 0
|
||||
paoBei: 0
|
||||
fishScore: 0
|
||||
bJbeishu: 0
|
||||
maxScore: 0
|
||||
startOffset: {x: 0, y: 0, z: -100}
|
||||
isSelf: 0
|
||||
isScoreEnd: 0
|
||||
useScorePanel: 1
|
||||
tMP_Score: {fileID: 0}
|
||||
scorePanelPrefab: {fileID: 0}
|
||||
currScore: 0
|
||||
scoreCount: 0
|
||||
bigPrizeFishMode: 0
|
||||
showDelay: 3
|
||||
moveDuration: 0.5
|
||||
moveEase: 6
|
||||
coinFlyDuration: 0.5
|
||||
coinArrivalInterval: 0.1
|
||||
showAddScoreFX: 1
|
||||
autoFinishOnScoreFull: 1
|
||||
totalBJCount: 0
|
||||
currBJCount: 0
|
||||
isEffEnd: 0
|
||||
isScoreStart: 0
|
||||
isGoldEffectStart: 0
|
||||
baoJiangMode: 0
|
||||
endUIType: 1
|
||||
endUIEntries: []
|
||||
monster: {fileID: 0}
|
||||
startPoint: {x: 0, y: 0, z: 0}
|
||||
coinCount: 0
|
||||
isLocalCoin: 0
|
||||
baoJiangEffectPrefab: {fileID: 0}
|
||||
parentTransform: {fileID: 0}
|
||||
offsetPosition: {x: 0, y: 0, z: 0}
|
||||
effectType: 0
|
||||
onTimeObjs: []
|
||||
hitTimes: []
|
||||
time: 0
|
||||
dieEffectTesyNum: 0
|
||||
minBJCount: 10
|
||||
maxBJCount: 15
|
||||
|
||||
Reference in New Issue
Block a user