Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/session.js
Show All 32 Lines | |||||
var g_ResearchProgress; | var g_ResearchProgress; | ||||
var g_TimeNotificationOverlay; | var g_TimeNotificationOverlay; | ||||
var g_TopPanel; | var g_TopPanel; | ||||
var g_TradeDialog; | var g_TradeDialog; | ||||
/** | /** | ||||
* Map, player and match settings set in game setup. | * Map, player and match settings set in game setup. | ||||
*/ | */ | ||||
const g_GameAttributes = deepfreeze(Engine.GuiInterfaceCall("GetInitAttributes")); | const g_InitAttributes = deepfreeze(Engine.GuiInterfaceCall("GetInitAttributes")); | ||||
/** | /** | ||||
* True if this is a multiplayer game. | * True if this is a multiplayer game. | ||||
*/ | */ | ||||
const g_IsNetworked = Engine.HasNetClient(); | const g_IsNetworked = Engine.HasNetClient(); | ||||
/** | /** | ||||
* Is this user in control of game settings (i.e. is a network server, or offline player). | * Is this user in control of game settings (i.e. is a network server, or offline player). | ||||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | function init(initData, hotloadData) | ||||
{ | { | ||||
g_ReplaySelectionData = initData.replaySelectionData; | g_ReplaySelectionData = initData.replaySelectionData; | ||||
g_HasRejoined = initData.isRejoining; | g_HasRejoined = initData.isRejoining; | ||||
if (initData.savedGUIData) | if (initData.savedGUIData) | ||||
restoreSavedGameData(initData.savedGUIData); | restoreSavedGameData(initData.savedGUIData); | ||||
} | } | ||||
if (g_GameAttributes.campaignData) | if (g_InitAttributes.campaignData) | ||||
g_CampaignSession = new CampaignSession(g_GameAttributes.campaignData); | g_CampaignSession = new CampaignSession(g_InitAttributes.campaignData); | ||||
let mapCache = new MapCache(); | let mapCache = new MapCache(); | ||||
g_Cheats = new Cheats(); | g_Cheats = new Cheats(); | ||||
g_DiplomacyColors = new DiplomacyColors(); | g_DiplomacyColors = new DiplomacyColors(); | ||||
g_PlayerViewControl = new PlayerViewControl(); | g_PlayerViewControl = new PlayerViewControl(); | ||||
g_PlayerViewControl.registerViewedPlayerChangeHandler(g_DiplomacyColors.updateDisplayedPlayerColors.bind(g_DiplomacyColors)); | g_PlayerViewControl.registerViewedPlayerChangeHandler(g_DiplomacyColors.updateDisplayedPlayerColors.bind(g_DiplomacyColors)); | ||||
g_DiplomacyColors.registerDiplomacyColorsChangeHandler(g_PlayerViewControl.rebuild.bind(g_PlayerViewControl)); | g_DiplomacyColors.registerDiplomacyColorsChangeHandler(g_PlayerViewControl.rebuild.bind(g_PlayerViewControl)); | ||||
g_DiplomacyColors.registerDiplomacyColorsChangeHandler(updateGUIObjects); | g_DiplomacyColors.registerDiplomacyColorsChangeHandler(updateGUIObjects); | ||||
▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | "gui": { | ||||
"assignedPlayer": playerID, | "assignedPlayer": playerID, | ||||
"disconnected": g_Disconnected, | "disconnected": g_Disconnected, | ||||
"isReplay": g_IsReplay, | "isReplay": g_IsReplay, | ||||
"replayDirectory": !g_HasRejoined && replayDirectory, | "replayDirectory": !g_HasRejoined && replayDirectory, | ||||
"replaySelectionData": g_ReplaySelectionData | "replaySelectionData": g_ReplaySelectionData | ||||
} | } | ||||
}; | }; | ||||
if (g_GameAttributes.campaignData) | if (g_InitAttributes.campaignData) | ||||
{ | { | ||||
let menu = g_CampaignSession.getMenu(); | let menu = g_CampaignSession.getMenu(); | ||||
if (g_GameAttributes.campaignData.skipSummary) | if (g_InitAttributes.campaignData.skipSummary) | ||||
{ | { | ||||
Engine.SwitchGuiPage(menu); | Engine.SwitchGuiPage(menu); | ||||
return; | return; | ||||
} | } | ||||
summaryData.campaignData = { "filename": g_GameAttributes.campaignData.run }; | summaryData.campaignData = { "filename": g_InitAttributes.campaignData.run }; | ||||
summaryData.nextPage = menu; | summaryData.nextPage = menu; | ||||
} | } | ||||
Engine.SwitchGuiPage("page_summary.xml", summaryData); | Engine.SwitchGuiPage("page_summary.xml", summaryData); | ||||
} | } | ||||
// Return some data that we'll use when hotloading this file after changes | // Return some data that we'll use when hotloading this file after changes | ||||
function getHotloadData() | function getHotloadData() | ||||
▲ Show 20 Lines • Show All 274 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator