private void ShowScore(string scoreText, int player, GUIStyle style) { Vector3 p = Camera.main.WorldToScreenPoint(ScoreDisplay.transform.position); p.y = Screen.height - p.y; GUIContent content = new GUIContent(scoreText); float min; float max; style.CalcMinMaxWidth(content, out min, out max); float height = style.CalcHeight(content, max); max += 50; if (PlayersPlaying > 1) { if (player == 0) { p.x -= max; } else { p.x += max * 0.15f; } } else { p.x -= max / 2.0f; } GUI.BeginGroup(new Rect(p.x, p.y - (height / 2.0f), max, 100)); if (player == CurrentPlayer) { // #FFAD14 FontColorUtils.DrawTextWithShadow(scoreText, "#ffad14", max, height, style, 6, 6); } else { FontColorUtils.DrawText(scoreText, max, height, style); } GUI.EndGroup(); }
private void OnGUI() { GUIStyle style = new GUIStyle(); style.richText = true; style.wordWrap = true; style.fontSize = (int)(32 * Initialize.Scale); style.fontStyle = FontStyle.Bold; style.font = DefaultFont; Vector3 p = Camera.main.WorldToScreenPoint(SpawnLocation.transform.position); p.y = Screen.height - p.y; GUI.BeginGroup(new Rect(p.x, p.y, 500, 50)); FontColorUtils.DrawTextWithShadow(Title, 500, 50, style); GUI.EndGroup(); }