Table of Contents

Struct GameEventButtonPosition

Namespace
Hi3Helper.Plugin.Core.UI.Controls
Assembly
Hi3Helper.Plugin.Core.dll

Represents the position and size of a game event button within a canvas, including its horizontal and vertical alignment, position, icon size, and background frame size.

public struct GameEventButtonPosition : IEquatable<GameEventButtonPosition>
Implements
Inherited Members
Extension Methods

Constructors

GameEventButtonPosition()

public GameEventButtonPosition()

GameEventButtonPosition(int, HorizontalAlignment, VerticalAlignment, DoublePosition, DoubleSize, DoubleSize)

Initializes a new instance of the GameEventButtonPosition struct with the specified version, horizontal alignment, vertical alignment, position, icon size, and frame size.

public GameEventButtonPosition(int version, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, DoublePosition position, DoubleSize iconSize, DoubleSize frameSize)

Parameters

version int

The version of the game event button position.

horizontalAlignment HorizontalAlignment

The horizontal alignment of the game event button.

verticalAlignment VerticalAlignment

The vertical alignment of the game event button.

position DoublePosition

The position of the game event button within the canvas.

iconSize DoubleSize

The size of the game event button's icon.

frameSize DoubleSize

The size of the background frame.

Fields

Version

public readonly int Version

Field Value

int

_frameSize

public DoubleSize _frameSize

Field Value

DoubleSize

_horizontalAlignment

public HorizontalAlignment _horizontalAlignment

Field Value

HorizontalAlignment

_iconSize

public DoubleSize _iconSize

Field Value

DoubleSize

_position

public DoublePosition _position

Field Value

DoublePosition

_verticalAlignment

public VerticalAlignment _verticalAlignment

Field Value

VerticalAlignment

Properties

Default

Gets the default GameEventButtonPosition instance with predefined values for miHoYo/HoYoverse game event button position in HoYoPlay Launcher.

public static GameEventButtonPosition Default { get; }

Property Value

GameEventButtonPosition

Empty

Gets an empty GameEventButtonPosition instance with all fields set to their default values (sets to 0).

public static GameEventButtonPosition Empty { get; }

Property Value

GameEventButtonPosition

FrameSize

Gets the size of the background canvas.

public DoubleSize FrameSize { get; init; }

Property Value

DoubleSize

HorizontalAlignment

Gets the horizontal alignment of the game event button.

[JsonConverter(typeof(JsonStringEnumConverter<HorizontalAlignment>))]
public HorizontalAlignment HorizontalAlignment { get; init; }

Property Value

HorizontalAlignment

IconSize

Gets the size of the game event button's icon, defined by its width and height. The width or height can be set to NaN to automatically adjust its size based on respecting aspect ratio.

public DoubleSize IconSize { get; init; }

Property Value

DoubleSize

IsEmpty

Whether the GameEventButtonPosition is empty and all the fields are set to default values.

[JsonIgnore]
public bool IsEmpty { get; }

Property Value

bool

Position

Gets the position of the game event button within the canvas, defined by its left, top, right, and bottom coordinates respecting the background's FrameSize. This property, though, can be referred as margin of the button.

public DoublePosition Position { get; init; }

Property Value

DoublePosition

VerticalAlignment

Gets the vertical alignment of the game event button.

[JsonConverter(typeof(JsonStringEnumConverter<VerticalAlignment>))]
public VerticalAlignment VerticalAlignment { get; init; }

Property Value

VerticalAlignment

Methods

Equals(GameEventButtonPosition)

Determines whether the specified GameEventButtonPosition is equal to the current instance by comparing all its fields.

public bool Equals(GameEventButtonPosition other)

Parameters

other GameEventButtonPosition

The GameEventButtonPosition to compare with the current instance.

Returns

bool

true if the specified GameEventButtonPosition is equal to the current instance; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current instance by checking if it is a GameEventButtonPosition and then comparing all its fields.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if the specified object is a GameEventButtonPosition and is equal to the current instance; otherwise, false.

GetHashCode()

Returns a hash code for the current instance by combining the hash codes of all its fields.

public override int GetHashCode()

Returns

int

A hash code for the current instance.

Operators

operator ==(GameEventButtonPosition, GameEventButtonPosition)

Determines whether two specified GameEventButtonPosition instances are equal by comparing all their fields.

public static bool operator ==(GameEventButtonPosition left, GameEventButtonPosition right)

Parameters

left GameEventButtonPosition

The first GameEventButtonPosition to compare.

right GameEventButtonPosition

The second GameEventButtonPosition to compare.

Returns

bool

true if the two GameEventButtonPosition instances are equal; otherwise, false.

operator !=(GameEventButtonPosition, GameEventButtonPosition)

Determines whether two specified GameEventButtonPosition instances are not equal by comparing all their fields.

public static bool operator !=(GameEventButtonPosition left, GameEventButtonPosition right)

Parameters

left GameEventButtonPosition

The first GameEventButtonPosition to compare.

right GameEventButtonPosition

The second GameEventButtonPosition to compare.

Returns

bool

true if the two GameEventButtonPosition instances are not equal; otherwise, false.