public static void UpdateLabel_UnitPlayer() { unitPlayerLabel = new string[unitPlayerDB.unitList.Count + 1]; unitPlayerLabel[0] = "Unassigned"; for (int i = 0; i < unitPlayerDB.unitList.Count; i++) { string name = unitPlayerDB.unitList[i].name; if (name == "") { name = "unnamed"; } while (Array.IndexOf(unitPlayerLabel, name) >= 0) { name += "_"; } unitPlayerLabel[i + 1] = name; } TDSEditorWindow.SetUnitPlayerDB(unitPlayerDB, unitPlayerIDList, unitPlayerLabel); TDSEditorInspector.SetUnitPlayerDB(unitPlayerDB, unitPlayerIDList, unitPlayerLabel); dirty = !dirty; }
public static void LoadUnitPlayer() { unitPlayerDB = UnitPlayerDB.LoadDB(); for (int i = 0; i < unitPlayerDB.unitList.Count; i++) { if (unitPlayerDB.unitList[i] != null) { //unitPlayerDB.unitList[i].prefabID=i; unitPlayerIDList.Add(unitPlayerDB.unitList[i].prefabID); } else { unitPlayerDB.unitList.RemoveAt(i); i -= 1; } } UpdateLabel_UnitPlayer(); TDSEditorWindow.SetUnitPlayerDB(unitPlayerDB, unitPlayerIDList, unitPlayerLabel); TDSEditorInspector.SetUnitPlayerDB(unitPlayerDB, unitPlayerIDList, unitPlayerLabel); }