Class PlayerColors
- Namespace
- Unity.Multiplayer.Core
Player colours (UM-T55): the palette every MindAttic game offers, the colour a player who never picked one is drawn
in (their seat's palette colour, so neighbours differ), and the format a colour change must have. Engine-free so
dotnet test covers it; the adapter and the front end convert to Unity colours.
public static class PlayerColors
- Inheritance
-
PlayerColors
- Inherited Members
Properties
Palette
Eight opaque colours that stay distinct from one another and readable on dark and light backgrounds (the same palette Unity.Shared picks a default from), in seat order.
public static IReadOnlyList<PlayerColor> Palette { get; }
Property Value
PaletteNames
The names of Palette's colours, in order.
public static IReadOnlyList<string> PaletteNames { get; }
Property Value
Methods
ForSeat(int)
The palette colour for seat seat (wrapping round after eight).
public static PlayerColor ForSeat(int seat)
Parameters
seatint
Returns
IsUnset(PlayerColor)
True when color means "not picked": opaque white (White, what a
PlayerIdentity carries by default) or fully transparent.
public static bool IsUnset(PlayerColor color)
Parameters
colorPlayerColor
Returns
NearestPaletteIndex(PlayerColor)
The index of the palette colour nearest color.
public static int NearestPaletteIndex(PlayerColor color)
Parameters
colorPlayerColor
Returns
Resolve(PlayerColor, int)
The colour a player in seat seat is drawn in: chosen made opaque, or the
seat's palette colour when they never picked one (IsUnset(PlayerColor)).
public static PlayerColor Resolve(PlayerColor chosen, int seat)
Parameters
chosenPlayerColorseatint
Returns
ToHex(PlayerColor)
color as #RRGGBB (alpha left out), upper case.
public static string ToHex(PlayerColor color)
Parameters
colorPlayerColor
Returns
TryParse(string, out PlayerColor)
Reads #RRGGBB or #RRGGBBAA (the # optional, any case). False for anything else.
public static bool TryParse(string text, out PlayerColor color)
Parameters
textstringcolorPlayerColor
Returns
Validate(PlayerColor)
Why color cannot be a player's colour (it must be opaque), or null when it can.
public static string Validate(PlayerColor color)
Parameters
colorPlayerColor