From c9ca72068f0934cd6c4b92ce83b222c2b45d7950 Mon Sep 17 00:00:00 2001 From: YangHua <1475658476@qq.com> Date: Wed, 15 Nov 2023 15:28:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E7=BA=BF=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Zion/Scripts/Adam/GameManager.cs | 13 +++---------- Assets/Zion/Scripts/Adam/UIBootstrap.cs | 6 +++--- .../Scripts/Adam/Utility/Sync/SyncCreateRoom.cs | 4 ++-- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Assets/Zion/Scripts/Adam/GameManager.cs b/Assets/Zion/Scripts/Adam/GameManager.cs index 04666943..5486c350 100644 --- a/Assets/Zion/Scripts/Adam/GameManager.cs +++ b/Assets/Zion/Scripts/Adam/GameManager.cs @@ -15,7 +15,7 @@ public class GameManager : MonoBehaviour private void Start() { SyncCreateRoom.getroomusersRequset += OnGetRoomUsers; - SyncCreateRoom.onlineRequset += OnOtherPlayerOnline; + SyncCreateRoom.send2roomRequset += OnOtherPlayerOnline; SyncPlayerTransform spt = Instantiate(playerTransformPrefab); spt.gameObject.SetActive(true); spt.gameObject.transform.position = spawnPos.position; @@ -27,14 +27,7 @@ public class GameManager : MonoBehaviour } - public void Update() - { - if (Input.GetKeyDown("t")) - { - string msg = "getroomusers "; - _ = SyncCreateRoom.SendMessageAsync(msg); - } - } + public void OnOtherPlayerOnline(string msg) { @@ -84,7 +77,7 @@ public class GameManager : MonoBehaviour userIds.Add(ulong.Parse(userInfo[0])); } } - string msg = string.Format("send2room " + "online"); + string msg = string.Format("send2room " + "online,"+ ulong.Parse(GlobalFlag.currentUser.user_id)); _ = SyncCreateRoom.SendMessageAsync(msg); } diff --git a/Assets/Zion/Scripts/Adam/UIBootstrap.cs b/Assets/Zion/Scripts/Adam/UIBootstrap.cs index 3cb862c8..aa1d783b 100644 --- a/Assets/Zion/Scripts/Adam/UIBootstrap.cs +++ b/Assets/Zion/Scripts/Adam/UIBootstrap.cs @@ -21,7 +21,7 @@ public class UIBootstrap : MonoSingleton } AdamSync.SyncCreateRoom.getRoomsRequset += OnGetRooms; AdamSync.SyncCreateRoom.getroomusersRequset += OnGetRoomsUsers; - AdamSync.SyncCreateRoom.onlineRequset += OnGetRoomsInfo; + AdamSync.SyncCreateRoom.send2roomRequset += OnGetRoomsInfo; } public void OnGetRooms(string msg) { @@ -62,13 +62,13 @@ public class UIBootstrap : MonoSingleton Debug.Log("OnDisable"); AdamSync.SyncCreateRoom.getRoomsRequset -= OnGetRooms; AdamSync.SyncCreateRoom.getroomusersRequset -= OnGetRoomsUsers; - AdamSync.SyncCreateRoom.onlineRequset -= OnGetRoomsInfo; + AdamSync.SyncCreateRoom.send2roomRequset -= OnGetRoomsInfo; } private void OnDestory() { Debug.Log("OnDestory"); AdamSync.SyncCreateRoom.getRoomsRequset -= OnGetRooms; AdamSync.SyncCreateRoom.getroomusersRequset -= OnGetRoomsUsers; - AdamSync.SyncCreateRoom.onlineRequset -= OnGetRoomsInfo; + AdamSync.SyncCreateRoom.send2roomRequset -= OnGetRoomsInfo; } } diff --git a/Assets/Zion/Scripts/Adam/Utility/Sync/SyncCreateRoom.cs b/Assets/Zion/Scripts/Adam/Utility/Sync/SyncCreateRoom.cs index 89f6ee05..938582d5 100644 --- a/Assets/Zion/Scripts/Adam/Utility/Sync/SyncCreateRoom.cs +++ b/Assets/Zion/Scripts/Adam/Utility/Sync/SyncCreateRoom.cs @@ -26,7 +26,7 @@ namespace AdamSync public static Action closeRoomRequset; public static Action playerInfoRequset; public static Action getroomusersRequset; - public static Action onlineRequset; + public static Action send2roomRequset; public static Action send2userRequset; @@ -113,7 +113,7 @@ namespace AdamSync getroomusersRequset?.Invoke(commands[1]); break; case "send2room": - onlineRequset?.Invoke(commands[1]); + send2roomRequset?.Invoke(commands[1]); break; case "send2user": send2userRequset?.Invoke(commands[1]);