17 CustomRemoveElementFunction =
"Remove",
18 CustomRemoveIndexFunction =
"RemoveAt",
19 CustomAddFunction =
"Add"
20 ), DisableContextMenu(DisableForCollectionElements =
true, DisableForMember =
false)]
27 if (scenarioInfo ==
null)
29 Debug.LogError($
"Scenario {scenario} info not exist");
38 TextInputDialogue.ShowDialogue(
39 "Enter name for new scenario",
40 scenarioName => { AddScenario(scenarioName); }
44 public void RemoveAt(
int index)
49 AssetDatabase.DeleteAsset(Path.GetDirectoryName(path));
50 AssetDatabase.Refresh();
52 ScenarioEditorWindow.Reinit();
60 private void AddScenario(
string name)
62 if (!
string.IsNullOrEmpty(name))
64 var scenarioPath = $
"{ScenarioEditorWindow.ScenariosRootPath}/{this.name}/{name}";
66 if (!Directory.Exists(scenarioPath))
68 var scenarioInfoPath = $
"{scenarioPath}/{name}ScenarioInfo.asset";
69 var scenarioStepDataPath = $
"{scenarioPath}/{name}StepData.asset";
71 var scenarioStepsPath = $
"{scenarioPath}/{ScenarioEditorWindow.StepsDirectoryName}";
73 Directory.CreateDirectory(scenarioPath);
74 Directory.CreateDirectory(scenarioStepsPath);
77 AssetDatabase.CreateAsset(stepsData, scenarioStepDataPath);
80 info.StepsDataLink = stepsData;
81 AssetDatabase.CreateAsset(info, scenarioInfoPath);
84 EditorUtility.SetDirty(
this);
86 ScenarioEditorWindow.Reinit();
90 EditorUtility.DisplayDialog(
"Add Scenario Error",
"Scenario already exist!",
"ok");
95 EditorUtility.DisplayDialog(
"Add Scenario Error",
"Scenario name is empty",
"ok");
98 AssetDatabase.Refresh();
101 private void OnValidate()
106 public void Validate()