Class GuiDialog
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
public abstract class GuiDialog : IDisposable
- Inheritance
-
GuiDialog
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
GuiDialog(ICoreClientAPI)
Constructor for the GUIDialogue.
public GuiDialog(ICoreClientAPI capi)
Parameters
capi
ICoreClientAPIThe Client API.
Fields
Composers
The Instance of Dialogue Composer for this GUIDialogue.
public GuiDialog.DlgComposers Composers
Field Value
MouseOverCursor
public string MouseOverCursor
Field Value
capi
protected ICoreClientAPI capi
Field Value
focused
protected bool focused
Field Value
ignoreNextKeyPress
public bool ignoreNextKeyPress
Field Value
opened
protected bool opened
Field Value
Properties
DebugName
Debug name. For debugging purposes.
public virtual string DebugName { get; }
Property Value
DialogType
Is this dialogue a dialogue or a HUD object?
public virtual EnumDialogType DialogType { get; }
Property Value
DisableMouseGrab
Gets whether ability to grab the mouse cursor is disabled while this dialog is opened. For example, the escape menu. (Default: false)
public virtual bool DisableMouseGrab { get; }
Property Value
DrawOrder
0 = draw first, 1 = draw last. Used to enforce tooltips and held itemstack always drawn last to be visible.
Vanilla dialogs draw order:
Name tags: -0.1
Chat dialog: 0
Block Interaction help: 0.05
Worldmap HUD: 0.07
Default value for most other dialogs: 0.1
Worldmap Dialog: 0.11
Player and Chest inventories: 0.2
Various config/edit dialogs: 0.2
Handbook: 0.2
Escape menu: 0.89
public virtual double DrawOrder { get; }
Property Value
Focusable
Can this dialog be focused?
public virtual bool Focusable { get; }
Property Value
Focused
Is the dialogue currently in focus?
public virtual bool Focused { get; }
Property Value
InputOrder
Determines the order on which dialog receives keyboard input first when the dialog is opened. 0 = handle inputs first, 9999 = handle inputs last.
Reference list:
0: Escape menu
0.5 (default): tick profiler, selection box editor, macro editor, survival&creative inventory, first launch info dialog, dead dialog, character dialog, etc.
1: hotbar
1.1: chat dialog
public virtual double InputOrder { get; }
Property Value
PrefersUngrabbedMouse
Gets whether it is preferred for the mouse to be not grabbed while this dialog is opened. If true (default), the Alt button needs to be held to manually grab the mouse.
public virtual bool PrefersUngrabbedMouse { get; }
Property Value
SingleComposer
A single composer for this GUIDialogue.
public GuiComposer SingleComposer { get; set; }
Property Value
ToggleKeyCombinationCode
The key combination string that toggles this GUI object.
public abstract string ToggleKeyCombinationCode { get; }
Property Value
UnregisterOnClose
Should this dialogue de-register itself once it's closed? (Defaults to no)
public virtual bool UnregisterOnClose { get; }
Property Value
ZSize
The amount of depth required for this dialog. Default is 150. Required for correct z-ordering of dialogs.
public virtual float ZSize { get; }
Property Value
Methods
CaptureAllInputs()
Should this dialog (e.g. textbox) capture all the keyboard events except for escape.
public virtual bool CaptureAllInputs()
Returns
CaptureRawMouse()
Should this dialog capture the raw mouse button clicks - useful for example for the settings menu itself (in case the user has unset them or set them to something crazy)
public virtual bool CaptureRawMouse()
Returns
ClearComposers()
Clears the composers.
public void ClearComposers()
Dispose()
Disposes the Dialog.
public virtual void Dispose()
Focus()
Focuses the dialog
public virtual void Focus()
FreePos(string, EnumPosFlag)
public void FreePos(string code, GuiDialog.EnumPosFlag pos)
Parameters
code
stringpos
GuiDialog.EnumPosFlag
GetFreePos(string)
public GuiDialog.EnumPosFlag GetFreePos(string code)
Parameters
code
string
Returns
IsInRangeOf(Vec3d)
Checks if the player is in range (pickingrange) of the given position
public virtual bool IsInRangeOf(Vec3d pos)
Parameters
pos
Vec3d
Returns
- bool
In range or no?
IsOpened()
Is this dialogue opened?
public virtual bool IsOpened()
Returns
- bool
Whether this dialogue is opened or not.
IsOpened(string)
Is this dialogue opened in the given context?
public virtual bool IsOpened(string dialogComposerName)
Parameters
dialogComposerName
stringThe composer context.
Returns
- bool
Whether this dialogue was opened or not within the given context.
IsRight(EnumPosFlag)
protected bool IsRight(GuiDialog.EnumPosFlag flag)
Parameters
flag
GuiDialog.EnumPosFlag
Returns
OccupyPos(string, EnumPosFlag)
public void OccupyPos(string code, GuiDialog.EnumPosFlag pos)
Parameters
code
stringpos
GuiDialog.EnumPosFlag
OnBeforeRenderFrame3D(float)
This runs before the render. Local update method.
public virtual void OnBeforeRenderFrame3D(float deltaTime)
Parameters
deltaTime
floatThe time that has elapsed.
OnBlockTexturesLoaded()
Makes this gui pop up once a pre-set given key combination is set.
public virtual void OnBlockTexturesLoaded()
OnEscapePressed()
Fires explicitly when the Escape key is pressed and attempts to close the dialogue.
public virtual bool OnEscapePressed()
Returns
- bool
Whether the dialogue was closed.
OnFinalizeFrame(float)
This runs when the dialogue is finalizing and cleaning up all of the components.
public virtual void OnFinalizeFrame(float dt)
Parameters
dt
floatThe time that has elapsed.
OnFocusChanged(bool)
protected virtual void OnFocusChanged(bool on)
Parameters
on
bool
OnGuiClosed()
Fires when the GUI is closed.
public virtual void OnGuiClosed()
OnGuiOpened()
Fires when the GUI is opened.
public virtual void OnGuiOpened()
OnKeyDown(KeyEvent)
Fires when keys are held down.
public virtual void OnKeyDown(KeyEvent args)
Parameters
args
KeyEventThe key or keys that were held down.
OnKeyPress(KeyEvent)
Fires when the keys are pressed.
public virtual void OnKeyPress(KeyEvent args)
Parameters
args
KeyEventThe key or keys that were pressed.
OnKeyUp(KeyEvent)
Fires when the keys are released.
public virtual void OnKeyUp(KeyEvent args)
Parameters
args
KeyEventthe key or keys that were released.
OnLevelFinalize()
public virtual void OnLevelFinalize()
OnMouseClickSlot(ItemSlot)
Fires when the mouse clicks within the slot.
public virtual bool OnMouseClickSlot(ItemSlot itemSlot)
Parameters
itemSlot
ItemSlotThe slot that the mouse clicked in.
Returns
- bool
Whether this event was handled.
OnMouseDown(MouseEvent)
Fires when a mouse button is held down.
public virtual void OnMouseDown(MouseEvent args)
Parameters
args
MouseEventThe mouse button or buttons in question.
OnMouseEnterSlot(ItemSlot)
Fires when the mouse enters the given slot.
public virtual bool OnMouseEnterSlot(ItemSlot slot)
Parameters
slot
ItemSlotThe slot the mouse entered.
Returns
- bool
Whether this event was handled.
OnMouseLeaveSlot(ItemSlot)
Fires when the mouse leaves the slot.
public virtual bool OnMouseLeaveSlot(ItemSlot itemSlot)
Parameters
itemSlot
ItemSlotThe slot the mouse entered.
Returns
- bool
Whether this event was handled.
OnMouseMove(MouseEvent)
Fires when the mouse is moved.
public virtual void OnMouseMove(MouseEvent args)
Parameters
args
MouseEventThe mouse movements in question.
OnMouseUp(MouseEvent)
Fires when a mouse button is released.
public virtual void OnMouseUp(MouseEvent args)
Parameters
args
MouseEventThe mouse button or buttons in question.
OnMouseWheel(MouseWheelEventArgs)
Fires when the mouse wheel is scrolled.
public virtual void OnMouseWheel(MouseWheelEventArgs args)
Parameters
args
MouseWheelEventArgs
OnOwnPlayerDataReceived()
public virtual void OnOwnPlayerDataReceived()
OnRenderGUI(float)
This runs when the dialogue is ready to render all of the components.
public virtual void OnRenderGUI(float deltaTime)
Parameters
deltaTime
floatThe time that has elapsed.
RequiresUngrabbedMouse()
[Obsolete("Use PrefersUngrabbedMouse instead")]
public virtual bool RequiresUngrabbedMouse()
Returns
ShouldReceiveKeyboardEvents()
A check for whether the dialogue should recieve keyboard events.
public virtual bool ShouldReceiveKeyboardEvents()
Returns
- bool
Whether the dialogue is focused or not.
ShouldReceiveMouseEvents()
A check if the dialogue should recieve mouse events.
public virtual bool ShouldReceiveMouseEvents()
Returns
- bool
Whether the mouse events should fire.
ShouldReceiveRenderEvents()
A check for whether the dialogue should recieve Render events.
public virtual bool ShouldReceiveRenderEvents()
Returns
- bool
Whether the dialogue is opened or not.
Toggle()
If the dialogue is opened, this attempts to close it. If the dialogue is closed, this attempts to open it.
public virtual void Toggle()
TryClose()
Attempts to close this dialogue- triggering the OnCloseDialogue event.
public virtual bool TryClose()
Returns
- bool
Was this dialogue successfully closed?
TryOpen()
Attempts to open this dialogue.
public virtual bool TryOpen()
Returns
- bool
Was this dialogue successfully opened?
TryOpen(bool)
public virtual bool TryOpen(bool withFocus)
Parameters
withFocus
bool
Returns
UnFocus()
Unfocuses the dialogue.
public virtual void UnFocus()
XOffsetMul(EnumPosFlag)
protected float XOffsetMul(GuiDialog.EnumPosFlag flag)
Parameters
flag
GuiDialog.EnumPosFlag
Returns
YOffsetMul(EnumPosFlag)
protected float YOffsetMul(GuiDialog.EnumPosFlag flag)
Parameters
flag
GuiDialog.EnumPosFlag
Returns
Events
OnClosed
The event fired when this dialogue is closed.
public event Action OnClosed
Event Type
OnOpened
The event fired when this dialogue is opened.
public event Action OnOpened