Photon Fusion 2.0.0

Public Member Functions | Public Attributes | Properties | List of all members
NetworkButtons Struct Reference

Represents a set of buttons that can be networked. More...

Inherits INetworkStruct, and IEquatable< NetworkButtons >.

Public Member Functions

bool Equals (NetworkButtons other)
 Determines whether the specified NetworkButtons is equal to the current NetworkButtons.
 
override bool Equals (object obj)
 Determines whether the specified object is equal to the current NetworkButtons.
 
override int GetHashCode ()
 Serves as the default hash function.
 
NetworkButtons GetPressed (NetworkButtons previous)
 Gets the buttons that were pressed since the previous state.
 
NetworkButtons GetPressedOrReleased (NetworkButtons previous)
 
NetworkButtons GetReleased (NetworkButtons previous)
 Gets the buttons that were released since the previous state.
 
bool IsSet (int button)
 Checks if the button at the specified index is set.
 
bool IsSet< T > (T button)
 Checks if the button of the specified enum type is set.
 
 NetworkButtons (int buttons)
 Initializes a new instance of the NetworkButtons struct with the specified buttons state.
 
void Set (int button, bool state)
 Sets the button at the specified index to the specified state.
 
void Set< T > (T button, bool state)
 Sets the button of the specified enum type to the specified state.
 
void SetAllDown ()
 Sets all buttons to down.
 
void SetAllUp ()
 Sets all buttons to up.
 
void SetDown (int button)
 Sets the button at the specified index to down.
 
void SetDown< T > (T button)
 Sets the button of the specified enum type to down.
 
void SetUp (int button)
 Sets the button at the specified index to up.
 
void SetUp< T > (T button)
 Sets the button of the specified enum type to up.
 
bool WasPressed (NetworkButtons previous, int button)
 Checks if the button at the specified index was pressed since the previous state.
 
bool WasPressed< T > (NetworkButtons previous, T button)
 Checks if the button of the specified enum type was pressed since the previous state.
 
bool WasReleased (NetworkButtons previous, int button)
 Checks if the button at the specified index was released since the previous state.
 
bool WasReleased< T > (NetworkButtons previous, T button)
 Checks if the button of the specified enum type was released since the previous state.
 

Public Attributes

int _bits
 
 NetworkButtons
 Gets the buttons that were pressed or released since the previous state.
 

Properties

int Bits [get]
 Gets the bits representing the state of the buttons.
 

Detailed Description

Represents a set of buttons that can be networked.

Constructor & Destructor Documentation

◆ NetworkButtons()

NetworkButtons ( int  buttons)

Initializes a new instance of the NetworkButtons struct with the specified buttons state.

Parameters
buttonsThe integer representing the state of the buttons.

Member Function Documentation

◆ Equals() [1/2]

bool Equals ( NetworkButtons  other)

Determines whether the specified NetworkButtons is equal to the current NetworkButtons.

Parameters
otherThe NetworkButtons to compare with the current NetworkButtons.
Returns
true if the specified NetworkButtons is equal to the current NetworkButtons; otherwise, false.

◆ Equals() [2/2]

override bool Equals ( object  obj)

Determines whether the specified object is equal to the current NetworkButtons.

Parameters
objThe object to compare with the current NetworkButtons.
Returns
true if the specified object is equal to the current NetworkButtons; otherwise, false.

◆ GetHashCode()

override int GetHashCode ( )

Serves as the default hash function.

Returns
A hash code for the current NetworkButtons.

◆ GetPressed()

NetworkButtons GetPressed ( NetworkButtons  previous)

Gets the buttons that were pressed since the previous state.

Parameters
previousThe previous state of the buttons.
Returns
The buttons that were pressed.

◆ GetReleased()

NetworkButtons GetReleased ( NetworkButtons  previous)

Gets the buttons that were released since the previous state.

Parameters
previousThe previous state of the buttons.
Returns
The buttons that were released.

◆ IsSet()

bool IsSet ( int  button)

Checks if the button at the specified index is set.

Parameters
buttonThe index of the button to check.
Returns
true if the button is set; otherwise, false.

◆ IsSet< T >()

bool IsSet< T > ( button)

Checks if the button of the specified enum type is set.

Template Parameters
TThe enum type of the button.
Parameters
buttonThe button of type T to check.
Returns
true if the button is set; otherwise, false.
Type Constraints
T :unmanaged 
T :Enum 

◆ Set()

void Set ( int  button,
bool  state 
)

Sets the button at the specified index to the specified state.

Parameters
buttonThe index of the button to set.
stateThe state to set the button to.

◆ Set< T >()

void Set< T > ( button,
bool  state 
)

Sets the button of the specified enum type to the specified state.

Template Parameters
TThe enum type of the button.
Parameters
buttonThe button of type T to set.
stateThe state to set the button to.
Type Constraints
T :unmanaged 
T :Enum 

◆ SetDown()

void SetDown ( int  button)

Sets the button at the specified index to down.

Parameters
buttonThe index of the button to set to down.

◆ SetDown< T >()

void SetDown< T > ( button)

Sets the button of the specified enum type to down.

Template Parameters
TThe enum type of the button.
Parameters
buttonThe button of type T to set to down.
Type Constraints
T :unmanaged 
T :Enum 

◆ SetUp()

void SetUp ( int  button)

Sets the button at the specified index to up.

Parameters
buttonThe index of the button to set to up.

◆ SetUp< T >()

void SetUp< T > ( button)

Sets the button of the specified enum type to up.

Template Parameters
TThe enum type of the button.
Parameters
buttonThe button of type T to set to up.
Type Constraints
T :unmanaged 
T :Enum 

◆ WasPressed()

bool WasPressed ( NetworkButtons  previous,
int  button 
)

Checks if the button at the specified index was pressed since the previous state.

Parameters
previousThe previous state of the buttons.
buttonThe index of the button to check.
Returns
true if the button was pressed; otherwise, false.

◆ WasPressed< T >()

bool WasPressed< T > ( NetworkButtons  previous,
button 
)

Checks if the button of the specified enum type was pressed since the previous state.

Template Parameters
TThe enum type of the button.
Parameters
previousThe previous state of the buttons.
buttonThe button of type T to check.
Returns
true if the button was pressed; otherwise, false.
Type Constraints
T :unmanaged 
T :Enum 

◆ WasReleased()

bool WasReleased ( NetworkButtons  previous,
int  button 
)

Checks if the button at the specified index was released since the previous state.

Parameters
previousThe previous state of the buttons.
buttonThe index of the button to check.
Returns
true if the button was released; otherwise, false.

◆ WasReleased< T >()

bool WasReleased< T > ( NetworkButtons  previous,
button 
)

Checks if the button of the specified enum type was released since the previous state.

Template Parameters
TThe enum type of the button.
Parameters
previousThe previous state of the buttons.
buttonThe button of type T to check.
Returns
true if the button was released; otherwise, false.
Type Constraints
T :unmanaged 
T :Enum 

Member Data Documentation

◆ NetworkButtons

Gets the buttons that were pressed or released since the previous state.

Parameters
previousThe previous state of the buttons.
Returns
A tuple containing the buttons that were pressed and the buttons that were released.