File size: 20,311 Bytes
24b81cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 |
//used as UserID in the layout. Values assigned for convenience here
enum EConsoleButtonsControls
{
INVALID = 0, //assumed unassigned value, ignored (dividers, formatting elements etc.)
BUTTON_MENU = 1,
BUTTON_VIEW = 2,
BUTTON_A = 4,
BUTTON_B = 8,
BUTTON_X = 16,
BUTTON_Y = 32,
BUTTON_PAD_UP = 64,
BUTTON_PAD_DOWN = 128,
BUTTON_PAD_LEFT = 256,
BUTTON_PAD_RIGHT = 512,
BUTTON_SHOULDER_LEFT = 1024,
BUTTON_SHOULDER_RIGHT = 2048,
BUTTON_THUMB_LEFT = 4096,
BUTTON_THUMB_RIGHT = 8192,
BUTTON_TRIGGER_LEFT = 16384,
BUTTON_TRIGGER_RIGHT = 32768,
BUTTON_GROUP_RIGHT_SIDE_COMMON = 65536,
BUTTON_GROUP_PAD_COMMON = 131072
}
typedef map<int,ref array<Widget>> TButtonPairingInfo; //<button_mask,<associated widgets on the respective side>>
class ControlsXboxNew extends UIScriptedMenu
{
protected string m_BackButtonTextID;
protected string m_NextPresetText;
protected int m_CurrentTabIdx = -1;
protected int m_CurrentPresetVariant = -1;
protected ButtonWidget m_Back;
protected ImageWidget m_ControlsLayoutImage;
//-------------
protected CanvasWidget m_CanvasWidget;
protected TabberUI m_TabScript;
protected Widget m_TabberWidget;
protected Widget m_ControlsImage;
protected Widget m_PlatformHolder; //controls container for selected platform
protected Widget m_VariantWidget;
protected ref map<int,Widget> m_ImageMarkerStructure;
protected ref map<int,Widget> m_CategoryStructure;
protected ref map<int,ref TButtonPairingInfo> m_AreasLR; //left/right area holders
protected const int AREA_LEFT = 1;
protected const int AREA_RIGHT = 2;
protected const int PLATFORM_ADJUST_X1 = 1000;
protected const int PLATFORM_ADJUST_PS = 2000;
//============================================
// ControlsXboxNew
//============================================
void ~ControlsXboxNew()
{
PPERequesterBank.GetRequester(PPERequesterBank.REQ_MENUEFFECTS).Stop();
}
protected void OnInputPresetChanged()
{
#ifdef PLATFORM_CONSOLE
UpdateControlsElements();
UpdateControlsElementVisibility();
#endif
}
protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
{
UpdateControlsElementVisibility();
}
void Back()
{
GetGame().GetUIManager().Back();
}
void UpdateTabContent(int tab_index)
{
Widget w;
//hide old
if (m_CurrentTabIdx != -1)
{
m_VariantWidget.Show(false);
while (m_VariantWidget.GetParent())
{
m_VariantWidget = m_VariantWidget.GetParent();
m_VariantWidget.Show(false);
}
}
//show new
w = FindChildByID(m_CategoryStructure[tab_index],InputUtils.GetConsolePresetID());
w.Show(true);
m_VariantWidget = w;
while (w.GetParent())
{
w = w.GetParent();
w.Show(true);
}
DrawConnectingLines(tab_index);
m_CurrentTabIdx = tab_index;
}
protected void DrawConnectingLines(int index)
{
//disconnected for now, to be finished
return;
m_CanvasWidget.Clear();
//TODO drawing over nyah
m_VariantWidget;
m_AreasLR = new map<int,ref TButtonPairingInfo>;
Widget wid_side; //left or right area
Widget wid_spacer; //item in the L/R areas
wid_side = m_VariantWidget.GetChildren();
typename t = EConsoleButtonsControls;
int side_idx;
int enum_value;
array<Widget> items_raw;
array<Widget> items_filtered;
while (wid_side)
{
TButtonPairingInfo button_mapping = new TButtonPairingInfo;
side_idx = wid_side.GetUserID();
wid_spacer = wid_side.GetChildren(); //dig into the side first..
for (int i = 1; i < EnumTools.GetEnumSize(EConsoleButtonsControls); i++)
{
items_raw = new array<Widget>;
items_filtered = new array<Widget>;
t.GetVariableValue(null, i, enum_value); //TODO
FindAllChildrenByID(wid_spacer,enum_value,items_raw);
if (FilterByVisible(items_raw,items_filtered) > 0) //if there are any button-relevant items..
{
button_mapping.Insert(enum_value,items_filtered);
//dump it!
/*
for (int dump = 0; dump < items_filtered.Count(); dump++)
{
Print("key: " + i + " | name: " + items_filtered[dump].GetName());
}
Print("-");
*/
}
}
m_AreasLR.Insert(side_idx,button_mapping);
wid_side = wid_side.GetSibling();
}
//dump it 2: the dumpening!
/*
int count_2 = m_AreasLR.Count();
for (int z = 0; z < m_AreasLR.Count(); z++)
{
Print("---------");
Print("Area: " + z);
TButtonPairingInfo tmp_info = m_AreasLR.GetElement(z);
int count_1 = tmp_info.Count();
for (int zz = 0; zz < tmp_info.Count(); zz++)
{
for (int zzz = 0; zzz < tmp_info.GetElement(zz).Count(); zzz++)
{
Print("key: " + tmp_info.GetKey(zz) + " | name: " + tmp_info.GetElement(zz).Get(zzz).GetName());
}
}
}
Print("------------------------");
*/
/*
map<string, ref array<int>> button_marker_groups_unflitred = new map<string, ref array<int>>;
map<string, ref array<int>> button_marker_groups = new map<string, ref array<int>>;
float text_widget_pos_x, text_widget_pos_y;
float text_widget_width, text_widget_height;
float dot_pos_x, dot_pos_y;
float dot_width, dot_height;
float draw_pos_x, draw_pos_y;
m_CanvasWidget.Clear();
for (int i = 0; i < m_TabScript.GetTabCount(); i++)
{
tab_array.Insert(new array<ref JsonControlMappingInfo>);
for (int j = 0; j < 20; j++)
{
tab_array[i].Insert(null);
}
}
// insert json info to array by index, so it is sorted
for (i = 0; i < control_mapping_info.Count(); i++)
{
JsonControlMappingInfo info = control_mapping_info.Get(i);
tab_array[info.m_TabID][info.m_TextWidgetID] = info;
}
// create group of buttons which are connected together with line
for (int l = 0; l < control_mapping_info.Count(); l++)
{
JsonControlMappingInfo info1 = control_mapping_info[l];
string button_name = info1.m_ButtonName;
int text_widget_id = info1.m_TextWidgetID;
if (info1.m_TabID != index)
{
continue;
}
if (!button_marker_groups_unflitred.Contains(button_name))
{
button_marker_groups_unflitred.Insert(button_name, new ref array<int>);
button_marker_groups_unflitred.Get(button_name).Insert(text_widget_id);
}
else
{
button_marker_groups_unflitred.Get(button_name).Insert(text_widget_id);
}
}
// we want groups which are bigger than 1
for (l = 0; l < button_marker_groups_unflitred.Count(); l++)
{
if (button_marker_groups_unflitred.GetElement(l).Count() > 1)
{
string key = button_marker_groups_unflitred.GetKey(l);
button_marker_groups.Insert(button_marker_groups_unflitred.GetKey(l), button_marker_groups_unflitred.Get(key));
}
}
Widget panel_widget;
Widget button_marker_widget;
for (l = 0; l < tab_array[index].Count(); l++)
{
panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + l);
if (tab_array[index][l] != null)
{
TextWidget text_widget = TextWidget.Cast(panel_widget.FindAnyWidget("TextWidget" + l));
string key_prefix;
#ifdef PLATFORM_XBOX
key_prefix = "xb_button_marker_";
#else
#ifdef PLATFORM_PS4
key_prefix = "ps_button_marker_";
#endif
#endif
button_marker_widget = layoutRoot.FindAnyWidget(key_prefix + tab_array[index][l].m_ButtonName);
text_widget.SetText(tab_array[index][l].m_InfoText);
panel_widget.Show(true);
button_marker_widget.Show(true);
panel_widget.Update();
if (!button_marker_groups.Contains(tab_array[index][l].m_ButtonName))
{
panel_widget.GetScreenPos(text_widget_pos_x, text_widget_pos_y);
panel_widget.GetScreenSize(text_widget_width,text_widget_height);
button_marker_widget.GetScreenPos(dot_pos_x, dot_pos_y);
button_marker_widget.GetScreenSize(dot_width, dot_height);
draw_pos_y = text_widget_pos_y + text_widget_height / 2;
if (l < 10)
{
draw_pos_x = text_widget_pos_x + text_widget_width - 1;
}
else
{
draw_pos_x = text_widget_pos_x;
}
m_CanvasWidget.DrawLine(draw_pos_x, draw_pos_y, dot_pos_x+dot_width/2, draw_pos_y, 2, ARGBF(0.6, 1, 1, 1));
m_CanvasWidget.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));
}
}
else
{
panel_widget.Show(false);
}
panel_widget.Update();
}
// draw connecting lines
for (l = 0; l < button_marker_groups.Count(); l++)
{
text_widget_pos_x = 0;
text_widget_pos_y = 0;
text_widget_width = 0;
text_widget_height = 0;
float group_point_x = 0, group_point_y = 0;
float first_x = 0, first_y = 0;
ref array<int> element = button_marker_groups.GetElement(l);
string key_name = button_marker_groups.GetKey(l);
#ifdef PLATFORM_XBOX
key_prefix = "xb_button_marker_";
#else
#ifdef PLATFORM_PS4
key_prefix = "ps_button_marker_";
#endif
#endif
button_marker_widget = layoutRoot.FindAnyWidget(key_prefix + key_name);
for (int g = 0; g < element.Count(); g++)
{
panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + element[g]);
panel_widget.GetScreenPos(text_widget_pos_x, text_widget_pos_y);
panel_widget.GetScreenSize(text_widget_width, text_widget_height);
if (g == 0)
{
if (element[0] < 10)
{
first_x = text_widget_pos_x + text_widget_width +50;
}
else
{
first_x = text_widget_pos_x - 50;
}
first_y = text_widget_pos_y + text_widget_height/2;
}
group_point_x += text_widget_pos_x;
group_point_y += text_widget_pos_y;
if (element[0] < 10)
{
m_CanvasWidget.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));
}
else
{
m_CanvasWidget.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));
}
}
if (element[0] < 10)
{
group_point_x = group_point_x/element.Count() + text_widget_width + 50;
}
else
{
group_point_x = group_point_x/element.Count() - 50;
}
if (element.Count() % 2 == 0)
{
group_point_y = ((text_widget_pos_y + text_widget_height/2) - first_y) / 2 + first_y;
}
else
{
float text_widget_pos_x_center, text_widget_pos_y_center;
float text_widget_width_center, text_widget_height_center;
panel_widget = layoutRoot.FindAnyWidget("PanelWidget" + element[1]);
panel_widget.GetScreenPos(text_widget_pos_x_center, text_widget_pos_y_center);
panel_widget.GetScreenSize(text_widget_width_center, text_widget_height_center);
group_point_y = text_widget_pos_y_center + text_widget_height_center / 2;
}
button_marker_widget.GetScreenPos(dot_pos_x, dot_pos_y);
button_marker_widget.GetScreenSize(dot_width, dot_height);
m_CanvasWidget.DrawLine(group_point_x, group_point_y, dot_pos_x+dot_width/2, group_point_y, 2, ARGBF(0.6, 1, 1, 1));
m_CanvasWidget.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));
if (element[0] < 10)
{
m_CanvasWidget.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));
}
else
{
m_CanvasWidget.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));
}
}
*/
}
//============================================
// Init
//============================================
override Widget Init()
{
m_CategoryStructure = new map<int,Widget>;
m_ImageMarkerStructure = new map<int,Widget>;
layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/Controls_Screen.layout");
#ifdef PLATFORM_XBOX
m_ControlsImage = layoutRoot.FindAnyWidget("XboxControlsImage");
#else
#ifdef PLATFORM_PS4
m_ControlsImage = layoutRoot.FindAnyWidget("PSControlsImage");
#endif
#endif
m_ControlsImage.Show(true);
m_TabberWidget = layoutRoot.FindAnyWidget("Tabber");
m_TabberWidget.GetScript(m_TabScript);
m_TabScript.m_OnTabSwitch.Insert(UpdateTabContent);
m_CanvasWidget = CanvasWidget.Cast(layoutRoot.FindAnyWidget("CanvasUniversal"));
m_Back = ButtonWidget.Cast(layoutRoot.FindAnyWidget("back"));
UpdateToolbarText();
UpdateControlsElements();
UpdateControlsElementVisibility();
PPERequester_MenuEffects requester;
Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequesterBank.REQ_MENUEFFECTS));
requester.SetVignetteIntensity(0.6);
ComposeData();
UpdateTabContent(0);
GetGame().GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
GetGame().GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
OnInputDeviceChanged(GetGame().GetInput().GetCurrentInputDevice());
return layoutRoot;
}
override void OnShow()
{
super.OnShow();
SetFocus(null);
}
override bool OnClick(Widget w, int x, int y, int button)
{
if (button == MouseState.LEFT)
{
if (w == m_Back)
{
Back();
return true;
}
}
return false;
}
override bool OnMouseEnter(Widget w, int x, int y)
{
if (IsFocusable(w))
{
ColorHighlight(w);
return true;
}
return false;
}
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
{
if (IsFocusable(w))
{
ColorNormal(w);
return true;
}
return false;
}
override bool OnFocus(Widget w, int x, int y)
{
if (IsFocusable(w))
{
ColorHighlight(w);
return true;
}
return false;
}
override bool OnFocusLost(Widget w, int x, int y)
{
if (IsFocusable(w))
{
ColorNormal(w);
return true;
}
return false;
}
bool IsFocusable(Widget w)
{
return (w && w == m_Back);
}
override void Update(float timeslice)
{
if (GetUApi().GetInputByID(UAUITabLeft).LocalPress())
{
m_TabScript.PreviousTab();
}
if (GetUApi().GetInputByID(UAUITabRight).LocalPress())
{
m_TabScript.NextTab();
}
if (GetUApi().GetInputByID(UAUIBack).LocalPress())
{
Back();
}
if (GetUApi().GetInputByID(UASwitchPreset).LocalPress())
{
PerformSwitchPreset();
UpdateTabContent(m_CurrentTabIdx);
m_TabScript.RefreshTab();
}
}
//! Inits data structure
protected void ComposeData()
{
if (m_CategoryStructure)
{
m_CategoryStructure = null;
m_CategoryStructure = new map<int,Widget>;
}
if (m_ImageMarkerStructure)
{
m_ImageMarkerStructure = null;
m_ImageMarkerStructure = new map<int,Widget>;
}
Widget w = m_ControlsImage.GetChildren();
m_ImageMarkerStructure.Set(w.GetUserID(),w);
while (w.GetSibling())
{
w = w.GetSibling();
m_ImageMarkerStructure.Set(w.GetUserID(),w); //inits button markers with their IDs
}
InputUtils.UpdateConsolePresetID();
#ifdef PLATFORM_XBOX
m_PlatformHolder = FindChildByID(layoutRoot,PLATFORM_ADJUST_X1);
#else
m_PlatformHolder = FindChildByID(layoutRoot,PLATFORM_ADJUST_PS);
#endif
//categories
Widget category_widget = m_PlatformHolder.GetChildren();
m_CategoryStructure.Set(category_widget.GetUserID(),category_widget);
while (category_widget.GetSibling())
{
category_widget = category_widget.GetSibling();
m_CategoryStructure.Set(category_widget.GetUserID(),category_widget);
}
}
protected void PerformSwitchPreset()
{
int index;
string preset_text;
UAInputAPI inputAPI = GetUApi();
index = inputAPI.PresetCurrent() + 1;
if (index >= inputAPI.PresetCount())
{
index = 0;
}
inputAPI.SupressNextFrame(true);
inputAPI.PresetSelect(index);
UpdateToolbarText();
GetGame().GetMission().GetOnInputPresetChanged().Invoke();
#ifdef PLATFORM_WINDOWS
GetUApi().Export(); //works on emulated consoles (-xbox,-ps4)
#else
GetUApi().SaveInputPresetMiscData(); //default console functionality
#endif
InputUtils.UpdateConsolePresetID();
UpdateControlsElements();
}
protected void UpdateToolbarText()
{
UAInputAPI inputAPI = GetUApi();
int target_idx = inputAPI.PresetCurrent() + 1;
int count = inputAPI.PresetCount();
if (target_idx >= inputAPI.PresetCount())
{
target_idx = 0;
}
m_NextPresetText = inputAPI.PresetName(target_idx);
if (m_NextPresetText == InputUtils.PRESET_OLD)
{
m_NextPresetText = "#STR_UAPRESET_ChangeTo_0";
}
else if (m_NextPresetText == InputUtils.PRESET_NEW)
{
m_NextPresetText = "#STR_UAPRESET_ChangeTo_1";
}
else
{
m_NextPresetText = "Invalid console preset name: " + m_NextPresetText;
}
}
//!Finds immediate child widget with a corresponding userID
protected Widget FindChildByID(Widget wid, int user_id)
{
Widget ret = wid.GetChildren();
while (ret)
{
if (ret.GetUserID() == user_id)
{
return ret;
}
ret = ret.GetSibling();
}
return ret;
}
//!Finds all immediate children widgets with corresponding userIDs
protected bool FindAllChildrenByID(Widget wid, int user_id, out array<Widget> results)
{
Widget child = wid.GetChildren();
while (child)
{
if (child.GetUserID() == user_id)
{
results.Insert(child);
}
child = child.GetSibling();
}
return (results && results.Count() > 0);
}
//! returns count
protected int FilterByVisible(array<Widget> input, array<Widget> filtered)
{
for (int i = 0; i < input.Count(); i++)
{
if (input[i].IsVisible())
{
filtered.Insert(input[i]);
}
}
return filtered.Count();
}
void ColorHighlight(Widget w)
{
if (!w)
return;
int color_pnl = ARGB(255, 0, 0, 0);
int color_lbl = ARGB(255, 255, 0, 0);
#ifdef PLATFORM_CONSOLE
color_pnl = ARGB(255, 200, 0, 0);
color_lbl = ARGB(255, 255, 255, 255);
#endif
ButtonSetColor(w, color_pnl);
ButtonSetTextColor(w, color_lbl);
}
void ColorNormal(Widget w)
{
if (!w)
return;
int color_pnl = ARGB(0, 0, 0, 0);
int color_lbl = ARGB(255, 255, 255, 255);
ButtonSetColor(w, color_pnl);
ButtonSetTextColor(w, color_lbl);
}
void ButtonSetText(Widget w, string text)
{
if (!w)
return;
TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
if (label)
{
label.SetText(text);
}
}
void ButtonSetColor(Widget w, int color)
{
if (!w)
return;
Widget panel = w.FindWidget(w.GetName() + "_panel");
if (panel)
{
panel.SetColor(color);
}
}
void ButtonSetTextColor(Widget w, int color)
{
if (!w)
return;
TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
if (label)
{
label.SetColor(color);
}
if (text)
{
text.SetColor(color);
}
if (text2)
{
text2.SetColor(color);
}
}
protected void UpdateControlsElements()
{
RichTextWidget toolbar_switch = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ChangePresetText"));
toolbar_switch.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UASwitchPreset", m_NextPresetText, EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
string text = string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#STR_settings_menu_root_toolbar_bg_ConsoleToolbar_Back_BackText0", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
toolbar_text.SetText(text);
RichTextWidget toolbar_b2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon0"));
toolbar_b2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
}
protected void UpdateControlsElementVisibility()
{
bool toolbarShow = false;
#ifdef PLATFORM_CONSOLE
toolbarShow = !GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
#endif
layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
layoutRoot.FindAnyWidget("play_panel_root").Show(!toolbarShow);
}
}
|