void AddChatMessage(string message, PhotonMessageInfo info) { bool shouldSnapToBottom = IsViewAtBottom; if (ViewRectHeight > LogPixelHeight) { shouldSnapToBottom = true; } string prefix = ""; if (info.sender != null) { // all player-sent messages that fail the message filter are silently ignored // TODO: we can also easily implement an ignore-by-player-ID feature here if (!MessageOK(info.sender.ID, message)) { return; } prefix = GetFormattedPlayerName(info.sender.ID); if (message.Length > MaxMessageLength) { message = message.Remove(MaxMessageLength); } PlaySound(m_Chat.ChatSound); } while (message.Length > 0) { string s = ((string.IsNullOrEmpty(prefix)) ? "" : prefix); if (m_HaveSkin) { // TODO: make cutoff point before / after whole words while ((message.Length > 0) && TextStyle.CalcSize(new GUIContent(s)).x < m_ViewRect.width - 16) { s += message[0]; message = message.Substring(1); } } else { s = message; message = ""; } m_Messages.Add(s); } if (m_Messages.Count > MaxMessages) { m_Messages.Remove(m_Messages[0]); } if (shouldSnapToBottom) { SnapToBottom(); } }
/// <summary> /// /// </summary> void DrawTime() { float bx = m_Pos.x; string s = ((vp_MPMaster.Phase == vp_MPMaster.GamePhase.Playing) ? "Time Left: " : "Next game starts in: "); m_Pos.x = 630 - TextStyle.CalcSize(new GUIContent(s)).x; DrawLabel(s + GetFormattedTime(vp_MPClock.TimeLeft) //+ " / " + GetFormattedTime(vp_MasterClient.GameDuration) // SNIPPET: uncomment to also show total game duration , m_Pos); m_Pos.y += 30; m_Pos.x = bx; }