DocFX + Singulink = ♥

Class PlayerFeature<T>

A constant setting of a SlugBaseCharacter's player.

Inheritance
object
Feature
Feature<T>
PlayerFeature<T>
Inherited Members
Feature<T>.TryGet(SlugBaseCharacter, out T)
Feature.ID
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 PlayerFeature<T> : Feature<T>
Type Parameters
Name Description
T

The type that stores this setting's information

Constructors

View Source

PlayerFeature(string, Func<JsonAny, T>)

Creates a new PlayerFeature<T> with the given id.

Declaration
public PlayerFeature(string id, Func<JsonAny, T> factory)
Parameters
Type Name Description
string id

The JSON key.

Func<JsonAny, T> factory

A delegate that parses JsonAny into T. An exception should be thrown on failure.

Methods

View Source

TryGet(Player, out T)

Gets the T instance assocated with player.

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

A Player instance that may be a SlugBaseCharacter with this Feature.

T value

The stored setting, or T's default value if the feature wasn't found.

Returns
Type Description
bool

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