diff --git a/xiaofang/Assets/ProtoBuf/test.cs b/xiaofang/Assets/ProtoBuf/test.cs index 17fb6350..6538a8be 100644 --- a/xiaofang/Assets/ProtoBuf/test.cs +++ b/xiaofang/Assets/ProtoBuf/test.cs @@ -780,7 +780,7 @@ public class test : MonoBehaviour } if (userJoinResponse.MessageType == 11)//房间开始 { - + test111.instance.Oppanel(); } break; diff --git a/xiaofang/Assets/Res/gsj/scripts/Starthost.cs b/xiaofang/Assets/Res/gsj/scripts/Starthost.cs index 4a8a0447..c1b7f2f6 100644 --- a/xiaofang/Assets/Res/gsj/scripts/Starthost.cs +++ b/xiaofang/Assets/Res/gsj/scripts/Starthost.cs @@ -145,6 +145,7 @@ public class Starthost : MonoBehaviour image.gameObject.SetActive(true); ready.gameObject.SetActive(false); test.JoinRoom(ReadRoom.instance.roomid); + test.PlayerReady(ReadRoom.instance.roomid, true); } // 停止计时并重置时间显示的方法 public void StopTimer() diff --git a/xiaofang/Assets/Res/gsj/test111.cs b/xiaofang/Assets/Res/gsj/test111.cs index cd8cfb9f..ed34cbb7 100644 --- a/xiaofang/Assets/Res/gsj/test111.cs +++ b/xiaofang/Assets/Res/gsj/test111.cs @@ -4,6 +4,7 @@ using UnityEngine; using UnityEngine.UI; public class test111 : MonoBehaviour { + public static test111 instance; // Start is called before the first frame update public Canvas canvas1; public Camera camera; @@ -12,24 +13,34 @@ public class test111 : MonoBehaviour void Start() { - if (ReadRoom.instance.isenter) - { - Debug.Log(ReadRoom.instance.isenter); + instance = this; + + canvas1.gameObject.SetActive(false); camera.gameObject.SetActive(false); canvas2.gameObject.SetActive(true); camera1.gameObject.SetActive(true); + + } + public void Oppanel() + { + Debug.LogError("房间开始游戏"); + if (ReadRoom.instance.isenter) + { + Debug.Log(ReadRoom.instance.isenter); + canvas1.gameObject.SetActive(false); + camera.gameObject.SetActive(true); + canvas2.gameObject.SetActive(false); + camera1.gameObject.SetActive(false); } else { - canvas1.gameObject.SetActive(false); camera.gameObject.SetActive(false); canvas2.gameObject.SetActive(true); camera1.gameObject.SetActive(true); } } - // Update is called once per frame void Update() {