Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ContextMenuActionsEditorUIComponent.c
Go to the documentation of this file.
2{
3 [Attribute(SCR_SoundEvent.FOCUS, UIWidgets.EditBox)]
4 protected string m_sSoundOnOpen;
5
6 [Attribute(SCR_SoundEvent.SOUND_E_TRAN_CANCEL, UIWidgets.EditBox)]
7 protected string m_sSoundOnCancelClose;
8
9 //~ Makes sure context action is never opened if not selection state
10 protected bool m_bEditorIsSelectingState = true;
11
13
14 //------------------------------------------------------------------------------------------------
15 protected void OnHoveredEntityCheck(float tDelta)
16 {
18 {
20 GetMenu().GetOnMenuUpdate().Remove(OnHoveredEntityCheck);
21 }
22 }
23
24 //------------------------------------------------------------------------------------------------
25 override protected void PopulateContextMenu(vector cursorWorldPosition)
26 {
27 super.PopulateContextMenu(cursorWorldPosition);
30 {
31 GetMenu().GetOnMenuUpdate().Insert(OnHoveredEntityCheck);
32
33 //--- Close the menu when UI of hovered entity changed, as it implies major change in its state (e.g., character died)
34 if (m_HoveredEntityReference.GetOnUIRefresh())
35 m_HoveredEntityReference.GetOnUIRefresh().Insert(CloseContextMenu);
36 }
37 }
38
39 //------------------------------------------------------------------------------------------------
44
45 //------------------------------------------------------------------------------------------------
46 protected override void OpenContextMenu()
47 {
48 super.OpenContextMenu();
49
50 if (m_ContextMenu && m_ContextMenu.IsVisible())
52 }
53
54 //------------------------------------------------------------------------------------------------
55 override void CloseContextMenu()
56 {
57 if (m_ContextMenu && m_ContextMenu.IsVisible())
58 GetGame().GetCallqueue().CallLater(DelayedCloseSound, 100);
59
61 {
62 GetMenu().GetOnMenuUpdate().Remove(OnHoveredEntityCheck);
64 }
65
66 super.CloseContextMenu();
67 }
68
69 //------------------------------------------------------------------------------------------------
70 protected void DelayedCloseSound()
71 {
72 if (!IsContextMenuOpen())
74 }
75
76 //------------------------------------------------------------------------------------------------
77 protected void OnOpenActionsMenuUp()
78 {
79 //~ Check if can open
81 {
82 //~ Reset the state
84 return;
85 }
86
87 //~ Open
89 }
90
91 //------------------------------------------------------------------------------------------------
92 protected override void OnOpenActionsMenuDown()
93 {
94 super.OnOpenActionsMenuDown();
95
96 //~ Is not selecting state so make sure on up context menu is not opened
98 if (statesManager && statesManager.GetState() != EEditorState.SELECTING)
100 }
101
102 //------------------------------------------------------------------------------------------------
104 {
105 super.HandlerAttachedScripted(w);
106
107 if (m_InputManager)
108 {
109 m_InputManager.AddActionListener("EditorActionsMenu", EActionTrigger.DOWN, OnOpenActionsMenuDown);
110 m_InputManager.AddActionListener("EditorActionsMenu", EActionTrigger.UP, OnOpenActionsMenuUp);
111 }
112
113 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_EDITOR_ACTIONS_MENU_SHOWDISABLED, string.Empty, "Show disabled actions", "Actions Menu");
114 }
115
116 //------------------------------------------------------------------------------------------------
117 override void HandlerDeattached(Widget w)
118 {
119 super.HandlerDeattached(w);
120
121 if (m_InputManager)
122 {
123 m_InputManager.RemoveActionListener("EditorActionsMenu", EActionTrigger.DOWN, OnOpenActionsMenuDown);
124 m_InputManager.RemoveActionListener("EditorActionsMenu", EActionTrigger.UP, OnOpenActionsMenuUp);
125 }
126
127 DiagMenu.Unregister(SCR_DebugMenuID.DEBUGUI_EDITOR_ACTIONS_MENU_SHOWDISABLED);
128 }
129}
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition DebugMenuID.c:4
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_RadialMenu GetMenu()
Diagnostic and developer menu system.
Definition DiagMenu.c:18
SCR_FieldOfViewSettings Attribute
EEditorState
Unique editor state.
Definition EEditorState.c:6
EActionTrigger