3 TextListboxWidget m_WgtValues;
10 bool m_ChangingSlider;
15 void HudDebugWinCharStats(
Widget widget_root)
25 void ~HudDebugWinCharStats()
71 PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(
GetPlugin( PluginDeveloperSync ) );
76 ref Param1<bool> params =
new Param1<bool>( state );
79 player.RPCSingleParam(
ERPCs.DEV_STATS_UPDATE, params,
true );
88 developer_sync.EnableUpdate( state,
ERPCs.DEV_STATS_UPDATE, player );
111 PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(
GetPlugin( PluginDeveloperSync ) );
116 if ( developer_sync.m_PlayerStatsSynced.Count() > 0 )
119 for (
int i = 0; i < developer_sync.m_PlayerStatsSynced.Count(); i++ )
121 AddValue( developer_sync.m_PlayerStatsSynced.Get( i ).GetName(), developer_sync.m_PlayerStatsSynced.Get( i ).GetValue().ToString() );
132 PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(
GetPlugin( PluginDeveloperSync ) );
133 if ( developer_sync.m_PlayerStatsSynced.Count() > 0 )
135 for (
int i = 0; i < developer_sync.m_PlayerStatsSynced.Count(); i++ )
137 string stat_name = developer_sync.m_PlayerStatsSynced.Get( i ).GetName();
138 float val_norm = developer_sync.m_PlayerStatsSynced.Get( i ).GetValueNorm();
139 float value = developer_sync.m_PlayerStatsSynced.Get( i ).GetValue();
141 if( stat_name ==
"BloodType" )
146 name = value.ToString();
148 m_StatValues.Get(i).SetText(
name);
152 m_StatValues.Get(i).SetText(value.ToString());
155 if(!m_ChangingSlider)
156 m_SliderWidgets.GetKeyByValue(stat_name).SetCurrent(val_norm * 100);
176 void AddValue(
string title,
string value )
178 Widget widget =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/debug/day_z_hud_debug_stat.layout", m_WgtPanel );
182 m_StatWidgets.Insert(widget);
185 m_StatValues.Insert(tw_output);
188 m_StatValuesInput.Insert(ebw_input, title );
190 SliderWidget sw = SliderWidget.Cast(widget.FindAnyWidget(
"StatSlider"));
191 m_SliderWidgets.Insert(sw,title );
198 m_WgtPanel.GetScript( WgtModifiersContent_panel_script );
199 WgtModifiersContent_panel_script.Update();
204 m_StatWidgets.Clear();
210 TextListboxWidget wgt = TextListboxWidget.Cast(m_WgtPanel);
212 FitWindowByContent( wgt );
217 if ( w.GetName() ==
"ResetStats" )
227 if ( m_StatValuesInput.Contains(
EditBoxWidget.Cast(w)) && finished )
230 RPCChangeStat(m_StatValuesInput.Get(
EditBoxWidget.Cast(w)), ebw.GetText().ToFloat());
233 if (m_SliderWidgets.Contains(SliderWidget.Cast(w)))
235 m_ChangingSlider =
true;
236 string stat_name = m_SliderWidgets.Get(SliderWidget.Cast(w));
237 SliderWidget sw = SliderWidget.Cast(w);
239 for (
int i = 0; i < player.m_PlayerStats.GetPCO().
Get().
Count(); i++ )
241 string label = player.m_PlayerStats.GetPCO().Get().Get( i ).GetLabel();
242 if(label == stat_name)
244 float stat_min = player.m_PlayerStats.GetPCO().Get().Get( i ).GetMin();
245 float stat_max = player.m_PlayerStats.GetPCO().Get().Get( i ).GetMax();
246 float current_value_norm = sw.GetCurrent() / 100;
247 float current_value_abs = stat_min + (stat_max - stat_min) * current_value_norm;
249 RPCChangeStat(label, current_value_abs);
254 m_ChangingSlider =
false;
267 ref Param1<bool> params =
new Param1<bool>(
false );
270 player.RPCSingleParam(
ERPCs.DEV_RPC_STATS_RESET, params,
true );
274 void RPCChangeStat(
string stat,
float value)
283 player.RPCSingleParam(
ERPCs.DEV_RPC_STAT_SET, params,
true );