6 protected ref array<EEditorMode> m_aActiveModes = {};
7 protected ref SCR_SortedArray<SCR_EditorModePrefab> m_aOrderedEditorModePrefabs =
new SCR_SortedArray<SCR_EditorModePrefab>();
25 m_aActiveModes.Insert(modeEntity.GetModeType());
35 int index = m_aActiveModes.Find(modeEntity.GetModeType());
39 m_aActiveModes.Remove(
index);
44 protected void CreateDropdown()
52 int count = m_aOrderedEditorModePrefabs.Count();
54 for(
int i = 0; i < count; ++i)
60 m_DropdownWidget.AddItem(info, info.GetModeColor());
62 if (currentModeEntity && currentModeEntity.GetModeType() == m_aOrderedEditorModePrefabs[i].GetMode())
63 m_DropdownWidget.SetCurrentItem(i,
false);
78 m_DropdownWidget.CloseDropdown();
91 WorkspaceWidget workspace =
GetGame().GetWorkspace();
94 if (workspace.GetFocusedWidget() == m_DropdownWidget.GetRootWidget())
95 workspace.SetFocusedWidget(
null);
102 protected void RefreshModes()
105 if (!currentModeEntity)
110 int count = m_aOrderedEditorModePrefabs.Count();
111 for(
int i = 0; i < count; ++i)
113 m_DropdownWidget.SetItemVisible(i, m_aActiveModes.Contains(m_aOrderedEditorModePrefabs[i].GetMode()));
115 if (!m_aActiveModes.Contains(m_aOrderedEditorModePrefabs[i].GetMode()))
121 if (currentModeEntity.GetModeType() == m_aOrderedEditorModePrefabs[i].GetMode())
122 m_DropdownWidget.SetCurrentItem(i,
false);
131 super.OnDialogOpened(linkedComponent);
139 int count = m_aOrderedEditorModePrefabs.Count();
141 for(
int i = 0; i < count; ++i)
143 if (m_aOrderedEditorModePrefabs[i].GetMode() == currentMode)
154 protected void SetSiblingMode(
int relIndex)
159 array<EEditorMode> modes = {};
169 protected void OnEditorModePrev(
float value, EActionTrigger reason)
175 protected void OnEditorModeNext(
float value, EActionTrigger reason)
181 override void OnRepeat()
188 override void OnInputDeviceIsGamepad(
bool isGamepad)
193 m_DropdownWidget.CloseDropdown();
200 m_CanCloseWithToggleAction =
false;
209 m_CanCloseWithToggleAction =
true;
215 override void HandlerAttachedScripted(Widget w)
217 super.HandlerAttachedScripted(w);
228 if (!m_DropdownWidget)
232 Widget border = w.FindAnyWidget(
"Border");
234 border.SetOpacity(0);
236 m_DropdownWidget.GetOnChanged().Insert(OnModeSelected);
237 m_DropdownWidget.GetOnOpened().Insert(OnDropdownOpen);
239 array<SCR_EditorModeEntity> modeEntities = {};
241 for (
int i = 0; i < modesCount; i++)
243 OnModeAdd(modeEntities[i]);
247 core.GetBaseModePrefabs(m_aOrderedEditorModePrefabs, -1,
true);
256 InputManager inputManager =
GetGame().GetInputManager();
259 inputManager.AddActionListener(
"EditorModePrev", EActionTrigger.PRESSED, OnEditorModePrev);
260 inputManager.AddActionListener(
"EditorModeNext", EActionTrigger.PRESSED, OnEditorModeNext);
265 override void HandlerDeattached(Widget w)
267 super.HandlerDeattached(w);
276 InputManager inputManager =
GetGame().GetInputManager();
279 inputManager.RemoveActionListener(
"EditorModePrev", EActionTrigger.PRESSED, OnEditorModePrev);
280 inputManager.RemoveActionListener(
"EditorModeNext", EActionTrigger.PRESSED, OnEditorModeNext);
283 if (m_DropdownWidget)
285 m_DropdownWidget.GetOnChanged().Remove(OnModeSelected);
286 m_DropdownWidget.GetOnOpened().Remove(OnDropdownOpen);
287 m_DropdownWidget.GetOnClosed().Remove(OnDropdownClosed);