DocFX + Singulink = ♥

Class PlayerData<TValue>

Stores per-player variables.

Inheritance
object
Data
Data<PlayerState, TValue>
PlayerData<TValue>
Inherited Members
Data<PlayerState, TValue>.Get(SlugBaseCharacter, PlayerState)
Data.TryUnbox<T>(StrongBox<T>, out T)
Data.RequiredFeature
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SlugBase.Features
Assembly: SlugBase.dll
Syntax
public class PlayerData<TValue> : Data<PlayerState, TValue> where TValue : new()
Type Parameters
Name Description
TValue

The type of data stored.

Constructors

View Source

PlayerData(Feature)

Creates a new per-player variable that depends on requiredFeature.

Declaration
public PlayerData(Feature requiredFeature)
Parameters
Type Name Description
Feature requiredFeature

The required Feature, or null if data access should not be locked behind a feature.

Methods

View Source

Get(Player)

Gets the TValue instance assocated with player, constructing it if it does not exist.

If the game's SlugBaseCharacter does not have RequiredFeature, then null is returned.

Declaration
public StrongBox<TValue> Get(Player player)
Parameters
Type Name Description
Player player

The player the variable is associated with.

Returns
Type Description
StrongBox<TValue>
View Source

Get(PlayerState)

Gets the TValue instance assocated with state, constructing it if it does not exist.

If the game's SlugBaseCharacter does not have RequiredFeature, then null is returned.

Declaration
public StrongBox<TValue> Get(PlayerState state)
Parameters
Type Name Description
PlayerState state

The player state the variable is associated with.

Returns
Type Description
StrongBox<TValue>
View Source

TryGet(Player, out TValue)

Gets the TValue instance assocated with player, constructing it if it does not exist.

Declaration
public bool TryGet(Player player, out TValue value)
Parameters
Type Name Description
Player player

The player the variable is associated with.

TValue value

The stored value, or TValue's default value if the required feature wasn't found.

Returns
Type Description
bool

true if the player's SlugBaseCharacter had RequiredFeature, false otherwise.

View Source

TryGet(PlayerState, out TValue)

Gets the TValue instance assocated with state, constructing it if it does not exist.

Declaration
public bool TryGet(PlayerState state, out TValue value)
Parameters
Type Name Description
PlayerState state

The player state the variable is associated with.

TValue value

The stored value, or TValue's default value if the required feature wasn't found.

Returns
Type Description
bool

true if the player's SlugBaseCharacter had RequiredFeature, false otherwise.