Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/lobby/LobbyPage/Subject.js
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
class Subject | |||||
{ | |||||
constructor(dialog, xmppMessages, gameList) | |||||
{ | |||||
this.subjectPanel = Engine.GetGUIObjectByName("subjectPanel"); | |||||
this.subjectText = Engine.GetGUIObjectByName("subjectText"); | |||||
this.subjectBox = Engine.GetGUIObjectByName("subjectBox"); | |||||
this.logoTop = Engine.GetGUIObjectByName("logoTop"); | |||||
this.logoCenter = Engine.GetGUIObjectByName("logoCenter"); | |||||
this.updateSubject(Engine.LobbyGetRoomSubject()); | |||||
xmppMessages.registerHandler("chat", "subject", this.onSubject.bind(this)); | |||||
gameList.registerSelectionChangeHandler(this.onGameListSelectionChange.bind(this)); | |||||
this.resize(dialog); | |||||
} | |||||
resize(dialog) | |||||
{ | |||||
let bottom = Engine.GetGUIObjectByName(dialog ? "leaveButton" : "hostButton").size.top - 5; | |||||
let size = this.subjectPanel.size; | |||||
size.bottom = bottom; | |||||
this.subjectPanel.size = size; | |||||
} | |||||
onGameListSelectionChange(game) | |||||
{ | |||||
this.subjectPanel.hidden = !!game; | |||||
} | |||||
onSubject(message) | |||||
{ | |||||
this.updateSubject(message.subject); | |||||
} | |||||
updateSubject(subject) | |||||
{ | |||||
subject = subject.trim(); | |||||
this.subjectBox.hidden = !subject; | |||||
this.subjectText.caption = subject; | |||||
this.logoTop.hidden = !subject; | |||||
this.logoCenter.hidden = !!subject; | |||||
} | |||||
} |
Wildfire Games · Phabricator