DayZ 1.24
Loading...
Searching...
No Matches
ChatInputMenu.c
Go to the documentation of this file.
1class ChatInputMenu extends UIScriptedMenu
2{
7
9 {
10 m_close_timer = new Timer();
11 }
12
13 override Widget Init()
14 {
15 m_BackInputWrapper = GetUApi().GetInputByID(UAUIBack).GetPersistentWrapper();
16 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/day_z_chat_input.layout");
17 m_edit_box = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("InputEditBoxWidget"));
18 m_channel_text = TextWidget.Cast(layoutRoot.FindAnyWidget("ChannelText"));
19
21 return layoutRoot;
22 }
23
24 override bool UseKeyboard()
25 {
26 return true;
27 }
28
29 override bool OnChange(Widget w, int x, int y, bool finished)
30 {
31 super.OnChange(w, x, y, finished);
32
33 if (!finished) return false;
34
35 string text = m_edit_box.GetText();
36
37 if (text != "")
38 {
39 GetGame().ChatPlayer(text);
40 if (!GetGame().IsMultiplayer())
41 {
42 string name;
43 GetGame().GetPlayerName(name);
45 MissionGameplay.Cast(GetGame().GetMission()).m_Chat.Add(chat_params);
46 }
47 }
48
49 m_close_timer.Run(0.1, this, "Close");
50
51 GetUApi().GetInputByID(UAPersonView).Supress();
52
53 return true;
54 }
55
56 override void OnShow()
57 {
58 SetFocus(m_edit_box);
59 }
60
61 override void OnHide()
62 {
63 super.OnHide();
64 GetGame().GetMission().HideChat();
65
66 if (!GetGame().GetMission().IsVoNActive())
67 GetGame().GetMission().HideVoiceLevelWidgets();
68 }
69
70 override void Refresh()
71 {
72 }
73
74 override void Update(float timeslice)
75 {
76 if (m_BackInputWrapper.InputP().LocalPress())
77 Close();
78 }
79
81 {
82 m_channel_text.SetText(GetChannelName(/*GetGame().ChatGetChannel()*/0));
83 }
84
86 {
87 switch (channel)
88 {
89 case CCSystem:
90 return "System";
91 case CCAdmin:
92 return "Admin";
93 case CCDirect:
94 return "Direct";
95 case CCMegaphone:
96 return "Megaphone";
97 case CCTransmitter:
98 return "Radio";
100 return "PAS";
101 }
102
103 return "";
104 }
105}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Icon x
Icon y
void Close()
UAIDWrapper m_BackInputWrapper
Definition RadialMenu.c:32
proto native UAInputAPI GetUApi()
proto native UAInput InputP()
override void OnShow()
override void Update(float timeslice)
TextWidget m_channel_text
UAIDWrapper m_BackInputWrapper
override void Refresh()
ref Timer m_close_timer
override void OnHide()
override bool OnChange(Widget w, int x, int y, bool finished)
void ChatInputMenu()
override bool UseKeyboard()
override Widget Init()
EditBoxWidget m_edit_box
static string GetChannelName(ChatChannel channel)
Param4< int, string, string, string > ChatMessageEventParams
channel, from, text, color config class
Definition gameplay.c:394
proto native CGame GetGame()
proto native void SetFocus(Widget w)