Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
mainmenuvideo.c
Go to the documentation of this file.
1class MainMenuVideo extends UIScriptedMenu
2{
3 protected string m_BackButtonTextID;
4
5 protected VideoWidget m_Video;
6
7 override Widget Init()
8 {
9 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/xbox/video_menu.layout");
10 m_Video = VideoWidget.Cast(layoutRoot.FindAnyWidget("video"));
11
12 GetGame().GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
13
14 m_Video.Load("video\\DayZ_onboarding_MASTER.mp4");
15
16 m_Video.Play();
17
18 m_Video.SetCallback(VideoCallback.ON_END, StopVideo);
19
20 return layoutRoot;
21 }
22
24 {
25 }
26
27 //after show
28 override void OnShow()
29 {
30 super.OnShow();
31 GetGame().GetUIManager().ShowUICursor(false);
32 GetGame().GetSoundScene().SetSoundVolume(0.0,0.0);
33
35 }
36
37 //after hide
38 override void OnHide()
39 {
40 super.OnHide();
41 GetGame().GetUIManager().ShowUICursor(true);
42 GetGame().GetSoundScene().SetSoundVolume(1.0,1.0);
43 }
44
45 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
46 {
48 }
49
50 void StopVideo()
51 {
52 if (m_Video)
53 {
54 m_Video.Unload();
55 GetGame().GetUIManager().Back();
56 }
57 }
58
60 {
61 if (m_Video)
62 {
63 if (m_Video.IsPlaying())
64 {
65 m_Video.Pause();
66 }
67 else
68 {
69 m_Video.Play();
70 }
71 }
72 }
73
74 override void Update(float timeslice)
75 {
76 if (GetUApi().GetInputByID(UAUIBack).LocalPress())
77 {
78 StopVideo();
79 }
80 }
81
82 override void OnVisibilityChanged(bool isVisible)
83 {
84 if (!isVisible)
85 {
86 m_Video.Unload();
87 }
88 }
89
90 //Deprecated
91 protected void LoadFooterButtonTexts()
92 {
93 }
94
95 //Deprecated
96 protected void LoadTextStrings()
97 {
98 }
99
100 protected void UpdateControlsElements()
101 {
102 RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
103 string text;
104
105 if (GetGame().GetInput().IsEnabledMouseAndKeyboard() && GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.MOUSE_AND_KEYBOARD)
106 {
107 text = "ESC " + "#menu_back";
108 }
109 else
110 {
111 text = string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#menu_back", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
112 }
113
114 toolbar_text.SetText(text);
115 }
116}
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition inventory.c:175
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition inpututils.c:167
static const float ICON_SCALE_TOOLBAR
Definition inpututils.c:15
void LoadFooterButtonTexts()
override void OnShow()
override void Update(float timeslice)
VideoWidget m_Video
string m_BackButtonTextID
void LoadTextStrings()
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
override void OnHide()
void ~MainMenuVideo()
void UpdateControlsElements()
void PlayPauseVideo()
override Widget Init()
override void OnVisibilityChanged(bool isVisible)
proto native CGame GetGame()
EInputDeviceType
Definition input.c:3
proto native UAInputAPI GetUApi()