1
This commit is contained in:
@@ -145,7 +145,7 @@ public class MonsterControl_BossBase : MonsterContral
|
||||
if (tMP_CurrBossScore != null) return;
|
||||
var prefab = CreateFishManager.Instance.dieFXPrefabAwardTmp;
|
||||
if (prefab == null) return;
|
||||
var parent = CreateFishManager.Instance.bjEffectRoot;
|
||||
var parent = CreateFishManager.Instance.currGameType.subPanelParent;
|
||||
if (parent == null) return;
|
||||
|
||||
var board = Instantiate(prefab, parent);
|
||||
|
||||
@@ -90,9 +90,17 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
public Transform poolRoot;
|
||||
|
||||
/// <summary>
|
||||
/// 爆奖特效统一父节点(Boss 分数版/加分弹出/BJEndUI/特殊爆奖等)。
|
||||
/// EnterRoom 时创建挂在 UIManager.uiRoot 下,ExitRoom 时整节点销毁,
|
||||
/// 避免爆奖残留特效在退出房间后仍挂在 subPanelParent.parent 上造成内存泄漏。
|
||||
/// 非 UI 爆奖特效统一父节点。
|
||||
/// 仅装载那些"原本挂在 UIManager.uiRoot 下(不会随房间退出自动销毁)"
|
||||
/// 或"原本无父对象(世界空间特效)"的爆奖特效:
|
||||
/// - BJEndUI 系列(BJEventBase/GSL/FLXJ 的 EndBJ)
|
||||
/// - DieEffect_TSY / EffectZuanTouDie 的 baoJiangEffectPrefab
|
||||
/// - HHWK_SDY_DieEvent 的 explosionPrefab
|
||||
/// - HHWK_ZDX_DieEvent 的 bombPrefab / explosionPrefab
|
||||
/// - Boss鱼/特殊Boss isToUI=false 分支的 currEffect_DieAward
|
||||
/// UI 爆奖(挂在 subPanelParent/subPanelParent.parent 下的金币飞、分数版等)
|
||||
/// 不挂这里,由 UIManager 卸载游戏主面板时自动清理。
|
||||
/// EnterRoom 时创建挂在 UIManager.uiRoot 下,ExitRoom 时整节点销毁。
|
||||
/// </summary>
|
||||
public Transform bjEffectRoot;
|
||||
|
||||
@@ -1765,7 +1773,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
{
|
||||
var award = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAward,
|
||||
bjEffectRoot);
|
||||
currGameType.subPanelParent.parent);
|
||||
|
||||
award.GetComponent<RectTransform>().anchoredPosition =
|
||||
CoordinateTransformation.WorldPos_ToCanvas(
|
||||
@@ -1804,7 +1812,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
// 3. 实例化金币特效(沿用你原来的 award 逻辑)
|
||||
var award = Instantiate(
|
||||
dieFXPrefabAward, // 或者用某个专门的"掉金币" prefab
|
||||
bjEffectRoot);
|
||||
currGameType.subPanelParent.parent);
|
||||
|
||||
var rect = award.GetComponent<RectTransform>();
|
||||
rect.anchoredPosition = canvasPos;
|
||||
@@ -1875,7 +1883,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
// 普通鱼:金币飞向炮台
|
||||
var award = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAward,
|
||||
bjEffectRoot);
|
||||
currGameType.subPanelParent.parent);
|
||||
try
|
||||
{
|
||||
award.GetComponent<RectTransform>().anchoredPosition =
|
||||
@@ -1916,12 +1924,14 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
{
|
||||
bossCtrl.currEffect_DieAward = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAwardTmp,
|
||||
bjEffectRoot);
|
||||
currGameType.subPanelParent.parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
// isToUI=false:世界空间特效,无 UI 父对象 → 挂 bjEffectRoot 统一管理
|
||||
bossCtrl.currEffect_DieAward = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAwardTmp);
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAwardTmp,
|
||||
bjEffectRoot);
|
||||
}
|
||||
bossCtrl.action_effect_DieAward?.Invoke(bossCtrl.currEffect_DieAward);
|
||||
|
||||
@@ -1933,7 +1943,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
// 普通鱼:金币飞向炮台
|
||||
var award = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAward,
|
||||
bjEffectRoot);
|
||||
currGameType.subPanelParent.parent);
|
||||
try
|
||||
{
|
||||
award.GetComponent<RectTransform>().anchoredPosition =
|
||||
@@ -1970,7 +1980,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
CoordinateTransformation.WorldPos_ToCanvas(
|
||||
monster.transform.position,
|
||||
UIManager.Instance.uiRoot.GetComponent<Canvas>());
|
||||
award.transform.SetParent(bjEffectRoot);
|
||||
award.transform.SetParent(currGameType.subPanelParent.parent);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -2024,12 +2034,14 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
{
|
||||
bossCtrl.currEffect_DieAward = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAwardTmp,
|
||||
bjEffectRoot);
|
||||
currGameType.subPanelParent.parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
// isToUI=false:世界空间特效,无 UI 父对象 → 挂 bjEffectRoot 统一管理
|
||||
bossCtrl.currEffect_DieAward = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAwardTmp);
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAwardTmp,
|
||||
bjEffectRoot);
|
||||
}
|
||||
bossCtrl.action_effect_DieAward?.Invoke(bossCtrl.currEffect_DieAward);
|
||||
|
||||
@@ -2095,6 +2107,10 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
/// </summary>
|
||||
public void FreezeAllFish()
|
||||
{
|
||||
// ⭐ 守卫:已冻结时直接返回,避免重复调用覆盖已记录的状态
|
||||
// (其他客户端会先后被 OnUsePropNotice 和 SyncGameData_FreezeFish 触发两次)
|
||||
if (isFrozen) return;
|
||||
|
||||
isFrozen = true;
|
||||
// ⭐ 两个字典必须同步清空,否则 frozenFishIsMoves 残留旧数据
|
||||
// 会导致下次解冻时用旧值覆盖 isMove 但不恢复 currState
|
||||
@@ -2134,19 +2150,24 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
MonsterContral m = kv.Value;
|
||||
if (m == null || !m.gameObject.activeInHierarchy) continue;
|
||||
|
||||
// ⭐ 只恢复本次冰冻记录的鱼(frozenFishStates 有记录才恢复)
|
||||
// 避免用 frozenFishIsMoves 的旧数据覆盖未冻结鱼的 isMove
|
||||
if (!frozenFishStates.TryGetValue(m.guid, out var prevState))
|
||||
continue;
|
||||
|
||||
// 恢复冰冻前的 isMove 和 currState
|
||||
if (frozenFishIsMoves.TryGetValue(m.guid, out var prevIsMove))
|
||||
m.isMove = prevIsMove;
|
||||
else
|
||||
m.isMove = true; // 兜底:没记录就恢复为可移动
|
||||
|
||||
m.SetFreezeEffect(false);
|
||||
m.ChangeState(prevState);
|
||||
|
||||
if (frozenFishStates.TryGetValue(m.guid, out var prevState))
|
||||
{
|
||||
// 被本次冰冻冻结的鱼:恢复冰冻前的 isMove 和 currState
|
||||
m.isMove = frozenFishIsMoves.TryGetValue(m.guid, out var prevIsMove)
|
||||
? prevIsMove
|
||||
: m.baseMmove;
|
||||
m.ChangeState(prevState);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ⭐ 不在冰冻记录里的鱼(冰冻期间新激活的,OnEnable 把 isMove 设成了 false)
|
||||
// 用 baseMmove 恢复预制体默认状态,避免解冻后永远不动
|
||||
m.isMove = m.baseMmove;
|
||||
if (m.baseMmove)
|
||||
m.ChangeState(CharacterStateType.move);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Assets.MyGame.Scripts.Net.API.GameConfig_SubClass;
|
||||
using CameraShake;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
@@ -326,17 +327,27 @@ public class GameManager : MonoSingleton<GameManager>
|
||||
// Start is called before the first frame update
|
||||
public Button btn_Skip;
|
||||
public VideoClip startVideoClip;
|
||||
|
||||
IEnumerator yanchi(LoadingPanel loadingPanel)
|
||||
{
|
||||
yield return new WaitForSeconds(5);
|
||||
btn_Skip.gameObject.SetActive(true);
|
||||
yield return new WaitForSeconds(23f);
|
||||
loadingPanel.LoadBar(100);
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
btn_Skip.gameObject.SetActive(false);
|
||||
var v = UIManager.Instance.ShowLoadPanel(startVideoClip);
|
||||
UIManager.Instance.ShowAsync(UIPanel.LoginPanel, null, (a) =>
|
||||
{
|
||||
v.LoadBar(100);
|
||||
}, 28);
|
||||
//UIManager.Instance.ShowAsync(UIPanel.LoginPanel, null, (a) =>
|
||||
//{
|
||||
// v.LoadBar(100);
|
||||
//}, 28);
|
||||
StartCoroutine(yanchi(v));
|
||||
btn_Skip.onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.Instance.StopShowPanel();
|
||||
UIManager.Instance.ShowAsync(UIPanel.LoginPanel, null, null, 0);
|
||||
//UIManager.Instance.ShowAsync(UIPanel.LoginPanel, null, null, 0);
|
||||
v.LoadBar(100);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user