void Update() { if (IsScreenVisible()) { if (PhotonNetwork.connected) { if (PhotonNetwork.inRoom) { UILobby.HideScreen(); UIRoom.ShowScreen(); } else if (PhotonNetwork.insideLobby) { UpdateRoomList(PhotonNetwork.GetRoomList()); } } else { UIDialog.Show("Disconnected From Photon"); UILobby.HideScreen(); UIConnect.ShowScreen(); } } }
public void OnConnectClicked() { if (String.IsNullOrEmpty(Username.text.Trim())) { UIDialog.Show("You need to enter a username"); return; } PhotonNetwork.player.NickName = Username.text; PhotonNetwork.autoJoinLobby = true; PhotonNetwork.ConnectUsingSettings(GameVersion); UIConnect.HideScreen(); UIConnecting.ShowScreen(); }
public void OnCreateClicked() { if (String.IsNullOrEmpty(RoomName.text.Trim())) { UIDialog.Show("You must enter a room name"); return; } if (String.IsNullOrEmpty(PlayerCount.text.Trim())) { UIDialog.Show("You must enter a max player count"); return; } RoomOptions roomOptions = new RoomOptions(); roomOptions.IsVisible = true; roomOptions.MaxPlayers = Byte.Parse(PlayerCount.text); PhotonNetwork.CreateRoom(RoomName.text, roomOptions, TypedLobby.Default); }
public void OnPhotonJoinRoomFailed(object[] codeAndMsg) { UIDialog.Show("Room Join Failed"); }
public void OnPhotonCreateRoomFailed(object[] codeAndMsg) { UIDialog.Show("Room Creation Failed"); }