/// <summary> /// Renders the GUI /// </summary> void OnGUI() { // Setting Skin (every ONGUI call, what a shame!) GUI.skin = GameGuiSkin; // Window rectangle manager Rect windowRect; // SERVER GUI if (Network.isServer) { if (AmApplication.CurrentMatchState == MatchState.MATCH) { // Player Scores windowRect = new Rect(Screen.width - SCOREBOX_WIDTH - SCOREBOX_RIGHTMARGIN, SCOREBOX_TOPMARGIN, SCOREBOX_WIDTH, SCORE_HEIGHT_LABEL * (Network.connections.Length) + 50); windowRect = GUI.Window(2, windowRect, DrawScorePanel, "Scores"); // show IP Address and Connections (not in waiting room) windowRect = new Rect(10, 10, 200, 80); windowRect = GUI.Window(1, windowRect, DrawServerStats, "Server Stats"); } // Waiting Room if (AmApplication.CurrentMatchState == MatchState.WAITING_ROOM) { // Match Final Score windowRect = new Rect(_scoreWindowLeftMargin, _scoreWindowTopMargin, Screen.width - 100, Screen.height - 40); windowRect = GUI.Window(2, windowRect, DrawWaitingRoomWindow, "End Game : Scores"); } } // CLIENT GUI if (Network.isClient) { // player stats windowRect = new Rect(SCOREBOX_RIGHTMARGIN + SCOREBOX_WIDTH, SCOREBOX_TOPMARGIN + 30, SCOREBOX_WIDTH, SCOREBOX_HEIGHT * 5); windowRect = GUI.Window(4, windowRect, DrawPlayerStatistics, "Player Stats"); // active powerups panel if (_player.PowerUps.Count > 0) { windowRect = new Rect(SCOREBOX_RIGHTMARGIN, SCOREBOX_TOPMARGIN + 30, SCOREBOX_WIDTH, SCORE_HEIGHT_LABEL * (_player.PowerUps.Count) + 20); windowRect = GUI.Window(3, windowRect, DrawPlayerPowerUps, "PowerUps"); } } // Match CountDown windowRect = new Rect(Screen.width - 120, 10, 100, 50); windowRect = GUI.Window(0, windowRect, DrawMatchCountDown, "CountDown"); // show Logout if (_escPressed && GUI.Button(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 150, 300, 300), "Logout")) { NetworkManager.Shutdown(); AmApplication.LoadMainMenu(); } }
/// <summary> /// Raises the disconnected from server event. /// * CLIENT event (if we use MasterServer, SERVER too) /// </summary> /// <param name='info'> /// NetworkDisconnection Info /// </param> void OnDisconnectedFromServer(NetworkDisconnection info) { Debug.Log("This CLIENT has disconnected from a server"); AmApplication.LoadMainMenu(); }