3 #ifdef PLATFORM_CONSOLE
5 protected bool m_CharacterSaved;
10 const int TOOLTIP_ID_SAVE = 1;
11 const int TOOLTIP_ID_APPLY = 2;
36 MissionMainMenu
mission = MissionMainMenu.Cast(
GetGame().GetMission());
38 #ifdef PLATFORM_CONSOLE
39 m_Scene =
mission.GetIntroSceneXbox();
41 m_Scene =
mission.GetIntroScenePC();
54 #ifdef PLATFORM_CONSOLE
65 #ifdef PLATFORM_CONSOLE
67 m_CharacterSaved =
false;
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");
86 #ifdef PLATFORM_CONSOLE
87 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
89 version =
"#main_menu_version" +
" " + version;
91 m_Version.SetText(version);
98 m_NameSelector =
new OptionSelectorEditbox(layoutRoot.FindAnyWidget(
"character_name_setting_option"), m_Scene.
GetIntroCharacter().GetCharacterName(), null,
false);
102 m_GenderSelector.SetValue(
"Female");
107 m_GenderSelector.SetValue(
"Male");
120 m_TopSelector.SetValue(obj.GetType(),
false);
122 obj = scene_char.GetInventory().FindAttachment(
InventorySlots.LEGS);
124 m_BottomSelector.SetValue(obj.GetType(),
false);
126 obj = scene_char.GetInventory().FindAttachment(
InventorySlots.FEET);
128 m_ShoesSelector.SetValue(obj.GetType(),
false);
130 m_SkinSelector.SetValue(scene_char.GetType());
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);
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);
163 string name = m_NameSelector.GetValue();
170 MainMenu menu_main = MainMenu.Cast(
GetGame().GetUIManager().FindMenu(
MENU_MAIN));
173 menu_main.OnChangeCharacter(
false);
183 string name = m_NameSelector.GetValue();
198 #ifdef PLATFORM_CONSOLE
226 m_GenderSelector.SetValue(
"Female");
228 m_SkinSelector.SetRandomValue();
232 m_GenderSelector.SetValue(
"Male");
234 m_SkinSelector.SetRandomValue();
240 m_BottomSelector.SetValue(
GetGame().GetMenuDefaultCharacterData().GetAttachmentMap().
Get(
InventorySlots.LEGS),
false);
241 m_ShoesSelector.SetValue(
GetGame().GetMenuDefaultCharacterData().GetAttachmentMap().
Get(
InventorySlots.FEET),
false);
254 if (m_GenderSelector.GetStringValue() ==
"Female")
261 m_SkinSelector.LoadNewValues(m_Scene.
GetIntroCharacter().GetCharList(gender) , 0);
262 m_SkinSelector.SetRandomValue();
268 m_Scene.
GetIntroCharacter().CreateNewCharacterByName(m_SkinSelector.GetStringValue(),
false);
295 super.OnKeyPress(w,
x,
y, key);
306 else if (w == m_Save)
312 else if (w == m_RandomizeCharacter)
317 else if (w == m_BackButton)
327 #ifndef PLATFORM_CONSOLE
328 if (w == m_CharacterRotationFrame)
340 #ifndef PLATFORM_CONSOLE
349 string tooltip_header =
"";
350 string tooltip_text =
"";
352 switch (w.GetUserID())
355 tooltip_header =
"#layout_main_menu_rename";
356 tooltip_text =
"#layout_character_creation_apply_tooltip";
360 tooltip_header =
"#layout_character_creation_save_character";
361 tooltip_text =
"#layout_character_creation_save_tooltip";
378 string tooltip_header =
"";
379 string tooltip_text =
"";
383 switch (w.GetUserID())
386 tooltip_header =
"#layout_main_menu_rename";
387 tooltip_text =
"#layout_character_creation_apply_tooltip";
391 tooltip_header =
"#layout_character_creation_save_character";
392 tooltip_text =
"#layout_character_creation_save_tooltip";
416 return (w == m_Apply || w == m_Save || w == m_RandomizeCharacter || w == m_BackButton);
423 #ifndef PLATFORM_CONSOLE
424 bool show = header !=
"" && desc !=
"";
425 m_DetailsRoot.Show(show);
426 m_DetailsLabel.SetText(header);
427 m_DetailsText.SetText(desc);
432 float parent_pos_x, parent_pos_y;
433 float parent_size_x, parent_size_y;
434 float layout_size_x, layout_size_y;
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);
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);
445 m_DetailsText.Update();
446 m_DetailsLabel.Update();
447 m_DetailsRoot.Update();
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);
461 if (!was_visible && show_widgets)
462 m_GenderSelector.Focus();
469#ifdef PLATFORM_CONSOLE
470 m_GenderSelector.Focus();
479 #ifdef PLATFORM_CONSOLE
480 if (
GetGame().GetUserManager() &&
GetGame().GetUserManager().GetSelectedUser())
495 m_NameSelector.SetValue(
name);
499 #ifdef PLATFORM_CONSOLE
500 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
502 m_Apply.Show(m_CharacterSaved || !m_Scene.
GetIntroCharacter().IsDefaultCharacter());
503 m_Save.Show(!m_CharacterSaved && m_Scene.
GetIntroCharacter().IsDefaultCharacter());
505 version =
"#main_menu_version" +
" " + version;
513 m_CharacterHeaderText.SetText(
"#character_menu_header");
517 m_CharacterHeaderText.SetText(
"#server_browser_prev_play_filter");
520 m_Version.SetText(version);
522 #ifdef PLATFORM_CONSOLE
530 if (
GetUApi().GetInputByID(UAUIBack).LocalPress())
535 if (
GetUApi().GetInputByID(UAUICtrlX).LocalPress())
540 #ifdef PLATFORM_CONSOLE
541 if (
GetUApi().GetInputByID(UAUICtrlY).LocalPress())
558 if (w.IsInherited(ButtonWidget))
560 ButtonWidget button = ButtonWidget.Cast(w);
561 button.SetTextColor(
ARGB(255, 200, 0, 0));
564 w.SetColor(
ARGB(255, 0, 0, 0));
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");
575 text1.SetColor(
ARGB(255, 255, 0, 0));
580 text2.SetColor(
ARGB(255, 255, 0, 0));
585 text3.SetColor(
ARGB(255, 255, 0, 0));
591 image.SetColor(
ARGB(255, 200, 0, 0));
596 option.SetColor(
ARGB(255, 255, 0, 0));
599 #ifndef PLATFORM_CONSOLE
602 option_label.SetColor(
ARGB(255, 255, 0, 0));
609 if (w.IsInherited(ButtonWidget))
611 ButtonWidget button = ButtonWidget.Cast(w);
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");
645 option.SetColor(
ARGB(150, 255, 255, 255));
648 #ifndef PLATFORM_CONSOLE
658 #ifndef PLATFORM_CONSOLE
664 ButtonWidget button = ButtonWidget.Cast(w);
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");
704 #ifndef PLATFORM_CONSOLE
714 #ifdef PLATFORM_CONSOLE
715 m_CharacterSaved = state;
722 #ifdef PLATFORM_CONSOLE
735 toolbar_text.SetText(text);
745 toolbar_y2.SetText(saveTextIcon);
746 toolbar_y2_2.SetText(saveTextIcon);
752 #ifdef PLATFORM_CONSOLE
754 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(toolbarShow);
755 layoutRoot.FindAnyWidget(
"play_panel_root").Show(!toolbarShow);
protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
void OptionSelectorMultistateCharacterMenu(Widget parent, int current_index, ScriptedWidgetEventHandler parent_c, bool disabled, notnull array< string > options)
array< ref PlayerStatBase > Get()
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)
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
void CharacterRotationStart()
void CharacterRotationStop()
IntroSceneCharacter GetIntroCharacter()
provides access to slot configuration
ScriptInvoker GetOnInputDeviceChanged()
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.
proto native CGame GetGame()
const string DEFAULT_CHARACTER_NAME
const int DEFAULT_CHARACTER_MENU_ID
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
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...
int ARGB(int a, int r, int g, int b)