1class ModsMenuSimple
extends ScriptedWidgetEventHandler
3 protected const int MOD_DISPLAY_COUNT_MAX = 3;
6 protected Widget m_MoreButton;
7 protected Widget m_MoreHighlight;
8 protected ref map<ModInfo, ref ModsMenuSimpleEntry>
m_Data;
9 protected ModsMenuDetailed m_DetailMenu;
11 void ModsMenuSimple(array<ref ModInfo> data, Widget parent, ModsMenuDetailed detail_menu)
13 m_Root =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/mods_menu/mods_menu_simple.layout", parent);
14 m_MoreButton =
m_Root.FindAnyWidget(
"ModMore");
15 m_MoreHighlight =
m_Root.FindAnyWidget(
"ModMoreOverlay");
16 m_Data =
new map<ModInfo, ref ModsMenuSimpleEntry>;
17 m_DetailMenu = detail_menu;
23 void ~ModsMenuSimple()
28 void LoadEntries(array<ref ModInfo> data)
30 m_MoreButton.Show(data.Count() > MOD_DISPLAY_COUNT_MAX);
31 int count = Math.Clamp(data.Count(),0,MOD_DISPLAY_COUNT_MAX);
33 for (
int i = 0; i < count; i++)
35 ref ModsMenuSimpleEntry entry =
new ModsMenuSimpleEntry(data[i], i,
m_Root,
this);
36 m_Data.Insert(data[i], entry);
40 void Select(ModInfo mod)
43 m_DetailMenu.Highlight(mod);
48 if (w == m_MoreButton)
50 if (m_DetailMenu.IsOpen())
61 if (w == m_MoreButton)
63 m_MoreHighlight.Show(
true);
71 if (enterW != m_MoreButton)
73 m_MoreHighlight.Show(
false);
79 override bool OnFocus(Widget w,
int x,
int y)
81 if (w == m_MoreButton)
83 m_MoreHighlight.Show(
true);
91 if (w == m_MoreButton)
93 m_MoreHighlight.Show(
false);
override bool OnFocusLost(Widget w, int x, int y)
override bool OnFocus(Widget w, int x, int y)
override bool OnMouseEnter(Widget w, int x, int y)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)