1
This commit is contained in:
@@ -2582,3 +2582,10 @@ AnimationClip:
|
||||
floatParameter: 0
|
||||
intParameter: 0
|
||||
messageOptions: 0
|
||||
- time: 16.4
|
||||
functionName:
|
||||
data:
|
||||
objectReferenceParameter: {fileID: 0}
|
||||
floatParameter: 0
|
||||
intParameter: 0
|
||||
messageOptions: 0
|
||||
|
||||
@@ -108,7 +108,7 @@ public class MonsterControl_BossBase : MonsterContral
|
||||
if (tMP_CurrBossScore != null) return;
|
||||
var prefab = CreateFishManager.Instance.dieFXPrefabAwardTmp;
|
||||
if (prefab == null) return;
|
||||
var parent = CreateFishManager.Instance.currGameType.subPanelParent;
|
||||
var parent = CreateFishManager.Instance.bjEffectRoot;
|
||||
if (parent == null) return;
|
||||
|
||||
tMP_CurrBossScore = Instantiate(prefab, parent)
|
||||
|
||||
@@ -89,6 +89,13 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
/// <summary>鱼的父节点(保持场景层级整洁)</summary>
|
||||
public Transform poolRoot;
|
||||
|
||||
/// <summary>
|
||||
/// 爆奖特效统一父节点(Boss 分数版/加分弹出/BJEndUI/特殊爆奖等)。
|
||||
/// EnterRoom 时创建挂在 UIManager.uiRoot 下,ExitRoom 时整节点销毁,
|
||||
/// 避免爆奖残留特效在退出房间后仍挂在 subPanelParent.parent 上造成内存泄漏。
|
||||
/// </summary>
|
||||
public Transform bjEffectRoot;
|
||||
|
||||
/// <summary>当前房间可生成鱼列表(与 NativeArray 下标对齐)</summary>
|
||||
public List<RoomFishDetailConfig> spawnList;
|
||||
|
||||
@@ -350,6 +357,24 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
{
|
||||
InitSpawnSystem(gameType);
|
||||
BindCurrentGamePanel();
|
||||
EnsureBJEffectRoot();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建爆奖特效统一父节点(挂在 UIManager.uiRoot 下)。
|
||||
/// 已存在则不重复创建。所有爆奖相关 Instantiate 都应使用此节点作为父对象。
|
||||
/// </summary>
|
||||
private void EnsureBJEffectRoot()
|
||||
{
|
||||
if (bjEffectRoot != null) return;
|
||||
var go = new GameObject("BJEffectRoot");
|
||||
go.transform.SetParent(UIManager.Instance.uiRoot, false);
|
||||
var rect = go.AddComponent<RectTransform>();
|
||||
rect.anchorMin = Vector2.zero;
|
||||
rect.anchorMax = Vector2.one;
|
||||
rect.offsetMin = Vector2.zero;
|
||||
rect.offsetMax = Vector2.zero;
|
||||
bjEffectRoot = go.transform;
|
||||
}
|
||||
|
||||
/// <summary>根据当前 GameType 绑定对应 UI 面板到 currGameType。</summary>
|
||||
@@ -1528,6 +1553,14 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
Destroy(item.gameObject);
|
||||
|
||||
}
|
||||
// ⭐ 销毁爆奖特效父节点:所有挂在 bjEffectRoot 下的爆奖特效
|
||||
// (Boss 分数版/加分弹出/BJEndUI/特殊爆奖等) 会一并被销毁,
|
||||
// 防止退出房间时残留未结束的爆奖协程/动画造成的内存泄漏
|
||||
if (bjEffectRoot != null)
|
||||
{
|
||||
Destroy(bjEffectRoot.gameObject);
|
||||
bjEffectRoot = null;
|
||||
}
|
||||
//for (int i = fishDatas_hashCodekey.childCount - 1; i >= 0; i--)
|
||||
// Destroy(fishRoot.GetChild(i).gameObject);
|
||||
}
|
||||
@@ -1728,7 +1761,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
{
|
||||
var award = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAward,
|
||||
currGameType.subPanelParent.parent);
|
||||
bjEffectRoot);
|
||||
|
||||
award.GetComponent<RectTransform>().anchoredPosition =
|
||||
CoordinateTransformation.WorldPos_ToCanvas(
|
||||
@@ -1767,7 +1800,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
// 3. 实例化金币特效(沿用你原来的 award 逻辑)
|
||||
var award = Instantiate(
|
||||
dieFXPrefabAward, // 或者用某个专门的"掉金币" prefab
|
||||
currGameType.subPanelParent.parent);
|
||||
bjEffectRoot);
|
||||
|
||||
var rect = award.GetComponent<RectTransform>();
|
||||
rect.anchoredPosition = canvasPos;
|
||||
@@ -1838,7 +1871,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
// 普通鱼:金币飞向炮台
|
||||
var award = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAward,
|
||||
currGameType.subPanelParent.parent);
|
||||
bjEffectRoot);
|
||||
try
|
||||
{
|
||||
award.GetComponent<RectTransform>().anchoredPosition =
|
||||
@@ -1877,7 +1910,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
{
|
||||
bossCtrl.currEffect_DieAward = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAwardTmp,
|
||||
currGameType.subPanelParent.parent);
|
||||
bjEffectRoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1894,7 +1927,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
// 普通鱼:金币飞向炮台
|
||||
var award = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAward,
|
||||
currGameType.subPanelParent.parent);
|
||||
bjEffectRoot);
|
||||
try
|
||||
{
|
||||
award.GetComponent<RectTransform>().anchoredPosition =
|
||||
@@ -1931,7 +1964,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
CoordinateTransformation.WorldPos_ToCanvas(
|
||||
monster.transform.position,
|
||||
UIManager.Instance.uiRoot.GetComponent<Canvas>());
|
||||
award.transform.SetParent(currGameType.subPanelParent.parent);
|
||||
award.transform.SetParent(bjEffectRoot);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -1983,7 +2016,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
|
||||
{
|
||||
bossCtrl.currEffect_DieAward = Instantiate(
|
||||
monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAwardTmp,
|
||||
currGameType.subPanelParent.parent);
|
||||
bjEffectRoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -217,6 +217,25 @@ namespace Assets.MyGame.Scripts.Net
|
||||
UIManager.Instance.ShowBoardError($"[WebSocket] {type} 未连接,无法发送消息");
|
||||
|
||||
#endif
|
||||
switch (type)
|
||||
{
|
||||
case SocketType.login:
|
||||
break;
|
||||
case SocketType.room:
|
||||
break;
|
||||
case SocketType.game:
|
||||
|
||||
//等待界面添加
|
||||
UIManager.Instance.ShowAsync(UIPanel.HomeMainPanel, GameManager.Instance.gameData.currGameType);
|
||||
UIManager.Instance.ShowBoardGongGao("网络异常,请重新进入房间");
|
||||
break;
|
||||
case SocketType.chess:
|
||||
break;
|
||||
case SocketType.customer:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -300,17 +300,6 @@
|
||||
"boardText": "",
|
||||
"dieEffectAssets": ""
|
||||
},
|
||||
{
|
||||
"fishNumber": 11028,
|
||||
"prefabFishResourcesPath": "1507",
|
||||
"showAudio": [],
|
||||
"moveAudio": [],
|
||||
"dieAudio": [],
|
||||
"dieGlodAduio": {},
|
||||
"layer": 30150,
|
||||
"boardText": "",
|
||||
"dieEffectAssets": ""
|
||||
},
|
||||
{
|
||||
"fishNumber": 11029,
|
||||
"prefabFishResourcesPath": "1595",
|
||||
|
||||
@@ -110,7 +110,7 @@ public class BJEventBase : MonoBehaviour
|
||||
}
|
||||
/// <summary>
|
||||
/// 自动补充分数版:tMP_Score 为空 → 优先用 scorePanelPrefab → 否则用 Manager 的 dieFXPrefabAwardTmp
|
||||
/// 父对象挂在 CreateFishManager.Instance.currGameType.subPanelParent 下
|
||||
/// 父对象挂在 CreateFishManager.Instance.bjEffectRoot 下
|
||||
/// </summary>
|
||||
protected virtual void EnsureScoreBoard()
|
||||
{
|
||||
@@ -118,7 +118,7 @@ public class BJEventBase : MonoBehaviour
|
||||
if (!useScorePanel) return;
|
||||
|
||||
if (CreateFishManager.Instance == null || CreateFishManager.Instance.currGameType == null) return;
|
||||
var parent = CreateFishManager.Instance.currGameType.subPanelParent;
|
||||
var parent = CreateFishManager.Instance.bjEffectRoot;
|
||||
if (parent == null) return;
|
||||
|
||||
// 1. 优先用 Inspector 设置的预制体
|
||||
@@ -387,7 +387,7 @@ public class BJEventBase : MonoBehaviour
|
||||
uiPos = GetSeatPosition() + Vector3.up * y;
|
||||
}
|
||||
|
||||
var endUI = Instantiate(bjEndUI, uiPos, Quaternion.identity, UIManager.Instance.uiRoot);
|
||||
var endUI = Instantiate(bjEndUI, uiPos, Quaternion.identity, CreateFishManager.Instance.bjEffectRoot);
|
||||
endUI.Init(bJbeishu, maxScore);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ public class FLXJEvent : BJEventBase
|
||||
if (bjEndUI != null)
|
||||
{
|
||||
var uiPos = GetSeatPosition() + Vector3.up * bjEndUIOffsetY;
|
||||
var endUI = Instantiate(bjEndUI, uiPos, Quaternion.identity, UIManager.Instance.uiRoot);
|
||||
var endUI = Instantiate(bjEndUI, uiPos, Quaternion.identity, CreateFishManager.Instance.bjEffectRoot);
|
||||
endUI.Init(bJbeishu, maxScore);
|
||||
bjEndUI = null; // 防止 OnScoreEnd 重复创建
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class GSLDieEvent :BJEventBase
|
||||
if (bjEndUI != null)
|
||||
{
|
||||
var uiPos = GetSeatPosition() + Vector3.up * bjEndUIOffsetY;
|
||||
var endUI = Instantiate(bjEndUI, uiPos, Quaternion.identity, UIManager.Instance.uiRoot);
|
||||
var endUI = Instantiate(bjEndUI, uiPos, Quaternion.identity, CreateFishManager.Instance.bjEffectRoot);
|
||||
endUI.Init(bJbeishu, maxScore);
|
||||
bjEndUI = null; // 防止 OnScoreEnd 重复创建
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user