public void OnClick_Button() { PhotonNetwork.JoinRoom(RoomInfo.Name); }
public void JoinSelectedRoom() { PhotonNetwork.JoinRoom(roomName); }
void OnGUI() { /* * if (!PhotonNetwork.connected) { * Debug.Log("Not connected to Photon"); * } * else if (PhotonNetwork.room == null) { * if (MainMenuController.instance.multiPlayerEnabled) { * if (MainMenuController.instance.creatingGame) { * Debug.Log("created room"); * isServerHost = true; * PhotonNetwork.CreateRoom(roomName + Guid.NewGuid().ToString("N"), * new RoomOptions() { maxPlayers = 3 }, null); //max players is set here, probably needs tweaking * * //for (int i = 0; i < roomsList.Length; i++) { //cycle through the current available rooms * // if (GUI.Button(new Rect(100, 250 + (110 * i), 250, 100), "Join Room #" + i + ":")) { * // PhotonNetwork.JoinRoom(roomsList[i].name); * // } * //} * } else if (MainMenuController.instance.joiningGame) { * for (int i = 0; i < roomsList.Length; i++) { //cycle through the current available rooms * if (GUI.Button(new Rect(100, 250 + (110 * i), 250, 100), "Join Room #" + i + ":")) { * PhotonNetwork.JoinRoom(roomsList[i].name); * } * } * } * * } * } */ Debug.Log("is photon network offline? " + PhotonNetwork.offlineMode); if (!PhotonNetwork.connected) { GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString()); } else if (PhotonNetwork.room == null) { //Create Room if (GUI.Button(new Rect(80, 80, 250, 100), "Start Server")) { isServerHost = true; PhotonNetwork.CreateRoom(roomName + Guid.NewGuid().ToString("N"), new RoomOptions() { maxPlayers = 3 }, null); //max players is set here, probably needs tweaking } //Join Room if (roomsList != null) { for (int i = 0; i < roomsList.Length; i++) //cycle through the current available rooms { if (GUI.Button(new Rect(100, 250 + (110 * i), 250, 100), "Join Room #" + i + ":")) { PhotonNetwork.JoinRoom(roomsList[i].name); } } } } }
public void JoinRoom(string room_id) { PhotonNetwork.JoinRoom(room_id); }
// when click on room, join the room public void OnClick_Button() { // join room by name when clicked PhotonNetwork.JoinRoom(RoomInfo.Name); }
void OnGUI() { GUIStyle labelStyle = new GUIStyle(); labelStyle.fontSize = 28; labelStyle.normal.textColor = Color.white; if (joinPanel != null) { if (joinPanel.activeSelf == true) { RoomInfo[] games = PhotonNetwork.GetRoomList(); for (int i = 0; i < games.Length; i++) { //Debug.Log (games[i].name); //Display the lobby connection list and room creation. if (games[i].playerCount < 2) { float height = joinPanel.GetComponent <RectTransform> ().rect.height; float width = joinPanel.GetComponent <RectTransform> ().rect.width; GUI.Box(new Rect(230, 90 + 110 * i, width - 50, 100), ""); GUI.Label(new Rect(240, 122 + 110 * i, width - 50, 100), "Room Name:", labelStyle); GUI.Label(new Rect(420, 122 + 110 * i, width - 50, 100), games [i].name, labelStyle); if (GUI.Button(new Rect(width - 50, 115 + 110 * i, 200, 50), "Join This Room")) { loadingScreen.SetActive(true); PhotonNetwork.JoinRoom(games [i].name); //PhotonNetwork.isMessageQueueRunning = false; //StartCoroutine (loadOnlineGame ()); } } /* * GUI.Box(new Rect(Screen.width/2.5f, Screen.height/3, 400, 550),""); * GUILayout.BeginArea(new Rect(300,300, 400, 500)); * GUI.color = Color.red; * GUILayout.Box("Lobby"); * GUI.color = Color.white; * GUILayout.Label("Room Name:"); * /*roomName = GUILayout.TextField("Room Name"); //For network room name ask and recieve * GUILayout.Label("Max Amount of player 1-20:"); * maxPlayerString = GUILayout.TextField(maxPlayerString,2); //How man players with a max character set of 2 allowing no more then 2 digit player size.*/ } if (games.Length == 0) { float width = joinPanel.GetComponent <RectTransform> ().rect.width; GUI.Label(new Rect(240, 122, width - 50, 100), "No rooms have been found", labelStyle); } else { int okGames = 0; foreach (RoomInfo element in games) { if (element.playerCount == 1) { okGames = 1; } } if (okGames == 0) { float width = joinPanel.GetComponent <RectTransform> ().rect.width; GUI.Label(new Rect(240, 122, width - 50, 100), "No rooms have been found", labelStyle); } } } } if (okNumeIdentic == 1) { GUIStyle err = new GUIStyle(); float widthOk = joinPanel.GetComponent <RectTransform> ().rect.width; err.fontSize = 28; err.normal.textColor = Color.red; GUI.Label(new Rect(240, 322, 600, 100), "Name already exist!!! Choose different name.", err); } }
public void onclick_JoinRoom() { PhotonNetwork.JoinRoom(JoinRoom.text, null); }
public void Clicksy() { PhotonNetwork.JoinRoom(nameoftheroom); }
void JoinRoom() { progress_text.text = "Attempting to join room " + join_room_name + "..."; PhotonNetwork.JoinRoom(join_room_name); }
public void OnGUI() { if (this.Skin != null) { GUI.skin = this.Skin; } if (!PhotonNetwork.connected) { if (PhotonNetwork.connecting) { GUILayout.Label("Connecting to: " + PhotonNetwork.ServerAddress); } else { GUILayout.Label("Not connected. Check console output. Detailed connection state: " + PhotonNetwork.connectionStateDetailed + " Server: " + PhotonNetwork.ServerAddress); } if (this.connectFailed) { GUILayout.Label("Connection failed. Check setup and use Setup Wizard to fix configuration."); GUILayout.Label(String.Format("Server: {0}", new object[] { PhotonNetwork.ServerAddress })); GUILayout.Label("AppId: " + PhotonNetwork.PhotonServerSettings.AppID.Substring(0, 8) + "****"); // only show/log first 8 characters. never log the full AppId. if (GUILayout.Button("Try Again", GUILayout.Width(100))) { this.connectFailed = false; PhotonNetwork.ConnectUsingSettings("0.9"); } } return; } //No se ha conectado Rect content = new Rect((Screen.width - this.WidthAndHeight.x) / 2, (Screen.height - this.WidthAndHeight.y) / 2, this.WidthAndHeight.x, this.WidthAndHeight.y); GUI.Box(content, "Join the Battleflied"); GUILayout.BeginArea(content); GUILayout.Space(40); // Player name GUILayout.BeginHorizontal(); GUILayout.Label("Officer:", GUILayout.Width(150)); //PlayerName PhotonNetwork.playerName = GUILayout.TextField(PhotonNetwork.playerName); GUILayout.Space(158); if (GUI.changed) { // Save name PlayerPrefs.SetString("playerName", PhotonNetwork.playerName); } GUILayout.EndHorizontal(); GUILayout.Space(15); // Join room by title GUILayout.BeginHorizontal(); GUILayout.Label("Battlefield:", GUILayout.Width(150)); //Roomname this.roomName = GUILayout.TextField(this.roomName); if (GUILayout.Button("Create Room", GUILayout.Width(150))) { PhotonNetwork.CreateRoom(this.roomName, new RoomOptions() { MaxPlayers = 10 }, null); } GUILayout.EndHorizontal(); // Create a room (fails if exist!) GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); //this.roomName = GUILayout.TextField(this.roomName); if (GUILayout.Button("Join Room", GUILayout.Width(150))) { PhotonNetwork.JoinRoom(this.roomName); } GUILayout.EndHorizontal(); if (!string.IsNullOrEmpty(ErrorDialog)) { GUILayout.Label(ErrorDialog); if (this.timeToClearDialog < Time.time) { this.timeToClearDialog = 0; ErrorDialog = ""; } } GUILayout.Space(5); // Join random room GUILayout.BeginHorizontal(); GUILayout.Label(PhotonNetwork.countOfPlayers + " users are online in " + PhotonNetwork.countOfRooms + " rooms."); //Muestra cantidad players online GUILayout.FlexibleSpace(); if (GUILayout.Button("Join Random", GUILayout.Width(150))) { PhotonNetwork.JoinRandomRoom(); } GUILayout.EndHorizontal(); GUILayout.Space(5); if (PhotonNetwork.GetRoomList().Length == 0) { GUILayout.Label("Currently no games are available."); //no Games avaliable GUILayout.Label("Rooms will be listed here, when they become available."); } else { GUILayout.Label(PhotonNetwork.GetRoomList().Length + " rooms available:"); // Room listing: simply call GetRoomList: no need to fetch/poll whatever! this.scrollPos = GUILayout.BeginScrollView(this.scrollPos); foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList()) { GUILayout.BeginHorizontal(); GUILayout.Label(roomInfo.Name + " " + roomInfo.PlayerCount + "/" + roomInfo.MaxPlayers); if (GUILayout.Button("Join", GUILayout.Width(150))) { PhotonNetwork.JoinRoom(roomInfo.Name); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } GUILayout.BeginHorizontal(); GUILayout.Space(80); if (GUILayout.Button("Team 1", GUILayout.Width(200))) { _TeamIndex = 1; } GUILayout.Space(20); if (GUILayout.Button("Team 2", GUILayout.Width(200))) { _TeamIndex = 2; } GUILayout.EndHorizontal(); GUILayout.EndArea(); }
private void OnClickRoomList(string roomName) { PhotonNetwork.player.NickName = userId.text; PhotonNetwork.JoinRoom(roomName); }
void LobbyWindow(int index) { //Connection Status and Room creation Button GUILayout.BeginHorizontal(); GUILayout.Label("Status: " + PhotonNetwork.NetworkClientState); if (joiningRoom || !PhotonNetwork.IsConnected || PhotonNetwork.NetworkClientState != ClientState.JoinedLobby) { GUI.enabled = false; } GUILayout.FlexibleSpace(); //Room name text field roomName = GUILayout.TextField(roomName, GUILayout.Width(250)); if (GUILayout.Button("Create Room", GUILayout.Width(125))) { if (roomName != "") { joiningRoom = true; RoomOptions roomOptions = new RoomOptions(); roomOptions.IsOpen = true; roomOptions.IsVisible = true; roomOptions.MaxPlayers = (byte)10; //Set any number PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default); } } GUILayout.EndHorizontal(); //Scroll through available rooms roomListScroll = GUILayout.BeginScrollView(roomListScroll, true, true); if (createdRooms.Count == 0) { GUILayout.Label("No Rooms were created yet..."); } else { for (int i = 0; i < createdRooms.Count; i++) { GUILayout.BeginHorizontal("box"); GUILayout.Label(createdRooms[i].Name, GUILayout.Width(400)); GUILayout.Label(createdRooms[i].PlayerCount + "/" + createdRooms[i].MaxPlayers); GUILayout.FlexibleSpace(); if (GUILayout.Button("Join Room")) { joiningRoom = true; //Set our Player name PhotonNetwork.NickName = playerName; //Join the Room PhotonNetwork.JoinRoom(createdRooms[i].Name); } GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); //Set player name and Refresh Room button GUILayout.BeginHorizontal(); GUILayout.Label("Player Name: ", GUILayout.Width(85)); //Player name text field playerName = GUILayout.TextField(playerName, GUILayout.Width(250)); GUILayout.FlexibleSpace(); GUI.enabled = (PhotonNetwork.NetworkClientState == ClientState.JoinedLobby || PhotonNetwork.NetworkClientState == ClientState.Disconnected) && !joiningRoom; if (GUILayout.Button("Refresh", GUILayout.Width(100))) { if (PhotonNetwork.IsConnected) { //Re-join Lobby to get the latest Room list PhotonNetwork.JoinLobby(TypedLobby.Default); } else { //We are not connected, estabilish a new connection PhotonNetwork.ConnectUsingSettings(); } } GUILayout.EndHorizontal(); if (joiningRoom) { GUI.enabled = true; GUI.Label(new Rect(900 / 2 - 50, 400 / 2 - 10, 100, 20), "Connecting..."); } }
/// <summary> /// 방이름으로 방에 참가하기 /// </summary> /// <param name="m_Roomname"></param> public void JoinRoom(string m_Roomname) { PhotonNetwork.JoinRoom(m_Roomname); }
private void OnJoinClicked(Room room) { m_CanvasGroup.interactable = false; m_Connecting.SetActive(true); PhotonNetwork.JoinRoom(room.roomName.text); }
//private GameManagerVik manager = new GameManagerVik(); void OnGUI() { if (!PhotonNetwork.connected) { ShowConnectingGUI(); return; //Wait for a connection } if (PhotonNetwork.room != null) { return; //Only when we're not in a Room } GUILayout.BeginArea(new Rect((Screen.width - 400) / 2, (Screen.height - 300) / 2, 400, 300)); GUILayout.Label("Main Menu"); //Player name GUILayout.BeginHorizontal(); GUILayout.Label("Player name:", GUILayout.Width(150)); PhotonNetwork.playerName = GUILayout.TextField(PhotonNetwork.playerName); if (GUI.changed)//Save name { PlayerPrefs.SetString("playerName", PhotonNetwork.playerName); } GUILayout.EndHorizontal(); //Player password GUILayout.BeginHorizontal(); GUILayout.Label("Password:"******"playerPassword", password); } GUILayout.EndHorizontal(); //Print login button //GUILayout.Space(5); //GUILayout.BeginHorizontal(); //GUILayout.Space(100); //if (GUILayout.Button("Login", GUILayout.Width(120))) //{ // // call function to send msg to server plugin // manager.Login(); // // receive the message from server // //PhotonNetwork.OnEventCall += this.OnEventHandler; //} //GUILayout.EndHorizontal(); GUILayout.Space(50); if (isLogin) { //Join room by title GUILayout.BeginHorizontal(); GUILayout.Label("JOIN ROOM:", GUILayout.Width(150)); roomName = GUILayout.TextField(roomName); if (GUILayout.Button("GO")) { PhotonNetwork.JoinRoom(roomName); } GUILayout.EndHorizontal(); //Create a room (fails if exist!) GUILayout.BeginHorizontal(); GUILayout.Label("CREATE ROOM:", GUILayout.Width(150)); roomName = GUILayout.TextField(roomName); if (GUILayout.Button("GO")) { // using null as TypedLobby parameter will also use the default lobby PhotonNetwork.CreateRoom(roomName, new RoomOptions() { MaxPlayers = 10 }, TypedLobby.Default); } GUILayout.EndHorizontal(); //Join random room GUILayout.BeginHorizontal(); GUILayout.Label("JOIN RANDOM ROOM:", GUILayout.Width(150)); if (PhotonNetwork.GetRoomList().Length == 0) { GUILayout.Label("..no games available..."); } else { if (GUILayout.Button("GO")) { PhotonNetwork.JoinRandomRoom(); } } GUILayout.EndHorizontal(); GUILayout.Space(30); GUILayout.Label("ROOM LISTING:"); if (PhotonNetwork.GetRoomList().Length == 0) { GUILayout.Label("..no games available.."); } else { //Room listing: simply call GetRoomList: no need to fetch/poll whatever! scrollPos = GUILayout.BeginScrollView(scrollPos); foreach (RoomInfo game in PhotonNetwork.GetRoomList()) { GUILayout.BeginHorizontal(); GUILayout.Label(game.name + " " + game.playerCount + "/" + game.maxPlayers); if (GUILayout.Button("JOIN")) { PhotonNetwork.JoinRoom(game.name); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } } GUILayout.EndArea(); }
public void Join() { PhotonNetwork.JoinRoom(roomName); SceneManager.LoadScene("Main"); }
private void OnGUI() { if (!PhotonNetwork.connected) { if (PhotonNetwork.connectionState == ConnectionState.Connecting) { GUILayout.Label("Connecting..."); } else { GUILayout.Label("Not connected. Check console output."); } if (this.connectFailed) { GUILayout.Label("Connection failed. Check setup and use Setup Wizard to fix configuration."); GUILayout.Label(string.Format("Server: {0}:{1}", PhotonNetwork.PhotonServerSettings.ServerAddress, PhotonNetwork.PhotonServerSettings.ServerPort)); GUILayout.Label(string.Format("AppId: {0}", PhotonNetwork.PhotonServerSettings.AppID)); if (GUILayout.Button("Try Again", GUILayout.Width(100))) { this.connectFailed = false; PhotonNetwork.ConnectUsingSettings("1.0"); } } return; } GUILayout.BeginArea(new Rect((Screen.width - 400) / 2, (Screen.height - 300) / 2, 400, 300)); GUILayout.Label("Main Menu"); GUILayout.Label(string.Format("Players: {0} Players on Master: {1} Games: {2}", PhotonNetwork.countOfPlayers, PhotonNetwork.countOfPlayersOnMaster, PhotonNetwork.countOfRooms)); // Player name GUILayout.BeginHorizontal(); GUILayout.Label("Player name:", GUILayout.Width(150)); PhotonNetwork.playerName = GUILayout.TextField(PhotonNetwork.playerName); if (GUI.changed) { // Save name PlayerPrefs.SetString("playerName", PhotonNetwork.playerName); } GUILayout.EndHorizontal(); GUILayout.Space(15); // Join room by title GUILayout.BeginHorizontal(); GUILayout.Label("JOIN ROOM:", GUILayout.Width(150)); this.roomName = GUILayout.TextField(this.roomName); if (GUILayout.Button("GO")) { PhotonNetwork.JoinRoom(this.roomName); } GUILayout.EndHorizontal(); // Create a room (fails if exist!) GUILayout.BeginHorizontal(); GUILayout.Label("CREATE ROOM:", GUILayout.Width(150)); this.roomName = GUILayout.TextField(this.roomName); if (GUILayout.Button("GO")) { PhotonNetwork.CreateRoom(this.roomName, true, true, 10); } GUILayout.EndHorizontal(); // Join random room GUILayout.BeginHorizontal(); GUILayout.Label("JOIN RANDOM ROOM:", GUILayout.Width(150)); if (PhotonNetwork.GetRoomList().Length == 0) { GUILayout.Label("..no games available..."); } else { if (GUILayout.Button("GO")) { PhotonNetwork.JoinRandomRoom(); } } GUILayout.EndHorizontal(); GUILayout.Space(30); GUILayout.Label("ROOM LISTING:"); if (PhotonNetwork.GetRoomList().Length == 0) { GUILayout.Label("..no games available.."); } else { // Room listing: simply call GetRoomList: no need to fetch/poll whatever! this.scrollPos = GUILayout.BeginScrollView(this.scrollPos); foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList()) { GUILayout.BeginHorizontal(); GUILayout.Label(roomInfo.name + " " + roomInfo.playerCount + "/" + roomInfo.maxPlayers); if (GUILayout.Button("JOIN")) { PhotonNetwork.JoinRoom(roomInfo.name); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } GUILayout.EndArea(); }
public void JoinRoom() { PhotonNetwork.JoinRoom("test"); }
public static void JoinGameSession(string sessionName) { PhotonNetwork.JoinRoom(sessionName); }
public void JoinRoom(string roomName) { PhotonNetwork.JoinRoom(roomName); }
public void JoinRoomClick(string roomName) { findRoomView.SetActive(false); PhotonNetwork.JoinRoom(roomName); }
private void OnCreatedRoom(short returnCode, string message) { Debug.Log("Room Created Successfully"); PhotonNetwork.JoinRoom(ProgramStateController.matricNo); }
public void JoinRoom(RoomInfo info) { PhotonNetwork.JoinRoom(info.Name); MenuManager.Instance.OpenMenu("loading"); }
public void JoinRoom(string name) { PhotonNetwork.JoinRoom(name); }
void OnGUI() { if (!PhotonNetwork.connected) { ShowConnectingGUI(); return; //Wait for a connection } if (PhotonNetwork.room != null) { return; //Only when we're not in a Room } GUILayout.BeginArea(new Rect((Screen.width - 400) / 2, (Screen.height - 300) / 2, 400, 300)); GUILayout.Label("Main Menu"); //Player name GUILayout.BeginHorizontal(); GUILayout.Label("Player name:", GUILayout.Width(150)); PhotonNetwork.playerName = GUILayout.TextField(PhotonNetwork.playerName); if (GUI.changed)//Save name { PlayerPrefs.SetString("playerName", PhotonNetwork.playerName); } GUILayout.EndHorizontal(); GUILayout.Space(15); //Join room by title GUILayout.BeginHorizontal(); GUILayout.Label("JOIN ROOM:", GUILayout.Width(150)); roomName = GUILayout.TextField(roomName); if (GUILayout.Button("GO")) { PhotonNetwork.JoinRoom(roomName); } GUILayout.EndHorizontal(); //Create a room (fails if exist!) GUILayout.BeginHorizontal(); GUILayout.Label("CREATE ROOM:", GUILayout.Width(150)); roomName = GUILayout.TextField(roomName); if (GUILayout.Button("GO")) { // using null as TypedLobby parameter will also use the default lobby PhotonNetwork.CreateRoom(roomName, new RoomOptions() { MaxPlayers = 10 }, TypedLobby.Default); } GUILayout.EndHorizontal(); //Join random room GUILayout.BeginHorizontal(); GUILayout.Label("JOIN RANDOM ROOM:", GUILayout.Width(150)); if (PhotonNetwork.GetRoomList().Length == 0) { GUILayout.Label("..no games available..."); } else { if (GUILayout.Button("GO")) { PhotonNetwork.JoinRandomRoom(); } } GUILayout.EndHorizontal(); GUILayout.Space(30); GUILayout.Label("ROOM LISTING:"); if (PhotonNetwork.GetRoomList().Length == 0) { GUILayout.Label("..no games available.."); } else { //Room listing: simply call GetRoomList: no need to fetch/poll whatever! scrollPos = GUILayout.BeginScrollView(scrollPos); foreach (RoomInfo game in PhotonNetwork.GetRoomList()) { GUILayout.BeginHorizontal(); GUILayout.Label(game.Name + " " + game.PlayerCount + "/" + game.MaxPlayers); if (GUILayout.Button("JOIN")) { PhotonNetwork.JoinRoom(game.Name); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } GUILayout.EndArea(); }
public void EntraSala(string nomeSala) { PhotonNetwork.JoinRoom(nomeSala); }
public void OnClick_JoinRoom() { PhotonNetwork.JoinRoom(joinRoomTF.text, null); }
public void ClickRoom(string roomNameText) { lobbyUI.UserCustumGameLobby(); PhotonNetwork.JoinRoom(roomNameText); }
public void OnClick_JoinRoom() { PhotonNetwork.JoinRoom(_roomName); }
public void JoinRoomOnClick() //paired the button that is the room listing. joins the player a room by its name { PhotonNetwork.JoinRoom(roomName); }