UnityToolbox
Brief documentation for all existing scripts.
 
Loading...
Searching...
No Matches
UnityToolbox.Item.Management.Itemizer Class Reference

The core of the item managment system. It takes care of the (de)serialization and changes to all data.

Public Member Functions

bool Initialize ()
 Tries to initialize the Itemizer.
 
ItemDefinition AddItemDefinition (ItemScope scope, string name, int maxStackCount, string resourceIconPath, string resourcePrefabPath, string iconGUID, string prefabGUID)
 Creates a new item definition and adds it to the mangement.
 
AddInheritedItemDefinition< T > (ItemScope scope, string name, int maxStackCount, string resourceIconPath, string resourcePrefabPath, string iconGUID, string prefabGUID, HashSet< ItemField > itemFields)
 Creates a new item inheriting ItemDefinition and adds it to the mangement.
 
void RemoveItemDefinition (ItemDefinition itemDefinition)
 Removes an ItemDefinition from the mangement.
 
void EditInheritedItemDefinition< T > (ItemDefinition itemDefinition, ItemScope scope, string name, int maxStackCount, string resourceIconPath, string resourcePrefabPath, string iconGUID, string prefabGUID, HashSet< ItemField > itemFields)
 Edits a given item inheriting ItemDefinition and replaces the old within the mangement.
 
void EditItemDefinition (ItemDefinition itemDefinition, ItemScope scope, string name, int maxStackCount, string resourceIconPath, string resourcePrefabPath, string iconGUID, string prefabGUID)
 Edits a given ItemDefinition and replaces the old within the mangement.
 
ItemScope AddItemScope (string name)
 Adds a new ItemScope by a given unique name.
 
void RemoveItemScope (ItemScope scope)
 Removes a given ItemScope. Replaces the given scope used for the ItemDefinition with the DefaultScope.
 
void EditItemScope (ItemScope scope, string name)
 Edits a given ItemScope and replaces the old.
 
List< Type > GetAllInheritedItemDefinitionTypes ()
 Checks the assembly for all classes inheriting ItemDefinition.
 
void WriteData ()
 Writes all data to the set resources folder.
 
void ItemScopeEdited (ItemScope oldScope, ItemScope newScope)
 Invokes the OnItemScopeEdited action.
 
void ItemDefinitionEdited (ItemDefinition oldItemDefinition, ItemDefinition newItemDefinition)
 Invokes the OnItemDefinitionEdited action.
 

Properties

static Itemizer Instance [get]
 The singleton instance of the Itemizer.
 
bool Initialized [get]
 Is the itemizer initialized? If not, it cannot be used.
 
HashSet< ItemDefinitionItemDefinitions [get]
 All defined items.
 
HashSet< ItemDefinitionFaultyItemDefinitions [get]
 All defined items which are faulty.
 
HashSet< ItemScopeItemScopes [get]
 All defined item scopes.
 
ItemScope DefaultScope [get]
 The defaulte scope, set by default and is the replacement for deleted scopes.
 

Events

Action< ItemScope, ItemScopeOnItemScopeEdited
 
Action< ItemDefinition, ItemDefinitionOnItemDefinitionEdited
 

Member Function Documentation

◆ AddInheritedItemDefinition< T >()

T UnityToolbox.Item.Management.Itemizer.AddInheritedItemDefinition< T > ( ItemScope  scope,
string  name,
int  maxStackCount,
string  resourceIconPath,
string  resourcePrefabPath,
string  iconGUID,
string  prefabGUID,
HashSet< ItemField itemFields 
)
Template Parameters
TA type which inherits ItemDefinition.
Parameters
scopeThe scope of the definition."/></param> <param name="name">The name of the definition. Has to be unique in combination with the scope.</param> <param name="maxStackCount">How high this item can be stacked.</param> <param name="resourceIconPath">The path to where the icon can be found. Has to be a resources path.</param> <param name="resourcePrefabPath">The path to where the prefab can be found. Has to be a resources path.</param> <param name="itemFields">All additional field values defined for type <typeparamref name="T"/>.</param> <returns>The created <see cref="ItemDefinition"/>.</returns> <exception cref="ItemDefinitionException">
Type Constraints
T :ItemDefinition 

References UnityToolbox.Item.Management.ItemField.FieldName, UnityToolbox.Item.Management.ItemField.FieldType, and UnityToolbox.Item.Management.ItemField.GetValue().

Referenced by UnityToolbox.Item.Management.Itemizer.EditInheritedItemDefinition< T >().

◆ AddItemDefinition()

ItemDefinition UnityToolbox.Item.Management.Itemizer.AddItemDefinition ( ItemScope  scope,
string  name,
int  maxStackCount,
string  resourceIconPath,
string  resourcePrefabPath,
string  iconGUID,
string  prefabGUID 
)
Parameters
scopeThe scope of the definition."/></param> <param name="name">The name of the definition. Has to be unique in combination with the scope.</param> <param name="maxStackCount">How high this item can be stacked.</param> <param name="resourceIconPath">The path to where the icon can be found. Has to be a resources path.</param> <param name="resourcePrefabPath">The path to where the prefab can be found. Has to be a resources path.</param> <returns>The created <see cref="ItemDefinition"/>.</returns> <exception cref="ItemDefinitionException">

References UnityToolbox.Item.ItemDefinition.GetQualifiedName().

Referenced by UnityToolbox.Item.Management.Itemizer.EditItemDefinition(), UnityToolbox.Item.Management.Itemizer.EditItemScope(), and UnityToolbox.Item.Management.Itemizer.RemoveItemScope().

◆ AddItemScope()

ItemScope UnityToolbox.Item.Management.Itemizer.AddItemScope ( string  name)
Parameters
nameThe unique name of the scope to create.
Returns
The created ItemScope.
Exceptions
ItemDefinitionException

Referenced by UnityToolbox.Item.Management.Itemizer.EditItemScope().

◆ EditInheritedItemDefinition< T >()

void UnityToolbox.Item.Management.Itemizer.EditInheritedItemDefinition< T > ( ItemDefinition  itemDefinition,
ItemScope  scope,
string  name,
int  maxStackCount,
string  resourceIconPath,
string  resourcePrefabPath,
string  iconGUID,
string  prefabGUID,
HashSet< ItemField itemFields 
)
Template Parameters
TA type which inherits ItemDefinition.
Parameters
itemDefinitionThe ItemDefinition to be edited.
scopeThe new scope of the definition."/></param> <param name="name">The new name of the definition. Has to be unique in combination with the scope.</param> <param name="maxStackCount">How high this item can be stacked.</param> <param name="resourceIconPath">The new path to where the icon can be found. Has to be a resources path.</param> <param name="resourcePrefabPath">The new path to where the prefab can be found. Has to be a resources path.</param> <param name="itemFields">All additional new field values defined for type <typeparamref name="T"/>.</param> <returns>The created <see cref="ItemDefinition"/>.</returns> <exception cref="ItemDefinitionException">
Type Constraints
T :ItemDefinition 

References UnityToolbox.Item.Management.Itemizer.AddInheritedItemDefinition< T >(), and UnityToolbox.Item.Management.Itemizer.ItemDefinitionEdited().

◆ EditItemDefinition()

void UnityToolbox.Item.Management.Itemizer.EditItemDefinition ( ItemDefinition  itemDefinition,
ItemScope  scope,
string  name,
int  maxStackCount,
string  resourceIconPath,
string  resourcePrefabPath,
string  iconGUID,
string  prefabGUID 
)
Parameters
itemDefinitionThe ItemDefinition to be edited.
scopeThe new scope of the definition."/></param> <param name="name">The new name of the definition. Has to be unique in combination with the scope.</param> <param name="maxStackCount">How high this item can be stacked.</param> <param name="resourceIconPath">The new path to where the icon can be found. Has to be a resources path.</param> <param name="resourcePrefabPath">The new path to where the prefab can be found. Has to be a resources path.</param> <returns>The created <see cref="ItemDefinition"/>.</returns> <exception cref="ItemDefinitionException">

References UnityToolbox.Item.Management.Itemizer.AddItemDefinition(), and UnityToolbox.Item.Management.Itemizer.ItemDefinitionEdited().

◆ EditItemScope()

◆ GetAllInheritedItemDefinitionTypes()

List< Type > UnityToolbox.Item.Management.Itemizer.GetAllInheritedItemDefinitionTypes ( )
Returns

◆ Initialize()

bool UnityToolbox.Item.Management.Itemizer.Initialize ( )
Returns
Whether initializing was successful.

References ProjectPrefs.GetString(), and ResourcesUtil.IsFullPathValid().

Referenced by UnityToolbox.Item.ItemManager.Awake().

◆ ItemDefinitionEdited()

void UnityToolbox.Item.Management.Itemizer.ItemDefinitionEdited ( ItemDefinition  oldItemDefinition,
ItemDefinition  newItemDefinition 
)

◆ ItemScopeEdited()

void UnityToolbox.Item.Management.Itemizer.ItemScopeEdited ( ItemScope  oldScope,
ItemScope  newScope 
)

◆ RemoveItemDefinition()

void UnityToolbox.Item.Management.Itemizer.RemoveItemDefinition ( ItemDefinition  itemDefinition)
Parameters
itemDefinitionThe ItemDefinition to be removed.
Exceptions
ItemDefinitionException

References UnityToolbox.Item.ItemDefinition.GetQualifiedName(), and UnityToolbox.Item.Management.Itemizer.ItemDefinitionEdited().

◆ RemoveItemScope()

◆ WriteData()

void UnityToolbox.Item.Management.Itemizer.WriteData ( )

Property Documentation

◆ DefaultScope

ItemScope UnityToolbox.Item.Management.Itemizer.DefaultScope
get

◆ FaultyItemDefinitions

HashSet<ItemDefinition> UnityToolbox.Item.Management.Itemizer.FaultyItemDefinitions
get

◆ Initialized

bool UnityToolbox.Item.Management.Itemizer.Initialized
get

◆ Instance

◆ ItemDefinitions

HashSet<ItemDefinition> UnityToolbox.Item.Management.Itemizer.ItemDefinitions
get

◆ ItemScopes

HashSet<ItemScope> UnityToolbox.Item.Management.Itemizer.ItemScopes
get

Event Documentation

◆ OnItemDefinitionEdited

Action<ItemDefinition, ItemDefinition> UnityToolbox.Item.Management.Itemizer.OnItemDefinitionEdited

◆ OnItemScopeEdited

Action<ItemScope, ItemScope> UnityToolbox.Item.Management.Itemizer.OnItemScopeEdited