Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/pregame/MainMenuPage.js
/** | /** | ||||
* This is the handler that coordinates all other handlers on this GUI page. | * This is the handler that coordinates all other handlers on this GUI page. | ||||
*/ | */ | ||||
class MainMenuPage | class MainMenuPage | ||||
{ | { | ||||
constructor(data, hotloadData, mainMenuItems, backgroundLayerData, projectInformation, communityButtons) | constructor(data, hotloadData, mainMenuItems, backgroundLayerData, projectInformation, communityButtons) | ||||
{ | { | ||||
this.backgroundHandler = new BackgroundHandler(pickRandom(backgroundLayerData)); | this.backgroundHandler = new BackgroundHandler(pickRandom(backgroundLayerData)); | ||||
this.menuHandler = new MainMenuItemHandler(mainMenuItems); | this.menuHandler = new MainMenuItemHandler(mainMenuItems); | ||||
this.incompatibleModsHandler = new IncompatibleModsHandler(data, hotloadData && hotloadData.incompatibleModsHanlder); | |||||
Imarok: typo | |||||
this.splashScreenHandler = new SplashScreenHandler(data, hotloadData && hotloadData.splashScreenHandler); | this.splashScreenHandler = new SplashScreenHandler(data, hotloadData && hotloadData.splashScreenHandler); | ||||
new MusicHandler(); | new MusicHandler(); | ||||
Lint: ESLintBear (no-new) Do not use 'new' for side effects. Lint: ESLintBear (no-new): `Do not use 'new' for side effects.` | |||||
Lint: ESLintBear (no-use-before-define) 'MusicHandler' was used before it was defined. Lint: ESLintBear (no-use-before-define): `'MusicHandler' was used before it was defined.` | |||||
new ProjectInformationHandler(projectInformation); | new ProjectInformationHandler(projectInformation); | ||||
Lint: ESLintBear (no-new) Do not use 'new' for side effects. Lint: ESLintBear (no-new): `Do not use 'new' for side effects.` | |||||
Lint: ESLintBear (no-use-before-define) 'ProjectInformationHandler' was used before it was defined. Lint: ESLintBear (no-use-before-define): `'ProjectInformationHandler' was used before it was defined.` | |||||
new CommunityButtonHandler(communityButtons); | new CommunityButtonHandler(communityButtons); | ||||
Lint: ESLintBear (no-new) Do not use 'new' for side effects. Lint: ESLintBear (no-new): `Do not use 'new' for side effects.` | |||||
Lint: ESLintBear (no-use-before-define) 'CommunityButtonHandler' was used before it was defined. Lint: ESLintBear (no-use-before-define): `'CommunityButtonHandler' was used before it was defined.` | |||||
} | } | ||||
Done Inline Actionsou Silier: ou | |||||
getHotloadData() | getHotloadData() | ||||
{ | { | ||||
return { | return { | ||||
"splashScreenHandler": this.splashScreenHandler.getHotloadData() | "splashScreenHandler": this.splashScreenHandler.getHotloadData(), | ||||
"incompatibleModsHanlder": this.incompatibleModsHandler.getHotloadData() | |||||
}; | }; | ||||
} | } | ||||
} | } | ||||
class MusicHandler | class MusicHandler | ||||
Lint: JSHintBear 'MusicHandler' was used before it was defined. Lint: JSHintBear: `'MusicHandler' was used before it was defined.` | |||||
{ | { | ||||
constructor() | constructor() | ||||
{ | { | ||||
initMusic(); | initMusic(); | ||||
global.music.setState(global.music.states.MENU); | global.music.setState(global.music.states.MENU); | ||||
} | } | ||||
} | } | ||||
class ProjectInformationHandler | class ProjectInformationHandler | ||||
Lint: JSHintBear 'ProjectInformationHandler' was used before it was defined. Lint: JSHintBear: `'ProjectInformationHandler' was used before it was defined.` | |||||
{ | { | ||||
constructor(projectInformation) | constructor(projectInformation) | ||||
{ | { | ||||
for (let objectName in projectInformation) | for (let objectName in projectInformation) | ||||
for (let propertyName in projectInformation[objectName]) | for (let propertyName in projectInformation[objectName]) | ||||
Engine.GetGUIObjectByName(objectName)[propertyName] = projectInformation[objectName][propertyName]; | Engine.GetGUIObjectByName(objectName)[propertyName] = projectInformation[objectName][propertyName]; | ||||
} | } | ||||
} | } | ||||
class CommunityButtonHandler | class CommunityButtonHandler | ||||
Lint: JSHintBear 'CommunityButtonHandler' was used before it was defined. Lint: JSHintBear: `'CommunityButtonHandler' was used before it was defined.` | |||||
{ | { | ||||
constructor(communityButtons) | constructor(communityButtons) | ||||
{ | { | ||||
let buttons = Engine.GetGUIObjectByName("communityButtons").children; | let buttons = Engine.GetGUIObjectByName("communityButtons").children; | ||||
communityButtons.forEach((buttonInfo, i) => { | communityButtons.forEach((buttonInfo, i) => { | ||||
let button = buttons[i]; | let button = buttons[i]; | ||||
button.hidden = false; | button.hidden = false; | ||||
for (let propertyName in buttonInfo) | for (let propertyName in buttonInfo) | ||||
button[propertyName] = buttonInfo[propertyName]; | button[propertyName] = buttonInfo[propertyName]; | ||||
}); | }); | ||||
if (buttons.length < communityButtons.length) | if (buttons.length < communityButtons.length) | ||||
error("GUI page has space for " + buttons.length + " community buttons, but " + menuItems.length + " items are provided!"); | error("GUI page has space for " + buttons.length + " community buttons, but " + menuItems.length + " items are provided!"); | ||||
} | } | ||||
} | } |
Wildfire Games · Phabricator
typo