/** Set user code and room number * @param aUcode user code * @param roomNumber room number * @return True if codes are valid, false otherwise */ public bool SetCode(int aUcode, int roomNumber) { UXPlayerController player = UXPlayerController.Instance; int lcode = GetRoomNumber(); int ucode = -1; if (lcode != -1) { ucode = player.GetCode(); } else { lcode = roomNumber; ucode = aUcode; } if (lcode == -1 || ucode == -1) { return(false); } launcherCode = lcode; player.SetCode(ucode); return(true); }
void ProcessReceivedMessage(string data) { if (string.IsNullOrEmpty(data) == true || data.Length <= 0) //data가 비어있따면 { return; } var N = JSON.Parse(data); string command = N["cmd"]; bool isRunBaseProcess = false; if (command == "join_result") { int result = N["ack"].AsInt; if (result != UXRoomConnect.ACK_RESULT_OK) { int errCode = ProcessConnectError(result); if (OnJoinFailed != null) { OnJoinFailed(result); } return; } isJoined = true; string temp = N["user"]; isHostJoined = N["is_host"].AsBool; string[] infos = temp.Split('.'); UXPlayerController player = UXPlayerController.Instance; player.SetCode(Int32.Parse(infos[0])); player.SetName(infos[1]); if (OnJoinSucceeded != null) { OnJoinSucceeded(isHostJoined); } } else //cmd != join_result { base.ProcessReceivedMessage(data); Debug.Log("ProcessReceivedMessage : " + data); } }