static void OnFilteringDone() { if (filteredList.Count == 0) { dDrawSidebarContent = Sidebar_ShowNoResult; if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnFilteringDone():: Set dDrawSidebarContent to ShowNoResult."); } dDrawEditorContent = EditorContent_NoSelection; if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnFilteringDone():: Set dDrawEditorContent to NoSelection."); } } else { dDrawSidebarContent = Sidebar_DrawSelections; if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnFilteringDone():: Set dDrawSidebarContent to DrawSelections."); } dDrawEditorContent = EditorContent_DrawEditor; if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnFilteringDone():: Set dDrawEditorContent to DrawEditor."); } } }
static void OnDeleteSelectedButtonClicked() { if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnDeleteSelectedButtonClicked():: Currently selected index: " + selected); } //Optimistic change on UI filteredList.Remove(entryCache); if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnDeleteSelectedButtonClicked():: Removing itemID cache in filteredItemNames."); } filteredItemNamesCache.RemoveAt(selected); //Actually remove reference and destroy if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnDeleteSelectedButtonClicked():: Removing reference of deleted entry in itemDatabase and filterList."); } databaseCache.itemList.Remove(entryCache); DestroyImmediate(entryCache, true); if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnDeleteSelectedButtonClicked():: Designated entry destroyed."); } CacheItemNames(); if (filteredList.Count > 0) { if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnDeleteSelectedButtonClicked():: Loading filteredList[" + (selected - 1) + "]"); } if (selected >= filteredList.Count) { selected -= 1; } LoadEntry(filteredList[selected]); } else { if (activeFilter == "") { dDrawSidebarContent = Sidebar_ShowDatabaseEmpty; dDrawEditorContent = EditorContent_NoSelection; } else { if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnDeleteSelectedButtonClicked():: No entry left in filteredList, clearing filter."); } ForceChangeFilterValue(""); } } SaveDatabase(); }
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(); }
static void OnFilteringBegin() { dDrawSidebarContent = Sidebar_ShowFiltering; if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnFilteringDone():: Set dDrawSidebarContent to ShowFiltering."); } dDrawEditorContent = EditorContent_Filtering; if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnFilteringDone():: Set dDrawEditorContent to Filtering."); } }