Перейти к основному содержанию

UI.Window

Represents window of required size that can be opened in container to provide any required UI facilities.

Implements

Index

Constructors

constructor

  • Constructs new UI.Window object with specified bounds.


    Parameters

    • location: WindowLocation

      object containing window's bounds. Note that the bounds change the width of the window, but the full width of the window becomes 1000 units.

    Returns Window

Properties

closeOnBackPressed

closeOnBackPressed: boolean

content

content: WindowContent

elementProvider

elementProvider: IElementProvider

elementView

elementView: ImageView

isBackgroundDirty

isBackgroundDirty: boolean

isForegroundDirty

isForegroundDirty: boolean

layout

layout: ViewGroup

location

location: WindowLocation

Methods

addAdjacentWindow

  • addAdjacentWindow(window: Window): void
  • Adds another window as adjacent window, so that several windows open at the same time. This allows to divide window into separate parts and treat them separately.


    Parameters

    • window: Window

      another window to be added as adjacent

    Returns void

close

  • close(): void
  • Closes window without container. Use only if the window was opened without container.


    Returns void

debug

  • debug(): void
  • Writes debug information about current window to the log.


    Returns void

forceRefresh

  • forceRefresh(): void
  • Returns void

frame

  • frame(time: number): void
  • Called up to 66 times a second to update window's content.


    Parameters

    • time: number

      current time in milliseconds

    Returns void

getBackgroundProvider

  • getBackgroundProvider<T>(): T

getContainer

  • Returns UiAbstractContainer

    Currently UI.Container that was used to open this window or null, if the window wasn't opened in container.

getContent

  • Returns WindowContent

    Window's content object (usually specified in the window's constructor).

getContentProvider

getElementProvider

  • getElementProvider<T>(): T

getElements

  • Gets all the elements in the window.


    Returns HashMap<String, IElement>

    Hashes containing string element names as keys and element instances as values.

getEventListener

  • since: 2.3.1b116

    Gets listener to be notified about window opening/closing events.


    Returns WindowEventListener

getLocation

getParentWindow

  • Returns IWindow

    Current window's parent window.

getProperty

  • getProperty<T>(name: string): T
  • Gets custom property by it's name. Custom properties can be used to store some values containing window's current state. Note that these properties are not saved between Inner Core launches.


    Type parameters

    • T

    Parameters

    • name: string

      custom property name

    Returns T

    Value set by UI.Window.putProperty or null if no value was specified for this name.

getScale

  • getScale(): number
  • Returns number

    Unit size (in pixel) in the window's bounds.

getStyle

  • Returns Style

    Object containing current style of the window.

getStyleSafe

  • since: 3.1.0b126

    Returns Style

invalidateAllContent

  • invalidateAllContent(): void
  • Returns void

invalidateBackground

  • invalidateBackground(): void
  • Returns void

invalidateDrawing

  • invalidateDrawing(onCurrentThread: boolean): void
  • Forces ui drawables of the window to refresh.


    Parameters

    • onCurrentThread: boolean

      if true, the drawables will be refreshed immediately, otherwise refresh event will be posted; ensure you are in the UI thread if you pass true as the parameter

    Returns void

invalidateElements

  • invalidateElements(onCurrentThread: boolean): void
  • Forces ui elements of the window to refresh.


    Parameters

    • onCurrentThread: boolean

      if true, the drawables will be refreshed immediately, otherwise refresh event will be posted; ensure you are in the UI thread if you pass true as the parameter

    Returns void

invalidateForeground

  • invalidateForeground(): void
  • Returns void

isBlockingBackground

  • isBlockingBackground(): boolean
  • Returns boolean

    true if window blocks background.

isDynamic

  • isDynamic(): boolean
  • Returns boolean

    true if the window can change it's contents position.

isInventoryNeeded

  • isInventoryNeeded(): boolean
  • Returns boolean

    true if the window has an inventory that should be updated.

isNotFocusable

  • isNotFocusable(): boolean
  • Returns boolean

    true if the window is game overlay, false otherwise.

isOpened

  • isOpened(): boolean
  • Returns boolean

    true if the window is opened, false otherwise.

isTouchable

  • isTouchable(): boolean
  • Returns boolean

    true if the window is touchable, false otherwise.

onBackPressed

  • onBackPressed(): boolean
  • Returns boolean

    Whether the window can be closed on pressing back navigation button.

open

  • open(): void
  • Opens window without container.


    Returns void

postBackgroundRefresh

  • postBackgroundRefresh(): void
  • Returns void

postElementRefresh

  • postElementRefresh(): void
  • Returns void

postOpen

  • postOpen(): void
  • Returns void

preOpen

  • preOpen(): void
  • Returns void

putProperty

  • putProperty<T>(name: string, value: T): void
  • Sets custom property value.


    Type parameters

    • T

    Parameters

    • name: string

      custom property name

    • value: T

      custom property value

    Returns void

removeAdjacentWindow

  • removeAdjacentWindow(window: Window): void
  • Removes adjacent window from the adjacent windows list.


    Parameters

    • window: Window

      another window that was added as adjacent

    Returns void

runCachePreparation

  • runCachePreparation(async: boolean): void
  • Parameters

    • async: boolean

    Returns void

setAsGameOverlay

  • setAsGameOverlay(inGameOverlay: boolean): void
  • Allows window to be displayed as game overlay without blocking Minecraft sounds. Note that this drops window's FPS.


    Parameters

    • inGameOverlay: boolean

      if true, the window is opened in PopupWindow to avoid blocking Minecraft sounds

    Returns void

setBackgroundColor

  • setBackgroundColor(color: number): void
  • Set background color of window.


    Parameters

    • color: number

      integer color value (you can specify it using hex value)

    Returns void

setBlockingBackground

  • setBlockingBackground(blockingBackground: boolean): void
  • Specifies whether the window should darken and block background.


    Parameters

    • blockingBackground: boolean

      pass true if you want the window to block background

    Returns void

setCloseOnBackPressed

  • setCloseOnBackPressed(val: boolean): void
  • Gives the property to be closed on pressing back navigation button to the given window.


    Parameters

    • val: boolean

    Returns void

setContainer

  • Sets container for the current window. Be careful when calling it manually. You should prefer opening the window via it. UI.Container.openAs call


    Parameters

    Returns void

setContent

  • Specifies the content of the window.


    Parameters

    Returns void

setDebugEnabled

  • setDebugEnabled(enabled: boolean): void
  • Turns debug mode for the window on and off.


    Parameters

    • enabled: boolean

      if true, additional debug information will be drawn on the window canvas

    Returns void

setDynamic

  • setDynamic(dynamic: boolean): void
  • Parameters

    • dynamic: boolean

      specify true, if the window contains dynamic (animated) elements, false otherwise. By default all windows are dynamic. Make them static for better performance

    Returns void

setEventListener

  • Sets listener to be notified about window opening/closing events.


    Parameters

    Returns void

setInventoryNeeded

  • setInventoryNeeded(inventoryNeeded: boolean): void
  • Parameters

    • inventoryNeeded: boolean

      specify true if the window requires player's inventory

    Returns void

setParentWindow

  • setParentWindow(parent: IWindow): void
  • Sets any window as current window's parent. If current window closes, parent window closes too.


    Parameters

    • parent: IWindow

      window to be used as parent window for the current window.

    Returns void

setStyle

  • Overrides style properties of the current style by the values specified in the style parameter.


    Parameters

    • style: BindingSet

      js object where keys represent binding names and values represent texture gui names

    Returns void

setTouchable

  • setTouchable(touchable: boolean): void
  • Specifies whether touch events should be handled by this window or passed to underlying windows (to the game). By default all windows are touchable.


    Parameters

    • touchable: boolean

      pass true if the window should handle touch events, false otherwise

    Returns void

updateScrollDimensions

  • updateScrollDimensions(): void
  • since: 2.2.1b96

    Returns void

updateWindowLocation

  • updateWindowLocation(): void
  • Returns void

updateWindowPositionAndSize

  • updateWindowPositionAndSize(): void
  • since: 2.2.1b96

    Returns void