DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
CharacterCreationMenu.c
Go to the documentation of this file.
1class CharacterCreationMenu extends UIScriptedMenu
2{
3 #ifdef PLATFORM_CONSOLE
5 protected bool m_CharacterSaved;
6 #else
8 #endif
9
10 const int TOOLTIP_ID_SAVE = 1;
11 const int TOOLTIP_ID_APPLY = 2;
12
14 protected Widget m_Apply;
15 protected Widget m_Save;
19 protected TextWidget m_Version;
20 protected Widget m_DetailsRoot; //tooltips
24
25 protected ref OptionSelectorEditbox m_NameSelector;
31
33
35 {
36 MissionMainMenu mission = MissionMainMenu.Cast(GetGame().GetMission());
37
38 #ifdef PLATFORM_CONSOLE
39 m_Scene = mission.GetIntroSceneXbox();
40 #else
41 m_Scene = mission.GetIntroScenePC();
42 #endif
43
44 m_Scene.ResetIntroCamera();
45 }
46
48 {
49 return m_Scene.GetIntroCharacter().GetCharacterObj();
50 }
51
52 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
53 {
54 #ifdef PLATFORM_CONSOLE
56 if (pInputDeviceType == EInputDeviceType.CONTROLLER)
57 {
58 CheckNewOptions(); //TODO - pick only the 'focus' bit
59 }
60 #endif
61 }
62
63 override Widget Init()
64 {
65 #ifdef PLATFORM_CONSOLE
66 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/character_creation/xbox/character_creation.layout");
67 m_CharacterSaved = false;
68 #else
69 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/character_creation/pc/character_creation.layout");
70 #endif
71
72 m_CharacterRotationFrame = layoutRoot.FindAnyWidget("character_rotation_frame");
73 m_Apply = layoutRoot.FindAnyWidget("apply");
74 m_Save = layoutRoot.FindAnyWidget("save");
75 m_RandomizeCharacter = layoutRoot.FindAnyWidget("randomize_character");
76 m_BackButton = layoutRoot.FindAnyWidget("back");
77 m_Version = TextWidget.Cast(layoutRoot.FindAnyWidget("version"));
78 m_DetailsRoot = layoutRoot.FindAnyWidget("menu_details_tooltip");
79 m_DetailsLabel = TextWidget.Cast(m_DetailsRoot.FindAnyWidget("menu_details_label"));
80 m_DetailsText = RichTextWidget.Cast(m_DetailsRoot.FindAnyWidget("menu_details_tooltip_content"));
81 m_CharacterHeaderText = TextWidget.Cast(layoutRoot.FindAnyWidget("char_header_text"));
82 m_PlayedCharacterInfo = layoutRoot.FindAnyWidget("played_char_info");
83
84 string version;
85 GetGame().GetVersion(version);
86 #ifdef PLATFORM_CONSOLE
87 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
88 #else
89 version = "#main_menu_version" + " " + version;
90 #endif
91 m_Version.SetText(version);
92
93 if (m_Scene && m_Scene.GetIntroCharacter())
94 {
95 m_OriginalCharacterID = m_Scene.GetIntroCharacter().GetCharacterID();
96 }
97
98 m_NameSelector = new OptionSelectorEditbox(layoutRoot.FindAnyWidget("character_name_setting_option"), m_Scene.GetIntroCharacter().GetCharacterName(), null, false);
99 m_GenderSelector = new OptionSelectorMultistateCharacterMenu(layoutRoot.FindAnyWidget("character_gender_setting_option"), 0, null, false, m_Scene.GetIntroCharacter().GetCharGenderList());
100 if (m_Scene.GetIntroCharacter().IsCharacterFemale())
101 {
102 m_GenderSelector.SetValue("Female");
103 m_SkinSelector = new OptionSelectorMultistateCharacterMenu(layoutRoot.FindAnyWidget("character_head_setting_option"), 0, null, false, m_Scene.GetIntroCharacter().GetCharList(ECharGender.Female));
104 }
105 else
106 {
107 m_GenderSelector.SetValue("Male");
108 m_SkinSelector = new OptionSelectorMultistateCharacterMenu(layoutRoot.FindAnyWidget("character_head_setting_option"), 0, null, false, m_Scene.GetIntroCharacter().GetCharList(ECharGender.Male));
109 }
110
111 m_TopSelector = new OptionSelectorMultistateCharacterMenu(layoutRoot.FindAnyWidget("character_top_setting_option"), 0, null, false, DefaultCharacterCreationMethods.GetConfigAttachmentTypes(InventorySlots.BODY));
112 m_BottomSelector = new OptionSelectorMultistateCharacterMenu(layoutRoot.FindAnyWidget("character_bottom_setting_option"), 0, null, false, DefaultCharacterCreationMethods.GetConfigAttachmentTypes(InventorySlots.LEGS));
113 m_ShoesSelector = new OptionSelectorMultistateCharacterMenu(layoutRoot.FindAnyWidget("character_shoes_setting_option"), 0, null, false, DefaultCharacterCreationMethods.GetConfigAttachmentTypes(InventorySlots.FEET));
114
115 PlayerBase scene_char = GetPlayerObj();
116 if (scene_char)
117 {
118 Object obj = scene_char.GetInventory().FindAttachment(InventorySlots.BODY);
119 if (obj)
120 m_TopSelector.SetValue(obj.GetType(), false);
121
122 obj = scene_char.GetInventory().FindAttachment(InventorySlots.LEGS);
123 if (obj)
124 m_BottomSelector.SetValue(obj.GetType(), false);
125
126 obj = scene_char.GetInventory().FindAttachment(InventorySlots.FEET);
127 if (obj)
128 m_ShoesSelector.SetValue(obj.GetType(), false);
129
130 m_SkinSelector.SetValue(scene_char.GetType());
131 }
132
133 m_GenderSelector.m_OptionChanged.Insert(GenderChanged);
134 m_SkinSelector.m_OptionChanged.Insert(SkinChanged);
135 m_TopSelector.m_OptionChanged.Insert(TopChanged);
136 m_BottomSelector.m_OptionChanged.Insert(BottomChanged);
137 m_ShoesSelector.m_OptionChanged.Insert(ShoesChanged);
138
139 Refresh();
140 SetCharacter();
142
144
145 return layoutRoot;
146 }
147
149 {
150 m_GenderSelector.m_OptionChanged.Remove(GenderChanged);
151 m_SkinSelector.m_OptionChanged.Remove(SkinChanged);
152 m_TopSelector.m_OptionChanged.Remove(TopChanged);
153 m_BottomSelector.m_OptionChanged.Remove(BottomChanged);
154 m_ShoesSelector.m_OptionChanged.Remove(ShoesChanged);
155 }
156
157 //Button Events
159 void Apply()
160 {
161 if (!m_Scene.GetIntroCharacter().IsDefaultCharacter())
162 {
163 string name = m_NameSelector.GetValue();
164 if (name == "")
166
167 m_Scene.GetIntroCharacter().SaveCharName(name);
168 }
169
170 MainMenu menu_main = MainMenu.Cast(GetGame().GetUIManager().FindMenu(MENU_MAIN));
171 if (menu_main)
172 {
173 menu_main.OnChangeCharacter(false);
174 }
176 }
177
179 void Save()
180 {
181 if (m_Scene.GetIntroCharacter().IsDefaultCharacter())
182 {
183 string name = m_NameSelector.GetValue();
184 if (name == "")
186
187 m_Scene.GetIntroCharacter().SaveCharName(name);
188 m_Scene.GetIntroCharacter().SaveDefaultCharacter();
189 m_Scene.GetIntroCharacter().SetToDefaultCharacter();
190 SetCharacterSaved(true);
191 }
192 }
193
194 void Back()
195 {
196 //bring back DefaultCharacter, if it exists (it should), or a previously played one.
198 #ifdef PLATFORM_CONSOLE
199 if (m_OriginalCharacterID != GameConstants.DEFAULT_CHARACTER_MENU_ID && m_CharacterSaved)
200 {
201 m_OriginalCharacterID = GameConstants.DEFAULT_CHARACTER_MENU_ID;
202 }
203 #endif
204 m_Scene.GetIntroCharacter().SetCharacterID(m_OriginalCharacterID);
205 m_Scene.GetIntroCharacter().CreateNewCharacterById(m_Scene.GetIntroCharacter().GetCharacterID());
207 }
208
210 {
211 if (m_Scene.GetIntroCharacter().IsDefaultCharacter())
212 {
214 }
215 }
216
218 {
219 m_Scene.GetIntroCharacter().SetToDefaultCharacter();
220
221 // make random selection
222 m_Scene.GetIntroCharacter().SetCharacterGender(Math.RandomInt(0, 2));
223
224 if (m_Scene.GetIntroCharacter().IsCharacterFemale())
225 {
226 m_GenderSelector.SetValue("Female");
227 m_SkinSelector.LoadNewValues(m_Scene.GetIntroCharacter().GetCharList(ECharGender.Female), 0);
228 m_SkinSelector.SetRandomValue();
229 }
230 else
231 {
232 m_GenderSelector.SetValue("Male");
233 m_SkinSelector.LoadNewValues(m_Scene.GetIntroCharacter().GetCharList(ECharGender.Male), 0);
234 m_SkinSelector.SetRandomValue();
235 }
236
238
239 m_TopSelector.SetValue(GetGame().GetMenuDefaultCharacterData().GetAttachmentMap().Get(InventorySlots.BODY),false);
240 m_BottomSelector.SetValue(GetGame().GetMenuDefaultCharacterData().GetAttachmentMap().Get(InventorySlots.LEGS),false);
241 m_ShoesSelector.SetValue(GetGame().GetMenuDefaultCharacterData().GetAttachmentMap().Get(InventorySlots.FEET),false);
242
243 Refresh();
244 SetCharacter();
245
247 }
248
249 //Selector Events
251 {
252 ECharGender gender = ECharGender.Male;
253
254 if (m_GenderSelector.GetStringValue() == "Female")
255 {
256 gender = ECharGender.Female;
257 }
258
259 m_Scene.GetIntroCharacter().SetCharacterGender(gender);
260
261 m_SkinSelector.LoadNewValues(m_Scene.GetIntroCharacter().GetCharList(gender) , 0);
262 m_SkinSelector.SetRandomValue();
263 SetCharacterSaved(false);
264 }
265
267 {
268 m_Scene.GetIntroCharacter().CreateNewCharacterByName(m_SkinSelector.GetStringValue(), false);
269 SetCharacterSaved(false);
270 }
271
273 {
274 GetGame().GetMenuDefaultCharacterData().SetDefaultAttachment(InventorySlots.BODY,m_TopSelector.GetStringValue());
276 SetCharacterSaved(false);
277 }
278
280 {
281 GetGame().GetMenuDefaultCharacterData().SetDefaultAttachment(InventorySlots.LEGS,m_BottomSelector.GetStringValue());
283 SetCharacterSaved(false);
284 }
285
287 {
288 GetGame().GetMenuDefaultCharacterData().SetDefaultAttachment(InventorySlots.FEET,m_ShoesSelector.GetStringValue());
290 SetCharacterSaved(false);
291 }
292
293 override bool OnKeyPress(Widget w, int x, int y, int key)
294 {
295 super.OnKeyPress(w, x, y, key);
296 return false;
297 }
298
299 override bool OnClick(Widget w, int x, int y, int button)
300 {
301 if (w == m_Apply)
302 {
303 Apply();
304 return true;
305 }
306 else if (w == m_Save)
307 {
308 Save();
310 return true;
311 }
312 else if (w == m_RandomizeCharacter)
313 {
315 return true;
316 }
317 else if (w == m_BackButton)
318 {
319 Back();
320 return true;
321 }
322 return false;
323 }
324
325 override bool OnMouseButtonDown(Widget w, int x, int y, int button)
326 {
327 #ifndef PLATFORM_CONSOLE
328 if (w == m_CharacterRotationFrame)
329 {
330 if (m_Scene)
332 return true;
333 }
334 #endif
335 return false;
336 }
337
338 override bool OnMouseButtonUp(Widget w, int x, int y, int button)
339 {
340 #ifndef PLATFORM_CONSOLE
341 if (m_Scene)
343 #endif
344 return false;
345 }
346
347 override bool OnMouseEnter(Widget w, int x, int y)
348 {
349 string tooltip_header = "";
350 string tooltip_text = "";
352 switch (w.GetUserID())
353 {
354 case TOOLTIP_ID_APPLY:
355 tooltip_header = "#layout_main_menu_rename";
356 tooltip_text = "#layout_character_creation_apply_tooltip";
357 break;
358
359 case TOOLTIP_ID_SAVE:
360 tooltip_header = "#layout_character_creation_save_character";
361 tooltip_text = "#layout_character_creation_save_tooltip";
362 break;
363 }
364 SetTooltipTexts(w, tooltip_header, tooltip_text);
365 return true;
366 }
367
368 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
369 {
370 ColorNormal(w);
371 SetFocus(null);
372
373 return true;
374 }
375
376 override bool OnFocus(Widget w, int x, int y)
377 {
378 string tooltip_header = "";
379 string tooltip_text = "";
380 if (IsFocusable(w))
381 {
383 switch (w.GetUserID())
384 {
385 case TOOLTIP_ID_APPLY:
386 tooltip_header = "#layout_main_menu_rename";
387 tooltip_text = "#layout_character_creation_apply_tooltip";
388 break;
389
390 case TOOLTIP_ID_SAVE:
391 tooltip_header = "#layout_character_creation_save_character";
392 tooltip_text = "#layout_character_creation_save_tooltip";
393 break;
394 }
395 SetTooltipTexts(w, tooltip_header, tooltip_text);
396 return true;
397 }
399 return false;
400 }
401
402 override bool OnFocusLost(Widget w, int x, int y)
403 {
404 if (IsFocusable(w))
405 {
406 ColorNormal(w);
407 return true;
408 }
409 return false;
410 }
411
413 {
414 if (w)
415 {
416 return (w == m_Apply || w == m_Save || w == m_RandomizeCharacter || w == m_BackButton);
417 }
418 return false;
419 }
420
421 void SetTooltipTexts(Widget w, string header = "", string desc = "")
422 {
423 #ifndef PLATFORM_CONSOLE
424 bool show = header != "" && desc != "";
425 m_DetailsRoot.Show(show);
426 m_DetailsLabel.SetText(header);
427 m_DetailsText.SetText(desc);
428
429 //moves the widget to parent, setting is relative to widget alignment, case-specific implementation (getter missing!!!)
430 if (show)
431 {
432 float parent_pos_x, parent_pos_y;
433 float parent_size_x, parent_size_y;
434 float layout_size_x, layout_size_y;
435
436 w.GetScreenPos(parent_pos_x,parent_pos_y);
437 w.GetScreenSize(parent_size_x,parent_size_y);
438 layoutRoot.GetScreenSize(layout_size_x,layout_size_y);
439
440 float set_x = layout_size_x - parent_pos_x;
441 float set_y = layout_size_y - parent_pos_y - parent_size_y;
442 m_DetailsRoot.SetPos(set_x,set_y,true);
443 }
444
445 m_DetailsText.Update();
446 m_DetailsLabel.Update();
447 m_DetailsRoot.Update();
448 #endif
449 }
450
452 {
453 bool show_widgets = m_Scene.GetIntroCharacter().IsDefaultCharacter();
454 bool was_visible = layoutRoot.FindAnyWidget("character_gender_button").IsVisible();
455 layoutRoot.FindAnyWidget("character_gender_button").Show(show_widgets);
456 layoutRoot.FindAnyWidget("character_head_button").Show(show_widgets);
457 layoutRoot.FindAnyWidget("character_top_button").Show(show_widgets);
458 layoutRoot.FindAnyWidget("character_bottom_button").Show(show_widgets);
459 layoutRoot.FindAnyWidget("character_shoes_button").Show(show_widgets);
460
461 if (!was_visible && show_widgets)
462 m_GenderSelector.Focus();
463 if (!show_widgets)
464 SetFocus(m_RandomizeCharacter);
465 }
466
467 override void OnShow()
468 {
469#ifdef PLATFORM_CONSOLE
470 m_GenderSelector.Focus();
472#endif
474 }
475
476 override void Refresh()
477 {
478 string name;
479 #ifdef PLATFORM_CONSOLE
480 if (GetGame().GetUserManager() && GetGame().GetUserManager().GetSelectedUser())
481 {
483 if (name.LengthUtf8() > 16)
484 {
485 name = name.SubstringUtf8(0, 16);
486 name += "...";
487 }
488 }
489 #else
490 name = m_Scene.GetIntroCharacter().GetCharacterName();
491 if (name == "")
493 #endif
494
495 m_NameSelector.SetValue(name);
496
497 string version;
498 GetGame().GetVersion(version);
499 #ifdef PLATFORM_CONSOLE
500 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
501
502 m_Apply.Show(m_CharacterSaved || !m_Scene.GetIntroCharacter().IsDefaultCharacter());
503 m_Save.Show(!m_CharacterSaved && m_Scene.GetIntroCharacter().IsDefaultCharacter());
504 #else
505 version = "#main_menu_version" + " " + version;
506 m_Apply.Show(!m_Scene.GetIntroCharacter().IsDefaultCharacter());
507 m_Save.Show(m_Scene.GetIntroCharacter().IsDefaultCharacter());
508 #endif
509 m_PlayedCharacterInfo.Show(!m_Scene.GetIntroCharacter().IsDefaultCharacter());
510
511 if (m_Scene.GetIntroCharacter().IsDefaultCharacter())
512 {
513 m_CharacterHeaderText.SetText("#character_menu_header");
514 }
515 else
516 {
517 m_CharacterHeaderText.SetText("#server_browser_prev_play_filter");
518 }
519
520 m_Version.SetText(version);
521
522 #ifdef PLATFORM_CONSOLE
525 #endif
526 }
527
528 override void Update(float timeslice)
529 {
530 if (GetUApi().GetInputByID(UAUIBack).LocalPress())
531 {
532 Back();
533 }
534
535 if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
536 {
538 }
539
540 #ifdef PLATFORM_CONSOLE
541 if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
542 {
543 if (m_Scene.GetIntroCharacter().IsDefaultCharacter() && !m_CharacterSaved)
544 {
545 Save();
546 }
547 }
548 #endif
549 }
550
551 override void OnHide()
552 {
553 }
554
555 //Coloring functions (Until WidgetStyles are useful)
557 {
558 if (w.IsInherited(ButtonWidget))
559 {
560 ButtonWidget button = ButtonWidget.Cast(w);
561 button.SetTextColor(ARGB(255, 200, 0, 0));
562 }
563
564 w.SetColor(ARGB(255, 0, 0, 0));
565
566 TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
567 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
568 TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
569 ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
570 Widget option = Widget.Cast(w.FindAnyWidget(w.GetName() + "_option_wrapper"));
571 Widget option_label = w.FindAnyWidget("option_label");
572
573 if (text1)
574 {
575 text1.SetColor(ARGB(255, 255, 0, 0));
576 }
577
578 if (text2)
579 {
580 text2.SetColor(ARGB(255, 255, 0, 0));
581 }
582
583 if (text3)
584 {
585 text3.SetColor(ARGB(255, 255, 0, 0));
586 w.SetAlpha(1);
587 }
588
589 if (image)
590 {
591 image.SetColor(ARGB(255, 200, 0, 0));
592 }
593
594 if (option)
595 {
596 option.SetColor(ARGB(255, 255, 0, 0));
597 }
598
599 #ifndef PLATFORM_CONSOLE
600 if (option_label)
601 {
602 option_label.SetColor(ARGB(255, 255, 0, 0));
603 }
604 #endif
605 }
606
608 {
609 if (w.IsInherited(ButtonWidget))
610 {
611 ButtonWidget button = ButtonWidget.Cast(w);
612 button.SetTextColor(ColorManager.COLOR_NORMAL_TEXT);
613 }
614
615 TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
616 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
617 TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
618 ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
619 Widget option = w.FindAnyWidget(w.GetName() + "_option_wrapper");
620 Widget option_label = w.FindAnyWidget("option_label");
621
622 if (text1)
623 {
624 text1.SetColor(ColorManager.COLOR_NORMAL_TEXT);
625 }
626
627 if (text2)
628 {
629 text2.SetColor(ColorManager.COLOR_NORMAL_TEXT);
630 }
631
632 if (text3)
633 {
634 text3.SetColor(ColorManager.COLOR_NORMAL_TEXT);
635 w.SetAlpha(0);
636 }
637
638 if (image)
639 {
640 image.SetColor(ColorManager.COLOR_NORMAL_TEXT);
641 }
642
643 if (option)
644 {
645 option.SetColor(ARGB(150, 255, 255, 255));
646 }
647
648 #ifndef PLATFORM_CONSOLE
649 if (option_label)
650 {
651 option_label.SetColor(ColorManager.COLOR_NORMAL_TEXT);
652 }
653 #endif
654 }
655
657 {
658 #ifndef PLATFORM_CONSOLE
659 SetFocus(null);
660 #endif
661
662 if (w)
663 {
664 ButtonWidget button = ButtonWidget.Cast(w);
665 if (button)
666 {
667 button.SetTextColor(ColorManager.COLOR_DISABLED_TEXT);
668 }
669 }
670
671 TextWidget text1 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
672 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
673 TextWidget text3 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
674 ImageWidget image = ImageWidget.Cast(w.FindAnyWidget(w.GetName() + "_image"));
675 Widget option = Widget.Cast(w.FindAnyWidget(w.GetName() + "_option_wrapper"));
676 Widget option_label = w.FindAnyWidget("option_label");
677
678 if (text1)
679 {
680 text1.SetColor(ColorManager.COLOR_DISABLED_TEXT);
681 }
682
683 if (text2)
684 {
685 text2.SetColor(ColorManager.COLOR_DISABLED_TEXT);
686 }
687
688 if (text3)
689 {
690 text3.SetColor(ColorManager.COLOR_DISABLED_TEXT);
691 w.SetAlpha(1);
692 }
693
694 if (image)
695 {
696 image.SetColor(ColorManager.COLOR_DISABLED_TEXT);
697 }
698
699 if (option)
700 {
701 option.SetColor(ColorManager.COLOR_DISABLED_TEXT);
702 }
703
704 #ifndef PLATFORM_CONSOLE
705 if (option_label)
706 {
707 option_label.SetColor(ColorManager.COLOR_DISABLED_TEXT);
708 }
709 #endif
710 }
711
712 void SetCharacterSaved(bool state)
713 {
714 #ifdef PLATFORM_CONSOLE
715 m_CharacterSaved = state;
716 Refresh();
717 #endif
718 }
719
720 protected void UpdateControlsElements()
721 {
722 #ifdef PLATFORM_CONSOLE
723 RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
724 string text = "";
725 if (!m_CharacterSaved && m_Scene.GetIntroCharacter().IsDefaultCharacter()) //can be saved..
726 {
727 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "#layout_character_creation_save_character", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
728 }
729 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "#layout_character_creation_toolbar_randomize", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
730 if (m_Scene.GetIntroCharacter().IsDefaultCharacter()) //edit options available
731 {
732 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#layout_character_creation_toolbar_select", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
733 }
734 text += string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#layout_character_creation_toolbar_back", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
735 toolbar_text.SetText(text);
736
737 RichTextWidget toolbar_b2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon0"));
738 RichTextWidget toolbar_x2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("RandomizeIcon0"));
739 RichTextWidget toolbar_y2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("SaveIcon0"));
740 RichTextWidget toolbar_y2_2 = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ApplyIcon0"));
741
742 string saveTextIcon = InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "", EUAINPUT_DEVICE_CONTROLLER);
743 toolbar_b2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER));
744 toolbar_x2.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "", EUAINPUT_DEVICE_CONTROLLER));
745 toolbar_y2.SetText(saveTextIcon);
746 toolbar_y2_2.SetText(saveTextIcon);
747 #endif
748 }
749
751 {
752 #ifdef PLATFORM_CONSOLE
754 layoutRoot.FindAnyWidget("toolbar_bg").Show(toolbarShow);
755 layoutRoot.FindAnyWidget("play_panel_root").Show(!toolbarShow);
756 #endif
757 }
758}
protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition Inventory.c:164
DayZGame g_Game
Definition DayZGame.c:3654
Mission mission
ECharGender
Definition ECharGender.c:2
Icon x
Icon y
void OptionSelectorMultistateCharacterMenu(Widget parent, int current_index, ScriptedWidgetEventHandler parent_c, bool disabled, notnull array< string > options)
array< ref PlayerStatBase > Get()
string name
proto native UAInputAPI GetUApi()
proto native owned string GetName()
proto native BiosUser GetSelectedUser()
Returns the currently selected user.
proto void GetVersion(out string version)
proto native Mission GetMission()
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition Game.c:1392
proto native Input GetInput()
proto native MenuData GetMenuData()
Return singleton of MenuData class - at main menu contains characters played with current profile.
proto native BiosUserManager GetUserManager()
proto native UIManager GetUIManager()
proto native WorkspaceWidget GetWorkspace()
static int COLOR_DISABLED_TEXT
static int COLOR_NORMAL_TEXT
Definition ColorManager.c:5
IntroSceneCharacter GetIntroCharacter()
proto native EInputDeviceType GetCurrentInputDevice()
proto native bool IsEnabledMouseAndKeyboard()
static const float ICON_SCALE_TOOLBAR
Definition InputUtils.c:15
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition InputUtils.c:167
provides access to slot configuration
Definition EnMath.c:7
proto bool RequestGetDefaultCharacterData()
void SetDefaultAttachment(int slotID, string type)
Definition gameplay.c:966
void EquipDefaultCharacter(Man player)
Definition gameplay.c:989
ScriptInvoker GetOnInputDeviceChanged()
Definition gameplay.c:823
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
bool Back()
Close top window on windows stack, returns true when any window is closed.
Definition UIManager.c:64
protected ref OptionSelectorEditbox m_NameSelector
protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
protected TextWidget m_CharacterHeaderText
override void Update(float timeslice)
void ColorDisable(Widget w)
protected Widget m_Save
override void Refresh()
protected Widget m_PlayedCharacterInfo
void SetTooltipTexts(Widget w, string header="", string desc="")
protected ref OptionSelectorMultistateCharacterMenu m_TopSelector
override void OnShow()
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
protected RichTextWidget m_DetailsText
protected Widget m_CharacterRotationFrame
void Save()
saves default character
protected TextWidget m_DetailsLabel
override bool OnKeyPress(Widget w, int x, int y, int key)
void Apply()
renames character
protected Widget m_DetailsRoot
protected void UpdateControlsElements()
void ColorNormal(Widget w)
protected Widget m_BackButton
override void OnHide()
protected ref OptionSelectorMultistateCharacterMenu m_GenderSelector
override Widget Init()
protected ref OptionSelectorMultistateCharacterMenu m_ShoesSelector
PlayerBase GetPlayerObj()
protected TextWidget m_Version
override bool OnFocusLost(Widget w, int x, int y)
DayZIntroScenePC m_Scene
bool IsFocusable(Widget w)
void SetCharacterSaved(bool state)
override bool OnMouseEnter(Widget w, int x, int y)
override bool OnMouseButtonDown(Widget w, int x, int y, int button)
void ColorHighlight(Widget w)
protected void UpdateControlsElementVisibility()
override bool OnFocus(Widget w, int x, int y)
protected ref OptionSelectorMultistateCharacterMenu m_SkinSelector
override bool OnClick(Widget w, int x, int y, int button)
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
protected Widget m_RandomizeCharacter
protected ref OptionSelectorMultistateCharacterMenu m_BottomSelector
protected Widget m_Apply
proto native CGame GetGame()
const string DEFAULT_CHARACTER_NAME
Definition constants.c:823
const int DEFAULT_CHARACTER_MENU_ID
Definition constants.c:825
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
const int MENU_MAIN
Definition constants.c:160
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
proto native int LengthUtf8()
Returns number of characters in UTF8 string.
proto string SubstringUtf8(int startChar, int len)
Substring of 'str' from 'startChar' position 'len' number of characters for UTF8 strings with multiby...
proto native void SetFocus(Widget w)
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.
EInputDeviceType
Definition input.c:3
int ARGB(int a, int r, int g, int b)
Definition proto.c:322