// Start is called before the first frame update
 void Start()
 {
     LoadingIndicator.Show();
     if (UserData.nickName == null)
     {
         UserData.nickName = "GUESTPLAYER";
     }
     webSocket = WebSocketManager.Instance;
     webSocket.Connect("/rooms", () =>
     {
         Debug.Log("connected");
         LoadingIndicator.Hide();
     });
 }
 public void ChangeIngame()
 {
     Debug.Log("start button이 클릭됨");
     if (UserData.mid != hostInfo.mid)
     {
         return;
     }
     LoadingIndicator.Show();
     WebSocketManager.Instance.SendEvent <ReadyByHostRequest>("/rooms", "ready",
                                                              new ReadyByHostRequest
     {
         hostInfo = UserData.GetUserInfo(),
         roomId   = roomId
     }
                                                              );
 }
예제 #3
0
        }//방 코드입력으로 입장

        public void JoinRoom(JoinResponse room)
        {
            LoadingIndicator.Hide();
            if (ErrorDetect(room.code) == true)

            {
                JoinedRoom.roomId         = room.roomId;
                JoinedRoom.roomName       = room.roomName;
                JoinedRoom.joinedUserList = room.userList;
                JoinedRoom.host           = room.host;
                Debug.Log(room.roomId + " 입장");
                WebSocketManager.Instance.CancelToReceiveEvent("/rooms", "userlist");
                SceneManager.LoadScene("Lobby");
            }
            else
            {
                CloseJoinPanel();
            }
        }
예제 #4
0
        public void JoinRoomByClick(GameObject room)
        {
            Debug.Log("클릭join요청 , roomid " + room.transform.Find("RoomId").GetComponentInChildren <Text>().text + " userinfo " + UserData.nickName + " id " + UserData.mid);

            /* HttpManager.Instance.Post<JoinRequest, JoinResponse>("/rooms/join",
             * new JoinRequest
             * {
             *  roomId = room.transform.Find("RoomId").GetComponentInChildren<Text>().text,
             *  userInfo = { nickname = UserData.nickName, mid = UserData.mid }
             * }, JoinRoom) ;
             */
            LoadingIndicator.Show();
            WebSocketManager.Instance.ReceiveEvent <JoinResponse>("/rooms", "userlist", JoinRoom);
            WebSocketManager.Instance.SendEvent <JoinRequest>("/rooms", "join",
                                                              new JoinRequest
            {
                roomId   = room.transform.Find("RoomId").GetComponentInChildren <Text>().text,
                userInfo = { nickname = UserData.nickName, mid = UserData.mid }
            });
        }//버튼클릭으로 입장
 public void MoveToIngame(StartGameResponse temp)
 {
     LoadingIndicator.Hide();
     SceneManager.LoadScene("Ingame");
 }