From f0b21888a452d22aa3afd41aa0036ec240ac39fd Mon Sep 17 00:00:00 2001 From: YangHua <1475658476@qq.com> Date: Wed, 22 Nov 2023 17:02:33 +0800 Subject: [PATCH 1/2] 33 --- Assets/Temp/Scripts/View_Panel2.cs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/Assets/Temp/Scripts/View_Panel2.cs b/Assets/Temp/Scripts/View_Panel2.cs index a53ac533..48507647 100644 --- a/Assets/Temp/Scripts/View_Panel2.cs +++ b/Assets/Temp/Scripts/View_Panel2.cs @@ -245,26 +245,15 @@ public class View_Panel2 : XUIPanel } OnRegisterFunction(); } - + public void OnRegisterFunction() { - //AdamSync.SyncCreateRoom.joinRoomRequset -= OnJoinRoom; - //AdamSync.SyncCreateRoom.createRoomRequset += OnCreateRoom; AdamSync.SyncCreateRoom.joinRoomRequset += OnJoinRoom; - //AdamSync.SyncCreateRoom.getRoomsRequset += OnGetRooms; } - - //public void OnGetRooms(string msg) - //{ - // Debug.Log("OnGetRooms====" + msg); - //} - //public void OnCreateRoom(string msg) - //{ - // Debug.Log("OnCreateRoom====" + msg); - //} + public void OnJoinRoom(string msg) { - Debug.Log("OnJoinRoom===" + msg); + Debug.Log("OnJoinRoom ViewPanel===" + msg); SceneManager.LoadScene("AdamTraining_pilot_terminal_panl 1"); } public async void GetAllRoomData() @@ -486,6 +475,7 @@ public class View_Panel2 : XUIPanel GameMain.model = false; //SceneManager.LoadScene("AdamTraining_pilot_terminal_panl 1"); //加入房间 + Debug.Log("进入训练"); string RoomName = "joinroom " + currentRoomName; _ = AdamSync.SyncCreateRoom.SendMessageAsync(RoomName); }); @@ -856,14 +846,14 @@ public class View_Panel2 : XUIPanel { Debug.Log("OnDisable"); //AdamSync.SyncCreateRoom.createRoomRequset -= OnCreateRoom; - //AdamSync.SyncCreateRoom.joinRoomRequset -= OnJoinRoom; + AdamSync.SyncCreateRoom.joinRoomRequset -= OnJoinRoom; //AdamSync.SyncCreateRoom.getRoomsRequset += OnGetRooms; } private void OnDestory() { Debug.Log("OnDestory"); //AdamSync.SyncCreateRoom.createRoomRequset -= OnCreateRoom; - //AdamSync.SyncCreateRoom.joinRoomRequset -= OnJoinRoom; + AdamSync.SyncCreateRoom.joinRoomRequset -= OnJoinRoom; //AdamSync.SyncCreateRoom.getRoomsRequset -= OnGetRooms; } } From a26c485de2ff4a10f6c003f5d0fb608043599df7 Mon Sep 17 00:00:00 2001 From: YangHua <1475658476@qq.com> Date: Wed, 22 Nov 2023 17:15:05 +0800 Subject: [PATCH 2/2] 3 --- Assets/Temp/Scripts/Taskpanel.cs | 3 ++- Assets/Zion/Scripts/Adam/GameManager.cs | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Assets/Temp/Scripts/Taskpanel.cs b/Assets/Temp/Scripts/Taskpanel.cs index 5875f881..987150bc 100644 --- a/Assets/Temp/Scripts/Taskpanel.cs +++ b/Assets/Temp/Scripts/Taskpanel.cs @@ -154,6 +154,8 @@ public class Taskpanel : MonoBehaviour string _msg = "leaveroom "; _ = SyncCreateRoom.SendMessageAsync(_msg); } + if (GameManager.Instance.isPlayer) + SceneManager.LoadScene("SampleScene"); } @@ -161,7 +163,6 @@ public class Taskpanel : MonoBehaviour { Debug.Log("Leaveroom"); _ = SyncCreateRoom.SendMessageAsync($"send2room offline,{GlobalFlag.currentUser.user_id}"); - SceneManager.LoadScene("SampleScene"); } } diff --git a/Assets/Zion/Scripts/Adam/GameManager.cs b/Assets/Zion/Scripts/Adam/GameManager.cs index 05d96a81..4d6c77a0 100644 --- a/Assets/Zion/Scripts/Adam/GameManager.cs +++ b/Assets/Zion/Scripts/Adam/GameManager.cs @@ -24,6 +24,7 @@ public class GameManager : MonoSingleton public DragController wxdDrag; public GameObject Teacher; public GameObject student; + public bool isPlayer = true; public System.Collections.Generic.List players = new System.Collections.Generic.List(); // Start is called before the first frame update private void Awake() @@ -46,7 +47,7 @@ public class GameManager : MonoSingleton spt.gameObject.SetActive(true); spt.gameObject.transform.position = spawnPos.position; spt.gameObject.transform.eulerAngles = spawnPos.eulerAngles; - spt.SetPlayerInfo(ulong.Parse(GlobalFlag.currentUser.user_id), GlobalFlag.currentUser.login_name, ulong.Parse(GlobalFlag.roomID), true); + spt.SetPlayerInfo(ulong.Parse(GlobalFlag.currentUser.user_id), GlobalFlag.currentUser.login_name, ulong.Parse(GlobalFlag.roomID), isPlayer); AddPlayers(spt); ToolsBootstrap.Instance.SetCameraInfo(spt); //0 red 1 blue @@ -163,7 +164,7 @@ public class GameManager : MonoSingleton spt.gameObject.SetActive(true); spt.gameObject.transform.position = spawnPos.position; spt.gameObject.transform.eulerAngles = spawnPos.eulerAngles; - spt.SetPlayerInfo(ulong.Parse(data[1]), data[2], ulong.Parse(data[3]), false); + spt.SetPlayerInfo(ulong.Parse(data[1]), data[2], ulong.Parse(data[3]), !isPlayer); AddPlayers(spt); } break; @@ -201,7 +202,7 @@ public class GameManager : MonoSingleton } break; case "offline": - + break; default: break; @@ -237,7 +238,7 @@ public class GameManager : MonoSingleton { SyncPlayerTransform spt = Instantiate(playerTransformPrefab); spt.gameObject.SetActive(true); - spt.SetPlayerInfo(ulong.Parse(userInfo[0]), userInfo[1], ulong.Parse(userInfo[2]), false); + spt.SetPlayerInfo(ulong.Parse(userInfo[0]), userInfo[1], ulong.Parse(userInfo[2]), !isPlayer); spt.transform.position = new Vector3(spawnPos.position.x + index * 0.5f, spawnPos.position.y, spawnPos.position.z + index * 0.5f); spt.transform.eulerAngles = spawnPos.eulerAngles; AddPlayers(spt);