DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
MainMenuPromo.c
См. документацию.
1
2class MainMenuDlcHandlerBase extends ScriptedWidgetEventHandler
3{
4 protected const string TEXT_OWNED = "#layout_dlc_owned";
5 protected const string TEXT_UNOWNED = "#layout_dlc_unowned";
6
8
9 protected Widget m_Root;
14 protected ImageWidget m_DlcPromotionImage;
16 protected MultilineTextWidget m_DescriptionTextDlc;
17 protected VideoWidget m_VideoWidget;
18 protected ref ModInfo m_ThisModInfo;
20
22
24 {
25 CreateRootWidget(parent);
26 m_Root.SetHandler(this);
27 m_DlcInfo = DlcInfo;
28 m_ThisModInfo = info;
29 Init();
30
31 g_Game.GetContentDLCService().Subscribe(OnDLCChange);
32
33 #ifdef PLATFORM_CONSOLE
34 if (g_Game.GetMission())
35 {
36 g_Game.GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
37 }
38 #endif
39 }
40
42 {
43 if (g_Game.GetContentDLCService())
44 g_Game.GetContentDLCService().Unsubscribe(OnDLCChange);
45 }
46
47 void Init()
48 {
50 m_StoreButton = m_Root.FindAnyWidget("dlc_openStore");
52 m_VideoWidget = VideoWidget.Cast(m_Root.FindAnyWidget("dlc_Video"));
53 m_VideoWidget.Show(false);
54 m_DlcPromotionImage = ImageWidget.Cast(m_Root.FindAnyWidget("dlc_ImageMain"));
55 m_DlcPromotionImage.Show(true);
56 m_BannerFrame = m_Root.FindAnyWidget("dlc_BannerFrame");//dlc_BannerFrame //dlc_BannerFrameVideo
58 m_TitleTextDlc = TextWidget.Cast(m_Root.FindAnyWidget("dlc_title"));
59 m_DescriptionTextDlc = MultilineTextWidget.Cast(m_Root.FindAnyWidget("dlc_Description"));
60 m_DescriptionTextDlc.SetLineBreakingOverride(LinebreakOverrideMode.LINEBREAK_WESTERN);
62
64 //StartVideo();
65 }
66
68 {
69 m_Root = g_Game.GetWorkspace().CreateWidgets("gui/layouts/new_ui/dlc_panels/DLC_Panel.layout", parent);
70 }
71
72 void ShowInfoPanel(bool show)
73 {
74 m_Root.Show(show);
76 }
77
79 {
80 return m_Root.IsVisible();
81 }
82
84 {
86 return;
87
88 /*if (IsInfoPanelVisible())
89 StartVideo();
90 else
91 PauseVideo();*/
92 }
93
94 //works on button only
95 override bool OnClick(Widget w, int x, int y, int button)
96 {
97 m_ThisModInfo.GoToStore();
98 return super.OnClick(w,x,y,button);
99 }
100
103 {
104 if (m_VideoWidget.GetState() != VideoState.NONE)
105 return true;
106
107 string path = "video\\" + m_DlcInfo.VideoFileName;
108 if (m_DlcInfo.VideoFileName != "")
109 return m_VideoWidget.Load(path, true);
110
111 return false;
112 }
113
115 {
116 if (LoadVideoFile())
117 m_VideoWidget.Play();
118 }
119
121 {
122 m_VideoWidget.Stop();
123 }
124
126 {
127 m_VideoWidget.Pause();
128 }
129
131 {
132 m_VideoWidget.Stop();
133 m_VideoWidget.Unload();
134 }
135
136 protected void ColorFocussed(Widget w, int x, int y)
137 {
138 m_Background.SetColor(ARGB(255,54,16,16));
139 }
140
141 protected void ColorUnfocussed(Widget w, Widget enterW, int x, int y)
142 {
144 }
145
146 protected void UpdateOwnedStatus()
147 {
148 if (m_ThisModInfo)
149 {
150 if (m_ThisModInfo.GetIsOwned())
151 {
153 m_BannerHandler.SetBannerText(TEXT_OWNED);
154 }
155 else
156 {
157 m_BannerHandler.SetBannerColor(Colors.COLOR_DAYZ_RED);
158 m_BannerHandler.SetBannerText(TEXT_UNOWNED);
159 }
160 }
161 }
162
163 protected void OnDLCChange()
164 {
166 }
167
168 protected void SetPlatformSpecifics()
169 {
170 TextWidget desc = TextWidget.Cast(m_StoreButton.FindAnyWidget("dlc_openStore_label"));
171 #ifdef PLATFORM_PS4
172 m_GamepadStoreImage = m_Root.FindAnyWidget("image_button_ps");
173 desc.SetText("#dlc_open_store_PS");
174 #endif
175 #ifdef PLATFORM_XBOX
176 m_GamepadStoreImage = m_Root.FindAnyWidget("image_button_xbox");
177 desc.SetText("#dlc_open_store_Xbox");
178 #endif
179 #ifdef PLATFORM_PC
180 m_GamepadStoreImage = m_Root.FindAnyWidget("image_button_xbox");
181 desc.SetText("#dlc_open_store");
182 #endif
183 }
184
185 //updates on language change etc.
192
193 protected void UpdateDlcData()
194 {
195 m_TitleTextDlc.SetText(m_DlcInfo.HeaderText);
196 m_DescriptionTextDlc.SetText(m_DlcInfo.DescriptionText);
197 }
198
199 protected void UpdateIconVisibility()
200 {
201 #ifdef PLATFORM_CONSOLE
202 m_GamepadStoreImage.Show(!g_Game.GetInput().IsEnabledMouseAndKeyboard() || g_Game.GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER);
203 #endif
204 }
205
206 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
207 {
209 }
210
212 {
213 return m_ThisModInfo;
214 }
215
216 override bool OnMouseEnter(Widget w, int x, int y)
217 {
218 if (w == m_StoreButton)
219 {
220 m_Root.FindAnyWidget("dlc_openStore_panel").SetColor(ARGB(255, 0, 0, 0));
221 m_Root.FindAnyWidget("dlc_openStore_label").SetColor(ARGB(255, 255, 0, 0));
222 return true;
223 }
224
225 return false;
226 }
227
228 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
229 {
230 if (w == m_StoreButton)
231 {
232 m_Root.FindAnyWidget("dlc_openStore_panel").SetColor(ARGB(140, 0, 0, 0));
233 m_Root.FindAnyWidget("dlc_openStore_label").SetColor(ARGB(255, 255, 255, 255));
234 return true;
235 }
236
237 return false;
238 }
239}
DayZGame g_Game
Определения DayZGame.c:4074
Icon x
Icon y
string path
Определения OptionSelectorMultistate.c:142
const int COLOR_FROSTLINE_MOUNTAIN_BLUE
Определения Colors.c:67
const int COLOR_DAYZ_RED
Определения Colors.c:53
Определения Colors.c:4
Определения JsonDataDLCInfo.c:7
Определения ModInfo.c:2
void UnloadVideo()
Определения MainMenuPromo.c:130
int m_ColorBackgroundOriginal
Определения MainMenuPromo.c:7
void ShowInfoPanel(bool show)
Определения MainMenuPromo.c:72
void UpdateIconVisibility()
Определения MainMenuPromo.c:199
VideoWidget m_VideoWidget
Определения MainMenuPromo.c:17
Widget m_GamepadStoreImage
Определения MainMenuPromo.c:13
Widget m_Root
Определения SizeToChild.c:9
Widget m_BannerFrame
Определения MainMenuPromo.c:10
void MainMenuDlcHandlerBase(ModInfo info, Widget parent, JsonDataDLCInfo DlcInfo)
Определения MainMenuPromo.c:23
void OnPanelVisibilityChanged()
Определения MainMenuPromo.c:83
Widget m_StoreButton
Определения MainMenuPromo.c:12
ref ModInfo m_ThisModInfo
Определения MainMenuPromo.c:18
void StopVideo()
Определения MainMenuPromo.c:120
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Определения ItemActionsWidget.c:104
void BannerHandlerBase(Widget parent)
Определения BannerHandlerBase.c:9
TextWidget m_TitleTextDlc
Определения MainMenuPromo.c:15
bool LoadVideoFile()
returns 'true' when video is loaded
Определения MainMenuPromo.c:102
void UpdateAllPromotionInfo()
Определения MainMenuPromo.c:186
void PauseVideo()
Определения MainMenuPromo.c:125
ImageWidget m_DlcPromotionImage
Определения MainMenuPromo.c:14
MultilineTextWidget m_DescriptionTextDlc
Определения MainMenuPromo.c:16
const string TEXT_OWNED
Определения MainMenuPromo.c:4
Widget m_Background
Определения MainMenuPromo.c:11
void StartVideo()
Определения MainMenuPromo.c:114
ModInfo GetModInfo()
Определения MainMenuPromo.c:211
void ~MainMenuDlcHandlerBase()
Определения MainMenuPromo.c:41
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения MainMenuPromo.c:228
override bool OnClick(Widget w, int x, int y, int button)
Определения MainMenuPromo.c:95
ref BannerHandlerBase m_BannerHandler
Определения MainMenuPromo.c:21
void OnDLCChange()
Определения MainMenuPromo.c:163
void Init()
Определения MainMenuPromo.c:47
void SetPlatformSpecifics()
Определения MainMenuPromo.c:168
void CreateRootWidget(Widget parent)
Определения MainMenuPromo.c:67
void UpdateDlcData()
Определения MainMenuPromo.c:193
bool IsInfoPanelVisible()
Определения MainMenuPromo.c:78
void ColorFocussed(Widget w, int x, int y)
Определения MainMenuPromo.c:136
override bool OnMouseEnter(Widget w, int x, int y)
Определения MainMenuPromo.c:216
ref JsonDataDLCInfo m_DlcInfo
Определения MainMenuPromo.c:19
const string TEXT_UNOWNED
Определения MainMenuPromo.c:5
void ColorUnfocussed(Widget w, Widget enterW, int x, int y)
Определения MainMenuPromo.c:141
void UpdateOwnedStatus()
Определения MainMenuPromo.c:146
Deprecated.
Определения EnWidgets.c:657
Определения EnWidgets.c:220
Определения EnWidgets.c:190
VideoState
Определения EnWidgets.c:517
EInputDeviceType
Определения input.c:3
int ARGB(int a, int r, int g, int b)
Определения proto.c:322