Skip to main content

Layering

Namespace with functions for managing the layering sub screen

Below is an example of some basic usage of the Layering subscreen, including a Click function for initializing the screen and a set of Resize and Exit functions for, respectively, handling the screens drawing/resizing and exiting

@example
let FancyScreenMode: "default" | "layering" = "default";

// Make sure the fancy screen mode is changed back to its default upon exiting the layering subscreen
Layering.RegisterExitCallbacks({
screen: "FancyScreen",
callback: () => FancyScreenMode = "default",
});

function FancyScreenClick() {
const C: Character;
const item: Item;
switch (FancyScreenMode) {
case "default": {
if Mousein(...) {
FancyScreenMode = "layering";
Layering.Init(C, item);
}
return;
}
}
}

function FancyScreenResize(load) {
switch (FancyScreenMode) {
case "layering":
Layering.Resize(load);
return;
}
}

function FancyScreenExit() {
switch (FancyScreenMode) {
case "layering":
Layering.Exit();
return;
}
}

Index

Variables

Character

Character: Character = null

The character in question

Display

Display: LayeringDisplay = null

The (rectangular) shape and inter-button gap of the layering screen

readonlyDisplayDefault

DisplayDefault: Readonly<LayeringDisplay> = ...

The default (rectangular) shape and inter-button gap of the layering screen

readonlyID

ID: Readonly<{ assetGrid: layering-asset-grid; assetHeader: layering-asset-header; buttonGrid: layering-button-grid; exitButton: layering-exit-button; hideButton: layering-hide-button; hideTooltip: layering-hide-button-tooltip; layerDIV: layering-layer-div; layerHeader: layering-layer-header; layerOuterGrid: layering-layer-outer-grid; lockButton: layering-lock-button; resetButton: layering-reset-button; root: layering }> = ...

The IDs of layering-specific DOM elements

Item

Item: Item = null

The selected item in question

Functions

Exit

  • Exit(reload?: boolean): void
  • Parameters

    • reload: boolean = false

      Whether the exit call is part of a reload (see Layering.Init)

    Returns void

Init

  • Initialize the layering subscreen


    Parameters

    • item: Item

      The affected item

    • character: Character

      The item's owning character

    • display: Partial<LayeringDisplay> = null

      The shape of the layering subscreen

    • reload: boolean = false

      Whether we're loading or reloading the screen. A reload pushes any current changes towards the server and reinitializes all DOM elements.

    • readonly: boolean = false

    Returns HTMLDivElement

    The div containing the layering subscreen

IsActive

  • IsActive(): boolean
  • Return whether the layering sub screen has currently been initialized (be it either active or unloaded)


    Returns boolean

Load

  • Load(): void
  • Called when screen is loaded using CommonSetScreen


    Returns void

RegisterExitCallbacks

  • Register screen-specific callbacks to-be executed after calling Layering.Exit.

    Callbacks registered herein must be used exclusively for setting up the next screen, and not for tearing down the layering sub screen. As such, they are ignored when performing a reload of the layering sub screen (see Layering.Init)


    Parameters

    Returns void

Resize

  • Resize(load: boolean): void
  • Called when screen size or position changes or after screen load


    Parameters

    • load: boolean

      If the reason for call was load (true) or window resize (false)

    Returns void

Unload

  • Unload(): void
  • Called when this screen is being replaced


    Returns void

Accessors

Asset

  • Get the item's asset


    Returns Asset

OverridePriority

Readonly

  • get Readonly(): boolean
  • set Readonly(value: boolean): void
  • Get or set whether the layering screen is readonly


    Returns boolean

  • Parameters

    • value: boolean

    Returns void