void OnGUI() { if (target != null) { Rect rect = new Rect(0, Screen.height - 50, Screen.width, 50); string text = "Spectating " + target.racerName; GUIX.ShadowLabel(rect, text, guistyle, 2); GUI.Label(rect, text, guistyle); } }
void OnGUI() { if (countdownText != "") { GUI.skin = skin; GUIStyle style = new GUIStyle(GUI.skin.label); style.alignment = TextAnchor.MiddleCenter; style.fontSize = countdownFontSize; style.fontStyle = FontStyle.Bold; Rect rect = new Rect(0, 0, Screen.width, 400); GUIX.ShadowLabel(rect, countdownText, style, 4); GUI.Label(rect, countdownText, style); } }
void OnGUI() { if (waitingForPlayers) { GUI.skin = skin; GUIStyle style = new GUIStyle(GUI.skin.label); style.fontSize = 50; style.alignment = TextAnchor.MiddleCenter; Rect rect = new Rect(0, 0, Screen.width, 400); var players = client.GetPlayerList(); int playersNotReady = 0; foreach (ServerPlayer p in players) { if (!p.ready) { playersNotReady++; } } string playertxt = "players"; if (playersNotReady == 1) { playertxt = "player"; } string text = "Waiting for " + playersNotReady + " " + playertxt + "\n(Timeout in " + Mathf.Ceil(waitingForPlayersTimeout) + " seconds)"; if (playersNotReady != 1) { text += "s"; //Plural } GUIX.ShadowLabel(rect, text, style, 3); GUI.Label(rect, text, style); } }
void OnGUI() { GUI.skin = skin; if (checkpointTime > 0) { Rect checkpointLapRect = new Rect(Screen.width / 2 - 200, Screen.height / 2 - 260, 400, 100); GUIStyle checkpointLapStyle = new GUIStyle(GUI.skin.label); checkpointLapStyle.alignment = TextAnchor.UpperCenter; checkpointLapStyle.fontSize = 48; Rect checkpointRect = new Rect(Screen.width / 2 - 200, Screen.height / 2 - 200, 400, 100); GUIStyle checkpointStyle = new GUIStyle(GUI.skin.label); checkpointStyle.alignment = TextAnchor.UpperCenter; checkpointStyle.fontSize = 40; Rect checkpointDiffRect = new Rect(Screen.width / 2 - 200, Screen.height / 2 - 150, 400, 100); GUIStyle checkpointDiffStyle = new GUIStyle(checkpointStyle); checkpointDiffStyle.fontSize = 36; checkpointDiffStyle.normal.textColor = checkpointDiffColor; GUIX.ShadowLabel(checkpointLapRect, checkpointLapString, checkpointLapStyle, 2); GUI.Label(checkpointLapRect, checkpointLapString, checkpointLapStyle); GUIX.ShadowLabel(checkpointRect, checkpointString, checkpointStyle, 2); GUI.Label(checkpointRect, checkpointString, checkpointStyle); GUIX.ShadowLabel(checkpointDiffRect, checkpointDiffString, checkpointDiffStyle, 2); GUI.Label(checkpointDiffRect, checkpointDiffString, checkpointDiffStyle); } //Basic info Rect infoRect = new Rect(10, Screen.height * 0.3f + 10, 400, 400); string spdStr = "fasts/h"; if (FindObjectOfType <MlgMode>() != null) { spdStr = "MLGs/h"; } string infoString = sanicspeed.ToString() + " " + spdStr + "\n" + "lap " + racer.Lap + " of " + racer.totalLaps; GUIStyle infoStyle = new GUIStyle(GUI.skin.label); infoStyle.fontSize = 36; GUIX.ShadowLabel(infoRect, infoString, infoStyle, 2); GUI.Label(infoRect, infoString, infoStyle); //Time Rect timeRect = new Rect(Screen.width / 2 - 200, Screen.height - 80, 400, 80); string timeString = Timing.GetTimeString(racer.RaceTime); GUIStyle timeStyle = new GUIStyle(GUI.skin.label); timeStyle.fontSize = 48; timeStyle.alignment = TextAnchor.UpperCenter; GUIX.ShadowLabel(timeRect, timeString, timeStyle, 3); GUI.Label(timeRect, timeString, timeStyle); //Finished text if (racer.finished) { Rect finishedRect = new Rect(Screen.width / 2 - 200, Screen.height - 102, 400, 80); GUIStyle finishedStyle = new GUIStyle(timeStyle); finishedStyle.fontSize = 24; GUIX.ShadowLabel(finishedRect, "Race finished", finishedStyle, 2); GUI.Label(finishedRect, "Race finished", finishedStyle); } //Player position Rect playerPosRect = new Rect(Screen.width - 420, Screen.height - 120, 400, 120); string playerPosString = racer.GetPositionString(); GUIStyle playerPosStyle = new GUIStyle(GUI.skin.label); playerPosStyle.fontSize = 86; playerPosStyle.fontStyle = FontStyle.Bold; playerPosStyle.alignment = TextAnchor.UpperRight; if (FindObjectOfType <MlgMode>() && racer.position == 1) { playerPosString = "#REKT"; } GUIX.ShadowLabel(playerPosRect, playerPosString, playerPosStyle, 4); GUI.Label(playerPosRect, playerPosString, playerPosStyle); }