Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
playerlistentryscriptedwidget.c
Go to the documentation of this file.
1class PlayerListEntryScriptedWidget extends ScriptedWidgetEventHandler
2{
3 protected string m_Name;
4 protected string m_UID;
5 protected bool m_Mute;
6 protected bool m_GlobalMute;
7
8 protected Widget m_Root;
10 protected ImageWidget m_PlayerAvatar;
11 protected ImageWidget m_MicrophoneIcon;
12 protected ImageWidget m_MuteIcon;
13 protected ButtonWidget m_PlayerButton;
14
16 protected bool m_Selected;
17
18 void PlayerListEntryScriptedWidget( Widget parent, string name, string uid, bool show_permissions, PlayerListScriptedWidget tab )
19 {
20 m_Name = name;
21 m_UID = uid;
22 m_Tab = tab;
23
24 m_Root = g_Game.GetWorkspace().CreateWidgets( "gui/layouts/xbox/ingamemenu_xbox/player_info_entry.layout", parent );
25 m_PlayerName = TextWidget.Cast( m_Root.FindAnyWidget( "Name" ) );
26 m_PlayerAvatar = ImageWidget.Cast( m_Root.FindAnyWidget( "Avatar" ) );
27 m_MicrophoneIcon = ImageWidget.Cast( m_Root.FindAnyWidget( "Microphone" ) );
28 m_MuteIcon = ImageWidget.Cast( m_Root.FindAnyWidget( "Muted" ) );
29 m_PlayerButton = ButtonWidget.Cast( m_Root.FindAnyWidget( "Button" ) );
30
31 m_MicrophoneIcon.Show( show_permissions && !IsLocalPlayer() );
32
33 m_PlayerName.SetText( name );
34 m_Root.SetHandler( this );
35 }
36
38 {
39 delete m_Root;
40 }
41
43 {
44 return m_PlayerButton;
45 }
46
48 {
49 foreach ( BiosPrivacyPermissionResult result : results )
50 {
51 if ( result.m_Permission == EBiosPrivacyPermission.COMMUNICATE_VOICE )
52 {
53 m_GlobalMute = !result.m_IsAllowed;
54 if ( result.m_IsAllowed && !m_Mute )
55 {
56 m_MuteIcon.Show( false );
57 }
58 else if ( !result.m_IsAllowed || m_Mute )
59 {
60 m_MuteIcon.Show( true );
61 }
62 }
63 }
64 }
65
66 string GetUID()
67 {
68 return m_UID;
69 }
70
71 bool IsMuted()
72 {
73 return m_Mute;
74 }
75
77 {
78 return m_GlobalMute;
79 }
80
81 void SetMute( bool mute )
82 {
83 m_Mute = mute;
84 m_MuteIcon.Show( mute );
85 }
86
88 {
89 if( !IsLocalPlayer() && !g_Game.GetWorld().IsDisabledReceivingVoN() )
90 {
91 m_Mute = !m_Mute;
93 {
95 m_MuteIcon.Show( m_Mute );
96 }
97 else
98 {
99 m_MuteIcon.Show( true );
100 }
101 }
102 else
103 {
104 m_MicrophoneIcon.Show( false );
105 m_MuteIcon.Show( false );
106 }
107 }
108
109 override bool OnMouseEnter( Widget w, int x, int y )
110 {
111 if( !m_Selected )
112 {
113 #ifdef PLATFORM_CONSOLE
114 if( w == m_PlayerButton )
115 {
116 Select();
118 }
119 #endif
120 return true;
121 }
122 return false;
123 }
124
125 override bool OnMouseLeave( Widget w, Widget enterW, int x, int y )
126 {
127 #ifdef PLATFORM_CONSOLE
128 if( w == m_PlayerButton )
129 {
130 Deselect();
131 return true;
132 }
133 #endif
134 return false;
135 }
136
137 void Focus()
138 {
140 }
141
142 override bool OnFocus( Widget w, int x, int y )
143 {
144 if( !m_Selected )
145 {
146 #ifdef PLATFORM_CONSOLE
147 if( w == m_PlayerButton )
148 {
149 Select();
150 }
151 #endif
152 return true;
153 }
154 return false;
155 }
156
157 override bool OnFocusLost( Widget w, int x, int y )
158 {
159 #ifdef PLATFORM_CONSOLE
160 if( w == m_PlayerButton )
161 {
162 Deselect();
163 }
164 #endif
165 return false;
166 }
167
168 override bool OnDoubleClick( Widget w, int x, int y, int button )
169 {
170 if( button == MouseState.LEFT && g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer() )
171 {
172 if( !IsLocalPlayer() )
173 {
175 }
176 }
177 return false;
178 }
179
180 override bool OnMouseButtonUp( Widget w, int x, int y, int button )
181 {
182 if( button == MouseState.LEFT && g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer() )
183 {
184 if( w == m_MicrophoneIcon && !m_GlobalMute )
185 {
186 ToggleMute();
187 return true;
188 }
189 }
190 return false;
191 }
192
194 {
195 string local_uid;
196 if( g_Game.GetUserManager() )
197 {
198 return g_Game.GetUserManager().GetSelectedUser().GetUid() == m_UID;
199 }
200 return false;
201 }
202
203 void Select( bool notify = true )
204 {
205 if( !m_Selected )
206 {
207 if( notify )
208 {
209 m_Tab.SelectPlayer( this );
210 }
211 m_Selected = true;
212 }
213 }
214
215 void Deselect()
216 {
217 if( m_Selected )
218 {
219 m_Selected = false;
220 }
221 }
222}
EBiosPrivacyPermission
EBiosPrivacyPermission represents possible privacy permissions.
array< ref BiosPrivacyPermissionResult > BiosPrivacyPermissionResultArray
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
BiosPrivacyPermissionResult represents the per permission result of the GetPermissionsAsync reqeust.
static void ShowUserProfile(string uid)
static bool MutePlayer(string id, bool mute)
proto static native bool CanStoreInputUserData()
Returns true when the channel is free, AND the InputBuffer is NOT full (same as '!...
map: item x vector(index, width, height)
Definition enwidgets.c:657
void PlayerListEntryScriptedWidget(Widget parent, string name, string uid, bool show_permissions, PlayerListScriptedWidget tab)
override bool OnDoubleClick(Widget w, int x, int y, int button)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
void LoadPermissions(BiosPrivacyPermissionResultArray results)
void PlayerListScriptedWidget(Widget parent, string header_text="")
override bool OnFocusLost(Widget w, int x, int y)
override bool OnMouseEnter(Widget w, int x, int y)
override bool OnFocus(Widget w, int x, int y)
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
DayZGame g_Game
Definition dayzgame.c:3942
MouseState
Definition ensystem.c:311
proto native void SetFocus(Widget w)
Icon x
Icon y