Show / Hide Table of Contents

Class PieceManager

Manager for handling custom pieces added to the game.
Inheritance
System.Object
PieceManager
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Jotunn.Managers
Assembly: Jotunn.dll
Syntax
public class PieceManager : IManager

Properties

| Improve this Doc View Source

Instance

The singleton instance of this manager.
Declaration
public static PieceManager Instance { get; }
Property Value
Type Description
PieceManager

Methods

| Improve this Doc View Source

AddPiece(CustomPiece)

Add a CustomPiece to the game.
Checks if the custom piece is valid and unique and adds it to the list of custom pieces.
Custom pieces are added to their respective s after .
Declaration
public bool AddPiece(CustomPiece customPiece)
Parameters
Type Name Description
CustomPiece customPiece The custom piece to add.
Returns
Type Description
System.Boolean true if the custom piece was added to the manager.
| Improve this Doc View Source

AddPieceCategory(String, String)

Add a new by name. A new category gets assigned a random integer for internal use. If you pass a vanilla category the actual integer value of the enum is returned.
Declaration
public Piece.PieceCategory AddPieceCategory(string table, string name)
Parameters
Type Name Description
System.String table Prefab or item name of the PieceTable.
System.String name Name of the category.
Returns
Type Description
Piece.PieceCategory int value of the vanilla or custom category
| Improve this Doc View Source

AddPieceTable(GameObject)

Add a new from .
Creates a CustomPieceTable and adds it to the manager.
Declaration
[Obsolete("Use CustomPieceTable instead")]
public void AddPieceTable(GameObject prefab)
Parameters
Type Name Description
GameObject prefab The to add.
| Improve this Doc View Source

AddPieceTable(CustomPieceTable)

Add a CustomPieceTable to the game.
Checks if the custom piece table is valid and unique and adds it to the list of custom piece tables.
Declaration
public bool AddPieceTable(CustomPieceTable customPieceTable)
Parameters
Type Name Description
CustomPieceTable customPieceTable The custom piece table to add.
Returns
Type Description
System.Boolean true if the custom piece table was added to the manager.
| Improve this Doc View Source

AddPieceTable(String)

Add a new from string.
Creates a CustomPieceTable and adds it to the manager.
Declaration
[Obsolete("Use CustomPieceTable instead")]
public void AddPieceTable(string name)
Parameters
Type Name Description
System.String name Name of the new piece table.
| Improve this Doc View Source

GetPiece(String)

Get a custom piece by its name.
Declaration
public CustomPiece GetPiece(string pieceName)
Parameters
Type Name Description
System.String pieceName Name of the piece to search.
Returns
Type Description
CustomPiece
| Improve this Doc View Source

GetPieceCategories()

Get a list of all custom piece category names
Declaration
public List<string> GetPieceCategories()
Returns
Type Description
System.Collections.Generic.List<System.String>
| Improve this Doc View Source

GetPieceTable(String)

Get a by name.

Search hierarchy:
Declaration
public PieceTable GetPieceTable(string name)
Parameters
Type Name Description
System.String name Prefab or item name of the PieceTable
Returns
Type Description
PieceTable component
| Improve this Doc View Source

Init()

Creates the piece table container and registers all hooks.
Declaration
public void Init()
| Improve this Doc View Source

RegisterPieceInPieceTable(GameObject, String, String)

Register a single piece prefab into a piece table by name.
Also adds the prefab to the PrefabManager and if necessary.
Custom categories can be referenced if they have been added to the manager before.
No mock references are fixed.
Declaration
public void RegisterPieceInPieceTable(GameObject prefab, string pieceTable, string category = null)
Parameters
Type Name Description
GameObject prefab with a component to add to the table
System.String pieceTable Prefab or item name of the PieceTable
System.String category Optional category string, does not create new custom categories
| Improve this Doc View Source

RemovePiece(CustomPiece)

Remove a custom piece by its ref.
Declaration
public void RemovePiece(CustomPiece piece)
Parameters
Type Name Description
CustomPiece piece CustomPiece to remove.
| Improve this Doc View Source

RemovePiece(String)

Remove a custom piece by its name.
Declaration
public void RemovePiece(string pieceName)
Parameters
Type Name Description
System.String pieceName Name of the piece to remove.

Events

| Improve this Doc View Source

OnPiecesRegistered

Event that gets fired after all pieces were added to their respective PieceTables. Your code will execute every time a new ObjectDB is created (on every game start). If you want to execute just once you will need to unregister from the event after execution.
Declaration
public static event Action OnPiecesRegistered
Event Type
Type Description
System.Action

Extension Methods

PrefabExtension.FixReferences(Object)
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾