DayZ 1.24
Loading...
Searching...
No Matches
HudDebugWinCharLevels.c
Go to the documentation of this file.
1class HudDebugWinCharLevels extends HudDebugWinBase
2{
4
5 //============================================
6 // Constructor
7 //============================================
9 {
10 m_WgtValues = TextListboxWidget.Cast(widget_root.FindAnyWidget("txl_CharLevels_Values"));
11
12 FitWindow();
13 }
14
15 //============================================
16 // Destructor
17 //============================================
19 {
20 SetUpdate(false);
21 }
22
23
24 //============================================
25 // GetWinType
26 //============================================
27 override int GetType()
28 {
29 return HudDebug.HUD_WIN_CHAR_LEVELS;
30 }
31
32 //============================================
33 // Show
34 //============================================
35 override void Show()
36 {
37 super.Show();
38
39 //Print("Show()");
40
41 SetUpdate(true);
42 }
43
44 //============================================
45 // Hide
46 //============================================
47 override void Hide()
48 {
49 super.Hide();
50
51 //Print("Hide()");
52
53 SetUpdate(false);
54 }
55
56 //============================================
57 // SetUpdate
58 //============================================
59 override void SetUpdate(bool state)
60 {
61 //Disable update on server (PluginDeveloperSync)
63
64 PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(GetPlugin(PluginDeveloperSync));
65
66 //if client, send RPC
67 if (GetGame().IsClient())
68 {
70 if (player)
71 {
72 player.RPCSingleParam(ERPCs.DEV_LEVELS_UPDATE, params, true);
73 SetRPCSent();
74 }
75 }
76 //else set directly
77 else
78 {
80 developer_sync.EnableUpdate(state, ERPCs.DEV_LEVELS_UPDATE, player);
81 }
82 }
83
84
85 override void Update()
86 {
87 super.Update();
88
89 //Print("Update()");
90
91 //refresh notifiers
92 SetValues();
93 }
94
95 void SetValues()
96 {
97 PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(GetPlugin(PluginDeveloperSync));
98
99 //clear window
100 ClearValues();
101
102 if (developer_sync.m_PlayerLevelsSynced.Count() > 0)
103 {
104 //set
105 for (int i = 0; i < developer_sync.m_PlayerLevelsSynced.Count(); i++)
106 {
107 string bar = MiscGameplayFunctions.ValueToBar(developer_sync.m_PlayerLevelsSynced.Get(i).GetValue2());
108 AddValue(developer_sync.m_PlayerLevelsSynced.Get(i).GetName(), developer_sync.m_PlayerLevelsSynced.Get(i).GetValue().ToString(), bar);
109 }
110 }
111
112 //fit to screen
113 FitWindow();
114 }
115
116 void AddValue(string title, string value, string value2)
117 {
118 int index = m_WgtValues.AddItem(title, NULL, 0);
119 m_WgtValues.SetItem(index, value, NULL, 1);
120 m_WgtValues.SetItem(index, value2, NULL, 2);
121 }
122
124 {
125 m_WgtValues.ClearItems();
126 }
127
129 {
130 //FitWindowByContent( m_WgtValues );
131 }
132}
ERPCs
Definition ERPCs.c:2
void HudDebug()
Definition HudDebug.c:104
PlayerBase GetPlayer()
PluginBase GetPlugin(typename plugin_type)
void AddValue(string title, string value, string value2)
void HudDebugWinCharLevels(Widget widget_root)
override void Update()
void SetUpdate(bool state)
TextListboxWidget m_WgtValues
override void SetUpdate(bool state)
proto native CGame GetGame()