DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ DrawConnectingLines()

void DrawConnectingLines ( int index)
protected

См. определение в файле ControlsXbox.c строка 41

42 {
45
46 map<string, ref array<int>> button_marker_groups_unflitred = new map<string, ref array<int>>;
47 map<string, ref array<int>> button_marker_groups = new map<string, ref array<int>>;
48
49 float text_widget_pos_x, text_widget_pos_y;
50 float text_widget_width, text_widget_height;
51 float dot_pos_x, dot_pos_y;
52 float dot_width, dot_height;
53 float draw_pos_x, draw_pos_y;
54
55 CanvasWidget canvas_widget = CanvasWidget.Cast(layoutRoot.FindAnyWidget("CanvasWidget_" + index));
56 canvas_widget.Clear();
57 control_mapping_info = GetControlMappingInfo();
58
59 for (int i = 0; i < m_TabScript.GetTabCount(); i++)
60 {
61 tab_array.Insert(new array<ref JsonControlMappingInfo>);
62 for (int j = 0; j < 20; j++)
63 {
64 tab_array[i].Insert(null);
65 }
66 }
67
68 // insert json info to array by index, so it is sorted
69 for (i = 0; i < control_mapping_info.Count(); i++)
70 {
71 JsonControlMappingInfo info = control_mapping_info.Get(i);
72 tab_array[info.m_TabID][info.m_TextWidgetID] = info;
73 }
74
75 // create group of buttons which are connected together with line
76 for (int l = 0; l < control_mapping_info.Count(); l++)
77 {
78 JsonControlMappingInfo info1 = control_mapping_info[l];
79 string button_name = info1.m_ButtonName;
80 int text_widget_id = info1.m_TextWidgetID;
81 if (info1.m_TabID != index)
82 {
83 continue;
84 }
85 if (!button_marker_groups_unflitred.Contains(button_name))
86 {
87 button_marker_groups_unflitred.Insert(button_name, new array<int>);
88 button_marker_groups_unflitred.Get(button_name).Insert(text_widget_id);
89 }
90 else
91 {
92 button_marker_groups_unflitred.Get(button_name).Insert(text_widget_id);
93 }
94 }
95
96 // we want groups which are bigger than 1
97 for (l = 0; l < button_marker_groups_unflitred.Count(); l++)
98 {
99 if (button_marker_groups_unflitred.GetElement(l).Count() > 1)
100 {
101 string key = button_marker_groups_unflitred.GetKey(l);
102 button_marker_groups.Insert(button_marker_groups_unflitred.GetKey(l), button_marker_groups_unflitred.Get(key));
103 }
104 }
105
106 Widget controls_image;
107 // hide all button markers
108 #ifdef PLATFORM_MSSTORE
109 controls_image = layoutRoot.FindAnyWidget("XboxControlsImage");
110 #else
111 #ifdef PLATFORM_XBOX
112 controls_image = layoutRoot.FindAnyWidget("XboxControlsImage");
113 #else
114 #ifdef PLATFORM_PS4
115 controls_image = layoutRoot.FindAnyWidget("PSControlsImage");
116 #endif
117 #endif
118 #endif
119
120 Widget child = controls_image.GetChildren();
121 child.Show(false);
122 while (child.GetSibling())
123 {
124 child = child.GetSibling();
125 child.Show(false);
126 }
127
128 Widget panel_widget;
129 Widget button_marker_widget;
130
131 for (l = 0; l < tab_array[index].Count(); l++)
132 {
133 panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + l);
134 if (tab_array[index][l] != null)
135 {
136 TextWidget text_widget = TextWidget.Cast(panel_widget.FindAnyWidget("TextWidget" + l));
137
138 string key_prefix;
139 #ifdef PLATFORM_MSSTORE
140 key_prefix = "xb_button_marker_";
141 #else
142 #ifdef PLATFORM_XBOX
143 key_prefix = "xb_button_marker_";
144 #else
145 #ifdef PLATFORM_PS4
146 key_prefix = "ps_button_marker_";
147 #endif
148 #endif
149 #endif
150
151 button_marker_widget = layoutRoot.FindAnyWidget(key_prefix + tab_array[index][l].m_ButtonName);
152 text_widget.SetText(tab_array[index][l].m_InfoText);
153 panel_widget.Show(true);
154 button_marker_widget.Show(true);
155 panel_widget.Update();
156 if (!button_marker_groups.Contains(tab_array[index][l].m_ButtonName))
157 {
158 panel_widget.GetScreenPos(text_widget_pos_x, text_widget_pos_y);
159 panel_widget.GetScreenSize(text_widget_width,text_widget_height);
160
161 button_marker_widget.GetScreenPos(dot_pos_x, dot_pos_y);
162 button_marker_widget.GetScreenSize(dot_width, dot_height);
163
164 draw_pos_y = text_widget_pos_y + text_widget_height / 2;
165 if (l < 10)
166 {
167 draw_pos_x = text_widget_pos_x + text_widget_width - 1;
168 }
169 else
170 {
171 draw_pos_x = text_widget_pos_x;
172 }
173 canvas_widget.DrawLine(draw_pos_x, draw_pos_y, dot_pos_x+dot_width/2, draw_pos_y, 2, ARGBF(0.6, 1, 1, 1));
174 canvas_widget.DrawLine(dot_pos_x+dot_width/2, draw_pos_y, dot_pos_x+dot_width/2, dot_pos_y+dot_height/2, 2, ARGBF(0.6, 1, 1, 1));
175 }
176 }
177 else
178 {
179 panel_widget.Show(false);
180 }
181 panel_widget.Update();
182 }
183
184 // draw connecting lines
185 for (l = 0; l < button_marker_groups.Count(); l++)
186 {
187 text_widget_pos_x = 0;
188 text_widget_pos_y = 0;
189 text_widget_width = 0;
190 text_widget_height = 0;
191 float group_point_x = 0, group_point_y = 0;
192 float first_x = 0, first_y = 0;
193
194 ref array<int> element = button_marker_groups.GetElement(l);
195 string key_name = button_marker_groups.GetKey(l);
196
197 #ifdef PLATFORM_MSSTORE
198 key_prefix = "xb_button_marker_";
199 #else
200 #ifdef PLATFORM_XBOX
201 key_prefix = "xb_button_marker_";
202 #else
203 #ifdef PLATFORM_PS4
204 key_prefix = "ps_button_marker_";
205 #endif
206 #endif
207 #endif
208 button_marker_widget = layoutRoot.FindAnyWidget(key_prefix + key_name);
209
210 for (int g = 0; g < element.Count(); g++)
211 {
212 panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + element[g]);
213
214 panel_widget.GetScreenPos(text_widget_pos_x, text_widget_pos_y);
215 panel_widget.GetScreenSize(text_widget_width, text_widget_height);
216
217 if (g == 0)
218 {
219 if (element[0] < 10)
220 {
221 first_x = text_widget_pos_x + text_widget_width +50;
222 }
223 else
224 {
225 first_x = text_widget_pos_x - 50;
226 }
227
228 first_y = text_widget_pos_y + text_widget_height/2;
229 }
230
231 group_point_x += text_widget_pos_x;
232 group_point_y += text_widget_pos_y;
233 if (element[0] < 10)
234 {
235 canvas_widget.DrawLine(text_widget_pos_x + text_widget_width - 1, text_widget_pos_y + text_widget_height/2, text_widget_pos_x + text_widget_width +50, text_widget_pos_y + text_widget_height/2, 2, ARGBF(0.6, 1, 1, 1));
236 }
237 else
238 {
239 canvas_widget.DrawLine(text_widget_pos_x, text_widget_pos_y + text_widget_height/2, text_widget_pos_x - 50, text_widget_pos_y + text_widget_height/2, 2, ARGBF(0.6, 1, 1, 1));
240 }
241 }
242 if (element[0] < 10)
243 {
244 group_point_x = group_point_x/element.Count() + text_widget_width + 50;
245 }
246 else
247 {
248 group_point_x = group_point_x/element.Count() - 50;
249 }
250
251 if (element.Count() % 2 == 0)
252 {
253 group_point_y = ((text_widget_pos_y + text_widget_height/2) - first_y) / 2 + first_y;
254 }
255 else
256 {
257 float text_widget_pos_x_center, text_widget_pos_y_center;
258 float text_widget_width_center, text_widget_height_center;
259
260 panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + element[1]);
261
262 panel_widget.GetScreenPos(text_widget_pos_x_center, text_widget_pos_y_center);
263 panel_widget.GetScreenSize(text_widget_width_center, text_widget_height_center);
264
265 group_point_y = text_widget_pos_y_center + text_widget_height_center / 2;
266 }
267
268 button_marker_widget.GetScreenPos(dot_pos_x, dot_pos_y);
269 button_marker_widget.GetScreenSize(dot_width, dot_height);
270
271 canvas_widget.DrawLine(group_point_x, group_point_y, dot_pos_x+dot_width/2, group_point_y, 2, ARGBF(0.6, 1, 1, 1));
272 canvas_widget.DrawLine(dot_pos_x+dot_width/2, group_point_y, dot_pos_x+dot_width/2, dot_pos_y, 2, ARGBF(0.6, 1, 1, 1));
273
274 if (element[0] < 10)
275 {
276 canvas_widget.DrawLine(first_x, first_y, text_widget_pos_x + text_widget_width +50, text_widget_pos_y + text_widget_height/2, 2, ARGBF(0.6, 1, 1, 1));
277 }
278 else
279 {
280 canvas_widget.DrawLine(first_x, first_y, text_widget_pos_x - 50, text_widget_pos_y + text_widget_height/2, 2, ARGBF(0.6, 1, 1, 1));
281 }
282 }
283 }
TabberUI m_TabScript
Определения ControlsXbox.c:21
array< ref JsonControlMappingInfo > GetControlMappingInfo()
Определения ControlsXbox.c:285
int m_TabID
Определения ControlsXbox.c:7
int m_TextWidgetID
Определения ControlsXbox.c:8
string m_ButtonName
Определения ControlsXbox.c:9
Определения EnWidgets.c:220
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения CachedEquipmentStorage.c:4
proto native void DrawLine(float x1, float y1, float x2, float y2, float width, int color)
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Определения proto.c:332

Перекрестные ссылки ARGBF(), Widget::DrawLine(), UIScriptedMenu::GetControlMappingInfo(), JsonControlMappingInfo::m_ButtonName, JsonControlMappingInfo::m_TabID, m_TabScript и JsonControlMappingInfo::m_TextWidgetID.

Используется в Init().