3 MissionWorkshopItem m_Item;
5 string m_sScenarioPath;
7 TextWidget m_wTypeText;
9 TextWidget m_wDescription;
17 ref ScriptInvoker m_OnPlay =
new ScriptInvoker();
18 ref ScriptInvoker m_OnContinue =
new ScriptInvoker();
19 ref ScriptInvoker m_OnRestart =
new ScriptInvoker();
20 ref ScriptInvoker m_OnFindServer =
new ScriptInvoker();
23 override void HandlerAttached(Widget w)
25 super.HandlerAttached(w);
26 m_wTypeText = TextWidget.Cast(w.FindAnyWidget(
"TypeText"));
27 m_wName = TextWidget.Cast(w.FindAnyWidget(
"Name"));
28 m_wDescription = TextWidget.Cast(w.FindAnyWidget(
"Description"));
29 m_wFooter = w.FindAnyWidget(
"Footer");
30 m_wFeatured = w.FindAnyWidget(
"Featured");
33 m_Play.m_OnActivated.Insert(OnPlay);
37 m_Continue.m_OnActivated.Insert(OnContinue);
41 m_FindServer.m_OnActivated.Insert(OnFindServer);
45 m_Restart.m_OnActivated.Insert(OnRestart);
47 m_wFooter.SetOpacity(0);
48 m_wFooter.SetEnabled(
false);
52 override bool OnDoubleClick(Widget w,
int x,
int y,
int button)
54 super.OnDoubleClick(w, x, y, button);
57 m_OnPlay.Invoke(
this);
63 override bool OnFocus(Widget w,
int x,
int y)
65 super.OnFocus(w, x, y);
67 m_wFooter.SetOpacity(1);
68 m_wFooter.SetEnabled(
true);
73 override bool OnFocusLost(Widget w,
int x,
int y)
75 super.OnFocusLost(w, x, y);
77 m_wFooter.SetOpacity(0);
78 m_wFooter.SetEnabled(
false);
89 void ShowMission(notnull MissionWorkshopItem item,
bool isFeatured =
false,
bool isRecent =
false,
bool isRecommended =
false)
94 m_wTypeText.SetText(
"#AR-MainMenu_Featured");
96 m_wTypeText.SetText(
"#AR-MainMenu_Recent");
97 else if (isRecommended)
98 m_wTypeText.SetText(
"#AR-MainMenu_Recommended");
100 m_wTypeText.SetText(
" ");
103 m_wDescription.SetText(item.Description());
110 ResourceName texture = GetTexture();
111 if (!texture.IsEmpty())
112 comp.SetImage(texture);
115 m_wFeatured.SetVisible(isFeatured);
117 bool canContinue = m_Header &&
GetGame().GetSaveManager().HasLatestSave(m_Header);
118 m_Play.SetVisible(!canContinue);
119 m_Continue.SetVisible(canContinue);
121 m_Restart.SetVisible(canContinue);
122 m_FindServer.SetVisible(item.GetPlayerCount() > 1);
127 ResourceName GetTexture()
130 return m_Item.Thumbnail().GetLocalScale(1920).Path();
132 if (!m_Header.m_sPreviewImage.IsEmpty())
133 return m_Header.m_sPreviewImage;
135 if (!m_Header.m_sIcon.IsEmpty())
136 return m_Header.m_sIcon;
138 return m_Header.m_sLoadingScreen;
144 m_OnPlay.Invoke(
this);
150 m_OnContinue.Invoke(
this);
156 m_OnRestart.Invoke(
this);
162 m_OnFindServer.Invoke(
this);