Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MapCommandCursor.c
Go to the documentation of this file.
2{
3 protected bool m_bIsDestinationEnabled;
5 protected SCR_MapCursorModule m_MapCursorModule;
6
9
10 //------------------------------------------------------------------------------------------------
19
20 //------------------------------------------------------------------------------------------------
29
30 //------------------------------------------------------------------------------------------------
31 void ShowCursor(vector startCursorPosition)
32 {
35
38
39 m_vStartPosition = startCursorPosition;
40
41 GetGame().GetCallqueue().CallLater(UpdateCursor, 100, true);
42 }
43
44 //------------------------------------------------------------------------------------------------
46 {
47 return true;
48 }
49
50 //------------------------------------------------------------------------------------------------
56
57 //------------------------------------------------------------------------------------------------
63
64 //------------------------------------------------------------------------------------------------
65 protected void OnSelection(vector coords)
66 {
68 if (!mapEntity)
69 return;
70
71 float x, y;
72 mapEntity.ScreenToWorld(coords[0], coords[2], x, y);
73 coords[0] = x;
74 coords[2] = y;
75
77 {
80 }
81 else
82 {
84 }
85
86 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_MAP_CLICK_POINT_ON);
87 }
88
89 //------------------------------------------------------------------------------------------------
90 protected void UpdateCursor()
91 {
93 if (!mapEntity)
94 return;
95
96 float cursorX = GetGame().GetWorkspace().DPIScale(SCR_MapCursorInfo.x);
97 float cursorY = GetGame().GetWorkspace().DPIScale(SCR_MapCursorInfo.y);
98
99 float x, y;
100 vector worldPosition;
101 mapEntity.ScreenToWorld(cursorX, cursorY, x, y);
102 worldPosition[0] = x;
103 worldPosition[2] = y;
104
105 // set cursor type and color
106 if (CanExecuteCommand(worldPosition))
107 {
109 return;
110
114 }
115 else
116 {
118 return;
119
123 }
124 }
125
126 //------------------------------------------------------------------------------------------------
127 protected void OnMapClose(MapConfiguration config)
128 {
129 DisableSelection(false);// toggleOffCursors param is disabled here, because cursors are reset in the SCR_MapCursorModule
130 }
131
132 //------------------------------------------------------------------------------------------------
133 void DisableSelection(bool toggleOffCursors = true)
134 {
137
138 if (toggleOffCursors)
139 {
142 }
143
144 GetGame().GetCallqueue().Remove(UpdateCursor);
145 }
146
147 //------------------------------------------------------------------------------------------------
148 protected void TogglePositiveCursor(bool enable)
149 {
151 return;
152
153 m_MapCursorModule.ToggleMapCommandPositiveCursor(enable);
154 }
155
156 //------------------------------------------------------------------------------------------------
157 protected void ToggleNegativeCursor(bool enable)
158 {
160 return;
161
162 m_MapCursorModule.ToggleMapCommandNegativeCursor(enable);
163 }
164
165 //------------------------------------------------------------------------------------------------
167 {
169 if (!mapEntity)
170 return;
171
172 m_MapCursorModule = SCR_MapCursorModule.Cast(mapEntity.GetMapModule(SCR_MapCursorModule));
173 }
174
175 //------------------------------------------------------------------------------------------------
177 {
179 }
180}
ArmaReforgerScripted GetGame()
Definition game.c:1398
ref array< string > coords
vector position
ScriptInvokerBase< ScriptInvokerVectorMethod > ScriptInvokerVector
ref ScriptInvokerVector m_OnCommandNotExecuted
SCR_MapCursorModule m_MapCursorModule
void OnSelection(vector coords)
bool CanExecuteCommand(vector position)
void OnCommandExecuted(vector position)
void OnCommandNotExecuted(vector position)
void OnMapClose(MapConfiguration config)
ScriptInvokerVector GetOnCommandExecuted()
ScriptInvokerVector GetOnCommandNotExecuted()
void TogglePositiveCursor(bool enable)
void DisableSelection(bool toggleOffCursors=true)
ref ScriptInvokerVector m_OnCommandExecuted
void ShowCursor(vector startCursorPosition)
void ToggleNegativeCursor(bool enable)
SCR_MapModuleBase GetMapModule(typename moduleType)
static ScriptInvokerBase< MapConfigurationInvoker > GetOnMapClose()
Get on map close invoker.
static ScriptInvokerVector GetOnSelection()
Get on selection invoker.
void ScreenToWorld(int screenPosX, int screenPosY, out float worldX, out float worldY)
Use scaled screen coords to get canvas world coords, flips the y-axis.
static SCR_MapEntity GetMapInstance()
Get map entity instance.