Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
mainmenuvideo.c
Go to the documentation of this file.
1 class 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 
23  void ~MainMenuVideo()
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 
59  void PlayPauseVideo()
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 }
GetGame
proto native CGame GetGame()
UIScriptedMenu
Definition: dayzgame.c:63
InputUtils
Definition: inpututils.c:1
UpdateControlsElements
protected void UpdateControlsElements()
Definition: itemdropwarningmenu.c:92
OnHide
override void OnHide()
Definition: inventorymenu.c:141
m_BackButtonTextID
class JsonControlMappingInfo m_BackButtonTextID
OnInputDeviceChanged
protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition: inventory.c:167
VideoCallback
VideoCallback
Definition: enwidgets.c:530
EInputDeviceType
EInputDeviceType
Definition: input.c:2
RichTextWidget
Definition: gameplay.c:315
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
LoadFooterButtonTexts
protected void LoadFooterButtonTexts()
Initial texts load for the footer buttons.
Definition: controlsxbox.c:404
LoadTextStrings
protected void LoadTextStrings()
Set correct bottom button texts based on platform (ps4 vs xbox texts)
Definition: controlsxbox.c:414
Update
proto native volatile void Update()
Definition: playersoundmanager.c:125
OnShow
override void OnShow()
Definition: controlsxbox.c:349
Widget
Definition: enwidgets.c:189
GetUApi
proto native UAInputAPI GetUApi()
GetInput
ActionInput GetInput()
Definition: actionbase.c:1066