Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
huddebugwincharagents.c
Go to the documentation of this file.
1
class
DebugAgentData
2
{
3
string
m_Name
;
4
int
m_ID
;
5
6
void
DebugAgentData
(
string
name
,
int
id
)
7
{
8
m_Name
=
name
;
9
m_ID
= id;
10
}
11
12
string
GetName
()
13
{
14
return
m_Name
;
15
}
16
17
int
GetID
()
18
{
19
return
m_ID
;
20
}
21
22
float
GetTemporaryResistance
()
23
{
24
25
}
26
}
27
28
29
class
HudDebugWinCharAgents
extends
HudDebugWinBase
30
{
31
protected
Widget
m_WgtAgents
;
32
protected
ref
array<ref Widget>
m_AgentWidgets
=
new
array<ref Widget>
;
33
protected
ref
map<Widget, ref DebugAgentData>
m_AgentWidgetData
=
new
map<Widget, ref DebugAgentData>
;
34
35
private
AutoHeightSpacer
WgtModifiersContentPanelScript
;
36
//============================================
37
// HudDebugWinCharAgents
38
//============================================
39
void
HudDebugWinCharAgents
(
Widget
widget_root )
40
{
41
m_WgtRoot
= widget_root;
42
//m_WgtAgents = TextListboxWidget.Cast( m_WgtRoot.FindAnyWidget( "txl_CharAgents_Values" ) );
43
m_WgtAgents
=
m_WgtRoot
.FindAnyWidget(
"AgentList"
);
44
45
//FitWindowByContent( m_WgtAgents );
46
47
m_WgtAgents
.GetScript(
WgtModifiersContentPanelScript
);
48
}
49
50
void
~HudDebugWinCharAgents
()
51
{
52
SetUpdate
(
false
);
53
}
54
55
//============================================
56
// GetWinType
57
//============================================
58
override
int
GetType
()
59
{
60
return
HudDebug
.HUD_WIN_CHAR_AGENTS;
61
}
62
63
//============================================
64
// Update
65
//============================================
66
override
void
SetUpdate
(
bool
state )
67
{
68
//Disable update on server (PluginDeveloperSync)
69
PlayerBase
player =
PlayerBase
.Cast(
g_Game
.GetPlayer() );
70
PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(
GetPlugin
( PluginDeveloperSync ) );
71
72
//if client, send RPC
73
if
(
g_Game
.IsClient() )
74
{
75
ref Param1<bool> params =
new
Param1<bool>( state );
76
if
( player )
77
{
78
player.RPCSingleParam(
ERPCs
.DEV_AGENTS_UPDATE, params,
true
);
79
SetRPCSent
();
80
}
81
}
82
//else set directly
83
else
84
{
85
if
( developer_sync )
86
{
87
developer_sync.EnableUpdate( state,
ERPCs
.DEV_AGENTS_UPDATE, player );
88
}
89
}
90
}
91
92
override
void
Update
()
93
{
94
super.Update();
95
96
//Print("Update()");
97
98
//refresh notifiers
99
SetAgents
();
100
}
101
102
//============================================
103
// Show / Hide
104
//============================================
105
override
void
Show
()
106
{
107
super.Show();
108
109
//Print("Show()");
110
111
SetUpdate
(
true
);
112
}
113
114
override
void
Hide
()
115
{
116
super.Hide();
117
118
//Print("Hide()");
119
120
SetUpdate
(
false
);
121
}
122
123
void
SetAgents
()
124
{
125
PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(
GetPlugin
( PluginDeveloperSync ) );
126
127
//clear window
128
ClearAgents
();
129
130
//set agents
131
if
( developer_sync.m_PlayerAgentsSynced.Count() > 0 )
132
{
133
for
(
int
i = 0; i < developer_sync.m_PlayerAgentsSynced.Count(); i++ )
134
{
135
SyncedValueAgent
syncedValue =
SyncedValueAgent
.Cast(developer_sync.m_PlayerAgentsSynced.Get(i));
136
AddAgent
(
137
syncedValue.GetName(),
138
syncedValue.GetValue(),
139
syncedValue.GetID(),
140
syncedValue.GetTemporaryResistanceTime(),
141
);
142
}
143
}
144
}
145
146
bool
OnClick
(
Widget
w,
int
x
,
int
y
,
int
button )
147
{
148
DebugAgentData
data;
149
if
(w.GetName() ==
"ButtonAgentActivate"
)
150
{
151
data =
m_AgentWidgetData
.Get(w);
152
DebugGrowAgentsRequest
(data.
GetID
(),
true
);
153
return
true
;
154
}
155
else
if
(w.GetName() ==
"ButtonAgentDeactivate"
)
156
{
157
data =
m_AgentWidgetData
.Get(w);
158
DebugGrowAgentsRequest
(data.
GetID
(),
false
);
159
return
true
;
160
}
161
else
if
(w.GetName() ==
"ResetAgents"
)
162
{
163
DebugRemoveAgentsRequest
();
164
return
true
;
165
}
166
167
return
false
;
168
}
169
170
void
DebugGrowAgentsRequest
(
int
agent_id,
bool
should_grow)
171
{
172
if
(!should_grow)
//id is minus value to mark killing instead of growing
173
{
174
agent_id *= -1;
175
}
176
177
ref Param1<int> p1 =
new
Param1<int>( agent_id );
178
Man man =
g_Game
.GetPlayer();
179
man.RPCSingleParam(
ERPCs
.DEV_AGENT_GROW, p1,
true
, man.GetIdentity());
180
}
181
182
void
DebugRemoveAgentsRequest
()
183
{
184
ref Param1<bool> p1 =
new
Param1<bool>(
false
);
185
Man man =
g_Game
.GetPlayer();
186
man.RPCSingleParam(
ERPCs
.DEV_RPC_AGENT_RESET, p1,
true
, man.GetIdentity());
187
}
188
189
void
AddAgent
(
string
title,
string
value,
int
id
,
float
temporaryResistance)
190
{
191
Widget
widget =
g_Game
.GetWorkspace().CreateWidgets(
"gui/layouts/debug/day_z_hud_debug_agent.layout"
,
m_WgtAgents
);
192
ButtonWidget btn = ButtonWidget.Cast( widget.FindAnyWidget(
"TextAgentName"
) );
193
TextWidget
countWidget =
TextWidget
.Cast(widget.FindAnyWidget(
"TextWidgetAgentCount"
));
194
TextWidget
tempResistanceWidget =
TextWidget
.Cast(widget.FindAnyWidget(
"TextWidgetAgentTempResistanceTime"
));
195
Widget
activateButton = widget.FindAnyWidget(
"ButtonAgentActivate"
);
196
Widget
deactivateButton = widget.FindAnyWidget(
"ButtonAgentDeactivate"
);
197
198
countWidget.SetText(value);
199
btn.SetText(title);
200
if
(temporaryResistance > 0.0)
201
tempResistanceWidget.SetText(
string
.Format(
"(R-%1s)"
,
Math
.
Round
(temporaryResistance).
ToString
()));
202
else
203
tempResistanceWidget.SetText(
""
);
204
205
DebugAgentData
data =
new
DebugAgentData
(
""
,
id
);
206
m_AgentWidgets
.Insert(widget);
207
m_AgentWidgetData
.Insert(btn, data);
208
m_AgentWidgetData
.Insert(activateButton, data);
209
m_AgentWidgetData
.Insert(countWidget, data);
210
m_AgentWidgetData
.Insert(tempResistanceWidget, data);
211
m_AgentWidgetData
.Insert(deactivateButton, data);
212
213
WgtModifiersContentPanelScript
.Update();
214
}
215
216
void
ClearAgents
()
217
{
218
m_AgentWidgetData
.Clear();
219
220
for
(
int
i = 0; i <
m_AgentWidgets
.Count(); i++)
221
{
222
delete
m_AgentWidgets
.Get(i);
223
}
224
225
m_AgentWidgets
.Clear();
226
}
227
228
void
FitWindow
()
229
{
230
FitWindowByContent
( TextListboxWidget.Cast(
m_WgtAgents
) );
231
}
232
}
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
AutoHeightSpacer
Definition
autoheightspacer.c:3
DebugAgentData
Definition
huddebugwincharagents.c:2
DebugAgentData::GetID
int GetID()
Definition
huddebugwincharagents.c:17
DebugAgentData::m_Name
string m_Name
Definition
huddebugwincharagents.c:3
DebugAgentData::m_ID
int m_ID
Definition
huddebugwincharagents.c:4
DebugAgentData::GetTemporaryResistance
float GetTemporaryResistance()
Definition
huddebugwincharagents.c:22
DebugAgentData::DebugAgentData
void DebugAgentData(string name, int id)
Definition
huddebugwincharagents.c:6
DebugAgentData::GetName
string GetName()
Definition
huddebugwincharagents.c:12
HudDebugWinBase
Definition
huddebugwinbase.c:2
HudDebugWinBase::GetType
int GetType()
Definition
huddebugwinbase.c:18
HudDebugWinBase::Hide
void Hide()
Definition
huddebugwinbase.c:57
HudDebugWinBase::SetRPCSent
void SetRPCSent()
Definition
huddebugwinbase.c:39
HudDebugWinBase::FitWindow
void FitWindow()
Definition
huddebugwincharlevels.c:130
HudDebugWinBase::SetUpdate
void SetUpdate(bool state)
HudDebugWinBase::OnClick
bool OnClick(Widget w, int x, int y, int button)
Definition
huddebugwincharstats.c:200
HudDebugWinBase::Show
void Show()
Definition
huddebugwinbase.c:48
HudDebugWinBase::Update
void Update()
Definition
huddebugwinbase.c:27
HudDebugWinBase::FitWindowByContent
void FitWindowByContent(TextListboxWidget wgt)
Definition
huddebugwinbase.c:74
Math
Definition
enmath.c:7
PlayerBase
Definition
playerbaseclient.c:2
TextWidget
Definition
enwidgets.c:220
Widget
Definition
enwidgets.c:190
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
float::ToString
proto string ToString(bool simple=true)
map
Definition
cachedequipmentstorage.c:4
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
ERPCs
ERPCs
Definition
erpcs.c:2
Math::Round
static proto float Round(float f)
Returns mathematical round of value.
HudDebug
void HudDebug()
Definition
huddebug.c:108
m_WgtRoot
Widget m_WgtRoot
Definition
huddebug.c:94
m_AgentWidgetData
ref map< Widget, ref DebugAgentData > m_AgentWidgetData
Definition
huddebugwincharagents.c:33
HudDebugWinCharAgents
void HudDebugWinCharAgents(Widget widget_root)
Definition
huddebugwincharagents.c:39
ClearAgents
void ClearAgents()
Definition
huddebugwincharagents.c:216
~HudDebugWinCharAgents
void ~HudDebugWinCharAgents()
Definition
huddebugwincharagents.c:50
SetAgents
void SetAgents()
Definition
huddebugwincharagents.c:123
m_AgentWidgets
ref array< ref Widget > m_AgentWidgets
Definition
huddebugwincharagents.c:32
DebugGrowAgentsRequest
void DebugGrowAgentsRequest(int agent_id, bool should_grow)
Definition
huddebugwincharagents.c:170
AddAgent
void AddAgent(string title, string value, int id, float temporaryResistance)
Definition
huddebugwincharagents.c:189
m_WgtAgents
class DebugAgentData m_WgtAgents
WgtModifiersContentPanelScript
AutoHeightSpacer WgtModifiersContentPanelScript
Definition
huddebugwincharagents.c:35
DebugRemoveAgentsRequest
void DebugRemoveAgentsRequest()
Definition
huddebugwincharagents.c:182
x
Icon x
y
Icon y
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition
pluginmanager.c:325
SyncedValueAgent
void SyncedValueAgent(string name, string value, int id, float temporaryResistance)
Definition
syncedvalue.c:111
Games
Dayz
scripts
5_mission
gui
scriptshuddebug
huddebugwincharagents.c
Generated by
1.17.0