From 04cd618b935bb0aa1cee770ba35fb635dac31b09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A3=AE2003?= <2384017988@qq.com>
Date: Mon, 13 Jul 2026 02:24:32 +0800
Subject: [PATCH] 1
---
.../AddressableAssetSettings.asset | 3 +-
.../Scripts/Net/WebSocketReponseList.cs | 39 +++++++++------
.../UI/DefaultPanel/GuaGuaLe/GuaGuaLeGPU.cs | 5 +-
.../aa/UI/Game/GameMainPanel_FishBase.cs | 2 +
.../MyGame/aa/UI/Home/Sub/TurretPanel.prefab | 50 +++++++++----------
5 files changed, 52 insertions(+), 47 deletions(-)
diff --git a/Assets/AddressableAssetsData/AddressableAssetSettings.asset b/Assets/AddressableAssetsData/AddressableAssetSettings.asset
index a78d7d854..c76b0edf6 100644
--- a/Assets/AddressableAssetsData/AddressableAssetSettings.asset
+++ b/Assets/AddressableAssetsData/AddressableAssetSettings.asset
@@ -15,7 +15,7 @@ MonoBehaviour:
m_DefaultGroup: a263e71fce79f2f4cb5b5f1fa6b7291a
m_currentHash:
serializedVersion: 2
- Hash: d0015976d5aa46d36938ddc770076c56
+ Hash: 2c18bfd5fc0794b3449f30246c6ffef9
m_OptimizeCatalogSize: 0
m_BuildRemoteCatalog: 0
m_BundleLocalCatalog: 0
@@ -46,7 +46,6 @@ MonoBehaviour:
m_GroupAssets:
- {fileID: 11400000, guid: 427f94f67624e374895487c87f881a7f, type: 2}
- {fileID: 11400000, guid: ca4eb1ed7a9a8bc4bbcc5d865fd723a4, type: 2}
- - {fileID: 11400000, guid: d40b25ba0f5f62e4b8ca04b2bba92711, type: 2}
- {fileID: 11400000, guid: ec57fb26f5bb61544b2831e9485b32fe, type: 2}
- {fileID: 11400000, guid: 39ca999e15083df459f52c7743a44f50, type: 2}
- {fileID: 11400000, guid: aa56712de737c4b4ea481409576c9b09, type: 2}
diff --git a/Assets/MyGame/Scripts/Net/WebSocketReponseList.cs b/Assets/MyGame/Scripts/Net/WebSocketReponseList.cs
index 2d4b8f9ed..faf1e75d2 100644
--- a/Assets/MyGame/Scripts/Net/WebSocketReponseList.cs
+++ b/Assets/MyGame/Scripts/Net/WebSocketReponseList.cs
@@ -12,8 +12,15 @@ namespace Assets.MyGame.Scripts.Net
{
public class WebSocketReponseList
{
- /// 正在加载中的游戏场景 UIPanel 集合,防止房主收到多条 RoomJoinNotice(含人机)时重复创建场景
- private static readonly HashSet _loadingGamePanels = new HashSet();
+ /// 已加载(或正在加载)的游戏场景名集合,防止人机 RoomJoinNotice 触发重复 LoadSceneAsync
+ private static readonly HashSet _loadedGameScenes = new HashSet();
+
+ /// 清除指定场景的加载标记(退出游戏时调用,下次进入可重新加载)
+ public static void ClearLoadedGameScene(string sceneName)
+ {
+ if (!string.IsNullOrEmpty(sceneName))
+ _loadedGameScenes.Remove(sceneName);
+ }
///
/// 获取房间列表 room
///
@@ -96,15 +103,9 @@ namespace Assets.MyGame.Scripts.Net
default:
break;
}
- if (UIManager.Instance.Get(uIPanel)==null && !_loadingGamePanels.Contains(uIPanel))
+ if (UIManager.Instance.Get(uIPanel)==null)
{
- // 标记正在加载,防止房主收到多条 RoomJoinNotice(含人机玩家)时重复创建场景
- _loadingGamePanels.Add(uIPanel);
- UIManager.Instance.ShowAsync(uIPanel, UIPanel.HomeMainPanel, msg, (panel) =>
- {
- // 面板创建完成,移除加载标记
- _loadingGamePanels.Remove(uIPanel);
- });
+ UIManager.Instance.ShowAsync(uIPanel, UIPanel.HomeMainPanel, msg);
// 卸载所有已加载的游戏地图场景(保证场景唯一性)
string[] gameScenes = { "FLZY", "YYSC", "XJMH", "HHWK" };
foreach (var sn in gameScenes)
@@ -113,17 +114,24 @@ namespace Assets.MyGame.Scripts.Net
if (sn == sceneName) continue;
var s = SceneManager.GetSceneByName(sn);
if (s.IsValid() && s.isLoaded)
+ {
SceneManager.UnloadSceneAsync(sn);
+ _loadedGameScenes.Remove(sn);
+ }
+ }
+ // 目标场景仅加载一次:标记已加载后不再重复 LoadSceneAsync(防止人机通知触发重复加载)
+ if (!string.IsNullOrEmpty(sceneName) && !_loadedGameScenes.Contains(sceneName))
+ {
+ _loadedGameScenes.Add(sceneName);
+ var targetScene = SceneManager.GetSceneByName(sceneName);
+ if (!targetScene.IsValid() || !targetScene.isLoaded)
+ SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
}
- // 目标场景已加载则不重复加载
- var targetScene = SceneManager.GetSceneByName(sceneName);
- if (!targetScene.IsValid() || !targetScene.isLoaded)
- SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
UIManager.Instance.Close(UIPanel.HomeMainPanel);
WebSocketManager.Instance.isGame = true;
}
- else if (UIManager.Instance.Get(uIPanel) != null)
+ else
{
// 面板已存在 → 新玩家加入,转发给现有面板激活座位
var panel = UIManager.Instance.Get(uIPanel);
@@ -147,7 +155,6 @@ namespace Assets.MyGame.Scripts.Net
}
}
}
- // else: 场景正在加载中(_loadingGamePanels 含此 uIPanel),忽略本次重复通知
}
diff --git a/Assets/MyGame/aa/UI/DefaultPanel/GuaGuaLe/GuaGuaLeGPU.cs b/Assets/MyGame/aa/UI/DefaultPanel/GuaGuaLe/GuaGuaLeGPU.cs
index 10c0c8672..91d4a6804 100644
--- a/Assets/MyGame/aa/UI/DefaultPanel/GuaGuaLe/GuaGuaLeGPU.cs
+++ b/Assets/MyGame/aa/UI/DefaultPanel/GuaGuaLe/GuaGuaLeGPU.cs
@@ -137,10 +137,7 @@ public class GuaGuaLeGPU : SubUIBase, IPointerDownHandler, IDragHandler
break;
}
- // 抽奖时刮刮卡已被扣减,立即刷新用户数据(触发 GameMainPanel_FishBase.RefreshGGKCount)
- string userId = GameManager.Instance?.user?.id;
- if (!string.IsNullOrEmpty(userId))
- APIRequestList.GetUser(userId, a => GameManager.Instance.UpdataUserData(a));
+ // 不在此处刷新用户数据:金币/钻石/刮刮卡数量统一在刮开(RevealAll)时刷新
});
}
diff --git a/Assets/MyGame/aa/UI/Game/GameMainPanel_FishBase.cs b/Assets/MyGame/aa/UI/Game/GameMainPanel_FishBase.cs
index d57a270c1..8af3497a1 100644
--- a/Assets/MyGame/aa/UI/Game/GameMainPanel_FishBase.cs
+++ b/Assets/MyGame/aa/UI/Game/GameMainPanel_FishBase.cs
@@ -308,6 +308,8 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
var scene = SceneManager.GetSceneByName(sceneName);
if (scene.IsValid() && scene.isLoaded)
SceneManager.UnloadSceneAsync(sceneName);
+ // 清除场景加载标记,下次进入可重新加载
+ Assets.MyGame.Scripts.Net.WebSocketReponseList.ClearLoadedGameScene(sceneName);
WebSocketManager.Instance.Close(SocketType.game);
}
diff --git a/Assets/MyGame/aa/UI/Home/Sub/TurretPanel.prefab b/Assets/MyGame/aa/UI/Home/Sub/TurretPanel.prefab
index eba86bc2b..dd77a04ec 100644
--- a/Assets/MyGame/aa/UI/Home/Sub/TurretPanel.prefab
+++ b/Assets/MyGame/aa/UI/Home/Sub/TurretPanel.prefab
@@ -547,9 +547,9 @@ RectTransform:
- {fileID: 7478071974668900598}
m_Father: {fileID: 9060029959765500742}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 518.49994, y: -131.5}
+ m_AnchorMin: {x: 1, y: 0}
+ m_AnchorMax: {x: 1, y: 0}
+ m_AnchoredPosition: {x: -293.50006, y: 243.5}
m_SizeDelta: {x: 185, y: 187}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1883757436979605396
@@ -704,9 +704,9 @@ RectTransform:
- {fileID: 6504682220588272823}
m_Father: {fileID: 9060029959765500742}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: -519, y: -59.5}
+ m_AnchorMin: {x: 0, y: 0.5}
+ m_AnchorMax: {x: 0, y: 0.5}
+ m_AnchoredPosition: {x: 293, y: -59.5}
m_SizeDelta: {x: 167, y: 631}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7130882456168440361
@@ -1242,9 +1242,9 @@ RectTransform:
- {fileID: 1587309832363243594}
m_Father: {fileID: 9060029959765500742}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 510.99997, y: 249}
+ m_AnchorMin: {x: 1, y: 1}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: -301.00003, y: -126}
m_SizeDelta: {x: 576, y: 94}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3918509619865740406
@@ -1608,7 +1608,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
- m_AnchoredPosition: {x: -349.6, y: 88.7}
+ m_AnchoredPosition: {x: -349.6, y: 88.70001}
m_SizeDelta: {x: 272, y: 64}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3254042493560536801
@@ -2322,10 +2322,10 @@ RectTransform:
- {fileID: 219246165221164760}
m_Father: {fileID: 9060029959765500742}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 510.99997, y: 92.6203}
- m_SizeDelta: {x: 560, y: 204.7593}
+ m_AnchorMin: {x: 1, y: 1}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: -301.00003, y: -282.3797}
+ m_SizeDelta: {x: 560, y: 204.75928}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1836136622499416430
CanvasRenderer:
@@ -4531,10 +4531,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 9060029959765500742}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 1}
- m_AnchorMax: {x: 0.5, y: 1}
- m_AnchoredPosition: {x: 0, y: -375}
- m_SizeDelta: {x: 1624, y: 750}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6235165147965413098
CanvasRenderer:
@@ -6222,10 +6222,10 @@ RectTransform:
- {fileID: 6264088540415891893}
m_Father: {fileID: 8904622048228621647}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 1624, y: 750}
+ m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1907540500704709558
CanvasRenderer:
@@ -6963,9 +6963,9 @@ RectTransform:
- {fileID: 6234075585866935153}
m_Father: {fileID: 9060029959765500742}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: -687.5, y: -59.5}
+ m_AnchorMin: {x: 0, y: 0.5}
+ m_AnchorMax: {x: 0, y: 0.5}
+ m_AnchoredPosition: {x: 124.5, y: -59.5}
m_SizeDelta: {x: 167, y: 631}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2916716009937732969
@@ -10611,7 +10611,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
- m_AnchoredPosition: {x: 5.261505, y: 0}
+ m_AnchoredPosition: {x: 5.2614746, y: 0}
m_SizeDelta: {x: -10.5228, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2420273348081823164