Struct PlayerColor
Represents a color that may copy from CustomColors.
Inherited Members
Namespace: SlugBase.DataTypes
Assembly: SlugBase.dll
Syntax
public readonly struct PlayerColor
Constructors
View SourcePlayerColor(JsonAny)
Creates a new PlayerColor from JSON.
Declaration
public PlayerColor(JsonAny json)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonAny | json | The JSON to load. |
PlayerColor(string)
Creates a new PlayerColor.
Declaration
public PlayerColor(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the custom color to copy. |
PlayerColor(Color)
Creates a new PlayerColor.
Declaration
public PlayerColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | The color to return. |
Fields
View SourceBody
The body color of SlugBaseCharacters.
Declaration
public static readonly PlayerColor Body
Field Value
| Type | Description |
|---|---|
| PlayerColor |
Eyes
The eye color of SlugBaseCharacters.
Declaration
public static readonly PlayerColor Eyes
Field Value
| Type | Description |
|---|---|
| PlayerColor |
Methods
View SourceGetColor(PlayerGraphics)
Gets the value of this color for a player.
Declaration
public Color? GetColor(PlayerGraphics playerGraphics)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerGraphics | playerGraphics | The player to get the color from. |
Returns
| Type | Description |
|---|---|
| Color? | The custom color, or |
GetCustomColor(PlayerGraphics, int)
Gets a color from the "custom_colors" feature by index for the given SlugBase character graphics.
Declaration
public static Color GetCustomColor(PlayerGraphics playerGraphics, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerGraphics | playerGraphics | The player graphics to get the color of. |
| int | index | The index of the custom color. |
Returns
| Type | Description |
|---|---|
| Color |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| IndexOutOfRangeException |
|
GetCustomColor(PlayerGraphics, string)
Gets a color from the "custom_colors" feature by name for the given SlugBase character graphics.
Declaration
public static Color GetCustomColor(PlayerGraphics playerGraphics, string name)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerGraphics | playerGraphics | The player graphics to get the color of. |
| string | name | The name of the custom color. |
Returns
| Type | Description |
|---|---|
| Color |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| KeyNotFoundException | No custom color was found matching |