Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/session/minimap/MiniMap.js
/** | /** | ||||
* This class is concerned with handling events occurring when the interacts with the minimap, | * This class is concerned with handling events occurring when the interacts with the minimap, | ||||
* except for changing the camera position on leftclick. | * except for changing the camera position on leftclick. | ||||
*/ | */ | ||||
class MiniMap | class MiniMap | ||||
{ | { | ||||
constructor() | constructor() | ||||
{ | { | ||||
this.miniMap = Engine.GetGUIObjectByName("minimap"); | this.miniMap = Engine.GetGUIObjectByName("minimap"); | ||||
this.miniMap.onWorldClick = this.onWorldClick.bind(this); | this.miniMap.onWorldClick = this.onWorldClick.bind(this); | ||||
this.miniMap.onMouseEnter = this.onMouseEnter.bind(this); | this.miniMap.onMouseEnter = this.onMouseEnter.bind(this); | ||||
this.miniMap.onMouseLeave = this.onMouseLeave.bind(this); | this.miniMap.onMouseLeave = this.onMouseLeave.bind(this); | ||||
this.mouseIsOverMiniMap = false; | this.mouseIsOverMiniMap = false; | ||||
this.updateFlareLifetime(); | |||||
registerConfigChangeHandler(changes => { | |||||
if (changes.has("gui.session.flarelifetime")) | |||||
this.updateFlareLifetime(); | |||||
}); | |||||
} | |||||
updateFlareLifetime() | |||||
{ | |||||
this.miniMap.flare_lifetime_seconds = Math.max(0, +Engine.ConfigDB_GetValue("user", "gui.session.flarelifetime")); | |||||
} | } | ||||
onWorldClick(target, button) | onWorldClick(target, button) | ||||
{ | { | ||||
// Partly duplicated from handleInputAfterGui(), but with the input being | // Partly duplicated from handleInputAfterGui(), but with the input being | ||||
// world coordinates instead of screen coordinates. | // world coordinates instead of screen coordinates. | ||||
if (inputState == INPUT_NORMAL && controlsPlayer(g_ViewedPlayer) && Engine.HotkeyIsPressed("session.flare")) | if (inputState == INPUT_NORMAL && controlsPlayer(g_ViewedPlayer) && Engine.HotkeyIsPressed("session.flare")) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator