55 DbgUI.Begin(
"ScenarioFramework Tasks");
57 array<SCR_ScenarioFrameworkTask> scenarioFrameworkTasks = {};
58 array<SCR_Task> finishedTasks = {};
59 array<string> listElements = {};
60 array<SCR_Task> tasks = {};
61 taskSystem.GetTasks(tasks);
63 SCR_ScenarioFrameworkSlotTask scenarioFrameworkSlotTask;
64 SCR_ScenarioFrameworkLayerTask scenarioFrameworkLayerTask;
69 if (!scenarioFrameworkTask)
72 scenarioFrameworkSlotTask = scenarioFrameworkTask.
GetSlotTask();
73 if (!scenarioFrameworkSlotTask)
76 scenarioFrameworkLayerTask = scenarioFrameworkTask.
GetLayerTask();
77 if (!scenarioFrameworkLayerTask)
80 scenarioFrameworkArea = scenarioFrameworkLayerTask.GetParentArea();
81 if (!scenarioFrameworkArea)
84 listElements.Insert(
WidgetManager.Translate(
string.Format(
"%1 - Area: %2 - LayerTask: %3 - SlotTask: %4", scenarioFrameworkTask.GetTaskName(), scenarioFrameworkArea.GetName(), scenarioFrameworkLayerTask.GetName(), scenarioFrameworkSlotTask.GetName())));
85 scenarioFrameworkTasks.Insert(scenarioFrameworkTask);
88 if (!listElements.IsEmpty())
91 DbgUI.List(
"Active Tasks", taskListIndex, listElements);
93 scenarioFrameworkTask = scenarioFrameworkTasks[taskListIndex];
96 DbgUI.Check(
"Inspect Area", inspectArea);
98 LayerInspector(scenarioFrameworkTask.
GetLayerTask().GetParentArea().GetName());
100 bool inspectLayerTask;
101 DbgUI.Check(
"Inspect Layer Task", inspectLayerTask);
102 if (inspectLayerTask)
103 LayerInspector(scenarioFrameworkTask.
GetLayerTask().GetName());
105 bool inspectSlotTask;
106 DbgUI.Check(
"Inspect Slot Task", inspectSlotTask);
108 LayerInspector(scenarioFrameworkTask.
GetSlotTask().GetName());
110 ProcessSlotTask(scenarioFrameworkTask.
GetSlotTask());
114 bool includeChildren =
true;
115 DbgUI.Check(
"Restore Include Children", includeChildren);
117 bool reinitAfterRestoration =
true;
118 DbgUI.Check(
"Reinit After Restoration", reinitAfterRestoration);
120 bool affectRandomization =
false;
121 DbgUI.Check(
"Restore Affects Randomization", affectRandomization);
123 bool deleteSpawnedEntities =
true;
124 DbgUI.Check(
"Delete Spawned Entities", deleteSpawnedEntities);
126 if (
DbgUI.Button(
"Restore To Default"))
127 scenarioFrameworkTask.
GetLayerTask().RestoreToDefault(includeChildren, reinitAfterRestoration, deleteSpawnedEntities);
135 static void RegisteredAreas()
137 DbgUI.Begin(
"ScenarioFramework Registered Areas");
141 if (!scenarioFrameworkSystem)
144 array<string> listElements = {};
147 listElements.Insert(area.GetName());
150 if (!listElements.IsEmpty())
152 int selectedAreaIndex;
153 DbgUI.List(
"Areas", selectedAreaIndex, listElements);
156 DbgUI.Check(
"Inspect Area", inspectArea);
159 string layerName = listElements[selectedAreaIndex];
160 LayerInspector(layerName);
169 static void DebugActions()
172 if (!scenarioFrameworkSystem)
175 DbgUI.Begin(
"ScenarioFramework Debug Actions");
177 array<string> listElements = {};
178 if (!scenarioFrameworkSystem.m_aDebugActions || scenarioFrameworkSystem.m_aDebugActions.IsEmpty())
183 listElements.Insert(action.m_sDebugActionName);
186 if (listElements.IsEmpty())
189 int selectedActionIndex;
190 DbgUI.List(
"Available actions", selectedActionIndex, listElements);
192 if (scenarioFrameworkSystem.m_aDebugActions.IsIndexValid(selectedActionIndex))
193 ProcessDebugAction(scenarioFrameworkSystem.m_aDebugActions[selectedActionIndex]);
201 if (!
DbgUI.Button(
"ACTIVATE"))
207 action.OnActivate(null);
213 static void DebugAreas()
215 DbgUI.Begin(
"ScenarioFramework Debug Areas");
218 if (!scenarioFrameworkSystem)
221 array<string> listElements = {};
224 listElements.Insert(
string.Format(
"%1 - LayerTask: %2 - SlotTask: %3", debugArea.m_sForcedArea, debugArea.m_sForcedLayerTask, debugArea.m_sForcedSlotTask));
227 if (!listElements.IsEmpty())
229 int selectedAreaIndex;
230 DbgUI.List(
"Debug Areas", selectedAreaIndex, listElements);
232 string toRemoveDebugArea = scenarioFrameworkSystem.m_aDebugAreas[selectedAreaIndex].m_sForcedArea;
233 if (
DbgUI.Button(
string.Format(
"Remove Debug Area: %1", toRemoveDebugArea)))
234 RemoveDebugArea(toRemoveDebugArea);
236 if (
DbgUI.Button(
"Clear All Debug Areas"))
237 scenarioFrameworkSystem.m_aDebugAreas.Clear();
241 DbgUI.Text(
"New Debug Area");
243 string newDebugLayerTask;
244 string newDebugSlotTask;
245 DbgUI.InputText(
"Area (Requiered)", newDebugArea);
246 DbgUI.InputText(
"Layer Task (Optional)", newDebugLayerTask);
247 DbgUI.InputText(
"Slot Task (Optional)", newDebugSlotTask);
248 if (
DbgUI.Button(
"Add Debug Area"))
249 AddNewDebugArea(newDebugArea, newDebugLayerTask, newDebugSlotTask);
253 bool possiblePresets;
254 DbgUI.Check(
"Show possible Debug Area Presets", possiblePresets);
257 DbgUI.Text(
"All possible Debug Area Presets");
258 array<string> listPossibleElements = {};
259 array<ref array<ref SCR_ScenarioFrameworkDebugArea>> allDebugArea = {};
262 foreach (
int index, array<ref SCR_ScenarioFrameworkDebugArea> debugArea : allDebugArea)
264 listPossibleElements.Insert(
string.Format(
"Debug Preset %1",
index));
267 if (!listPossibleElements.IsEmpty())
269 int selectedPresetIndex;
270 DbgUI.List(
"Debug Area Presets", selectedPresetIndex, listPossibleElements);
272 array<string> listSelectedPresetElements = {};
275 listSelectedPresetElements.Insert(
string.Format(
"%1 - LayerTask: %2 - SlotTask: %3", debugSelectedPresetArea.m_sForcedArea, debugSelectedPresetArea.m_sForcedLayerTask, debugSelectedPresetArea.m_sForcedSlotTask));
278 if (!listSelectedPresetElements.IsEmpty())
280 int selectedPresetListIndex;
281 DbgUI.List(
"Selected Preset Details", selectedPresetListIndex, listSelectedPresetElements);
284 if (
DbgUI.Button(
string.Format(
"Add Debug Preset %1", selectedPresetIndex)))
288 AddNewDebugArea(newSelectedDebugArea)
295 DbgUI.Text(
"Remove Debug Area Removal");
297 if (
DbgUI.Button(
"Reinit ScenarioFramework"))
298 ReinitScenarioFramework(scenarioFrameworkSystem);
308 if (!scenarioFrameworkSystem)
312 scenarioFrameworkSystem.m_bDebugInit =
true;
327 if (!scenarioFrameworkSystem.m_aCoreAreas.Contains(registeredArea.GetName()))
331 scenarioFrameworkSystem.
Init();
339 static void AddNewDebugArea(
string newDebugArea,
string newDebugLayerTask,
string newDebugSlotTask)
342 if (!scenarioFrameworkSystem)
348 if (debugArea.m_sForcedArea == newDebugArea)
353 debugArea.m_sForcedArea = newDebugArea;
354 debugArea.m_sForcedLayerTask = newDebugLayerTask;
355 debugArea.m_sForcedSlotTask = newDebugSlotTask;
357 scenarioFrameworkSystem.m_aDebugAreas.Insert(debugArea);
366 if (!scenarioFrameworkSystem)
372 if (debugArea.m_sForcedArea == newDebugArea.m_sForcedArea)
376 scenarioFrameworkSystem.m_aDebugAreas.Insert(newDebugArea);
382 static void RemoveDebugArea(
string toRemoveDebugArea)
385 if (!scenarioFrameworkSystem)
388 for (
int i = scenarioFrameworkSystem.m_aDebugAreas.Count() - 1; i >= 0; i--)
390 if (scenarioFrameworkSystem.m_aDebugAreas[i].m_sForcedArea == toRemoveDebugArea)
391 scenarioFrameworkSystem.m_aDebugAreas.Remove(i);
397 static array<ref array<ref SCR_ScenarioFrameworkDebugArea>> GetDebugAreaPresets()
400 if (!scenarioFrameworkSystem)
403 array<ref array<ref SCR_ScenarioFrameworkDebugArea>> allDebugArea = {};
406 array<SCR_ScenarioFrameworkSlotTask> aSlotTasks = {};
409 area.GetAllSlotTasks(aSlotTasks);
410 if (!aSlotTasks || aSlotTasks.IsEmpty())
413 foreach (SCR_ScenarioFrameworkSlotTask slotTask : aSlotTasks)
419 debugArea.m_sForcedArea = area.GetName();
420 debugArea.m_sForcedLayerTask = slotTask.GetLayerTask().GetName();
421 debugArea.m_sForcedSlotTask = slotTask.GetName();
424 array<ref SCR_ScenarioFrameworkDebugArea> temporaryDebugAreas = {};
426 if (allDebugArea.IsEmpty())
428 temporaryDebugAreas.Insert(debugArea);
429 allDebugArea.Insert(temporaryDebugAreas);
433 array<ref SCR_ScenarioFrameworkDebugArea> temporaryDebugAreas2 = {};
434 foreach (array<ref SCR_ScenarioFrameworkDebugArea> debugAreasFromAll : allDebugArea)
436 bool unusedAreaFound =
true;
439 if (innerDebugArea.m_sForcedArea == area.GetName())
441 unusedAreaFound =
false;
448 debugAreasFromAll.Insert(debugArea);
453 temporaryDebugAreas2.Insert(debugArea);
454 newAreaCreated =
true;
460 allDebugArea.Insert(temporaryDebugAreas2);
466 for (
int i = allDebugArea.Count() - 1; i >= 0; i--)
468 array<ref SCR_ScenarioFrameworkDebugArea> debugAreasFromAll = allDebugArea[i];
470 for (
int j = debugAreasFromAll.Count() - 1; j >= 0; j--)
472 debugArea = debugAreasFromAll[j];
473 foreach (array<ref SCR_ScenarioFrameworkDebugArea> debugAreasFromAll2 : allDebugArea)
475 bool unusedAreaFound =
true;
478 if (innerDebugArea.m_sForcedArea == debugArea.m_sForcedArea)
480 unusedAreaFound =
false;
487 debugAreasFromAll2.Insert(debugArea);
488 debugAreasFromAll.Remove(j);
494 if (debugAreasFromAll.IsEmpty())
495 allDebugArea.Remove(i);
504 static void LayerInspector(
string inputLayerName =
"")
506 DbgUI.Begin(
string.Format(
"ScenarioFramework Layer Inspector %1", inputLayerName));
509 DbgUI.InputText(
"Layer Name to inspect", inputLayerName);
514 bool layerTaskHasFinishConditions;
515 bool layerTaskHasFinishActions;
516 bool layerTaskHasCreateActions;
517 bool layerTaskHasFailedActions;
518 bool layerTaskHasCancelledActions;
519 bool layerTaskHasProgressActions;
520 bool layerTaskHasAssignedActions;
523 bool slotTaskHasFinishConditions;
524 bool slotTaskHasFinishActions;
525 bool slotTaskHasCreateActions;
526 bool slotTaskHasFailedActions;
527 bool slotTaskHasCancelledActions;
528 bool slotTaskHasProgressActions;
529 bool slotTaskHasAssignedActions;
533 bool detailsChecked =
true;
536 if (layerBase.m_bInitiated)
537 DbgUI.Text(
"Initiated");
539 DbgUI.Text(
"Not Initiated");
543 if (layerBase.m_bIsTerminated)
544 DbgUI.Text(
"Terminated");
546 DbgUI.Text(
"Not Terminated");
548 if (layerBase.m_iCurrentlySpawnedChildren < layerBase.m_iSupposedSpawnedChildren)
550 DbgUI.Text(
string.Format(
"Currently spawned %1 out of %2 children", layerBase.m_iCurrentlySpawnedChildren, layerBase.m_iSupposedSpawnedChildren));
553 if (layerBase.m_Area)
554 DbgUI.Text((
string.Format(
"Parent Area Name: %1", layerBase.m_Area.GetName())));
556 if (layerBase.m_ParentLayer)
557 DbgUI.Text((
string.Format(
"Parent Layer Name: %1", layerBase.m_ParentLayer.GetName())));
560 SCR_ScenarioFrameworkLayerTask layerTask = SCR_ScenarioFrameworkLayerTask.Cast(layerBase);
563 ProcessSlotTask(layerTask.m_SlotTask);
564 if ((layerTask.m_aFinishConditions && !layerTask.m_aFinishConditions.IsEmpty()))
565 layerTaskHasFinishConditions =
true;
567 if ((layerTask.m_aTriggerActionsOnFinish && !layerTask.m_aTriggerActionsOnFinish.IsEmpty()))
568 layerTaskHasFinishActions =
true;
570 if ((layerTask.m_aActionsOnCreated && !layerTask.m_aActionsOnCreated.IsEmpty()))
571 layerTaskHasCreateActions =
true;
573 if ((layerTask.m_aActionsOnFailed && !layerTask.m_aActionsOnFailed.IsEmpty()))
574 layerTaskHasFailedActions =
true;
576 if ((layerTask.m_aActionsOnCancelled && !layerTask.m_aActionsOnCancelled.IsEmpty()))
577 layerTaskHasCancelledActions =
true;
579 if ((layerTask.m_aActionsOnProgress && !layerTask.m_aActionsOnProgress.IsEmpty()))
580 layerTaskHasProgressActions =
true;
582 if ((layerTask.m_aActionsOnAssigned && !layerTask.m_aActionsOnAssigned.IsEmpty()))
583 layerTaskHasAssignedActions =
true;
589 string spawnedEntityDisplayName;
590 spawnedEntityDisplayName = slotBase.GetSpawnedEntityDisplayName();
592 DbgUI.Text((
string.Format(
"Spawned Entity Display Name: %1", spawnedEntityDisplayName)));
594 IEntity spawnedEntity = slotBase.GetSpawnedEntity();
596 BaseGameTriggerEntity baseGameTrigger = BaseGameTriggerEntity.Cast(spawnedEntity);
599 if (baseGameTrigger.IsPeriodicQueriesEnabled())
601 DbgUI.Text(
"Trigger Periodic Queries Enabled");
602 if (
DbgUI.Button(
"Disable Periodic Queries"))
603 baseGameTrigger.EnablePeriodicQueries(
false);
607 DbgUI.Text(
"Trigger Periodic Queries Disabled");
608 if (
DbgUI.Button(
"Enable Periodic Queries"))
609 baseGameTrigger.EnablePeriodicQueries(
true);
613 SCR_ScenarioFrameworkSlotTask slotTask = SCR_ScenarioFrameworkSlotTask.Cast(slotBase);
616 ProcessSlotTask(slotTask);
617 if ((slotTask.m_aFinishConditions && !slotTask.m_aFinishConditions.IsEmpty()))
618 slotTaskHasFinishConditions =
true;
620 if ((slotTask.m_aActionsOnFinished && !slotTask.m_aActionsOnFinished.IsEmpty()))
621 slotTaskHasFinishActions =
true;
623 if ((slotTask.m_aActionsOnCreated && !slotTask.m_aActionsOnCreated.IsEmpty()))
624 slotTaskHasCreateActions =
true;
626 if ((slotTask.m_aActionsOnFailed && !slotTask.m_aActionsOnFailed.IsEmpty()))
627 slotTaskHasFailedActions =
true;
629 if ((slotTask.m_aActionsOnCancelled && !slotTask.m_aActionsOnCancelled.IsEmpty()))
630 slotTaskHasCancelledActions =
true;
632 if ((slotTask.m_aActionsOnProgress && !slotTask.m_aActionsOnProgress.IsEmpty()))
633 slotTaskHasProgressActions =
true;
635 if ((slotTask.m_aActionsOnAssigned && !slotTask.m_aActionsOnAssigned.IsEmpty()))
636 slotTaskHasAssignedActions =
true;
638 else if (spawnedEntity)
640 ProcessTeleport(spawnedEntity.
GetOrigin(),
"Teleport to Spawned Entity");
643 if (layerBase.m_aPlugins && !layerBase.m_aPlugins.IsEmpty())
646 DbgUI.Check(
"Inspect Plugins", inspectPlugins);
648 PluginInspector(inputLayerName);
653 array<string> childrenLayerElements = {};
654 ProcessLayerHierarchy(layerBase, childrenLayerElements);
656 if (!childrenLayerElements.IsEmpty())
660 DbgUI.Text(
"Layer Hierarchy:");
662 DbgUI.List(
"Layer Hierarchy", childLayerIndex, childrenLayerElements);
664 bool inspectChildLayer;
665 DbgUI.Check(
"Inspect Child Layer", inspectChildLayer);
666 if (inspectChildLayer)
668 string layerName = childrenLayerElements[childLayerIndex];
669 layerName.Replace(
"-",
"");
670 LayerInspector(layerName);
674 array<string> logicLayerElements = {};
675 array<SCR_ScenarioFrameworkLogic>
m_aLogic = {};
677 foreach (SCR_ScenarioFrameworkLogic logic :
m_aLogic)
679 logicLayerElements.Insert(logic.GetName());
682 if (!logicLayerElements.IsEmpty())
684 DbgUI.Text(
"Layer Logics:");
686 DbgUI.List(
"Logics Hierarchy", logicIndex, logicLayerElements);
689 DbgUI.Check(
"Inspect Logic", inspectLogic);
692 string logicName = logicLayerElements[logicIndex];
693 LogicInspector(logicName);
697 if (layerBase.m_aPlugins && !layerBase.m_aPlugins.IsEmpty())
700 DbgUI.Check(
"Inspect Plugins", inspectPlugins);
702 PluginInspector(inputLayerName);
706 if ((layerBase.m_aActivationActions && !layerBase.m_aActivationActions.IsEmpty()) || layerTaskHasFinishActions
707 || layerTaskHasCreateActions || layerTaskHasFailedActions || layerTaskHasCancelledActions || layerTaskHasProgressActions || layerTaskHasAssignedActions || slotTaskHasFinishActions
708 || slotTaskHasCreateActions || slotTaskHasFailedActions || slotTaskHasCancelledActions || slotTaskHasProgressActions || slotTaskHasAssignedActions
711 bool inspectActivationActions;
712 DbgUI.Check(
"Inspect Actions", inspectActivationActions);
713 if (inspectActivationActions)
714 ActionInspector(inputLayerName);
717 if ((layerBase.m_aActivationConditions && !layerBase.m_aActivationConditions.IsEmpty()) || slotTaskHasFinishConditions || layerTaskHasFinishConditions)
719 bool inspectActivationConditions;
720 DbgUI.Check(
"Inspect Conditions", inspectActivationConditions);
721 if (inspectActivationConditions)
722 ConditionInspector(inputLayerName);
726 ProcessTeleport(layerBase.GetOwner().GetOrigin(),
"Teleport to Layer");
728 if (layerBase.m_bInitiated)
730 if (
DbgUI.Button(
"Initiate Dynamic Despawn"))
731 layerBase.DynamicDespawn(layerBase);
735 if (
DbgUI.Button(
"Initiate Dynamic Spawn"))
736 layerBase.DynamicReinit();
741 bool includeChildren =
true;
742 DbgUI.Check(
"Restore Include Children", includeChildren);
744 bool reinitAfterRestoration =
true;
745 DbgUI.Check(
"Reinit After Restoration", reinitAfterRestoration);
747 bool affectRandomization =
true;
748 DbgUI.Check(
"Restore Affects Randomization", affectRandomization);
750 bool deleteSpawnedEntities =
true;
751 DbgUI.Check(
"Delete Spawned Entities", deleteSpawnedEntities);
753 if (
DbgUI.Button(
"Restore To Default"))
754 layerBase.RestoreToDefault(includeChildren, reinitAfterRestoration, affectRandomization, deleteSpawnedEntities);
769 for (
int i = 0; i < level; i++)
774 array<SCR_ScenarioFrameworkLayerBase> childrenLayers = {};
775 layerBase.GetChildren(childrenLayers);
777 childrenLayers.RemoveItem(null);
780 childrenLayerElements.Insert(
string.Format(
"%1%2", levelString, layerChild.GetName()));
781 ProcessLayerHierarchy(layerChild, childrenLayerElements, level + 1);
788 static void ProcessSlotTask(SCR_ScenarioFrameworkSlotTask slotTask)
798 if (
DbgUI.Button(
"Finish Task"))
800 SCR_ScenarioFrameworkLayerTask layerTask = slotTask.GetLayerTask();
807 if (
DbgUI.Button(
"Finish Task (Forced)"))
809 SCR_ScenarioFrameworkLayerTask layerTask = slotTask.GetLayerTask();
817 IEntity spawnedEntity = slotTask.GetSpawnedEntity();
819 ProcessTeleport(spawnedEntity.
GetOrigin(),
"Teleport to Spawned Entity");
826 static void ProcessTeleport(
vector destination,
string buttonName)
828 if (
DbgUI.Button(buttonName))
832 char.SetOrigin(destination)
839 static void ActionInspector(
string inputLayerName =
"")
841 DbgUI.Begin(
string.Format(
"ScenarioFramework Action Inspector %1", inputLayerName));
844 DbgUI.InputText(
"Layer Name to inspect", inputLayerName);
852 PrepareActionStrings(layerBase.m_aActivationActions, layerEntity,
"Activation Actions");
854 SCR_ScenarioFrameworkLayerTask layerTask = SCR_ScenarioFrameworkLayerTask.Cast(layerBase);
857 PrepareActionStrings(layerTask.m_aTriggerActionsOnFinish, layerEntity,
"Finish Actions");
858 PrepareActionStrings(layerTask.m_aActionsOnCreated, layerEntity,
"Created Actions");
859 PrepareActionStrings(layerTask.m_aActionsOnFailed, layerEntity,
"Failed Actions");
860 PrepareActionStrings(layerTask.m_aActionsOnCancelled, layerEntity,
"Cancelled Actions");
861 PrepareActionStrings(layerTask.m_aActionsOnProgress, layerEntity,
"Progress Actions");
862 PrepareActionStrings(layerTask.m_aActionsOnAssigned, layerEntity,
"Assigned Actions");
865 SCR_ScenarioFrameworkSlotTask slotTask = SCR_ScenarioFrameworkSlotTask.Cast(layerBase);
868 PrepareActionStrings(slotTask.m_aActionsOnFinished, layerEntity,
"Finish Actions");
869 PrepareActionStrings(slotTask.m_aActionsOnCreated, layerEntity,
"Created Actions");
870 PrepareActionStrings(slotTask.m_aActionsOnFailed, layerEntity,
"Failed Actions");
871 PrepareActionStrings(slotTask.m_aActionsOnCancelled, layerEntity,
"Cancelled Actions");
872 PrepareActionStrings(slotTask.m_aActionsOnProgress, layerEntity,
"Progress Actions");
873 PrepareActionStrings(slotTask.m_aActionsOnAssigned, layerEntity,
"Assigned Actions");
890 DbgUI.Text(
string.Format(
"%1 Debug Action enabled", categoryName));
892 if (
DbgUI.Button(
string.Format(
"%1 Disable Action debug", categoryName)))
893 action.m_bDebug =
false;
897 DbgUI.Text(
string.Format(
"%1 Debug Action disabled", categoryName));
899 if (
DbgUI.Button(
string.Format(
"%1 Enable Action debug", categoryName)))
900 action.m_bDebug =
true;
903 DbgUI.Text(
string.Format(
"%1 Number of activations %1 out of %2", categoryName, action.m_iNumberOfActivations, action.m_iMaxNumberOfActivations));
905 if (
DbgUI.Button(
string.Format(
"%1 Init again", categoryName)))
906 action.Init(layerEntity);
908 if (
DbgUI.Button(
string.Format(
"%1 Activate again", categoryName)))
909 action.OnActivate(layerEntity);
911 array<ref SCR_ScenarioFrameworkActionBase> subActions = action.GetSubActions();
912 if (!subActions || subActions.IsEmpty())
917 array<ref SCR_ScenarioFrameworkAIAction> subActionsAI = actionAI.GetSubActionsAI();
918 if (!subActionsAI || subActionsAI.IsEmpty())
922 DbgUI.Check(
string.Format(
"%1 Show SubAction AI Inspector", categoryName), debugCheck);
924 ProcessSubActions(actionAI, layerEntity);
930 array<ref SCR_ScenarioFrameworkMedicalAction> subActionsMedical = actionMedical.GetSubActionsMedical();
931 if (!subActionsMedical || subActionsMedical.IsEmpty())
935 DbgUI.Check(
string.Format(
"%1 Show SubAction Medical Inspector", categoryName), debugCheck);
937 ProcessSubActions(actionMedical, layerEntity);
944 DbgUI.Check(
string.Format(
"%1 Show SubAction Inspector", categoryName), debugCheck);
946 ProcessSubActions(action, layerEntity);
958 DbgUI.Text(
string.Format(
"%1 Debug Action enabled", categoryName));
960 if (
DbgUI.Button(
string.Format(
"%1 Disable Action debug", categoryName)))
961 action.m_bDebug =
false;
965 DbgUI.Text(
string.Format(
"%1 Debug Action disabled", categoryName));
967 if (
DbgUI.Button(
string.Format(
"%1 Enable Action debug", categoryName)))
968 action.m_bDebug =
true;
971 if (
DbgUI.Button(
string.Format(
"%1 Activate again", categoryName)))
974 array<ref SCR_ScenarioFrameworkActionBase> subActions = action.GetSubActions();
975 if (!subActions || subActions.IsEmpty())
979 DbgUI.Check(
string.Format(
"%1 Show SubAction Inspector", categoryName), debugCheck);
981 ProcessSubActions(action, layerEntity);
993 DbgUI.Text(
string.Format(
"%1 Debug Action enabled", categoryName));
995 if (
DbgUI.Button(
string.Format(
"%1 Disable Action debug", categoryName)))
996 action.m_bDebug =
false;
1000 DbgUI.Text(
string.Format(
"%1 Debug Action disabled", categoryName));
1002 if (
DbgUI.Button(
string.Format(
"%1 Enable Action debug", categoryName)))
1003 action.m_bDebug =
true;
1006 if (
DbgUI.Button(
string.Format(
"%1 Activate again", categoryName)))
1007 action.OnActivate();
1009 array<ref SCR_ScenarioFrameworkActionBase> subActions = action.GetSubActions();
1010 if (!subActions || subActions.IsEmpty())
1014 DbgUI.Check(
string.Format(
"%1 Show SubAction Inspector", categoryName), debugCheck);
1016 ProcessSubActions(action, layerEntity);
1025 array<string> listElements = {};
1026 array<ref SCR_ScenarioFrameworkActionBase> subActions = action.GetSubActions();
1027 if (!subActions || subActions.IsEmpty())
1030 string name = action.ToString();
1031 name.Replace(
"SCR_ScenarioFrameworkAction",
"");
1032 name.Replace(
"SCR_ScenarioFrameworkAIAction",
"");
1033 name.Replace(
"SCR_ScenarioFrameworkMedicalAction",
"");
1034 DbgUI.Begin(
string.Format(
"SubAction %1", name));
1036 PrepareActionStrings(subActions, layerEntity,
"Sub Actions");
1047 array<string> listElements = {};
1048 array<ref SCR_ScenarioFrameworkAIAction> subActions = action.GetSubActionsAI();
1049 if (!subActions || subActions.IsEmpty())
1052 string name = action.ToString();
1053 name.Replace(
"SCR_ScenarioFrameworkAIAction",
"");
1054 DbgUI.Begin(
string.Format(
"SubAction %1", name));
1056 PrepareActionStrings(subActions, layerEntity,
"Sub Actions");
1067 array<string> listElements = {};
1068 array<ref SCR_ScenarioFrameworkActionBase> subActions = action.GetSubActions();
1069 if (!subActions || subActions.IsEmpty())
1072 string name = action.ToString();
1073 name.Replace(
"SCR_ScenarioFrameworkAction",
"");
1074 name.Replace(
"SCR_ScenarioFrameworkAIAction",
"");
1075 name.Replace(
"SCR_ScenarioFrameworkMedicalAction",
"");
1076 DbgUI.Begin(
string.Format(
"SubAction %1", name));
1078 PrepareActionStrings(subActions, layerEntity,
"Sub Actions");
1089 array<string> listElements = {};
1090 array<ref SCR_ScenarioFrameworkMedicalAction> subActions = action.GetSubActionsMedical();
1091 if (!subActions || subActions.IsEmpty())
1094 string name = action.ToString();
1095 name.Replace(
"SCR_ScenarioFrameworkMedicalAction",
"");
1096 DbgUI.Begin(
string.Format(
"SubAction %1", name));
1098 PrepareActionStrings(subActions, layerEntity,
"Sub Actions");
1109 array<string> listElements = {};
1110 array<ref SCR_ScenarioFrameworkActionBase> subActions = action.GetSubActions();
1111 if (!subActions || subActions.IsEmpty())
1114 string name = action.ToString();
1115 name.Replace(
"SCR_ScenarioFrameworkAction",
"");
1116 name.Replace(
"SCR_ScenarioFrameworkAIAction",
"");
1117 name.Replace(
"SCR_ScenarioFrameworkMedicalAction",
"");
1118 DbgUI.Begin(
string.Format(
"SubAction %1", name));
1120 PrepareActionStrings(subActions, layerEntity,
"Sub Actions");
1130 static void PrepareActionStrings(array<ref SCR_ScenarioFrameworkActionBase> actions,
IEntity activationEntity,
string categoryName)
1132 array<string> listElements = {};
1133 if (!actions || actions.IsEmpty())
1138 string name = action.ToString();
1139 name.Replace(
"SCR_ScenarioFrameworkAction",
"");
1140 name.Replace(
"SCR_ScenarioFrameworkAIAction",
"");
1141 name.Replace(
"SCR_ScenarioFrameworkMedicalAction",
"");
1142 listElements.Insert(
string.Format(
"%1 - %2",
index, name));
1145 if (listElements.IsEmpty())
1148 int selectedActionIndex;
1149 DbgUI.Text(
string.Format(
"%1 Hierarchy:", categoryName));
1150 DbgUI.List(
string.Format(
"%1", categoryName), selectedActionIndex, listElements);
1152 if (actions.IsIndexValid(selectedActionIndex))
1153 ProcessAction(actions[selectedActionIndex], activationEntity, categoryName);
1161 static void PrepareActionStrings(array<ref SCR_ScenarioFrameworkAIAction> actions,
IEntity activationEntity,
string categoryName)
1163 array<string> listElements = {};
1164 if (!actions || actions.IsEmpty())
1169 string name = action.ToString();
1170 name.Replace(
"SCR_ScenarioFrameworkAction",
"");
1171 name.Replace(
"SCR_ScenarioFrameworkAIAction",
"");
1172 name.Replace(
"SCR_ScenarioFrameworkMedicalAction",
"");
1173 listElements.Insert(
string.Format(
"%1 - %2",
index, name));
1176 if (listElements.IsEmpty())
1179 int selectedActionIndex;
1180 DbgUI.Text(
string.Format(
"%1 Hierarchy:", categoryName));
1181 DbgUI.List(
string.Format(
"%1", categoryName), selectedActionIndex, listElements);
1183 if (actions.IsIndexValid(selectedActionIndex))
1184 ProcessAction(actions[selectedActionIndex], activationEntity, categoryName);
1192 static void PrepareActionStrings(array<ref SCR_ScenarioFrameworkMedicalAction> actions,
IEntity activationEntity,
string categoryName)
1194 array<string> listElements = {};
1195 if (!actions || actions.IsEmpty())
1200 string name = action.ToString();
1201 name.Replace(
"SCR_ScenarioFrameworkAction",
"");
1202 name.Replace(
"SCR_ScenarioFrameworkAIAction",
"");
1203 name.Replace(
"SCR_ScenarioFrameworkMedicalAction",
"");
1204 listElements.Insert(
string.Format(
"%1 - %2",
index, name));
1207 if (listElements.IsEmpty())
1210 int selectedActionIndex;
1211 DbgUI.Text(
string.Format(
"%1 Hierarchy:", categoryName));
1212 DbgUI.List(
string.Format(
"%1", categoryName), selectedActionIndex, listElements);
1214 if (actions.IsIndexValid(selectedActionIndex))
1215 ProcessAction(actions[selectedActionIndex], activationEntity, categoryName);
1221 static void LogicInspector(
string inputLogicName =
"")
1223 DbgUI.Begin(
string.Format(
"ScenarioFramework Logic Inspector %1", inputLogicName));
1226 DbgUI.InputText(
"Logic Name to inspect", inputLogicName);
1231 SCR_ScenarioFrameworkLogic logic = SCR_ScenarioFrameworkLogic.Cast(logicEntity);
1236 DbgUI.Text(
"Debug Logic enabled");
1238 if (
DbgUI.Button(
"Disable Logic debug"))
1239 logic.m_bDebug =
false;
1243 DbgUI.Text(
"Debug Logic disabled");
1245 if (
DbgUI.Button(
"Enable Logic debug"))
1246 logic.m_bDebug =
true;
1249 if (logic.m_bIsTerminated)
1250 DbgUI.Text(
"Terminated");
1252 DbgUI.Text(
"Not Terminated");
1254 PrepareActionStrings(logic.m_aActions, logicEntity,
"Actions");
1256 SCR_ScenarioFrameworkLogicCounter logicCounter = SCR_ScenarioFrameworkLogicCounter.Cast(logicEntity);
1259 DbgUI.Text(
string.Format(
"Logic Counter value %1 out of %2.", logicCounter.m_iCnt, logicCounter.m_iCountTo));
1261 PrepareActionStrings(logicCounter.m_aOnIncreaseActions, logicEntity,
"OnIncrease Action");
1262 PrepareActionStrings(logicCounter.m_aOnDecreaseActions, logicEntity,
"OnDecrease Action");
1264 if (
DbgUI.Button(
"Increase Counter"))
1265 logicCounter.Increase(logicEntity);
1267 if (
DbgUI.Button(
"Decrease Counter"))
1268 logicCounter.Decrease(logicEntity);
1279 static void PluginInspector(
string inputLayerName =
"")
1281 DbgUI.Begin(
string.Format(
"ScenarioFramework Plugin Inspector %1", inputLayerName));
1284 DbgUI.InputText(
"Layer Name to inspect", inputLayerName);
1292 PreparePluginStrings(layerBase.m_aPlugins, layerEntity,
"Plugins");
1304 static void PreparePluginStrings(array<ref SCR_ScenarioFrameworkPlugin> plugins,
IEntity activationEntity,
string categoryName)
1306 array<string> listElements = {};
1307 if (!plugins || plugins.IsEmpty())
1312 string name = action.ToString();
1313 name.Replace(
"SCR_ScenarioFrameworkPlugin",
"");
1314 listElements.Insert(
string.Format(
"%1 - %2",
index, name));
1317 if (listElements.IsEmpty())
1320 int selectedPluginIndex;
1321 DbgUI.Text(
string.Format(
"%1 Hierarchy:", categoryName));
1322 DbgUI.List(
string.Format(
"%1", categoryName), selectedPluginIndex, listElements);
1324 if (plugins.IsIndexValid(selectedPluginIndex))
1325 ProcessPlugin(plugins[selectedPluginIndex], activationEntity);
1334 if (plugin.m_bDebug)
1336 DbgUI.Text(
"Debug Plugin enabled");
1337 if (
DbgUI.Button(
"Disable Plugin debug"))
1338 plugin.m_bDebug =
false;
1342 DbgUI.Text(
"Debug Plugin disabled");
1343 if (
DbgUI.Button(
"Enable Plugin debug"))
1344 plugin.m_bDebug =
true;
1350 ProcessPluginTrigger(pluginTrigger);
1355 if (pluginOnInventoryChange)
1357 ProcessPluginOnInventoryChange(pluginOnInventoryChange, layerEntity);
1362 if (pluginSpawnPoint)
1364 ProcessPluginSpawnPoint(pluginSpawnPoint, layerEntity);
1369 if (pluginOnDestroyEvent)
1371 ProcessPluginOnDestroyEvent(pluginOnDestroyEvent, layerEntity);
1381 IEntity entity = pluginTrigger.m_Object.GetSpawnedEntity();
1385 BaseGameTriggerEntity baseGameTrigger = BaseGameTriggerEntity.Cast(entity);
1386 if (!baseGameTrigger)
1389 if (baseGameTrigger.IsPeriodicQueriesEnabled())
1391 DbgUI.Text(
"Periodic Queries Enabled");
1392 if (
DbgUI.Button(
"Disable Periodic Queries"))
1393 baseGameTrigger.EnablePeriodicQueries(
false);
1397 DbgUI.Text(
"Periodic Queries Disabled");
1398 if (
DbgUI.Button(
"Enable Periodic Queries"))
1399 baseGameTrigger.EnablePeriodicQueries(
true);
1403 if (!frameworkTrigger)
1406 if (
DbgUI.Button(
"Force Finish Trigger"))
1416 PrepareActionStrings(pluginOnInventoryChange.m_aActionsOnItemAdded, layerEntity,
"Actions On Item Added");
1417 PrepareActionStrings(pluginOnInventoryChange.m_aActionsOnItemRemoved, layerEntity,
"Actions On Item Removed");
1426 PrepareActionStrings(pluginSpawnPoint.m_aActionsOnSpawnPointUsed, layerEntity,
"Actions On Spawn Point Used");
1435 PrepareActionStrings(pluginOnDestroyEvent.m_aActionsOnDestroy, layerEntity,
"Actions On Destroy");
1441 static void ConditionInspector(
string inputLayerName =
"")
1443 DbgUI.Begin(
string.Format(
"ScenarioFramework Condition Inspector %1", inputLayerName));
1446 DbgUI.InputText(
"Layer Name to inspect", inputLayerName);
1454 PrepareConditionStrings(layerBase.m_aActivationConditions, layerEntity,
"Condition");
1456 SCR_ScenarioFrameworkLayerTask layerTask = SCR_ScenarioFrameworkLayerTask.Cast(layerBase);
1458 PrepareConditionStrings(layerTask.m_aFinishConditions, layerEntity,
"Finish Condition");
1460 SCR_ScenarioFrameworkSlotTask slotTask = SCR_ScenarioFrameworkSlotTask.Cast(layerBase);
1462 PrepareConditionStrings(slotTask.m_aFinishConditions, layerEntity,
"Finish Condition");
1474 static void PrepareConditionStrings(array<ref SCR_ScenarioFrameworkActivationConditionBase> conditions,
IEntity activationEntity,
string categoryName)
1476 array<string> listElements = {};
1477 if (!conditions || conditions.IsEmpty())
1482 string name = condition.ToString();
1483 name.Replace(
"SCR_ScenarioFrameworkActivationCondition",
"");
1484 listElements.Insert(
string.Format(
"%1 - %2",
index, name));
1487 if (listElements.IsEmpty())
1490 int selectedPluginIndex;
1491 DbgUI.Text(
string.Format(
"%1 Hierarchy:", categoryName));
1492 DbgUI.List(
string.Format(
"%1", categoryName), selectedPluginIndex, listElements);
1494 if (conditions.IsIndexValid(selectedPluginIndex))
1495 ProcessCondition(conditions[selectedPluginIndex], activationEntity);
1500 if (
DbgUI.Button(
"Perform Conditon Check"))
1501 layerBase.InitActivationConditions();
1511 if (condition.m_bDebug)
1513 DbgUI.Text(
"Debug Condition enabled");
1514 if (
DbgUI.Button(
"Disable Condition debug"))
1515 condition.m_bDebug =
false;
1519 DbgUI.Text(
"Debug Condition disabled");
1520 if (
DbgUI.Button(
"Enable Condition debug"))
1521 condition.m_bDebug =
true;
1524 bool conditionCheck =
false;
1525 DbgUI.Check(
"Check condition status", conditionCheck);
1528 if (condition.Init(layerEntity))
1529 DbgUI.Text(
"Condition: True");
1531 DbgUI.Text(
"Condition: False");