DayZ 1.24
Loading...
Searching...
No Matches
HudDebugWinCharAgents.c File Reference

Go to the source code of this file.

Classes

class  DebugAgentData
 

Functions

void HudDebugWinCharAgents (Widget widget_root)
 
void ~HudDebugWinCharAgents ()
 
override int GetType ()
 
override void SetUpdate (bool state)
 
override void Update ()
 
override void Show ()
 
override void Hide ()
 
void SetAgents ()
 
bool OnClick (Widget w, int x, int y, int button)
 
void DebugGrowAgentsRequest (int agent_id, bool should_grow)
 
void DebugRemoveAgentsRequest ()
 
void AddAgent (string title, string value, int id)
 
void ClearAgents ()
 
void FitWindow ()
 

Variables

class DebugAgentData m_WgtAgents
 
ref array< ref Widgetm_AgentWidgets = new array<ref Widget>
 
ref map< Widget, ref DebugAgentDatam_AgentWidgetData = new map<Widget, ref DebugAgentData>
 

Function Documentation

◆ AddAgent()

void AddAgent ( string title,
string value,
int id )
protected

Definition at line 183 of file HudDebugWinCharAgents.c.

184 {
185 Widget widget = GetGame().GetWorkspace().CreateWidgets("gui/layouts/debug/day_z_hud_debug_agent.layout", m_WgtAgents);
186 ButtonWidget btn = ButtonWidget.Cast(widget.FindAnyWidget("TextAgentName"));
187
188
189 DebugAgentData data = new DebugAgentData("", id);
190 m_AgentWidgetData.Insert(btn, data);
191
192 Widget activate_button = widget.FindAnyWidget("ButtonAgentActivate");
194
195 TextWidget count_widget = TextWidget.Cast(widget.FindAnyWidget("TextWidgetAgentCount"));
197 count_widget.SetText(value);
198
199 //Deactivate button
200 Widget deactivate_button = widget.FindAnyWidget("ButtonAgentDeactivate");
202
203 btn.SetText(title);
204 m_AgentWidgets.Insert(widget);
205
209 }
ref map< Widget, ref DebugAgentData > m_AgentWidgetData
ref array< ref Widget > m_AgentWidgets
class DebugAgentData m_WgtAgents
proto native CGame GetGame()

References GetGame(), m_AgentWidgetData, m_AgentWidgets, and m_WgtAgents.

Referenced by SetAgents().

◆ ClearAgents()

void ClearAgents ( )
protected

Definition at line 211 of file HudDebugWinCharAgents.c.

212 {
213 m_AgentWidgetData.Clear();
214 for (int i = 0; i < m_AgentWidgets.Count(); i++)
215 delete m_AgentWidgets.Get(i);
216
217 m_AgentWidgets.Clear();
218 }

References m_AgentWidgetData, and m_AgentWidgets.

Referenced by SetAgents().

◆ DebugGrowAgentsRequest()

void DebugGrowAgentsRequest ( int agent_id,
bool should_grow )
protected

Definition at line 166 of file HudDebugWinCharAgents.c.

167 {
168 if (!should_grow) //id is minus value to mark killing instead of growing
169 agent_id *= -1;
170
172 Man man = GetGame().GetPlayer();
173 man.RPCSingleParam(ERPCs.DEV_AGENT_GROW, p1, true, man.GetIdentity());
174 }
ERPCs
Definition ERPCs.c:2

References GetGame().

Referenced by OnClick().

◆ DebugRemoveAgentsRequest()

void DebugRemoveAgentsRequest ( )
protected

Definition at line 176 of file HudDebugWinCharAgents.c.

177 {
178 ref Param1<bool> p1 = new Param1<bool>(false);
179 Man man = GetGame().GetPlayer();
180 man.RPCSingleParam(ERPCs.DEV_RPC_AGENT_RESET, p1, true, man.GetIdentity());
181 }

References GetGame().

Referenced by OnClick().

◆ FitWindow()

void FitWindow ( )
protected

Definition at line 220 of file HudDebugWinCharAgents.c.

221 {
222 FitWindowByContent(TextListboxWidget.Cast(m_WgtAgents));
223 }

References HudDebugWinBase::FitWindowByContent(), and m_WgtAgents.

◆ GetType()

override int GetType ( )
protected

Definition at line 49 of file HudDebugWinCharAgents.c.

50 {
51 return HudDebug.HUD_WIN_CHAR_AGENTS;
52 }
void HudDebug()
Definition HudDebug.c:104

References HudDebug().

◆ Hide()

override void Hide ( )
protected

Definition at line 103 of file HudDebugWinCharAgents.c.

104 {
105 super.Hide();
106
107 //Print("Hide()");
108
109 SetUpdate(false);
110 }
override void SetUpdate(bool state)

References HudDebugWinBase::SetUpdate().

◆ HudDebugWinCharAgents()

void HudDebugWinCharAgents ( Widget widget_root)
protected

Definition at line 32 of file HudDebugWinCharAgents.c.

33 {
35 //m_WgtAgents = TextListboxWidget.Cast( m_WgtRoot.FindAnyWidget( "txl_CharAgents_Values" ) );
36 m_WgtAgents = m_WgtRoot.FindAnyWidget("AgentList");
37
38 //FitWindowByContent( m_WgtAgents );
39 }
Widget m_WgtRoot
Definition HudDebug.c:92

References m_WgtAgents, and m_WgtRoot.

Referenced by Init().

◆ OnClick()

bool OnClick ( Widget w,
int x,
int y,
int button )
protected

Definition at line 137 of file HudDebugWinCharAgents.c.

138 {
139 //Button activate
141 if (w.GetName() == "ButtonAgentActivate")
142 {
143 data = m_AgentWidgetData.Get(w);
144 DebugGrowAgentsRequest(data.GetID(), true);
145 //Print("activate" + data.GetID().ToString());
146 return true;
147 }
148 //Button deactivate
149 else if (w.GetName() == "ButtonAgentDeactivate")
150 {
151 data = m_AgentWidgetData.Get(w);
152 DebugGrowAgentsRequest(data.GetID(), false);
153 //Print("deactivate" + data.GetID().ToString());
154 return true;
155 }
156 else if (w.GetName() == "ResetAgents")
157 {
159 return true;
160 }
161
162
163 return false;
164 }
void DebugGrowAgentsRequest(int agent_id, bool should_grow)
void DebugRemoveAgentsRequest()

References DebugGrowAgentsRequest(), DebugRemoveAgentsRequest(), and m_AgentWidgetData.

◆ SetAgents()

void SetAgents ( )
protected

Definition at line 112 of file HudDebugWinCharAgents.c.

113 {
114 PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(GetPlugin(PluginDeveloperSync));
115
116 //clear window
117 ClearAgents();
118
119 //set agents
120 if (developer_sync.m_PlayerAgentsSynced.Count() > 0)
121 {
122 for (int i = 0; i < developer_sync.m_PlayerAgentsSynced.Count(); i++)
123 AddAgent(developer_sync.m_PlayerAgentsSynced.Get(i).GetName(), developer_sync.m_PlayerAgentsSynced.Get(i).GetValue(), developer_sync.m_PlayerAgentsSynced.Get(i).GetID());
124 }
125
126 //fit to screen
127 //FitWindow();
128 }
void ClearAgents()
void AddAgent(string title, string value, int id)
PluginBase GetPlugin(typename plugin_type)

References AddAgent(), ClearAgents(), and GetPlugin().

Referenced by Update().

◆ SetUpdate()

override void SetUpdate ( bool state)
protected

Definition at line 57 of file HudDebugWinCharAgents.c.

58 {
59 //Disable update on server (PluginDeveloperSync)
61 PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(GetPlugin(PluginDeveloperSync));
62
63 //if client, send RPC
64 if (GetGame().IsClient())
65 {
67 if (player)
68 {
69 player.RPCSingleParam(ERPCs.DEV_AGENTS_UPDATE, params, true);
70 SetRPCSent();
71 }
72 }
73 //else set directly
74 else
75 {
77 developer_sync.EnableUpdate(state, ERPCs.DEV_AGENTS_UPDATE, player);
78 }
79 }
PlayerBase GetPlayer()

References GetGame(), GetPlayer(), GetPlugin(), and HudDebugWinBase::SetRPCSent().

◆ Show()

override void Show ( )
protected

Definition at line 94 of file HudDebugWinCharAgents.c.

95 {
96 super.Show();
97
98 //Print("Show()");
99
100 SetUpdate(true);
101 }

References HudDebugWinBase::SetUpdate().

◆ ~HudDebugWinCharAgents()

void ~HudDebugWinCharAgents ( )
protected

Definition at line 41 of file HudDebugWinCharAgents.c.

42 {
43 SetUpdate(false);
44 }

References HudDebugWinBase::SetUpdate().

Variable Documentation

◆ m_AgentWidgetData

ref map<Widget, ref DebugAgentData> m_AgentWidgetData = new map<Widget, ref DebugAgentData>
protected

Definition at line 28 of file HudDebugWinCharAgents.c.

Referenced by AddAgent(), ClearAgents(), and OnClick().

◆ m_AgentWidgets

ref array<ref Widget> m_AgentWidgets = new array<ref Widget>
protected

Definition at line 27 of file HudDebugWinCharAgents.c.

Referenced by AddAgent(), and ClearAgents().

◆ m_WgtAgents