public static void ReceiveData(CmdEnum cmd, byte[] data) { if (cmd == CmdEnum.ResLogin) { ResponseLogin login = SerializeTool.Deserialize <ResponseLogin>(data); ResponseLogin(login); } else if (cmd == CmdEnum.ResAlive) { ResponseAlive alive = SerializeTool.Deserialize <ResponseAlive>(data); ResponseAlive(alive); } else if (cmd == CmdEnum.ResRegister) { ResponseRegister response = SerializeTool.Deserialize <ResponseRegister>(data); ResponseRegister(response); } else if (cmd == CmdEnum.ResCreateRoom) { ResponseCreateRoom response = SerializeTool.Deserialize <ResponseCreateRoom>(data); ResponseCreateRoom(response); } else if (cmd == CmdEnum.ResGetRooms) { ResponseGetRooms response = SerializeTool.Deserialize <ResponseGetRooms>(data); ResponseGetRooms(response); } else if (cmd == CmdEnum.ResDeleteRoom) { ResponseDeleteRoom response = SerializeTool.Deserialize <ResponseDeleteRoom>(data); ResponseDeleteRoom(response); } }
public override void responseString(bool isSuccess, string identifier, string json) { if (isSuccess) { switch (identifier) { case Common.IDENTIFIER_GANE_LIST: { ResponseGameList res = JsonUtility.FromJson <ResponseGameList>(json); gameList = res.gameList; isUpdate = true; } break; case Common.IDENTIFIER_CREATE_ROOM: { ResponseCreateRoom res = JsonUtility.FromJson <ResponseCreateRoom>(json); StateManager.Instance().changeState(BaseState.GAME_STATE.WAITING_ROOM, res); } break; } } else { ResponseBase res = JsonUtility.FromJson <ResponseBase>(json); showAlert("errorCreate", res.message, false, false, (AlertData data, bool isOn, string fieldText) => { }); } }
public void ResponseCreateRoom(ResponseCreateRoom response) { // 情報保持 UserInfo.room_id = response.room_id; UserInfo.player_entory_id = response.player_entry_id; // Gameシーン切り替え SceneManager.LoadScene("GameScene"); }
public void ResponseCreateRoom(ResponseCreateRoom response) { PlayerSession.room_id = response.room_id; PlayerSession.player_entry_id = response.player_entry_id; PlayerSession.is_owner = true; Debug.Log("create: room_id[" + response.room_id + "]"); Debug.Log("Player \"" + PlayerSession.name + "\" Create and Entry to room number \"" + response.room_id + "\""); SceneManager.LoadScene("battle_scene"); }
public override void initState(ResponseBase res) { base.initState(res); this.gameObject.SetActive(true); Debug.Log("initState res : " + res); if (res is ResponseCreateRoom) { ResponseCreateRoom resCr = (ResponseCreateRoom)res; title.text = resCr.title; // setUsersData(resCr.userList); roomNo = resCr.roomNo; maxUser = resCr.max; listUsers = resCr.userList; gameNo = resCr.gameNo; } else { ResponseConnectionRoom resCr = (ResponseConnectionRoom)res; title.text = resCr.title; // setUsersData(resCr.userList); roomNo = resCr.roomNo; maxUser = resCr.max; listUsers = resCr.userList; gameNo = resCr.gameNo; } foreach (GameObject obj in listUserObj) { Destroy(obj.gameObject); } listUserObj = new List <GameObject>(); for (int i = 0; i < maxUser; i++) { GameObject item = Instantiate(userItem) as GameObject; //item.SetActive(false); listUserObj.Add(item); item.transform.parent = content.transform; } setUsersData(); setButton(); }
//返回创建房间 public static void ResponseCreateRoom(ResponseCreateRoom response) { //关闭创建界面,然后再次请求房间列表 RoomUIController.Instance.ClickCancel(); }