Struct PlayerColor

Namespace
Unity.Multiplayer.Core

A player's chosen colour as 8-bit RGBA, engine-free so Core can carry it in the approval payload. The adapter converts it to and from UnityEngine.Color32.

public readonly struct PlayerColor : IEquatable<PlayerColor>
Implements
Inherited Members

Constructors

PlayerColor(byte, byte, byte, byte)

Builds a colour from its channels; alpha defaults to opaque.

public PlayerColor(byte r, byte g, byte b, byte a = 255)

Parameters

r byte
g byte
b byte
a byte

Properties

A

Alpha channel; 255 is opaque.

public byte A { get; }

Property Value

byte

B

Blue channel.

public byte B { get; }

Property Value

byte

G

Green channel.

public byte G { get; }

Property Value

byte

R

Red channel.

public byte R { get; }

Property Value

byte

White

Opaque white.

public static PlayerColor White { get; }

Property Value

PlayerColor

Methods

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Equals(PlayerColor)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(PlayerColor other)

Parameters

other PlayerColor

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

FromRgba32(uint)

Unpacks a 0xRRGGBBAA value.

public static PlayerColor FromRgba32(uint rgba)

Parameters

rgba uint

Returns

PlayerColor

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToRgba32()

Packs the colour as 0xRRGGBBAA.

public uint ToRgba32()

Returns

uint

ToString()

#RRGGBBAA in upper-case hex.

public override string ToString()

Returns

string

Operators

operator ==(PlayerColor, PlayerColor)

Equality.

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

Parameters

left PlayerColor
right PlayerColor

Returns

bool

operator !=(PlayerColor, PlayerColor)

Inequality.

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

Parameters

left PlayerColor
right PlayerColor

Returns

bool