Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Chat/ChatMessagesPanel.js
- This file was added.
/** | |||||
* This class stores and displays the chat history since the login and | |||||
* displays timestamps if enabled. | |||||
*/ | |||||
class ChatMessagesPanel | |||||
{ | |||||
constructor(useTimestampWrapper) | |||||
{ | |||||
this.chatHistory = ""; | |||||
this.statusMessageFormat = new StatusMessageFormat(); | |||||
if (useTimestampWrapper) | |||||
this.timestampWrapper = new TimestampWrapper(); | |||||
this.chatText = Engine.GetGUIObjectByName("chatText"); | |||||
} | |||||
addText(text) | |||||
{ | |||||
if (this.timestampWrapper) | |||||
text = this.timestampWrapper.format(text); | |||||
this.chatHistory += this.chatHistory ? "\n" + text : text; | |||||
this.chatText.addItem(text); | |||||
} | |||||
addStatusMessage(text) | |||||
{ | |||||
this.addText(this.statusMessageFormat.format(text)); | |||||
} | |||||
clearChatMessages() | |||||
{ | |||||
this.chatHistory = ""; | |||||
this.chatText.list = []; | |||||
this.chatText.list_data = []; | |||||
} | |||||
} |
Wildfire Games · Phabricator