Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CommandActionsEditorUIComponent.c
Go to the documentation of this file.
2{
3 [Attribute("EditorSetCommand")]
4 protected string m_sSetCommandAction;
5
6 [Attribute("EditorAddCommand")]
7 protected string m_sAddCommandAction;
8
12
14
15 //------------------------------------------------------------------------------------------------
22
23 //------------------------------------------------------------------------------------------------
30
31 //------------------------------------------------------------------------------------------------
32 protected void PerformDefaultCommand(bool isQueue)
33 {
35 if (!OnCancelUp() || IsContextMenuOpen())
36 return;
37
38 m_CommandActionsComponent.PerformDefaultAction(isQueue);
39 }
40
41 //------------------------------------------------------------------------------------------------
42 protected void OnEditorSetCommand()
43 {
45 }
46
47 //------------------------------------------------------------------------------------------------
48 protected void OnEditorAddCommand()
49 {
51 }
52
53 //------------------------------------------------------------------------------------------------
54 protected void OnEditorCommandModifier(float value, EActionTrigger reason)
55 {
56 if (reason == EActionTrigger.DOWN)
57 {
59 m_Filter.GetOnChanged().Insert(OnSelectedChanged);
60 }
61 else
62 {
63 UpdateState(true);
64 m_Filter.GetOnChanged().Remove(OnSelectedChanged);
65 }
66 }
67
68 //------------------------------------------------------------------------------------------------
69 protected void OnSelectedChanged(EEditableEntityState state, set<SCR_EditableEntityComponent> entitiesInsert, set<SCR_EditableEntityComponent> entitiesRemove)
70 {
72 }
73
74 //------------------------------------------------------------------------------------------------
75 protected void UpdateState(bool clear = false)
76 {
77
78 if (clear)
79 m_State = 0;
80 else
81 m_State = m_CommandActionsComponent.ValidateSelection(false);
82
84 }
85
86 //------------------------------------------------------------------------------------------------
87 private void OnMenuUpdate(float tDelta)
88 {
89 m_InputManager.ActivateContext("EditorCommandContext");
90 //m_InputManager.ActivateContext("EditorCommandActionsContext");
91 //m_InputManager.SetContextDebug("EditorCommandActionsContext", true);
92 }
93
94 //------------------------------------------------------------------------------------------------
95 override void HandlerAttachedScripted(Widget w)
96 {
97 super.HandlerAttachedScripted(w);
98
99 m_CommandActionsComponent = SCR_CommandActionsEditorComponent.Cast(SCR_CommandActionsEditorComponent.GetInstance(SCR_CommandActionsEditorComponent, true));
102 return;
103
104 if (m_InputManager)
105 {
108
109 m_InputManager.AddActionListener("EditorCommandModifier", EActionTrigger.DOWN, OnEditorCommandModifier);
110 m_InputManager.AddActionListener("EditorCommandModifier", EActionTrigger.UP, OnEditorCommandModifier);
111 }
112
113 m_Filter = SCR_BaseEditableEntityFilter.GetInstance(EEditableEntityState.COMMANDED, true); //--- ToDo: Don't hardcode
114
115 MenuRootBase menu = GetMenu();
116 if (!menu)
117 return;
118
119 menu.GetOnMenuUpdate().Insert(OnMenuUpdate);
120 }
121
122 //------------------------------------------------------------------------------------------------
123 override void HandlerDeattached(Widget w)
124 {
125 super.HandlerDeattached(w);
126
127 if (m_InputManager)
128 {
131
132 m_InputManager.RemoveActionListener("EditorCommandModifier", EActionTrigger.DOWN, OnEditorCommandModifier);
133 m_InputManager.RemoveActionListener("EditorCommandModifier", EActionTrigger.UP, OnEditorCommandModifier);
134 }
135
136 if (m_Filter)
137 m_Filter.GetOnChanged().Remove(OnSelectedChanged);
138
139 MenuRootBase menu = GetMenu();
140 if (!menu)
141 return;
142
143 menu.GetOnMenuUpdate().Remove(OnMenuUpdate);
144 }
145}
InputManager m_InputManager
void OnMenuUpdate(float tDelta)
SCR_RadialMenu GetMenu()
ScriptInvoker GetOnMenuUpdate()
void OnEditorCommandModifier(float value, EActionTrigger reason)
void OnSelectedChanged(EEditableEntityState state, set< SCR_EditableEntityComponent > entitiesInsert, set< SCR_EditableEntityComponent > entitiesRemove)
SCR_CommandActionsEditorComponent m_CommandActionsComponent
EEditableEntityState
SCR_FieldOfViewSettings Attribute
EEditorCommandActionFlags
Simplified action conditions.
EActionTrigger
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134