DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ConnectionDialogue.c
См. документацию.
1class ConnectionDialogue extends UIScriptedMenu
2{
3 protected bool m_DebugMonitorHidden;
4
5 protected MultilineTextWidget m_Description;
6 protected ButtonWidget m_DisconnectBtn;
7 #ifdef PLATFORM_CONSOLE
8 protected RichTextWidget m_DisconnectBtnLabel;
9 protected Widget m_ConsoleToolbar;
10 #endif
11
13
15 {
16 #ifdef PLATFORM_CONSOLE
17 if (g_Game.GetMission())
18 {
19 g_Game.GetMission().GetOnInputDeviceChanged().Remove(OnInputDeviceChanged);
20 }
21 #endif
22 }
23
24 override Widget Init()
25 {
26 layoutRoot = g_Game.GetWorkspace().CreateWidgets("gui/layouts/day_z_connection_dialogue.layout");
27 m_DisconnectBtn = ButtonWidget.Cast(layoutRoot.FindAnyWidget("DCButton"));
28 #ifdef PLATFORM_CONSOLE
29 m_DisconnectBtnLabel = RichTextWidget.Cast(layoutRoot.FindAnyWidget("DCButtonLabel"));
30 m_ConsoleToolbar = layoutRoot.FindAnyWidget("ConsoleToolbar");
31 #endif
32
33 #ifdef PLATFORM_CONSOLE
34 if (g_Game.GetMission())
35 {
36 g_Game.GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
37 }
38 #endif
39
40 RichTextWidget toolbar_text = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
41 string context = string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#main_menu_exit", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
42 toolbar_text.SetText(context);
43
44 #ifdef PLATFORM_CONSOLE
45 OnInputDeviceChanged(g_Game.GetInput().GetCurrentInputDevice());
46 #endif
47
48 return layoutRoot;
49 }
50
51 #ifdef PLATFORM_CONSOLE
52 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
53 {
54 switch (pInputDeviceType)
55 {
56 case EInputDeviceType.CONTROLLER:
57 {
58 g_Game.GetUIManager().ShowUICursor(false);
59 m_DisconnectBtnLabel.SetText("#main_menu_exit");
60 SetFocus(m_DisconnectBtn);
61 }
62 break;
63 default:
64 {
65 if (g_Game.GetInput().IsEnabledMouseAndKeyboard())
66 {
67 g_Game.GetUIManager().ShowUICursor(true);
68 m_DisconnectBtnLabel.SetText(string.Format(" %1",InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "#main_menu_exit", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_NORMAL)));
69 SetFocus(null);
70 }
71 }
72 break;
73 }
74
76 }
77
78 protected void UpdateControlsElementVisibility()
79 {
80 bool toolbarShow = !g_Game.GetInput().IsEnabledMouseAndKeyboard() || g_Game.GetInput().GetCurrentInputDevice() == EInputDeviceType.CONTROLLER;
81 m_ConsoleToolbar.Show(toolbarShow);
82 }
83
84 override bool OnFocus(Widget w, int x, int y)
85 {
86 if (w == m_DisconnectBtn)
87 {
88 m_DisconnectBtn.SetColor(ARGB(255, 255, 0, 0));
89 return true;
90 }
91 return false;
92 }
93
94 override bool OnFocusLost(Widget w, int x, int y)
95 {
96 if (w == m_DisconnectBtn)
97 {
98 m_DisconnectBtn.SetColor(ARGB(0, 0, 0, 0));
99 return true;
100 }
101 return false;
102 }
103 #endif
104
105 override bool OnClick(Widget w, int x, int y, int button)
106 {
107 super.OnClick(w, x, y, button);
108
109 if (w == m_DisconnectBtn)
110 {
111 CloseDialog();
112 }
113
114 return false;
115 }
116
117 override bool OnMouseEnter(Widget w, int x, int y)
118 {
119 if (w == m_DisconnectBtn)
120 {
121 m_DisconnectBtn.SetColor(ARGB(255, 255, 0, 0));
122 return true;
123 }
124 return false;
125 }
126
127 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
128 {
129 if (w == m_DisconnectBtn)
130 {
131 m_DisconnectBtn.SetColor(ARGB(0, 0, 0, 0));
132 return true;
133 }
134 return false;
135 }
136
137 override void OnShow()
138 {
139 super.OnShow();
140
141 SetFocus(null);
142 PPERequesterBank.GetRequester(PPERequester_LatencyBlur).Start();
143 MissionGameplay mission = MissionGameplay.Cast(g_Game.GetMission());
144 if (mission)
145 {
146 mission.GetHud().ShowHud(false);
147 mission.GetHud().ShowQuickBar(false);
148 mission.AddActiveInputExcludes({"menu"});
149 mission.AddActiveInputRestriction(EInputRestrictors.INVENTORY);
151
153 if (mission && mission.m_DebugMonitor && mission.m_DebugMonitor.IsVisible())
154 {
155 mission.m_DebugMonitor.Hide();
157 }
158 }
159
160 if (GetDayZGame())
161 {
162 GetDayZGame().SetConnectivityStatState(EConnectivityStatType.CONN_LOST, EConnectivityStatLevel.LEVEL1);
163 }
164
165 #ifdef PLATFORM_PS4
167 #endif
168 }
169
170 override void OnHide()
171 {
172 super.OnHide();
173
174 PPERequesterBank.GetRequester(PPERequester_LatencyBlur).Stop();
175 MissionGameplay mission = MissionGameplay.Cast(g_Game.GetMission());
176 if (mission)
177 {
178 // make sure certain input restrictions are removed if present
179 mission.RemoveActiveInputExcludes({"menu"}, true);
180 mission.RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
181 mission.GetHud().ShowHud(true);
182 mission.GetHud().ShowQuickBar(true);
183
186 {
187 if (mission.m_DebugMonitor)
188 {
189 mission.m_DebugMonitor.Show();
190 }
191 m_DebugMonitorHidden = false;
192 }
193 }
194
195 if (GetDayZGame())
196 {
197 GetDayZGame().SetConnectivityStatState(EConnectivityStatType.CONN_LOST, EConnectivityStatLevel.OFF);
198 }
199
200 #ifdef PLATFORM_PS4
202 #endif
203 }
204
205 override void Update(float timeslice)
206 {
207 #ifdef PLATFORM_CONSOLE
208 if (GetUApi().GetInputByID(UAUISelect).LocalValue())
209 {
210 CloseDialog();
211 return;
212 }
213 #endif
214 }
215
217 {
218 if (g_Game)
219 {
220 g_Game.GetUIManager().CloseMenu(MENU_CONNECTION_DIALOGUE);
221 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(g_Game.DisconnectSessionForce);
222 }
223 }
224}
DayZGame g_Game
Определения DayZGame.c:3942
DayZGame GetDayZGame()
Определения DayZGame.c:3944
Mission mission
Определения DisplayStatus.c:28
EConnectivityStatType
Определения EGameStateIcons.c:2
Icon x
Icon y
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)
Определения InputUtils.c:167
static const float ICON_SCALE_TOOLBAR
Определения InputUtils.c:15
Определения InputUtils.c:2
static void SetMultiplayState(bool state)
Определения OnlineServices.c:520
Определения OnlineServices.c:2
Определения gameplay.c:317
proto native void SupressNextFrame(bool bForce)
void UpdateControlsElementVisibility()
Определения ControlsXboxNew.c:545
override bool OnMouseEnter(Widget w, int x, int y)
Определения ConnectionDialogue.c:117
void CloseDialog()
Определения ConnectionDialogue.c:216
override void OnShow()
Определения ConnectionDialogue.c:137
MultilineTextWidget m_Description
Определения ConnectionDialogue.c:5
override bool OnFocus(Widget w, int x, int y)
Определения CameraToolsMenu.c:940
override void Update(float timeslice)
Определения ConnectionDialogue.c:205
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Определения ControlsXboxNew.c:71
ButtonWidget m_DisconnectBtn
Определения ConnectionDialogue.c:6
bool m_DebugMonitorHidden
Определения ConnectionDialogue.c:3
override void OnHide()
Определения ConnectionDialogue.c:170
void ~ConnectionDialogue()
Определения ConnectionDialogue.c:14
override bool OnFocusLost(Widget w, int x, int y)
Определения CameraToolsMenu.c:950
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения ConnectionDialogue.c:127
override Widget Init()
Определения ConnectionDialogue.c:24
override bool OnClick(Widget w, int x, int y, int button)
Определения ConnectionDialogue.c:105
void ConnectionDialogue()
Определения ConnectionDialogue.c:12
Определения DayZGame.c:64
Определения EnWidgets.c:190
const int MENU_CONNECTION_DIALOGUE
Определения 3_Game/DayZ/constants.c:215
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8
proto native void SetFocus(Widget w)
WorkspaceWidget Widget
Defined in code.
EInputDeviceType
Определения input.c:3
int ARGB(int a, int r, int g, int b)
Определения proto.c:322