2class MainMenuDlcHandlerBase
extends ScriptedWidgetEventHandler
4 protected const string TEXT_OWNED =
"#layout_dlc_owned";
5 protected const string TEXT_UNOWNED =
"#layout_dlc_unowned";
7 protected int m_ColorBackgroundOriginal;
10 protected Widget m_BannerFrame;
11 protected Widget m_Background;
12 protected Widget m_StoreButton;
13 protected Widget m_GamepadStoreImage;
14 protected ImageWidget m_DlcPromotionImage;
15 protected TextWidget m_TitleTextDlc;
16 protected MultilineTextWidget m_DescriptionTextDlc;
17 protected VideoWidget m_VideoWidget;
18 protected ref
ModInfo m_ThisModInfo;
21 protected ref BannerHandlerBase m_BannerHandler;
25 CreateRootWidget(parent);
31 #ifdef PLATFORM_CONSOLE
40 void ~MainMenuDlcHandlerBase()
42 #ifdef PLATFORM_CONSOLE
43 if (
GetGame().GetContentDLCService())
51 m_StoreButton =
m_Root.FindAnyWidget(
"dlc_openStore");
52 SetPlatformSpecifics();
53 m_VideoWidget = VideoWidget.Cast(
m_Root.FindAnyWidget(
"dlc_Video"));
54 m_VideoWidget.Show(
false);
55 m_DlcPromotionImage = ImageWidget.Cast(
m_Root.FindAnyWidget(
"dlc_ImageMain"));
56 m_DlcPromotionImage.Show(
true);
57 m_BannerFrame =
m_Root.FindAnyWidget(
"dlc_BannerFrame");
58 m_BannerHandler =
new BannerHandlerBase(m_BannerFrame);
59 m_TitleTextDlc = TextWidget.Cast(
m_Root.FindAnyWidget(
"dlc_title"));
60 m_DescriptionTextDlc = MultilineTextWidget.Cast(
m_Root.FindAnyWidget(
"dlc_Description"));
61 m_DescriptionTextDlc.SetLineBreakingOverride(LinebreakOverrideMode.LINEBREAK_WESTERN);
62 m_ColorBackgroundOriginal = m_Background.GetColor();
64 UpdateAllPromotionInfo();
68 void CreateRootWidget(Widget parent)
70 m_Root =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/dlc_panels/DLC_Panel.layout", parent);
73 void ShowInfoPanel(
bool show)
76 OnPanelVisibilityChanged();
79 bool IsInfoPanelVisible()
84 void OnPanelVisibilityChanged()
86 UpdateAllPromotionInfo();
96 override bool OnClick(Widget w,
int x,
int y,
int button)
98 m_ThisModInfo.GoToStore();
99 return super.OnClick(w,
x,
y,button);
105 if (m_VideoWidget.GetState() != VideoState.NONE)
108 string path =
"video\\" + m_DlcInfo.VideoFileName;
109 if (m_DlcInfo.VideoFileName !=
"")
110 return m_VideoWidget.Load(
path,
true);
118 m_VideoWidget.Play();
123 m_VideoWidget.Stop();
128 m_VideoWidget.Pause();
133 m_VideoWidget.Stop();
134 m_VideoWidget.Unload();
137 protected void ColorFocussed(Widget w,
int x,
int y)
139 m_Background.SetColor(
ARGB(255,54,16,16));
142 protected void ColorUnfocussed(Widget w, Widget enterW,
int x,
int y)
144 m_Background.SetColor(m_ColorBackgroundOriginal);
147 protected void UpdateOwnedStatus()
151 if (m_ThisModInfo.GetIsOwned())
153 m_BannerHandler.SetBannerColor(
Colors.COLOR_FROSTLINE_MOUNTAIN_BLUE);
154 m_BannerHandler.SetBannerText(TEXT_OWNED);
158 m_BannerHandler.SetBannerColor(
Colors.COLOR_DAYZ_RED);
159 m_BannerHandler.SetBannerText(TEXT_UNOWNED);
169 protected void SetPlatformSpecifics()
171 TextWidget desc = TextWidget.Cast(m_StoreButton.FindAnyWidget(
"dlc_openStore_label"));
173 m_GamepadStoreImage =
m_Root.FindAnyWidget(
"image_button_ps");
174 desc.SetText(
"#dlc_open_store_PS");
177 m_GamepadStoreImage =
m_Root.FindAnyWidget(
"image_button_xbox");
178 desc.SetText(
"#dlc_open_store_Xbox");
181 m_GamepadStoreImage =
m_Root.FindAnyWidget(
"image_button_xbox");
182 desc.SetText(
"#dlc_open_store");
187 void UpdateAllPromotionInfo()
191 UpdateIconVisibility();
194 protected void UpdateDlcData()
196 m_TitleTextDlc.SetText(m_DlcInfo.HeaderText);
197 m_DescriptionTextDlc.SetText(m_DlcInfo.DescriptionText);
200 protected void UpdateIconVisibility()
202 #ifdef PLATFORM_CONSOLE
203 m_GamepadStoreImage.Show(!
GetGame().GetInput().IsEnabledMouseAndKeyboard() ||
GetGame().GetInput().GetCurrentInputDevice() ==
EInputDeviceType.CONTROLLER);
209 UpdateIconVisibility();
214 return m_ThisModInfo;
219 if (w == m_StoreButton)
221 m_Root.FindAnyWidget(
"dlc_openStore_panel").SetColor(
ARGB(255, 0, 0, 0));
222 m_Root.FindAnyWidget(
"dlc_openStore_label").SetColor(
ARGB(255, 255, 0, 0));
231 if (w == m_StoreButton)
233 m_Root.FindAnyWidget(
"dlc_openStore_panel").SetColor(
ARGB(140, 0, 0, 0));
234 m_Root.FindAnyWidget(
"dlc_openStore_label").SetColor(
ARGB(255, 255, 255, 255));
override bool OnMouseEnter(Widget w, int x, int y)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
proto native ContentDLC GetContentDLCService()
Return DLC service (service for entitlement keys for unlock content)
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
proto native CGame GetGame()
int ARGB(int a, int r, int g, int b)
void OnDLCChange(EDLCId dlcId)