public void startServer() { //gamename:playername:numon server: if (serverNameInput.text.Length < 1 || playerNameInput.text.Length < 1 || serverNameInput.text.Contains(":") || playerNameInput.text.Contains(":")) { Debug.Log("Server and Player Name must be filled and can't contain the symbol ':'"); } else { playerInput.SetActive(false); serverInput.SetActive(false); serverB.SetActive(false); clientB.SetActive(false); endB.SetActive(true); LoadCanvas.SetActive(false); LobbyCanvas.SetActive(true); StartCanvas.SetActive(false); Initialize(); broadcastData = serverNameInput.text + ":" + playerNameInput.text + ":" + 0; StartAsServer(); NetworkLobbyManager.singleton.matchName = serverNameInput.text; netmanager.playerName = playerNameInput.text; NetworkLobbyManager.singleton.StartHost(); } }
//m_msgOutBuffer needs to be set to null on broadcast stop public void endBroadcast() { //StopClient(); playerInput.SetActive(true); LoadCanvas.SetActive(true); serverInput.SetActive(true); serverB.SetActive(true); clientB.SetActive(true); endB.SetActive(true); LobbyCanvas.SetActive(true); StartCanvas.SetActive(true); //StopBroadcast(); try { Debug.Log("stophost"); NetworkLobbyManager.singleton.StopHost(); } catch { Debug.Log("No Server In Lobby"); } try { Debug.Log("stop client"); NetworkLobbyManager.singleton.StopClient(); } catch { Debug.Log("No Client In Lobby"); } SceneManager.LoadScene("offline"); }
public void LobbyConnection() { PhotonNetwork.playerName = myUsername.text; if (PhotonNetwork.connected) { PhotonNetwork.JoinLobby(); myText.text = "Joined Lobby"; LobbyCanvas.SetActive(true); LoginCanvas.SetActive(false); } else { PhotonNetwork.ConnectUsingSettings(VERSION); } }
public void startClient() { StopAllCoroutines(); StartCoroutine(CleanUp()); StartCanvas.SetActive(true); LoadCanvas.SetActive(false); LobbyCanvas.SetActive(false); playerInput.SetActive(false); serverInput.SetActive(false); serverB.SetActive(false); clientB.SetActive(false); endB.SetActive(true); Initialize(); netmanager.playerName = playerNameInput.text; StartAsClient(); }
public void Awake() { Initialize(); glControl = this.transform.GetComponent <GameListController>(); playerInput = GameObject.Find("PlayerName"); serverInput = GameObject.Find("ServerName"); serverB = GameObject.Find("Server Broadcast"); clientB = GameObject.Find("Client Broadcast"); endB = GameObject.Find("End Broadcast"); LoadCanvas = GameObject.Find("LoadCanvas"); LobbyCanvas = GameObject.Find("LobbyCanvas"); StartCanvas = GameObject.Find("StartCanvas"); transform.GetChild(3).gameObject.SetActive(false); netmanager = GetComponent <MyNetworkManager>(); thisNetworkDis = this.gameObject; endB.SetActive(false); LoadCanvas.SetActive(false); LobbyCanvas.SetActive(false); serverNameInput = serverInput.transform.GetChild(1).GetComponent <Text>(); playerNameInput = playerInput.transform.GetChild(1).GetComponent <Text>(); }