Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/OverlayCounter.js
/** | /** | ||||
* This is an abstract base class managing one counter shown. | * This is an abstract base class managing one counter shown. | ||||
* Classes implementing this class require a Config property and may have a Hotkey property. | * Classes implementing this class require a Config property and may have a Hotkey property. | ||||
*/ | */ | ||||
class OverlayCounter | class OverlayCounter | ||||
{ | { | ||||
constructor(overlayCounterManager) | constructor(overlayCounterManager) | ||||
{ | { | ||||
this.overlayCounterManager = overlayCounterManager; | this.overlayCounterManager = overlayCounterManager; | ||||
this.updateEnabled(); | this.updateEnabled(); | ||||
registerConfigChangeHandler(this.onConfigChange.bind(this)); | registerConfigChangeHandler(this.onConfigChange.bind(this)); | ||||
if (this.Hotkey) | if (this.Hotkey) | ||||
Engine.SetGlobalHotkey(this.Hotkey, this.toggle.bind(this)); | Engine.SetGlobalHotkey(this.Hotkey, "Press", this.toggle.bind(this)); | ||||
} | } | ||||
onConfigChange(changes) | onConfigChange(changes) | ||||
{ | { | ||||
if (changes.has(this.Config)) | if (changes.has(this.Config)) | ||||
this.updateEnabled(); | this.updateEnabled(); | ||||
} | } | ||||
Show All 24 Lines |
Wildfire Games · Phabricator