Class OnixModuleVisual
- Namespace
- OnixRuntime.Api.OnixClient
- Assembly
- OnixRuntime.dll
Represents a visual module for the Onix client.
public class OnixModuleVisual : OnixModule, IDisposable
- Inheritance
-
OnixModuleVisual
- Implements
- Derived
- Inherited Members
Constructors
OnixModuleVisual(string, string, Vec2, VisualAnchor, Vec2, string, bool)
Creates a new visual module for your plugin.
public OnixModuleVisual(string name, string description, Vec2 position, OnixModuleVisual.VisualAnchor visualAnchor, Vec2 initialSize, string saveName, bool register = true)
Parameters
name
stringThe display name of the module.
description
stringA description of the module's functionality.
position
Vec2The initial position of the module on screen.
visualAnchor
OnixModuleVisual.VisualAnchorThe anchoring position for the module.
initialSize
Vec2The initial size of the module.
saveName
stringThe name used to save module settings.
register
boolIndicates whether to register this module with the plugin system. Default is true.
Properties
Anchor
Gets or sets the current active anchor point for the visual module. This represents the actual anchor being used for positioning.
public OnixModuleVisual.VisualAnchor Anchor { get; set; }
Property Value
AnchorSetting
Gets or sets the configured anchor point setting for the visual module. This determines which part of the screen the module is attached to.
public OnixModuleVisual.VisualAnchor AnchorSetting { get; set; }
Property Value
Area
Gets or sets the rectangular area associated with the visual module.
public Rect Area { get; set; }
Property Value
Remarks
The area specifies the bounds of the visual module in terms of its position and dimensions. Setting this property updates the visual module's area, while getting it retrieves the current area.
ExpandDirection
Gets or sets the current active expansion direction for the visual module. This represents the actual direction being used for expansion.
public OnixModuleVisual.ModuleExpandDirection ExpandDirection { get; set; }
Property Value
ExpandDirectionSetting
Gets or sets the configured expansion direction setting for the visual module. This determines which way the module expands when its content changes size.
public OnixModuleVisual.ModuleExpandDirection ExpandDirectionSetting { get; set; }
Property Value
Position
Gets or sets the absolute position of the visual module on the screen.
public Vec2 Position { get; set; }
Property Value
RelativePosition
Gets or sets the position of the module relative to its anchor point.
public Vec2 RelativePosition { get; set; }
Property Value
ShouldHideInHudEditor
Gets whether the visual module should be hidden when the HUD editor is active.
public bool ShouldHideInHudEditor { get; }
Property Value
Size
Gets or sets the size/dimensions of the visual module.
public Vec2 Size { get; set; }
Property Value
Methods
OnRender(RendererCommon2D)
Called everytime the module is rendered. If you're lazy just add a listener in You could call it yourself, just make sure to check UsesLegacyRenderer to know when to call this on the Game(which you lost)'s renderer or the Direct2D renderer. This includes client UI, game UI, preview UI and whatever else the module will be asked to be rendered on. Which renderer you will get is based on use preference and UsesLegacyRenderer. If you have UsesLegacyRenderer set to true, you'll always get the Game's renderer. Otherwise, the default is the Direct2D renderer but the user could have disabled it, giving you the game's only. This callback will NEVER be logic, no touching gameplay objects. Gather that data elsewhere if you require it.
public virtual void OnRender(RendererCommon2D gfx)
Parameters
gfx
RendererCommon2DThe 2D renderer used to draw the current state.
Events
Render
public event OnixModuleVisual.RenderDelegate? Render