Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/menu.js
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Remember last viewed summary panel and charts. | * Remember last viewed summary panel and charts. | ||||
*/ | */ | ||||
var g_SummarySelectedData; | var g_SummarySelectedData; | ||||
// Redefined every time someone makes a tribute (so we can save some data in a closure). Called in input.js handleInputBeforeGui. | // Redefined every time someone makes a tribute (so we can save some data in a closure). Called in input.js handleInputBeforeGui. | ||||
var g_FlushTributing = function() {}; | var g_FlushTributing = function() {}; | ||||
function initSessionMenuButtons() | function initSessionMenuButtons() | ||||
ffffffff: jsdocs missing
/**
* Setting menu buttons tooltips and hotkey descriptions plus enable or… | |||||
{ | { | ||||
Not Done Inline ActionsMaybe "Toggle the in-game menu"? Imarok: Maybe "Toggle **the** in-game menu"? | |||||
Not Done Inline Actionsclaro! ffffffff: claro! | |||||
initMenuPosition(); | initMenuPosition(); | ||||
updateGameSpeedControl(); | updateGameSpeedControl(); | ||||
resizeDiplomacyDialog(); | resizeDiplomacyDialog(); | ||||
resizeTradeDialog(); | resizeTradeDialog(); | ||||
Not Done Inline Actionshotkey property is redundant and should be received by Engine.GetGUIObjectByName("name").hotkey elexis: hotkey property is redundant and should be received by Engine.GetGUIObjectByName("name").hotkey | |||||
Not Done Inline Actionsnice!! ffffffff: nice!! | |||||
Not Done Inline Actionsnot just "enabled": Engine.HasXmppClient ? Imarok: not just `"enabled": Engine.HasXmppClient` ? | |||||
} | } | ||||
function initMenuPosition() | function initMenuPosition() | ||||
Not Done Inline ActionsMaybe name updateMenuButtons. ffffffff: Maybe name updateMenuButtons. | |||||
{ | { | ||||
Engine.GetGUIObjectByName("menu").size = "100%-164 " + MENU_TOP + " 100% " + MENU_BOTTOM; | Engine.GetGUIObjectByName("menu").size = "100%-164 " + MENU_TOP + " 100% " + MENU_BOTTOM; | ||||
} | } | ||||
Not Done Inline ActionsIs this actually what we want compared to colorizeHotkey() in color,js? Dont like this "Unassigned hotkey: %(hotkeyName)s" String from it. ffffffff: Is this actually what we want compared to colorizeHotkey() in color,js?
Dont like this… | |||||
function updateMenuPosition(dt) | function updateMenuPosition(dt) | ||||
{ | { | ||||
let menu = Engine.GetGUIObjectByName("menu"); | let menu = Engine.GetGUIObjectByName("menu"); | ||||
let maxOffset = g_IsMenuOpen ? | let maxOffset = g_IsMenuOpen ? | ||||
END_MENU_POSITION - menu.size.bottom : | END_MENU_POSITION - menu.size.bottom : | ||||
menu.size.top - MENU_TOP; | menu.size.top - MENU_TOP; | ||||
Show All 35 Lines | |||||
{ | { | ||||
if (!Engine.HasXmppClient()) | if (!Engine.HasXmppClient()) | ||||
return; | return; | ||||
closeOpenDialogs(); | closeOpenDialogs(); | ||||
Engine.PushGuiPage("page_lobby.xml", { "dialog": true }); | Engine.PushGuiPage("page_lobby.xml", { "dialog": true }); | ||||
} | } | ||||
function chatMenuButton() | |||||
{ | |||||
closeOpenDialogs(); | |||||
openChat(); | |||||
} | |||||
function diplomacyMenuButton() | function diplomacyMenuButton() | ||||
{ | { | ||||
closeOpenDialogs(); | closeOpenDialogs(); | ||||
openDiplomacy(); | openDiplomacy(); | ||||
} | } | ||||
function pauseMenuButton() | function pauseMenuButton() | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,086 Lines • ▼ Show 20 Lines | Engine.PostNetworkCommand({ | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": [], | "translateParameters": [], | ||||
"parameters": {} | "parameters": {} | ||||
}); | }); | ||||
} | } | ||||
function closeOpenDialogs() | function closeOpenDialogs() | ||||
{ | { | ||||
if (Engine.GetGUIObjectByName("chatDialogPanel").hidden && | |||||
!g_IsMenuOpen && | |||||
!g_IsDiplomacyOpen && | |||||
!g_IsTradeOpen && | |||||
!g_IsObjectivesOpen) | |||||
return false; | |||||
closeMenu(); | closeMenu(); | ||||
closeChat(); | closeChat(); | ||||
closeDiplomacy(); | closeDiplomacy(); | ||||
closeTrade(); | closeTrade(); | ||||
closeObjectives(); | closeObjectives(); | ||||
return true; | |||||
} | } | ||||
function formatTributeTooltip(playerID, resourceCode, amount) | function formatTributeTooltip(playerID, resourceCode, amount) | ||||
{ | { | ||||
return sprintf(translate("Tribute %(resourceAmount)s %(resourceType)s to %(playerName)s. Shift-click to tribute %(greaterAmount)s."), { | return sprintf(translate("Tribute %(resourceAmount)s %(resourceType)s to %(playerName)s. Shift-click to tribute %(greaterAmount)s."), { | ||||
"resourceAmount": amount, | "resourceAmount": amount, | ||||
"resourceType": resourceNameWithinSentence(resourceCode), | "resourceType": resourceNameWithinSentence(resourceCode), | ||||
"playerName": colorizePlayernameByID(playerID), | "playerName": colorizePlayernameByID(playerID), | ||||
"greaterAmount": amount < 500 ? 500 : amount + 500 | "greaterAmount": amount < 500 ? 500 : amount + 500 | ||||
}); | }); | ||||
} | } |
Wildfire Games · Phabricator
jsdocs missing
/**