public static void LoadCollectible() { collectibleDB = CollectibleDB.LoadDB(); for (int i = 0; i < collectibleDB.collectibleList.Count; i++) { if (collectibleDB.collectibleList[i] != null) { collectibleIDList.Add(collectibleDB.collectibleList[i].prefabID); } else { collectibleDB.collectibleList.RemoveAt(i); i -= 1; } } UpdateLabel_Collectible(); TBEditorWindow.SetCollectibleDB(collectibleDB, collectibleIDList, collectibleLabel); TBEditorInspector.SetCollectibleDB(collectibleDB, collectibleIDList, collectibleLabel); }
public static void UpdateLabel_Collectible() { collectibleLabel = new string[collectibleDB.collectibleList.Count + 1]; collectibleLabel[0] = "Unassigned"; for (int i = 0; i < collectibleDB.collectibleList.Count; i++) { string name = collectibleDB.collectibleList[i].itemName; if (name == "") { name = "unnamed"; } while (Array.IndexOf(collectibleLabel, name) >= 0) { name += "_"; } collectibleLabel[i + 1] = name; } TBEditorWindow.SetCollectibleDB(collectibleDB, collectibleIDList, collectibleLabel); TBEditorInspector.SetCollectibleDB(collectibleDB, collectibleIDList, collectibleLabel); dirty = !dirty; }