Widget MakeHistoryWidget(object o) { var message = (ChatMessage)o; var from = message.Type == ChatMessageType.Notification ? "Battlefield Control" : message.Nick; var color = message.Type == ChatMessageType.Notification ? ChromeMetrics.Get <Color>("GlobalChatNotificationColor") : ChromeMetrics.Get <Color>("GlobalChatPlayerNameColor"); var template = (ContainerWidget)chatTemplate.Clone(); LobbyUtils.SetupChatLine(template, color, message.Time, from, message.Message); template.Id = message.UID; return(template); }
void AddChatLine(Color c, string from, string text) { var template = (ContainerWidget)chatTemplate.Clone(); LobbyUtils.SetupChatLine(template, c, DateTime.Now, from, text); var scrolledToBottom = lobbyChatPanel.ScrolledToBottom; lobbyChatPanel.AddChild(template); if (scrolledToBottom) { lobbyChatPanel.ScrollToBottom(smooth: true); } Game.Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null); }
void AddChatLine(string name, Color nameColor, string text, Color textColor) { var template = (ContainerWidget)chatTemplate.Clone(); LobbyUtils.SetupChatLine(template, DateTime.Now, name, nameColor, text, textColor); var scrolledToBottom = lobbyChatPanel.ScrolledToBottom; lobbyChatPanel.AddChild(template); if (scrolledToBottom) { lobbyChatPanel.ScrollToBottom(smooth: true); } Game.Sound.PlayNotification(modRules, null, "Sounds", chatLineSound, null); }