void MainGUIElements() { GUI.Box(new Rect(100 * x, 175 * y, 1500 * x, 250 * y), "The Zomb City", gUIManager.title.box); if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex == 0) { Rect hostButton = new Rect(250 * x, 500 * y, 500 * x, 100 * y); GUI.Box(hostButton, "Play as Host", gUIManager.title.button); if (hostButton.Contains(Event.current.mousePosition) && (Event.current.type == EventType.MouseDown)) { networkManager.StartAsHost(check); } Rect searchMatchButton = new Rect(250 * x, 625 * y, 500 * x, 100 * y); GUI.Box(searchMatchButton, "Find Match", gUIManager.title.button); if (searchMatchButton.Contains(Event.current.mousePosition) && (Event.current.type == EventType.MouseDown)) { check = true; networkManager.FindGame(); } } else { Rect disconnetButton = new Rect(250 * x, 625 * y, 500 * x, 100 * y); GUI.Box(disconnetButton, "Disconnect", gUIManager.title.button); if (disconnetButton.Contains(Event.current.mousePosition) && (Event.current.type == EventType.MouseDown)) { if (myPlayer.GetComponent <PlayerNetworkManager>().isServer) { networkManager.ShutDownServer(); } networkManager.Disconnect(); } } Rect settingsButton = new Rect(250 * x, 750 * y, 500 * x, 100 * y); GUI.Box(settingsButton, "Settings", gUIManager.title.button); if (settingsButton.Contains(Event.current.mousePosition) && (Event.current.type == EventType.MouseDown)) { k = 1; } Rect creditsButton = new Rect(250 * x, 875 * y, 500 * x, 100 * y); GUI.Button(creditsButton, "Credits", gUIManager.title.button); for (int i = 0; i < networkManager.gameAdresses.Count; i++) { Rect gameList = new Rect(1000 * x, 875 * y * i, 500 * x, 100 * y); GUI.Box(gameList, networkManager.gameAdresses[i], gUIManager.title.textField); if (gameList.Contains(Event.current.mousePosition) && (Event.current.type == EventType.MouseDown)) { networkManager.hostAdress = networkManager.gameAdresses[i]; networkManager.JoinGame(); } } }