Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
huddebugwincharlevels.c
Go to the documentation of this file.
1 class HudDebugWinCharLevels extends HudDebugWinBase
2 {
3  TextListboxWidget m_WgtValues;
4 
5  //============================================
6  // Constructor
7  //============================================
8  void HudDebugWinCharLevels(Widget widget_root)
9  {
10  m_WgtValues = TextListboxWidget.Cast( widget_root.FindAnyWidget("txl_CharLevels_Values") );
11 
12  FitWindow();
13  }
14 
15  //============================================
16  // Destructor
17  //============================================
18  void ~HudDebugWinCharLevels()
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)
62  PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
63 
64  PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast( GetPlugin( PluginDeveloperSync ) );
65 
66  //if client, send RPC
67  if ( GetGame().IsClient() )
68  {
69  ref Param1<bool> params = new Param1<bool>( state );
70  if ( player )
71  {
72  player.RPCSingleParam( ERPCs.DEV_LEVELS_UPDATE, params, true );
73  SetRPCSent();
74  }
75  }
76  //else set directly
77  else
78  {
79  if ( developer_sync )
80  {
81  developer_sync.EnableUpdate( state, ERPCs.DEV_LEVELS_UPDATE, player );
82  }
83  }
84  }
85 
86 
87  override void Update()
88  {
89  super.Update();
90 
91  //Print("Update()");
92 
93  //refresh notifiers
94  SetValues();
95  }
96 
97  void SetValues()
98  {
99  PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast( GetPlugin( PluginDeveloperSync ) );
100 
101  //clear window
102  ClearValues();
103 
104  if ( developer_sync.m_PlayerLevelsSynced.Count() > 0 )
105  {
106  //set
107  for ( int i = 0; i < developer_sync.m_PlayerLevelsSynced.Count(); i++ )
108  {
109  string bar = MiscGameplayFunctions.ValueToBar(developer_sync.m_PlayerLevelsSynced.Get( i ).GetValue2());
110  AddValue( developer_sync.m_PlayerLevelsSynced.Get( i ).GetName(), developer_sync.m_PlayerLevelsSynced.Get( i ).GetValue().ToString() ,bar );
111  }
112  }
113 
114  //fit to screen
115  FitWindow();
116  }
117 
118  void AddValue( string title, string value, string value2 )
119  {
120  int index = m_WgtValues.AddItem( title, NULL, 0 );
121  m_WgtValues.SetItem( index, value, NULL, 1 );
122  m_WgtValues.SetItem( index, value2, NULL, 2 );
123  }
124 
125  void ClearValues()
126  {
127  m_WgtValues.ClearItems();
128  }
129 
130  void FitWindow()
131  {
132  //FitWindowByContent( m_WgtValues );
133  }
134 }
GetGame
proto native CGame GetGame()
FitWindow
void FitWindow()
Definition: huddebugwincharagents.c:228
Show
proto native void Show(bool show, bool immedUpdate=true)
SetUpdate
override void SetUpdate(bool state)
Definition: huddebugwincharagents.c:57
HudDebugWinBase
Definition: huddebugwinbase.c:1
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
PlayerBase
Definition: playerbaseclient.c:1
Update
proto native volatile void Update()
Definition: playersoundmanager.c:125
GetPlayer
protected void GetPlayer()
Definition: crosshairselector.c:127
HudDebug
void HudDebug()
Definition: huddebug.c:104
ERPCs
ERPCs
Definition: erpcs.c:1
Widget
Definition: enwidgets.c:189
Hide
void Hide()
Definition: dayzgame.c:165
GetType
override int GetType()
Definition: huddebugwincharagents.c:49