Class CatalogItem
Base class for most of the static data in Game Foundation.
Namespace: UnityEngine.GameFoundation
Syntax
public abstract class CatalogItem : IEquatable<CatalogItem>, IComparable<CatalogItem>
Properties
displayName
The readable name of this CatalogItem instance. It is used to make the Editor more comfortable, but it can also be used at runtime to display a readable information to the players.
Declaration
public string displayName { get; }
Property Value
Type | Description |
---|---|
String |
Item[String]
Get the value of the static property with the given propertyKey
.
Declaration
public Property this[string propertyKey] { get; }
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | Identifier of the static property to get the value of. |
Property Value
Type | Description |
---|---|
Property | The value of the static property with the given |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the given |
PropertyNotFoundException | Thrown if there is no static property with the given |
key
The unique identifier of this CatalogItem.
Declaration
public string key { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Equals(Object)
Tells whether this CatalogItem instance equals obj
.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The other object to compare this instance with. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
GetHashCode()
Gets the hash code of this CatalogItem instance. Returns the hash code of its key.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The hash code of this CatalogItem instance. |
Overrides
GetStaticProperties()
Get all static properties stored in this item.
Declaration
public Dictionary<string, Property> GetStaticProperties()
Returns
Type | Description |
---|---|
Dictionary<String, Property> | Return a new dictionary containing all properties stored in this item. The returned dictionary is never null. |
GetStaticProperties(Dictionary<String, Property>)
Get all static properties stored in this item.
Declaration
public void GetStaticProperties(Dictionary<string, Property> target)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<String, Property> | target | The dictionary to fill with the properties stored in this item. It is cleared before being filled. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the given |
GetStaticProperty(String)
Get the value of the static property with the given propertyKey
.
Declaration
public Property GetStaticProperty(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | Identifier of the static property to get the value of. |
Returns
Type | Description |
---|---|
Property | The value of the static property with the given |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the given |
PropertyNotFoundException | Thrown if there is no static property with the given |
GetTags(ICollection<Tag>, Boolean)
Fills the given target
collection with all the Tag instances linked
to this CatalogItem instance.
Declaration
public int GetTags(ICollection<Tag> target = null, bool clearTarget = true)
Parameters
Type | Name | Description |
---|---|---|
ICollection<Tag> | target | The target container of all the Tag instances. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of Tag instances linked to this CatalogItem instance. |
HasStaticProperty(String)
Check if this item has a static property with the given propertyKey
.
Declaration
public bool HasStaticProperty(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The identifier of the static property to look for. |
Returns
Type | Description |
---|---|
Boolean |
|
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the given |
HasTag(Tag)
Tells whether or not the given tag
is within this CatalogItem instance.
Declaration
public bool HasTag(Tag tag)
Parameters
Type | Name | Description |
---|---|---|
Tag | tag | The Tag instance to search for. |
Returns
Type | Description |
---|---|
Boolean | Whether or not this CatalogItem instance has the specified Tag included. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If the |
TryGetStaticProperty(String, out Property)
Try to get the value of the static property with the given propertyKey
.
Declaration
public bool TryGetStaticProperty(string propertyKey, out Property property)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | Identifier of the static property to get the value of. |
Property | property | The value of the searched static property, if found. |
Returns
Type | Description |
---|---|
Boolean | Returns true if a static property with the given |