public override void responseString(bool isSuccess, string identifier, string json) { if (isSuccess) { if (identifier.Equals(Common.IDENTIFIER_GAME_ROOM_LIST)) { ResponseRoomList res = JsonUtility.FromJson <ResponseRoomList>(json); roomDataList = res.list; current = res.current; maxCount = res.max; isUpdateList = true; } else if (identifier.Equals(Common.IDENTIFIER_CONNECT_ROOM)) { ResponseConnectionRoom res = JsonUtility.FromJson <ResponseConnectionRoom>(json); StateManager.Instance().changeState(GAME_STATE.WAITING_ROOM, res); } } else { ResponseBase res = JsonUtility.FromJson <ResponseBase>(json); showAlert("error", res.message, false, false, (AlertData data, bool isOn, string fieldText) => { }); } }
private bool VerifyGameList(Command c, int roomNumber) { if (c.action != ActionType.GetRoomList.ToString()) { return(false); } ResponseRoomList response = JsonConvert.DeserializeObject <ResponseRoomList>(c.payload); return(response.rooms.Count == roomNumber); }
private void PlayerGetRoomList(IHanabiPlayer player) { List <RoomInfo> roomList = new List <RoomInfo>(); foreach (var room in Rooms.Values) { roomList.Add(room.Info); } ResponseRoomList response = new ResponseRoomList(); response.Rooms = roomList; SendCommand(player, ActionType.GetRoomList, response); }