DayZ 1.24
Loading...
Searching...
No Matches
MainMenuVideo.c
Go to the documentation of this file.
2{
3 protected string m_BackButtonTextID;
4
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
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 m_Video.Pause();
65 else
66 m_Video.Play();
67 }
68 }
69
70 override void Update(float timeslice)
71 {
72 if (GetUApi().GetInputByID(UAUIBack).LocalPress())
73 StopVideo();
74 }
75
76 override void OnVisibilityChanged(bool isVisible)
77 {
78 if (!isVisible)
79 m_Video.Unload();
80 }
81
82 //Deprecated
83 protected void LoadFooterButtonTexts()
84 {
85 }
86
87 //Deprecated
88 protected void LoadTextStrings()
89 {
90 }
91
92 protected void UpdateControlsElements()
93 {
94 RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
95 string text;
96
97 if (GetGame().GetInput().IsEnabledMouseAndKeyboard() && GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.MOUSE_AND_KEYBOARD)
98 text = "ESC " + "#menu_back";
99 else
101
102 toolbar_text.SetText(text);
103 }
104}
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition Inventory.c:167
ActionInput GetInput()
Definition ActionBase.c:989
class JsonControlMappingInfo m_BackButtonTextID
void UpdateControlsElements()
proto native UAInputAPI GetUApi()
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition InputUtils.c:151
static const float ICON_SCALE_TOOLBAR
Definition InputUtils.c:15
void LoadFooterButtonTexts()
override void OnShow()
override void Update(float timeslice)
VideoWidget m_Video
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()
VideoCallback
Definition EnWidgets.c:531
EInputDeviceType
Definition input.c:3