Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SelectionEditorUIComponent.c
Go to the documentation of this file.
1
2
4{
5 protected static const float FRAME_SIZE_MIN = 10;
6 protected static const float FRAME_DURATION_MIN = 0.15;
7
9 [Attribute(desc: "State in which entities are unselected.", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EEditableEntityState))]
11
12 [Attribute(desc: "Only entities of this state can be multi-selected, e.g., using selection frame or by pressing Ctrl+A.", uiwidget: UIWidgets.Flags, enums: ParamEnumArray.FromEnum(EEditableEntityState))]
14
15 [Attribute(desc: "When true, multi-selection operations are enabled (e.g., selection frame or Ctrl+A).", defvalue: "1")]
17
18 [Attribute(desc: "Name of a widget representing setting selection with mouse & keyboard.")]
19 protected string m_sSetSelectionWidgetName;
20
21 [Attribute(desc: "Name of a widget representing toggling selection with mouse & keyboard.")]
23
24 [Attribute(desc: "Name of a widget representing setting selection with gamepad.")]
26
27 [Attribute(desc: "Name of a widget representing toggling selection with gamepad.")]
29
30 [Attribute("1", desc: "Initial size of multi-selection widget, measured as a coefficient of default cursor widget size (1 = same size).")]
32
33 [Attribute(defvalue: "0.5")]
35
36 [Attribute(desc: "Curve defining how will gamepad selection widget expand.", defvalue: "0 0 1 1", uiwidget: UIWidgets.CurveDialog, params: "1 1 0 0")]
38
39 [Attribute(SCR_SoundEvent.SOUND_E_MULTI_SELECT_START_KEYBOARD, UIWidgets.EditBox)]
41
42 [Attribute(SCR_SoundEvent.SOUND_E_MULTI_SELECT_START_GAMEPAD, UIWidgets.EditBox)]
44
45 [Attribute(SCR_SoundEvent.SOUND_E_TRAN_CANCEL, UIWidgets.EditBox)]
47
48 [Attribute(SCR_SoundEvent.SOUND_E_TRAN_CANCEL, UIWidgets.EditBox)]
50
51 [Attribute(SCR_SoundEvent.SOUND_FE_BUTTON_SELECT, UIWidgets.EditBox)]
52 protected string m_sSfxSelectEntities;
53
54 [Attribute(SCR_SoundEvent.TAB_SWITCH, UIWidgets.EditBox)]
55 protected string m_sSfxToggleEntities;
56
57 [Attribute(SCR_SoundEvent.SOUND_FE_BUTTON_SELECT, UIWidgets.EditBox)]
59
60 [Attribute(SCR_SoundEvent.SOUND_E_TRAN_CANCEL, UIWidgets.EditBox)]
62
63 [Attribute(SCR_SoundEvent.SOUND_E_TRAN_CANCEL, UIWidgets.EditBox)]
64 protected string m_sSfxClearSelection;
65
72
81
84
87 protected bool m_bEnableSelection = true;
88 protected bool m_bIsDrawingFrame;
93 protected bool m_bIsAnimatingFrame;
94 protected bool m_bHideCursor;
96 protected BaseWorld m_World;
97
98 //------------------------------------------------------------------------------------------------
103 {
104 if (!m_InputManager.IsUsingMouseAndKeyboard())
106 }
107
109 //--- Input listeners
111
112 //------------------------------------------------------------------------------------------------
113 protected void EditorToggleSelection(float value = 1, EActionTrigger reason = EActionTrigger.DOWN)
114 {
115 if (IsInputDisabled())
116 return;
117
118 set<SCR_EditableEntityComponent> focused = new set<SCR_EditableEntityComponent>();
119 m_FocusedManager.GetEntities(focused);
120
121 //~ Multiple entities selected so play general selection sfx
122 if (focused.Count() > 1)
123 {
124 SCR_UISoundEntity.SoundEvent(m_sSfxToggleEntities, true);
125 }
126 //~ Only one entity so check if toggle on or off sfx should be played
127 else if (!focused.IsEmpty())
128 {
129 set<SCR_EditableEntityComponent> selected = new set<SCR_EditableEntityComponent>();
130 m_SelectedManager.GetEntities(selected, true);
131
132 if (selected.Contains(focused[0]))
134 else
136 }
137
138 m_SelectedManager.Toggle(focused);
139 ShowGUI();
140 }
141
142 //------------------------------------------------------------------------------------------------
143 protected void EditorSetSelection(float value = 1, EActionTrigger reason = EActionTrigger.DOWN)
144 {
145 if (IsInputDisabled())
146 return;
147
148 set<SCR_EditableEntityComponent> focused = new set<SCR_EditableEntityComponent>();
149 m_FocusedManager.GetEntities(focused);
150
151 //~ Set selected
152 if (!focused.IsEmpty())
153 SCR_UISoundEntity.SoundEvent(m_sSfxSelectEntities, true);
154 //~ Check if deselecting any selected entities
155 else if (m_SelectedManager.GetEntitiesCount() > 0)
157
158 m_SelectedManager.Replace(focused, true);
159
160 ShowGUI();
161 }
162
163 //------------------------------------------------------------------------------------------------
164 protected void EditorAddSelection(float value = 1, EActionTrigger reason = EActionTrigger.DOWN)
165 {
166 if (IsInputDisabled())
167 return;
168
169 set<SCR_EditableEntityComponent> focused = new set<SCR_EditableEntityComponent>();
170 m_FocusedManager.GetEntities(focused);
171 m_SelectedManager.Add(focused, true);
172
173 if (!focused.IsEmpty())
175
176 ShowGUI();
177 }
178
179 //------------------------------------------------------------------------------------------------
180 protected void EditorClearSelection(float value = 1, EActionTrigger reason = EActionTrigger.DOWN)
181 {
183 return;
184
185 if (m_SelectedManager.GetEntitiesCount() > 0)
187
188 m_SelectedManager.Clear();
189 ShowGUI();
190 }
191
192 //------------------------------------------------------------------------------------------------
193 protected void EditorSelectAll(float value = 1, EActionTrigger reason = EActionTrigger.DOWN)
194 {
196 return;
197
198 set<SCR_EditableEntityComponent> entities = new set<SCR_EditableEntityComponent>();
199 m_UnselectedManager.GetEntities(entities);
200 if (entities.IsEmpty())
201 return;
202
203 int screenW = m_Workspace.GetWidth();
204 int screenH = m_Workspace.GetHeight();
205
206 set<SCR_EditableEntityComponent> selectEntities = new set<SCR_EditableEntityComponent>();
207 foreach (SCR_EditableEntityComponent entity: entities)
208 {
209 if (!SCR_Enum.HasPartialFlag(entity.GetEntityStates(), m_MultiSelectStates))
210 continue;
211
212 vector posWorld;
213 if (!entity.GetPos(posWorld))
214 continue;
215
216 vector posScreen = m_Workspace.ProjWorldToScreenNative(posWorld, m_World); //--- ToDo: Also check for distance visibility
217 if (posScreen[2] > 0 && posScreen[0] > 0 && posScreen[0] < screenW && posScreen[1] > 0 && posScreen[1] < screenH)
218 selectEntities.Insert(entity);
219 }
220
221 m_SelectedManager.Replace(selectEntities);
222
223 if (!selectEntities.IsEmpty())
225
226 ShowGUI();
227 }
228
229 //------------------------------------------------------------------------------------------------
231 {
232 DrawFrameDown(false);
233 }
234
235 //------------------------------------------------------------------------------------------------
237 {
238 DrawFramePressed(false);
239 }
240
241 //------------------------------------------------------------------------------------------------
242 protected void EditorDrawSetSelectionUp(float value, EActionTrigger reason)
243 {
244 DrawFrameUp(false);
245 }
246
247 //------------------------------------------------------------------------------------------------
249 {
250 DrawFrameDown(true);
251 }
252
253 //------------------------------------------------------------------------------------------------
255 {
256 DrawFramePressed(true);
257 }
258
259 //------------------------------------------------------------------------------------------------
261 {
262 DrawFrameUp(true);
263 }
264
265 //------------------------------------------------------------------------------------------------
267 {
268 CancelFrame();
269 }
270
272 //--- Multi-selection
274
275 //------------------------------------------------------------------------------------------------
276 protected void DrawFrameDown(bool isToggle)
277 {
278 //--- Exit when clicked not on mouse area (e.g., on a button)
280 {
282 return;
283 }
284
285 m_bIsAnimatingFrame = true;
286 m_bIsDrawingFrameIsToggle = isToggle;
290 if (m_vCursorPosClick == vector.Zero)
291 m_vCursorPosClick = m_CursorComponent.GetCursorPos();
292 }
293
294 //------------------------------------------------------------------------------------------------
295 protected void DrawFrameUp(bool isToggle)
296 {
298 {
299 ResetFrame();
300 return;
301 }
302
303 if (isToggle != m_bIsDrawingFrameIsToggle)
304 return;
305
307 GetGame().GetCallqueue().Call(ConfirmFrame, isToggle); //--- Needs a delay to faciliate switching between Set (LMB) and add (Ctrl+LMB) variants
308 }
309
310 //------------------------------------------------------------------------------------------------
311 protected void DrawFramePressed(bool isToggle)
312 {
314 return;
315
316 //--- Some other state is preventing multi-selecting - instantly cancel, so it won't become activated after the other state is unset
317 if ((m_StatesManager && !m_StatesManager.CanSet(EEditorState.MULTI_SELECTING)) || IsMapOpened())
318 {
321 ResetFrame();
322
323 return;
324 }
325
327 return;
328
329 //--- Get visible entities
330 set<SCR_EditableEntityComponent> entitiesInside = new set<SCR_EditableEntityComponent>();
331 set<SCR_EditableEntityComponent> entities = new set<SCR_EditableEntityComponent>();
332 m_UnselectedManager.GetEntities(entities);
333
334 //--- Resize frame
335 if (m_InputManager.IsUsingMouseAndKeyboard())
336 {
337 if (!DrawFrameMouseAndKeyboard(entities, entitiesInside))
338 return;
339
340 //~ Start drawing frame audio
343 }
344 else
345 {
346 if (!DrawFrameController(entities, entitiesInside))
347 return;
348
351 }
352
353 if (m_StatesManager && !m_StatesManager.SetState(EEditorState.MULTI_SELECTING))
354 {
355 DrawFrameUp(isToggle);
356 return;
357 }
358
360 m_EditorMenuManager.SetVisible(true);
361
362 m_bIsDrawingFrame = true;
363 m_HoverManager.SetEntityUnderCursorEnabled(false);
364
365 if (entitiesInside.Count() == m_FocusedManager.GetEntitiesCount())
366 return; //--- Ignore when nothing changed
367
368 m_FocusedManager.Replace(entitiesInside);
369 }
370
371 //------------------------------------------------------------------------------------------------
372 protected bool DrawFrameMouseAndKeyboard(set<SCR_EditableEntityComponent> entities, out set<SCR_EditableEntityComponent> entitiesInside)
373 {
374 //--- Too small frame, ignore (e.g., when just clicking)
375 vector cursorPos = m_CursorComponent.GetCursorPos();
376 if (!m_bIsDrawingFrame && vector.Distance(m_vCursorPosClick, cursorPos) < FRAME_SIZE_MIN)
377 return false;
378
379 //Print("DrawFrameMouseAndKeyboard");
380
381 float xMin = m_vCursorPosClick[0];
382 float yMin = m_vCursorPosClick[1];
383 float xMax = cursorPos[0];
384 float yMax = cursorPos[1];
385 if (xMin > xMax)
386 {
387 xMin = xMax;
388 xMax = m_vCursorPosClick[0];
389 }
390
391 if (yMin > yMax)
392 {
393 yMin = yMax;
394 yMax = m_vCursorPosClick[1];
395 }
396
398 {
399 FrameSlot.SetPos(m_ToggleSelectionWidget, xMin, yMin);
400 FrameSlot.SetSize(m_ToggleSelectionWidget, xMax - xMin, yMax - yMin);
402 m_SetSelectionWidget.SetVisible(false);
403
405 m_ToggleSelectionWidget.SetVisible(true);
406 }
407 else
408 {
409 FrameSlot.SetPos(m_SetSelectionWidget, xMin, yMin);
410 FrameSlot.SetSize(m_SetSelectionWidget, xMax - xMin, yMax - yMin);
412 m_ToggleSelectionWidget.SetVisible(false);
413
415 m_SetSelectionWidget.SetVisible(true);
416 }
417
418 //--- Find entities in the frame
419 vector worldPos, screenPos;
420 foreach (SCR_EditableEntityComponent entity: entities)
421 {
422 if (!SCR_Enum.HasPartialFlag(entity.GetEntityStates(), m_MultiSelectStates))
423 continue;
424
425 if (!entity.GetPos(worldPos))
426 continue;
427
428 screenPos = m_Workspace.ProjWorldToScreen(worldPos, m_World);
429 if (screenPos[2] > 0 && screenPos[0] > xMin && screenPos[0] < xMax && screenPos[1] > yMin && screenPos[1] < yMax)
430 {
431 if (m_LayersManager)
432 entity = m_LayersManager.GetParentBelowCurrentLayer(entity);
433
434 if (entity)
435 entitiesInside.Insert(entity);
436 }
437 }
438
439 return true;
440 }
441
442 //---- REFACTOR NOTE START: Use of unclear hardcoded values
443
444 //------------------------------------------------------------------------------------------------
445 protected bool DrawFrameController(set<SCR_EditableEntityComponent> entities, out set<SCR_EditableEntityComponent> entitiesInside)
446 {
447 //--- Too fast, ignore (e.g., when just clicking)
449 return false;
450
451 float size;
452 vector cursorPos = m_CursorComponent.GetCursorPos();
454
458 {
460 widgetHide = m_GamepadSetSelectionWidget;
461 }
462
463 if (widgetHide)
464 widgetHide.SetVisible(false);
465
466 if (widgetShow)
467 {
468 float cursorRadius = 0;
470 cursorRadius = 2 * m_CursorComponent.GetCursorRadius() * m_fGamepadSelectionWidgetStartSize;
471
472 size = cursorRadius + (m_iGamepadSelectionHeight - cursorRadius) * curveCoef;
473 FrameSlot.SetPos(widgetShow, cursorPos[0], cursorPos[1]);
474 FrameSlot.SetSize(widgetShow, size, size);
475 widgetShow.SetVisible(true);
476 widgetShow.SetOpacity(1);
477
478 //--- Convert to squared radius
479 size *= 0.5;
480 size *= size;
481 }
482
483 //--- Hide gamepad cursor
484 if (m_CursorComponent && !m_bHideCursor && curveCoef > 0.01)
485 {
486 m_bHideCursor = true;
487 m_CursorComponent.SetCursorAlpha(0, 32);
488 }
489
490 //--- Find entities in the frame
491 foreach (SCR_EditableEntityComponent entity: entities)
492 {
493 if (!SCR_Enum.HasPartialFlag(entity.GetEntityStates(), m_MultiSelectStates))
494 continue;
495
496 vector worldPos;
497 if (!entity.GetPos(worldPos))
498 continue;
499
500 vector screenPos = m_Workspace.ProjWorldToScreen(worldPos, m_World);
501 if (screenPos[2] > 0 && vector.DistanceSq(cursorPos, screenPos) < size)
502 {
503 if (m_LayersManager)
504 entity = m_LayersManager.GetParentBelowCurrentLayer(entity);
505
506 if (entity)
507 entitiesInside.Insert(entity);
508 }
509 }
510
511 return true;
512 }
513
514 //---- REFACTOR NOTE END ----
515
516 //------------------------------------------------------------------------------------------------
517 protected void ConfirmFrame(bool isToggle)
518 {
520 return;
521
522 m_bIsDrawingFrame = false;
524 {
526 }
527 else
528 {
530
531 set<SCR_EditableEntityComponent> selected = new set<SCR_EditableEntityComponent>();
532 m_SelectedManager.GetEntities(selected, true);
533
534 //Nothing selected so play SFX
535 if (m_SelectedManager.GetEntitiesCount() <= 0)
537
538// if (m_InputManager.IsUsingMouseAndKeyboard())
539// EditorSetSelection();
540// else
541// EditorAddSelection(); //--- With gamepad, add to selection, don't replace it
542 }
543
544 ResetFrame();
546 }
547
548 //------------------------------------------------------------------------------------------------
549 protected void CancelFrame()
550 {
552 {
553 //~ Cancel Sfx
555
557 ResetFrame();
558 }
559 }
560
561 //---- REFACTOR NOTE START: Use of unclear hardcoded values
562 // Double click handled by delay using call later
563
564 //------------------------------------------------------------------------------------------------
565 protected void ResetFrame()
566 {
570 m_bIsDrawingFrame = false;
571 m_bHideCursor = false;
572
573 if (m_StatesManager)
574 m_StatesManager.UnsetState(EEditorState.MULTI_SELECTING);
575
576 //if (m_FocusedManager) m_FocusedManager.Clear(); //--- Disabled, handled in m_HoverManager.SetEntityUnderCursorEnabled
577 if (m_HoverManager)
578 m_HoverManager.SetEntityUnderCursorEnabled(true);
579
581 m_SetSelectionWidget.SetVisible(false);
582
584 m_ToggleSelectionWidget.SetVisible(false);
585 //if (m_GamepadSetSelectionWidget)
586 // m_GamepadSetSelectionWidget.SetVisible(false);
587 //if (m_GamepadToggleSelectionWidget)
588 // m_GamepadToggleSelectionWidget.SetVisible(false);
590 m_CursorComponent.SetCursorAlpha(1, 8);
591 }
592
593 //------------------------------------------------------------------------------------------------
595 {
596 //--- Clear selection when layers change
597 EnableSelection(false);
598
599 //--- Block input for a few frames (double-click also counts as selection click)
600 GetGame().GetCallqueue().CallLater(EnableSelection, 100, false, true);
601 m_SelectedManager.Clear();
602 }
603
604 //---- REFACTOR NOTE END ----
605
606 //------------------------------------------------------------------------------------------------
607 protected void EnableSelection(bool enable)
608 {
609 m_bEnableSelection = enable;
610 }
611
612 //------------------------------------------------------------------------------------------------
613 protected bool IsMapOpened()
614 {
616 }
617
618 //---- REFACTOR NOTE START: Use of unclear hardcoded values
619
620 //------------------------------------------------------------------------------------------------
621 protected void OnMenuUpdate(float tDelta)
622 {
623 if (!m_Workspace || !m_InputManager/* || !GetWidget().IsEnabledInHierarchy()*/)
624 return;
625
626 if (m_StatesManager && (m_StatesManager.GetState() != EEditorState.SELECTING && m_StatesManager.GetState() != EEditorState.MULTI_SELECTING))
627 return; //--- ToDo: Move to OnStateChange event?
628
629 //--- Activate context for input listeners
630 m_InputManager.ActivateContext("EditorSelectingContext");
631
633 {
634 //--- Fade in gamepad selection frame
636
637 //--- Fade out gamepad selection frame
639 {
640 Widget frameWidget;
642 frameWidget = m_GamepadToggleSelectionWidget;
643 else
644 frameWidget = m_GamepadSetSelectionWidget;
645
646 if (frameWidget)
647 {
648 float opacity = Math.Lerp(frameWidget.GetOpacity(), 0, 32 * tDelta);
649 if (opacity < 0.001)
650 {
651 opacity = 0;
652 m_bIsAnimatingFrame = false;
653 }
654 frameWidget.SetOpacity(opacity);
655 }
656 }
657 }
658 }
659
660 //---- REFACTOR NOTE END ----
661
662 //------------------------------------------------------------------------------------------------
663 protected void OnMenuFocusLost()
664 {
665 CancelFrame();
666 }
667
668 //------------------------------------------------------------------------------------------------
669 protected Widget GetFrameWidget(Widget root, string name)
670 {
671 Widget widget = root.FindWidget(name);
672 if (widget && !name.IsEmpty())
673 {
674 widget.SetVisible(false);
675 return widget;
676 }
677 else
678 {
679 Print(string.Format("Selection frame widget '%1' not found!", name), LogLevel.ERROR);
680 return null;
681 }
682 }
683
684 //---- REFACTOR NOTE START: Worth rethinking?
685
687 //--- Saved selection (cannot be done dynamically, action listeners cannot pass index as param)
689
690 //------------------------------------------------------------------------------------------------
691 protected void EditorSaveSelection(int index)
692 {
693 m_SelectedManager.SaveSelection(index);
694 }
705
706 //------------------------------------------------------------------------------------------------
707 protected void EditorLoadSelection(int index)
708 {
709 m_SelectedManager.LoadSelection(index);
710 }
721
722 //------------------------------------------------------------------------------------------------
723 protected void EditorTeleportSelection(int index)
724 {
725 m_SelectedManager.TeleportSelection(index);
726 }
737
738 //---- REFACTOR NOTE END ----
739
741 //--- Custom methods
743
744 //------------------------------------------------------------------------------------------------
745 protected bool IsInputDisabled()
746 {
747 return m_bIsDrawingFrame //--- Multi-selection is active
748 //--- Required classes unavailable
750 //--- Disabled internally
752 //--- Clicked with mouse on unrelated widget with no entity under cursor
753 || (m_InputManager.IsUsingMouseAndKeyboard() && m_FocusedManager.GetEntitiesCount() == 0 && !m_MouseArea.IsMouseOn());
754 }
755
756 //------------------------------------------------------------------------------------------------
757 protected void ShowGUI()
758 {
760 m_EditorMenuManager.SetVisible(true);
761 }
762
764 //--- Default methods
766
767 //---- REFACTOR NOTE START: Use of hardcoded values and specific methods limits modularity
768
769 //------------------------------------------------------------------------------------------------
771 {
772 super.HandlerAttachedScripted(w);
774 return; //--- Run-time only
775
776 ArmaReforgerScripted game = GetGame();
777 if (!game)
778 return;
779
780 m_InputManager = game.GetInputManager();
781 m_Workspace = game.GetWorkspace();
782 m_World = game.GetWorld();
783 if (!m_Workspace)
784 return;
785
786 MenuRootBase menu = GetMenu();
787 if (!menu)
788 return;
789
794
797
798 MenuRootComponent root = GetRootComponent();
799 if (root)
800 {
803 return;
804
806 }
807
809 if (m_StatesManager)
810 m_StatesManager.SetState(EEditorState.SELECTING);
811
813 if (m_LayersManager)
814 m_LayersManager.GetOnCurrentLayerChange().Insert(OnCurrentLayerChange);
815
819 return;
820
825
826 if (m_InputManager)
827 {
828 m_InputManager.AddActionListener("EditorSetSelection", EActionTrigger.DOWN, EditorSetSelection);
829 m_InputManager.AddActionListener("EditorClearSelection", EActionTrigger.DOWN, EditorClearSelection);
831 {
832 m_InputManager.AddActionListener("EditorToggleSelection", EActionTrigger.DOWN, EditorToggleSelection);
833 m_InputManager.AddActionListener("EditorSelectAll", EActionTrigger.DOWN, EditorSelectAll);
834 m_InputManager.AddActionListener("EditorDrawSetSelection", EActionTrigger.DOWN, EditorDrawSetSelectionDown);
835 m_InputManager.AddActionListener("EditorDrawSetSelection", EActionTrigger.PRESSED, EditorDrawSetSelectionPressed);
836 m_InputManager.AddActionListener("EditorDrawSetSelection", EActionTrigger.UP, EditorDrawSetSelectionUp);
837
838 m_InputManager.AddActionListener("EditorDrawToggleSelection", EActionTrigger.DOWN, EditorDrawToggleSelectionDown);
839 m_InputManager.AddActionListener("EditorDrawToggleSelection", EActionTrigger.PRESSED, EditorDrawToggleSelectionPressed);
840 m_InputManager.AddActionListener("EditorDrawToggleSelection", EActionTrigger.UP, EditorDrawToggleSelectionUp);
841
842 m_InputManager.AddActionListener("EditorDrawSelectionCancel", EActionTrigger.DOWN, EditorDrawSelectionCancel);
843 }
844
845 m_InputManager.AddActionListener("EditorSaveSelection1", EActionTrigger.DOWN, EditorSaveSelection1);
846 m_InputManager.AddActionListener("EditorSaveSelection2", EActionTrigger.DOWN, EditorSaveSelection2);
847 m_InputManager.AddActionListener("EditorSaveSelection3", EActionTrigger.DOWN, EditorSaveSelection3);
848 m_InputManager.AddActionListener("EditorSaveSelection4", EActionTrigger.DOWN, EditorSaveSelection4);
849 m_InputManager.AddActionListener("EditorSaveSelection5", EActionTrigger.DOWN, EditorSaveSelection5);
850 m_InputManager.AddActionListener("EditorSaveSelection6", EActionTrigger.DOWN, EditorSaveSelection6);
851 m_InputManager.AddActionListener("EditorSaveSelection7", EActionTrigger.DOWN, EditorSaveSelection7);
852 m_InputManager.AddActionListener("EditorSaveSelection8", EActionTrigger.DOWN, EditorSaveSelection8);
853 m_InputManager.AddActionListener("EditorSaveSelection9", EActionTrigger.DOWN, EditorSaveSelection9);
854 m_InputManager.AddActionListener("EditorSaveSelection0", EActionTrigger.DOWN, EditorSaveSelection0);
855
856 m_InputManager.AddActionListener("EditorLoadSelection1", EActionTrigger.DOWN, EditorLoadSelection1);
857 m_InputManager.AddActionListener("EditorLoadSelection2", EActionTrigger.DOWN, EditorLoadSelection2);
858 m_InputManager.AddActionListener("EditorLoadSelection3", EActionTrigger.DOWN, EditorLoadSelection3);
859 m_InputManager.AddActionListener("EditorLoadSelection4", EActionTrigger.DOWN, EditorLoadSelection4);
860 m_InputManager.AddActionListener("EditorLoadSelection5", EActionTrigger.DOWN, EditorLoadSelection5);
861 m_InputManager.AddActionListener("EditorLoadSelection6", EActionTrigger.DOWN, EditorLoadSelection6);
862 m_InputManager.AddActionListener("EditorLoadSelection7", EActionTrigger.DOWN, EditorLoadSelection7);
863 m_InputManager.AddActionListener("EditorLoadSelection8", EActionTrigger.DOWN, EditorLoadSelection8);
864 m_InputManager.AddActionListener("EditorLoadSelection9", EActionTrigger.DOWN, EditorLoadSelection9);
865 m_InputManager.AddActionListener("EditorLoadSelection0", EActionTrigger.DOWN, EditorLoadSelection0);
866
867 m_InputManager.AddActionListener("EditorTeleportSelection1", EActionTrigger.DOWN, EditorTeleportSelection1);
868 m_InputManager.AddActionListener("EditorTeleportSelection2", EActionTrigger.DOWN, EditorTeleportSelection2);
869 m_InputManager.AddActionListener("EditorTeleportSelection3", EActionTrigger.DOWN, EditorTeleportSelection3);
870 m_InputManager.AddActionListener("EditorTeleportSelection4", EActionTrigger.DOWN, EditorTeleportSelection4);
871 m_InputManager.AddActionListener("EditorTeleportSelection5", EActionTrigger.DOWN, EditorTeleportSelection5);
872 m_InputManager.AddActionListener("EditorTeleportSelection6", EActionTrigger.DOWN, EditorTeleportSelection6);
873 m_InputManager.AddActionListener("EditorTeleportSelection7", EActionTrigger.DOWN, EditorTeleportSelection7);
874 m_InputManager.AddActionListener("EditorTeleportSelection8", EActionTrigger.DOWN, EditorTeleportSelection8);
875 m_InputManager.AddActionListener("EditorTeleportSelection9", EActionTrigger.DOWN, EditorTeleportSelection9);
876 m_InputManager.AddActionListener("EditorTeleportSelection0", EActionTrigger.DOWN, EditorTeleportSelection0);
877 }
878
879 menu.GetOnMenuUpdate().Insert(OnMenuUpdate);
880 menu.GetOnMenuFocusLost().Insert(OnMenuFocusLost);
881 }
882
883 //------------------------------------------------------------------------------------------------
884 override void HandlerDeattached(Widget w)
885 {
886 super.HandlerDeattached(w);
887
888 MenuRootBase menu = GetMenu();
889 if (menu)
890 {
891 menu.GetOnMenuUpdate().Remove(OnMenuUpdate);
892 menu.GetOnMenuFocusLost().Remove(OnMenuFocusLost);
893 }
894
895 if (m_LayersManager)
896 m_LayersManager.GetOnCurrentLayerChange().Remove(OnCurrentLayerChange);
897
898 if (m_InputManager)
899 {
900 m_InputManager.RemoveActionListener("EditorSetSelection", EActionTrigger.DOWN, EditorSetSelection);
901 m_InputManager.RemoveActionListener("EditorClearSelection", EActionTrigger.DOWN, EditorClearSelection);
903 {
904 m_InputManager.RemoveActionListener("EditorToggleSelection", EActionTrigger.DOWN, EditorToggleSelection);
905 m_InputManager.RemoveActionListener("EditorSelectAll", EActionTrigger.DOWN, EditorSelectAll);
906
907 m_InputManager.RemoveActionListener("EditorDrawSetSelection", EActionTrigger.DOWN, EditorDrawSetSelectionDown);
908 m_InputManager.RemoveActionListener("EditorDrawSetSelection", EActionTrigger.PRESSED, EditorDrawSetSelectionPressed);
909 m_InputManager.RemoveActionListener("EditorDrawSetSelection", EActionTrigger.UP, EditorDrawSetSelectionUp);
910
911 m_InputManager.RemoveActionListener("EditorDrawToggleSelection", EActionTrigger.DOWN, EditorDrawToggleSelectionDown);
912 m_InputManager.RemoveActionListener("EditorDrawToggleSelection", EActionTrigger.PRESSED, EditorDrawToggleSelectionPressed);
913 m_InputManager.RemoveActionListener("EditorDrawToggleSelection", EActionTrigger.UP, EditorDrawToggleSelectionUp);
914
915 m_InputManager.RemoveActionListener("EditorDrawSelectionCancel", EActionTrigger.DOWN, EditorDrawSelectionCancel);
916 }
917 }
918 }
919
920 //---- REFACTOR NOTE END ----
921}
ref DSGameConfig game
Definition DSConfig.c:81
ArmaReforgerScripted GetGame()
Definition game.c:1398
int size
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
SCR_RadialMenu GetMenu()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Math.c:22
Input management system for user interactions.
Definition Math.c:13
ScriptInvoker GetOnMenuUpdate()
ScriptInvoker GetOnMenuFocusLost()
MenuRootSubComponent FindComponent(typename type, bool showError=false)
static bool IsEditMode()
Definition Functions.c:1566
bool IsOpen()
Check if the map is opened.
static SCR_MapEntity GetMapInstance()
Get map entity instance.
void OnCurrentLayerChange(SCR_EditableEntityComponent currentLayer, SCR_EditableEntityComponent prevLayer)
void EditorDrawSetSelectionDown(float value, EActionTrigger reason)
void EditorDrawSetSelectionUp(float value, EActionTrigger reason)
Widget GetFrameWidget(Widget root, string name)
EEditableEntityState m_UnselectedState
State in which entities are unselected.
void EditorClearSelection(float value=1, EActionTrigger reason=EActionTrigger.DOWN)
static const float FRAME_DURATION_MIN
How long must the button bepressed for frame selection to behin (controller).
void EditorAddSelection(float value=1, EActionTrigger reason=EActionTrigger.DOWN)
void EditorDrawSetSelectionPressed(float value, EActionTrigger reason)
void EditorSelectAll(float value=1, EActionTrigger reason=EActionTrigger.DOWN)
bool DrawFrameMouseAndKeyboard(set< SCR_EditableEntityComponent > entities, out set< SCR_EditableEntityComponent > entitiesInside)
SCR_BaseEditableEntityFilter m_UnselectedManager
SCR_HoverEditableEntityFilter m_HoverManager
SCR_SelectedEditableEntityFilter m_SelectedManager
SCR_CursorEditorUIComponent m_CursorComponent
SCR_BaseEditableEntityFilter m_FocusedManager
void EditorDrawSelectionCancel(float value, EActionTrigger reason)
bool DrawFrameController(set< SCR_EditableEntityComponent > entities, out set< SCR_EditableEntityComponent > entitiesInside)
void EditorToggleSelection(float value=1, EActionTrigger reason=EActionTrigger.DOWN)
void EditorDrawToggleSelectionDown(float value, EActionTrigger reason)
void EditorDrawToggleSelectionUp(float value, EActionTrigger reason)
SCR_EntitiesManagerEditorComponent m_EntitiesManager
void EditorDrawToggleSelectionPressed(float value, EActionTrigger reason)
static const float FRAME_SIZE_MIN
How many ref pixels must cursor move for frame selection to begin (mouse & keyboard).
SCR_MouseAreaEditorUIComponent m_MouseArea
void EditorSetSelection(float value=1, EActionTrigger reason=EActionTrigger.DOWN)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
EEditableEntityState
SCR_FieldOfViewSettings Attribute
EEditorState
Unique editor state.
Definition EEditorState.c:6
EActionTrigger
ECurveType
Definition ECurveType.c:13