DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
InviteMenu.c
См. документацию.
1class InviteMenu extends UIScriptedMenu
2{
4 private MultilineTextWidget m_DescriptionText;
5 private ButtonWidget m_bCancel;
6 private ButtonWidget m_bCancelConsole;
7 private int m_iTime;
8
10
12 {
13 m_iTime = 15;
14
16
17 if (GetGame().GetMission())
18 {
20
23 }
24 }
25
39
40 override Widget Init()
41 {
42 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/day_z_invite_dialog.layout");
43
44 m_LogoutTimeText = TextWidget.Cast(layoutRoot.FindAnyWidget("txtLogoutTime"));
45 m_DescriptionText = MultilineTextWidget.Cast(layoutRoot.FindAnyWidget("txtDescription"));
46 m_bCancel = ButtonWidget.Cast(layoutRoot.FindAnyWidget("bCancel"));
47
48 m_DescriptionText.SetText("#layout_logout_dialog_note_invite");
49 m_DescriptionText.Update();
50
51 // player should sit down if possible
52 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
53 if (player && player.GetEmoteManager() && !player.IsRestrained() && !player.IsUnconscious())
54 {
55 player.GetEmoteManager().CreateEmoteCBFromMenu(EmoteConstants.ID_EMOTE_SITA);
56 player.GetEmoteManager().GetEmoteLauncher().SetForced(EmoteLauncher.FORCE_DIFFERENT);
57 }
58
59 if (GetGame().GetMission())
60 {
63 }
64
65 OnInputDeviceChanged(GetGame().GetInput().GetCurrentInputDevice());
66
69
70 return layoutRoot;
71 }
72
73 override void Update(float timeslice)
74 {
75 if (GetUApi().GetInputByID(UAUIBack).LocalPress())
76 Cancel();
77
78 if (m_iTime <= 0)
79 {
81 string ip;
82 int port;
84 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(g_Game.ConnectFromJoin, ip, port);
85 }
86 }
87
88 override bool OnClick(Widget w, int x, int y, int button)
89 {
90 super.OnClick(w, x, y, button);
91
92 if (w.GetUserID() == IDC_CANCEL)
93 {
94 Cancel();
95 return true;
96 }
97
98 return false;
99 }
100
101 void SetTime(int time)
102 {
103 m_iTime = time;
104 string text = "#layout_logout_dialog_until_logout_";
105
106 TimeConversions.ConvertSecondsToFullTime(time, m_FullTime);
107
108 if (m_FullTime.m_Days > 0)
109 text += "dhms";
110 else if (m_FullTime.m_Hours > 0)
111 text += "hms";
112 else if (m_FullTime.m_Minutes > 0)
113 text += "ms";
114 else
115 text += "s";
116
117 text = Widget.TranslateString(text);
118 text = string.Format(text, m_FullTime.m_Seconds, m_FullTime.m_Minutes, m_FullTime.m_Hours, m_FullTime.m_Days);
119 m_LogoutTimeText.SetText(text);
120 }
121
123 {
124 if (m_iTime > 0)
125 {
126 m_iTime -= 1;
128 }
129 }
130
131 void Cancel()
132 {
134
135 g_Game.SetGameState(DayZGameState.IN_GAME);
136 g_Game.SetLoadState(DayZLoadState.CONNECT_CONTROLLER_SELECT);
137 Close();
138 }
139
140 protected void OnInputPresetChanged()
141 {
142 #ifdef PLATFORM_CONSOLE
144 #endif
145 }
146
147 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
148 {
151 }
152
153 protected void UpdateControlsElements()
154 {
155 RichTextWidget toolbarText = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ContextToolbarText"));
156 string context = string.Format(" %1", InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "#dialog_cancel", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
157
158 toolbarText.SetText(context);
159 }
160
162 {
163 bool toolbarShow = false;
164 #ifdef PLATFORM_CONSOLE
166 #endif
167
168 layoutRoot.FindAnyWidget("BottomConsoleToolbar").Show(toolbarShow);
169 m_bCancel.Show(!toolbarShow);
170 }
171}
DayZGame g_Game
Определения DayZGame.c:3868
Icon x
Icon y
void Close()
PlayerBase GetPlayer()
Определения ModifierBase.c:51
proto native UAInputAPI GetUApi()
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native WorkspaceWidget GetWorkspace()
proto native Input GetInput()
proto native Mission GetMission()
Определения constants.c:359
static const int FORCE_DIFFERENT
Определения EmoteManager.c:77
Определения EmoteManager.c:75
struct that keeps Time relevant information for future formatting
Определения TimeConversions.c:5
void ShowHudUI(bool show)
void ShowQuickbarUI(bool show)
proto native EInputDeviceType GetCurrentInputDevice()
proto native bool IsEnabledMouseAndKeyboard()
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
ScriptInvoker GetOnInputDeviceChanged()
Определения gameplay.c:851
ScriptInvoker GetOnInputPresetChanged()
Определения gameplay.c:859
void AddActiveInputExcludes(array< string > excludes)
Hud GetHud()
Определения gameplay.c:721
void RemoveActiveInputExcludes(array< string > excludes, bool bForceSupress=false)
deprecated
static void GetInviteServerInfo(out string ip, out int port)
Определения OnlineServices.c:188
Определения OnlineServices.c:2
Определения PlayerBaseClient.c:2
Определения gameplay.c:317
proto void Remove(func fn)
remove specific call from queue
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
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
Определения EnWidgets.c:220
void UpdateControlsElementVisibility()
Определения ControlsXboxNew.c:540
override void Update(float timeslice)
Определения InviteMenu.c:73
void InviteMenu()
Определения InviteMenu.c:11
TextWidget m_LogoutTimeText
Определения InviteMenu.c:3
void SetTime(int time)
Определения InviteMenu.c:101
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Определения ControlsXboxNew.c:71
void ~InviteMenu()
Определения InviteMenu.c:26
void UpdateTime()
Определения InviteMenu.c:122
void Cancel()
Определения InviteMenu.c:131
MultilineTextWidget m_DescriptionText
Определения InviteMenu.c:4
ref FullTimeData m_FullTime
Определения InviteMenu.c:9
ButtonWidget m_bCancelConsole
Определения InviteMenu.c:6
void UpdateControlsElements()
Определения ControlsXboxNew.c:527
override Widget Init()
Определения InviteMenu.c:40
override bool OnClick(Widget w, int x, int y, int button)
Определения InviteMenu.c:88
ButtonWidget m_bCancel
Определения InviteMenu.c:5
int m_iTime
Определения InviteMenu.c:7
void OnInputPresetChanged()
Определения ControlsXboxNew.c:63
Определения DayZGame.c:64
Определения EnWidgets.c:190
proto native CGame GetGame()
const int ID_EMOTE_SITA
Определения constants.c:373
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
const int IDC_CANCEL
Определения constants.c:136
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.
EInputDeviceType
Определения input.c:3