static void OnAddNewButtonClicked() { CollectionDataEntry newEntry = CollectionDataEntry.Create("New Item"); AddSubAsset(newEntry, databaseCache); databaseCache.itemList.Add(newEntry); if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnAddNewButtonClicked():: New entry added to itemDatabaseCache.ItemList."); } CacheItemNames(); ForceChangeFilterValue(""); //itemNamesCache.Add("New Item"); //if (CollectionDataEditorDebugging) Debug.Log("CollectionDataEditor:: OnAddNewButtonClicked():: \"New Item\" added to itemNamesCache to be optimistic."); //filteredItemNamesCache = new List<string>(itemNamesCache); selected = databaseCache.itemList.Count - 1; LoadEntry(databaseCache.itemList[selected]); dDrawEditorContent = EditorContent_DrawEditor; dDrawSidebarContent = Sidebar_DrawSelections; SaveDatabase(); }
///Load entry content into Editor block, does not thing to do with (int) selected. static void LoadEntry(CollectionDataEntry entry) { if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: LoadEntry():: Loading " + entry.itemID); } entryCache = entry; }
public static CollectionDataEntry Create(string itemID, string desc) { CollectionDataEntry created = ScriptableObject.CreateInstance <CollectionDataEntry>(); created.itemID = itemID; created.itemBasicDescription = desc; created.itemThumbnail = null; created.itemImage = null; return(created); }
public void CreateFromJsonArray(string[] jsonArr) { while (itemList.Count < jsonArr.Length) { CollectionDataEntry newEntry = CollectionDataEntry.Create("NewItem"); AddSubAsset(newEntry); itemList.Add(newEntry); } for (int i = 0; i < jsonArr.Length; i++) { JsonUtility.FromJsonOverwrite(jsonArr[i], itemList[i]); } }