Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/session/PauseControl.js
/** | /** | ||||
* Controller to pause or resume the game and remember which players paused the game. | * Controller to pause or resume the game and remember which players paused the game. | ||||
* | * | ||||
* If the current player ordered a pause manually, it is called explicit pause. | * If the current player ordered a pause manually, it is called explicit pause. | ||||
* If the player opened a dialog in singleplayer mode, the game is paused implicitly. | * If the player opened a dialog in single-player mode, the game is paused implicitly. | ||||
*/ | */ | ||||
class PauseControl | class PauseControl | ||||
{ | { | ||||
constructor() | constructor() | ||||
{ | { | ||||
/** | /** | ||||
* This is true if the current player has paused the game using the pause button or hotkey. | * This is true if the current player has paused the game using the pause button or hotkey. | ||||
* The game may also be paused without this being true in singleplayermode when opening a dialog. | * The game may also be paused without this being true in single-player mode when opening a dialog. | ||||
*/ | */ | ||||
this.explicitPause = false; | this.explicitPause = false; | ||||
/** | /** | ||||
* List of GUIDs of players who have currently paused the game, if the game is networked. | * List of GUIDs of players who have currently paused the game, if the game is networked. | ||||
*/ | */ | ||||
this.pausingClients = []; | this.pausingClients = []; | ||||
Show All 21 Lines | class PauseControl | ||||
callPauseHandlers() | callPauseHandlers() | ||||
{ | { | ||||
for (let handler of this.pauseHandlers) | for (let handler of this.pauseHandlers) | ||||
handler(); | handler(); | ||||
} | } | ||||
/** | /** | ||||
* Called from UI dialogs, but only in singleplayermode. | * Called from UI dialogs, but only in single-player mode. | ||||
*/ | */ | ||||
implicitPause() | implicitPause() | ||||
{ | { | ||||
this.setPaused(true, false); | this.setPaused(true, false); | ||||
} | } | ||||
implicitResume() | implicitResume() | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator