DayZ 1.27
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 #ifdef PLATFORM_CONSOLE
33 if (GetGame().GetMission())
34 {
36 }
37 #endif
38 }
39
41 {
42 #ifdef PLATFORM_CONSOLE
43 if (GetGame().GetContentDLCService())
45 #endif
46 }
47
48 void Init()
49 {
51 m_StoreButton = m_Root.FindAnyWidget("dlc_openStore");
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");//dlc_BannerFrame //dlc_BannerFrameVideo
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);
63
65 //StartVideo();
66 }
67
69 {
70 m_Root = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/dlc_panels/DLC_Panel.layout", parent);
71 }
72
73 void ShowInfoPanel(bool show)
74 {
75 m_Root.Show(show);
77 }
78
80 {
81 return m_Root.IsVisible();
82 }
83
85 {
87 return;
88
89 /*if (IsInfoPanelVisible())
90 StartVideo();
91 else
92 PauseVideo();*/
93 }
94
95 //works on button only
96 override bool OnClick(Widget w, int x, int y, int button)
97 {
98 m_ThisModInfo.GoToStore();
99 return super.OnClick(w,x,y,button);
100 }
101
104 {
105 if (m_VideoWidget.GetState() != VideoState.NONE)
106 return true;
107
108 string path = "video\\" + m_DlcInfo.VideoFileName;
109 if (m_DlcInfo.VideoFileName != "")
110 return m_VideoWidget.Load(path, true);
111
112 return false;
113 }
114
116 {
117 if (LoadVideoFile())
118 m_VideoWidget.Play();
119 }
120
122 {
123 m_VideoWidget.Stop();
124 }
125
127 {
128 m_VideoWidget.Pause();
129 }
130
132 {
133 m_VideoWidget.Stop();
134 m_VideoWidget.Unload();
135 }
136
137 protected void ColorFocussed(Widget w, int x, int y)
138 {
139 m_Background.SetColor(ARGB(255,54,16,16));
140 }
141
142 protected void ColorUnfocussed(Widget w, Widget enterW, int x, int y)
143 {
145 }
146
147 protected void UpdateOwnedStatus()
148 {
149 if (m_ThisModInfo)
150 {
151 if (m_ThisModInfo.GetIsOwned())
152 {
154 m_BannerHandler.SetBannerText(TEXT_OWNED);
155 }
156 else
157 {
158 m_BannerHandler.SetBannerColor(Colors.COLOR_DAYZ_RED);
159 m_BannerHandler.SetBannerText(TEXT_UNOWNED);
160 }
161 }
162 }
163
164 protected void OnDLCChange()
165 {
167 }
168
169 protected void SetPlatformSpecifics()
170 {
171 TextWidget desc = TextWidget.Cast(m_StoreButton.FindAnyWidget("dlc_openStore_label"));
172 #ifdef PLATFORM_PS4
173 m_GamepadStoreImage = m_Root.FindAnyWidget("image_button_ps");
174 desc.SetText("#dlc_open_store_PS");
175 #endif
176 #ifdef PLATFORM_XBOX
177 m_GamepadStoreImage = m_Root.FindAnyWidget("image_button_xbox");
178 desc.SetText("#dlc_open_store_Xbox");
179 #endif
180 #ifdef PLATFORM_PC
181 m_GamepadStoreImage = m_Root.FindAnyWidget("image_button_xbox");
182 desc.SetText("#dlc_open_store");
183 #endif
184 }
185
186 //updates on language change etc.
193
194 protected void UpdateDlcData()
195 {
196 m_TitleTextDlc.SetText(m_DlcInfo.HeaderText);
197 m_DescriptionTextDlc.SetText(m_DlcInfo.DescriptionText);
198 }
199
200 protected void UpdateIconVisibility()
201 {
202 #ifdef PLATFORM_CONSOLE
203 m_GamepadStoreImage.Show(!GetGame().GetInput().IsEnabledMouseAndKeyboard() || GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER);
204 #endif
205 }
206
207 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
208 {
210 }
211
213 {
214 return m_ThisModInfo;
215 }
216
217 override bool OnMouseEnter(Widget w, int x, int y)
218 {
219 if (w == m_StoreButton)
220 {
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));
223 return true;
224 }
225
226 return false;
227 }
228
229 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
230 {
231 if (w == m_StoreButton)
232 {
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));
235 return true;
236 }
237
238 return false;
239 }
240}
Icon x
Icon y
string path
Определения OptionSelectorMultistate.c:142
proto native WorkspaceWidget GetWorkspace()
proto native ContentDLC GetContentDLCService()
Return DLC service (service for entitlement keys for unlock content)
proto native Mission GetMission()
const int COLOR_FROSTLINE_MOUNTAIN_BLUE
Определения Colors.c:65
const int COLOR_DAYZ_RED
Определения Colors.c:51
Определения Colors.c:4
ref ScriptInvoker m_OnChange
void(EDLCId dlcId)
Определения ContentDLC.c:13
Определения JsonDataDLCInfo.c:7
ScriptInvoker GetOnInputDeviceChanged()
Определения gameplay.c:851
Определения ModInfo.c:2
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
void UnloadVideo()
Определения MainMenuPromo.c:131
int m_ColorBackgroundOriginal
Определения MainMenuPromo.c:7
void ShowInfoPanel(bool show)
Определения MainMenuPromo.c:73
void UpdateIconVisibility()
Определения MainMenuPromo.c:200
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:84
Widget m_StoreButton
Определения MainMenuPromo.c:12
ref ModInfo m_ThisModInfo
Определения MainMenuPromo.c:18
void StopVideo()
Определения MainMenuPromo.c:121
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:103
void UpdateAllPromotionInfo()
Определения MainMenuPromo.c:187
void PauseVideo()
Определения MainMenuPromo.c:126
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:115
ModInfo GetModInfo()
Определения MainMenuPromo.c:212
void ~MainMenuDlcHandlerBase()
Определения MainMenuPromo.c:40
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения MainMenuPromo.c:229
override bool OnClick(Widget w, int x, int y, int button)
Определения MainMenuPromo.c:96
ref BannerHandlerBase m_BannerHandler
Определения MainMenuPromo.c:21
void OnDLCChange()
Определения MainMenuPromo.c:164
void Init()
Определения MainMenuPromo.c:48
void SetPlatformSpecifics()
Определения MainMenuPromo.c:169
void CreateRootWidget(Widget parent)
Определения MainMenuPromo.c:68
void UpdateDlcData()
Определения MainMenuPromo.c:194
bool IsInfoPanelVisible()
Определения MainMenuPromo.c:79
void ColorFocussed(Widget w, int x, int y)
Определения MainMenuPromo.c:137
override bool OnMouseEnter(Widget w, int x, int y)
Определения MainMenuPromo.c:217
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:142
void UpdateOwnedStatus()
Определения MainMenuPromo.c:147
map: item x vector(index, width, height)
Определения EnWidgets.c:651
Определения EnWidgets.c:220
Определения EnWidgets.c:190
proto native CGame GetGame()
VideoState
Определения EnWidgets.c:517
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.
EInputDeviceType
Определения input.c:3
int ARGB(int a, int r, int g, int b)
Определения proto.c:322