Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/session/messages.js
Show First 20 Lines • Show All 540 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
function updateTutorial(notification) | function updateTutorial(notification) | ||||
{ | { | ||||
// Show the tutorial panel if not yet done | // Show the tutorial panel if not yet done | ||||
Engine.GetGUIObjectByName("tutorialPanel").hidden = false; | Engine.GetGUIObjectByName("tutorialPanel").hidden = false; | ||||
if (notification.warning) | if (notification.warning) | ||||
{ | { | ||||
Engine.GetGUIObjectByName("tutorialWarning").caption = '[color="orange"]' + translate(notification.warning) + '[/color]'; | Engine.GetGUIObjectByName("tutorialWarning").caption = coloredText(translate(notification.warning), "orange"); | ||||
return; | return; | ||||
} | } | ||||
let tutorialText = Engine.GetGUIObjectByName("tutorialText"); | let tutorialText = Engine.GetGUIObjectByName("tutorialText"); | ||||
tutorialText.caption = | tutorialText.caption = | ||||
tutorialText.caption.replace('[color="yellow"]', '').replace('[/color]', '') + | tutorialText.caption.replace('[color="yellow"]', '').replace('[/color]', '') + | ||||
(tutorialText.caption ? "\n" : "") + | (tutorialText.caption ? "\n" : "") + | ||||
'[color="yellow"]' + | coloredText(notification.instructions.reduce((instructions, item) => instructions + translate(item), ""), "yellow"); | ||||
notification.instructions.reduce((instructions, item) => instructions + translate(item), "") + | |||||
'[/color]'; | |||||
if (notification.readyButton) | if (notification.readyButton) | ||||
{ | { | ||||
Engine.GetGUIObjectByName("tutorialReady").hidden = false; | Engine.GetGUIObjectByName("tutorialReady").hidden = false; | ||||
if (notification.leave) | if (notification.leave) | ||||
{ | { | ||||
Engine.GetGUIObjectByName("tutorialWarning").caption = translate("Click to quit this tutorial."); | Engine.GetGUIObjectByName("tutorialWarning").caption = translate("Click to quit this tutorial."); | ||||
Engine.GetGUIObjectByName("tutorialReady").caption = translate("Quit"); | Engine.GetGUIObjectByName("tutorialReady").caption = translate("Quit"); | ||||
▲ Show 20 Lines • Show All 375 Lines • ▼ Show 20 Lines | function colorizePlayernameByGUID(guid) | ||||
let username = g_PlayerAssignments[guid] ? g_PlayerAssignments[guid].name : ""; | let username = g_PlayerAssignments[guid] ? g_PlayerAssignments[guid].name : ""; | ||||
let playerID = g_PlayerAssignments[guid] ? g_PlayerAssignments[guid].player : -1; | let playerID = g_PlayerAssignments[guid] ? g_PlayerAssignments[guid].player : -1; | ||||
return colorizePlayernameHelper(username, playerID); | return colorizePlayernameHelper(username, playerID); | ||||
} | } | ||||
function colorizePlayernameHelper(username, playerID) | function colorizePlayernameHelper(username, playerID) | ||||
{ | { | ||||
let playerColor = playerID > -1 ? rgbToGuiColor(g_Players[playerID].color) : "white"; | let playerColor = playerID > -1 ? rgbToGuiColor(g_Players[playerID].color) : "white"; | ||||
return '[color="' + playerColor + '"]' + (username || translate("Unknown Player")) + "[/color]"; | return coloredText(username || translate("Unknown Player"), playerColor); | ||||
} | } | ||||
/** | /** | ||||
* Insert the colorized playername to chat messages sent by the AI and time notifications. | * Insert the colorized playername to chat messages sent by the AI and time notifications. | ||||
*/ | */ | ||||
function colorizePlayernameParameters(parameters) | function colorizePlayernameParameters(parameters) | ||||
{ | { | ||||
for (let param in parameters) | for (let param in parameters) | ||||
▲ Show 20 Lines • Show All 313 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator