DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
HudDebugWinCharStomach.c
См. документацию.
1class HudDebugWinCharStomach extends HudDebugWinBase
2{
3 TextListboxWidget m_WgtValues;
5
6 //============================================
7 // Constructor
8 //============================================
9 void HudDebugWinCharStomach(Widget widget_root)
10 {
11 m_WgtValues = TextListboxWidget.Cast( widget_root.FindAnyWidget("txl_StomachContents") );
12 m_WgtOverall = TextWidget.Cast( widget_root.FindAnyWidget("InfoOverall") );
13 //FitWindow();
14 }
15
16 //============================================
17 // Destructor
18 //============================================
20 {
21 SetUpdate( false );
22 }
23
24
25 //============================================
26 // GetWinType
27 //============================================
28 override int GetType()
29 {
30 return HudDebug.HUD_WIN_CHAR_STOMACH;
31 }
32
33 //============================================
34 // Show
35 //============================================
36 override void Show()
37 {
38 super.Show();
39
40 //Print("Show()");
41
42 SetUpdate( true );
43 }
44
45 //============================================
46 // Hide
47 //============================================
48 override void Hide()
49 {
50 super.Hide();
51
52 //Print("Hide()");
53
54 SetUpdate( false );
55 }
56
57 //============================================
58 // SetUpdate
59 //============================================
60 override void SetUpdate( bool state )
61 {
62 //Disable update on server (PluginDeveloperSync)
63 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
64
65 PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast( GetPlugin( PluginDeveloperSync ) );
66
67 //if client, send RPC
68 if ( GetGame().IsClient() )
69 {
70 ref Param1<bool> params = new Param1<bool>( state );
71 if ( player )
72 {
73 player.RPCSingleParam( ERPCs.DEV_STOMACH_UPDATE, params, true );
74 SetRPCSent();
75 }
76 }
77 //else set directly
78 else
79 {
80 if ( developer_sync )
81 {
82 developer_sync.EnableUpdate( state, ERPCs.DEV_STOMACH_UPDATE, player );
83 }
84 }
85 }
86
87
88 override void Update()
89 {
90 super.Update();
91
92 //Print("Update()");
93
94 //refresh notifiers
96 }
97
98
100 {
101 PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast( GetPlugin( PluginDeveloperSync ) );
102
103 //clear window
104 ClearValues();
105 int count = developer_sync.m_PlayerStomachSynced.Count() - 2; // dont iterate appended params (stomach volume and temperature)
106
107 for ( int i = 0; i < count; i++ )
108 {
109 //new Param5<int,int,int,float,float>(id, food_stage, agents, amount,temperature);
110 Param5<int,int,int,float, float> p5 = Param5<int,int,int,float,float>.Cast(developer_sync.m_PlayerStomachSynced.Get(i));
111 AddValue( PlayerStomach.GetClassnameFromID(p5.param1), p5.param2, p5.param3, p5.param4, p5.param5);
112 }
113
114 if( developer_sync.m_PlayerStomachSynced.Count() )
115 {
116 int last_index = developer_sync.m_PlayerStomachSynced.Count() - 2;
117 Param1<float> p1 = Param1<float>.Cast(developer_sync.m_PlayerStomachSynced.Get(last_index));
118
119 last_index = developer_sync.m_PlayerStomachSynced.Count() - 1;
120 Param1<float> paramTemp = Param1<float>.Cast(developer_sync.m_PlayerStomachSynced.Get(last_index));
121 m_WgtOverall.SetText("Overall volume:" + p1.param1.ToString() + " " + "Average temperature:" + paramTemp.param1.ToString());
122 }
123 else
124 {
125 m_WgtOverall.SetText("Overall volume: 0" + " " + "Average temperature: 0");
126 }
127
128
129
130 //fit to screen
131 //FitWindow();
132 }
133
134 void AddValue( string classname, int food_stage, int agents, float amount, float temperature)
135 {
136 int index = m_WgtValues.AddItem( classname, NULL, 0 );
137 string stage = typename.EnumToString(FoodStageType, food_stage) + "(" + food_stage.ToString()+")";;
138 m_WgtValues.SetItem( index, amount.ToString(), NULL, 1 );
139 m_WgtValues.SetItem( index,stage , NULL, 2 );
140 m_WgtValues.SetItem( index, temperature.ToString() , NULL, 3 );
141 array<string> agent_list = GetAgentsArray(agents);
142 string agent_line = "("+agents.ToString()+") ";
143
144 for(int i = 0; i < agent_list.Count();i++)
145 {
146 agent_line += "," +agent_list.Get(i);
147 }
148
149 m_WgtValues.SetItem( index, agent_line , NULL, 4);
150 }
151
153 {
154 array<string> list = new array<string>;
155 for(int i = 0; i < 32; i++)
156 {
157 int agent = agents & (1 << i);
158 if(agent)
159 {
160 list.Insert(PluginTransmissionAgents.GetNameByID(agent));
161 }
162 }
163 return list;
164 }
165
167 {
168 m_WgtValues.ClearItems();
169 }
170
172 {
174 }
175}
ERPCs
Определения ERPCs.c:2
FoodStageType
Определения FoodStage.c:2
void HudDebug()
Определения HudDebug.c:108
PlayerBase GetPlayer()
Определения ModifierBase.c:51
void PlayerStomach(PlayerBase player)
Определения PlayerStomach.c:142
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
void HudDebugWinCharStomach(Widget widget_root)
Определения HudDebugWinCharStomach.c:9
void SetRPCSent()
Определения HudDebugWinBase.c:39
override void Show()
Определения HudDebugWinCharStomach.c:36
override void Hide()
Определения HudDebugWinCharStomach.c:48
void AddValue(string title, string value, string value2)
Определения HudDebugWinCharLevels.c:118
void FitWindow()
Определения HudDebugWinCharStomach.c:171
override void Update()
Определения HudDebugWinCharStomach.c:88
void FitWindowByContent(TextListboxWidget wgt)
Определения HudDebugWinBase.c:74
void SetUpdate(bool state)
TextWidget m_WgtOverall
Определения HudDebugWinCharStomach.c:4
override int GetType()
Определения HudDebugWinCharStomach.c:28
void ~HudDebugWinCharStomach()
Определения HudDebugWinCharStomach.c:19
void ClearValues()
Определения HudDebugWinCharLevels.c:125
TextListboxWidget m_WgtValues
Определения HudDebugWinCharLevels.c:3
void SetContentValues()
Определения HudDebugWinCharStomach.c:99
array< string > GetAgentsArray(int agents)
Определения HudDebugWinCharStomach.c:152
override void SetUpdate(bool state)
Определения HudDebugWinCharStomach.c:60
void AddValue(string classname, int food_stage, int agents, float amount, float temperature)
Определения HudDebugWinCharStomach.c:134
Определения HudDebugWinBase.c:2
Определения PlayerBaseClient.c:2
Определения EnWidgets.c:220
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
proto native CGame GetGame()