Class Overlay
- Namespace
- UILib
- Assembly
- UILib.dll
A primitive UIObject which stays in a fixed position on the screen.
public class Overlay : UIObject
- Inheritance
-
Overlay
- Derived
- Inherited Members
Constructors
Overlay(float, float)
Initializes an overlay.
By default overlays will pause the game when shown. If you want to disable this behaviour see SetLockMode(LockMode).
public Overlay(float width, float height)
Parameters
Properties
canvas
This overlay's canvas.
public Canvas canvas { get; }
Property Value
enabled
Whether the user can interact with this overlay.
public bool enabled { get; }
Property Value
isFocused
Whether this overlay is currently focused. If the overlay is focused, it means that it can receive local shortcuts.
public bool isFocused { get; }
Property Value
lockMode
The lock modes this overlay will automatically use when it's visible.
public LockMode lockMode { get; }
Property Value
onFocus
Invokes listeners when this overlay becomes focused.
public UIEvent onFocus { get; }
Property Value
onLostFocus
Invokes listeners when this overlay loses focus.
public UIEvent onLostFocus { get; }
Property Value
sortingMode
The sorting mode this overlay is currently in.
public Overlay.SortingMode sortingMode { get; }
Property Value
Methods
AddCanvasGroup()
Creates a canvas group for customising opacity.
protected void AddCanvasGroup()
AddFade()
Creates a fade behaviour to fade in/out.
protected void AddFade()
AddShortcut(Shortcut)
Adds a local Shortcut to this overlay.
Local shortcuts are triggered whenever all keys configured in the shortcut are pressed.
Local shortcuts only trigger when
the Overlay they're added to is
currently in focus.
public void AddShortcut(Shortcut shortcut)
Parameters
shortcutShortcutThe shortcut to add
BringToFront()
Brings this overlay to the front so that it displays above all others.
If the sorting mode is Recede, this will only cause the overlay to become focused. It won't move to the front.
public void BringToFront()
Destroy()
Destroy this overlay and all children.
public override void Destroy()
Disable()
Disables interacting with this overlay.
public virtual void Disable()
Enable()
Enables interacting with this overlay.
public virtual void Enable()
Hide(bool)
Hides this overlay.
If you force hiding this overlay, the attached ease group will be forced to ease all the way out immediately.
public override void Hide(bool force)
Parameters
forceboolWhether to force hiding this overlay
OnClick()
Bring this overlay's canvas to the front.
protected override void OnClick()
OnHide()
Runs when this overlay finishes hiding itself. This will run after the ease group finishes easing out.
protected override void OnHide()
OnPointerEnter()
Handles this overlay being hovered over.
protected override void OnPointerEnter()
OnPointerExit()
Handles this overlay no longer being hovered over.
protected override void OnPointerExit()
SetLockMode(LockMode)
Sets the lock mode this overlay will use when it's visible.
If the overlay is currently visible, the provided lock mode will apply immediately.
public void SetLockMode(LockMode lockMode)
Parameters
lockModeLockModeThe lock mode to use
SetSortingMode(SortingMode)
Sets the sorting mode this overlay is currently in
public void SetSortingMode(Overlay.SortingMode sortingMode)
Parameters
sortingModeOverlay.SortingModeThe new sorting mode to use
SetThisTheme(Theme)
Allows setting the theme of this overlay.
This handles setting the theme specifically for this object, not its children. It's protected to allow overriding if you were to create a subclass.
In most cases, you'd probably want to use SetTheme(Theme) instead.
protected override void SetThisTheme(Theme theme)
Parameters
themeThemeThe theme to apply
Show(bool)
Shows this overlay.
If you force showing this overlay, the attached ease group will be forced to ease all the way in immediately.
public override void Show(bool force)
Parameters
forceboolWhether to force showing this overlay