Learn / Documentation / Script Reference / NamesDatabase

NamesDatabase

class in Doozy.Engine.UI.Base / Inherits from: ScriptableObject

Description

Database model, of NamesCategory, used by the UIButton, UICanvas, UIDrawer and UIView components.
It stores and manages all the categories/names for each component type.

Public Variables

  • public List<string> CategoryNames – List of all the category names found in this database

  • public List<NamesCategory> Categories – The category/names database

  • public NamesDatabaseType DatabaseNamesDatabaseType – Defines which type of component this database is for

Public Methods

  • public bool Add(NamesCategory categoryData, bool performUndo, bool saveAssets) – Adds a new entry, from a data container, to the database. Returns TRUE if the operation was successful

  • public bool Add(string category, string item, bool performUndo, bool saveAssets) – Adds a new entry, category and name, to the database. Returns TRUE if the operation was successful

  • public bool AddCategory(string category, bool performUndo = true, bool saveAssets = false) – Adds a new entry, category only, to the database. Returns TRUE if the operation was successful

  • public bool AddDefaultCategories(bool saveAssets) – Adds the default categories to the database by taking into account the database type. Returns TRUE if the operation was successful

  • public bool Contains(string categoryName) – Returns TRUE if the category name has been found in the database

  • public bool Contains(string categoryName, string item) – Returns TRUE if the category name and item name (that belongs to said category) have been defined in the database

  • public NamesCategory GetData(string category, bool createNewDataIfNotFound = false) – Returns a reference to the database entry of the given category name. If the name does not exist, it will return null

  • public List<string> GetItems(string category, bool getDirectReference = false) – Returns a copy of the list of items (names) found in the given category name. If the category does not exist, it will return null

  • public bool Remove(string category, bool showDialog = false, bool performUndo = true, bool saveAssets = false) – Iterates through the database to look for the category name. If found, removes the entry and returns TRUE

  • public bool Remove(string category, string item, bool performUndo = true, bool saveAssets = false) – Iterates through the database to look for the category name and its corresponding item name. If found, removes the entry and returns TRUE

  • public bool Rename(string oldCategoryName, string newCategoryName, bool performUndo = true, bool saveAssets = false) – Renames a category to a new category name. Returns TRUE if the operation was successful

  • public void RefreshDatabase(bool performUndo, bool saveAssets) – Refreshes the entire database by adding the default categories, removing empty and duplicate entries, sorting the database and updating the category names list

  • public void RemoveDuplicateEntries(bool performUndo, bool saveAssets = false) – Removes any duplicate entries found in the database

  • public void RemoveEmptyCategories(bool performUndo, bool saveAssets = false) – Removes any entries with an empty category name

  • public void RemoveUnnamedEntries(bool performUndo, bool saveAssets = false) – Removes any item names that are empty (unnamed)

  • public bool ResetDatabase(bool saveAssets = true) – Resets the entire database by removing all the entries

  • public void SetDirty(bool saveAssets) – [Editor Only] Marks target object as dirty. (Only suitable for non-scene objects)

  • public void Sort(bool performUndo, bool saveAssets = false) – Sorts the entire database

  • public void UndoRecord(string undoMessage) – Records any changes done on the object after this function

  • public bool UpdateItem(string categoryName, int itemIndex, string newItem, bool performUndo = true, bool saveAssets = false) – Updates an item to the given settings. Returns TRUE if the operation was a success

Static Methods

  • public static bool CanDeleteItem(NamesDatabase database, string itemName) – Returns TRUE if an item can be deleted from the database. This is used to make sure some values cannot be deleted from the database according to the DatabaseType (NamesDatabaseType)

  • public static NamesDatabase GetDatabase(string fileName, string resourcesPath) – Returns a NamesDatabase with the given fileName from the target resourcesPath. If the database is not found, a new one will get created instead