DayZ 1.24
Loading...
Searching...
No Matches
GameplayEffectsData Class Reference

Manages all bleeding indicators and their updates. More...

Collaboration diagram for GameplayEffectsData:
[legend]

Protected Member Functions

void GameplayEffectsDataBleeding (array< ref Widget > input, int type, int user_override=-1)
 
override void Init (array< ref Widget > input, int type, Widget layout_root, int user_override=-1)
 
override bool HasDefinedHandle ()
 
override bool DataInitialized ()
 
override void RegisterData (Param p)
 
void RegisterBleedingIndicatorInstance (int bit, float flow_modifier)
 
void SpawnBleedingIndicator (int source_ID, vector position)
 
int CalculateSeverity (float flow_modifier)
 
ImageWidget GetNextDropImage ()
 
void StopBleedingIndicator (int source_ID, bool instant=false)
 
void UpdateBleedingIndicators (float timeSlice)
 
void CleanupBleedingIndicators ()
 
override void Update (float timeSlice=0, Param p=null, int handle=-1)
 
override void UpdateVisibility (bool state)
 
override void ForceStop ()
 stops and re-sets indicators and images even out of sequence. Should still be tied to the 'player' update, though!
 
void BuildProbabilityData (int severity, float frequency)
 
array< floatGetProbabilities (int severity)
 
void BuildPositioningData ()
 
vector GenerateSequenceRandomPosition ()
 

Protected Attributes

bool m_Initialized
 
bool m_Visible
 
ref map< int, ref BleedingIndicator > m_RegisteredInstances
 
ref array< intm_CleanupQueue
 
ref array< intm_RunningIndicators
 
int m_LastDropIdx
 
int m_ImageWidgetCount
 
ref map< int, ref array< float > > m_ProbabilityMap
 
ref array< Widgetm_PositioningFramesArray
 
Widget m_BloodDropsFrame
 
int m_LastPositionFrameUsed
 

Detailed Description

Manages all bleeding indicators and their updates.

Definition at line 3 of file GEWidgetsMetaDataBleeding.c.

Member Function Documentation

◆ BuildPositioningData()

void GameplayEffectsData::BuildPositioningData ( )
inlineprotected

Definition at line 228 of file GEWidgetsMetaDataBleeding.c.

229 {
230 Widget frameParent = m_LayoutRoot.FindAnyWidget("PoisitioningFrames");
231 if (frameParent)
232 {
235
236 Widget frame = frameParent.GetChildren();
237 while (frame)
238 {
240 frame = frame.GetSibling();
241 }
242 }
243 }
ref array< Widget > m_PositioningFramesArray

Referenced by Init().

◆ BuildProbabilityData()

void GameplayEffectsData::BuildProbabilityData ( int severity,
float frequency )
inlineprotected

Definition at line 207 of file GEWidgetsMetaDataBleeding.c.

208 {
209 if (!m_ProbabilityMap)
211
213
216
218 }
ref map< int, ref array< float > > m_ProbabilityMap
Definition EnMath.c:7
static float Poisson(float mean, int occurences)
occurences values above '12' will cause Factorial to overflow int.
Definition EnMath.c:681

References Math::Poisson(), and BleedingIndicationConstants::SEQUENCE_STEPS.

Referenced by Init().

◆ CalculateSeverity()

int GameplayEffectsData::CalculateSeverity ( float flow_modifier)
inlineprotected

Definition at line 97 of file GEWidgetsMetaDataBleeding.c.

References PlayerConstants::BLEEDING_SOURCE_FLOW_MODIFIER_HIGH, PlayerConstants::BLEEDING_SOURCE_FLOW_MODIFIER_LOW, PlayerConstants::BLEEDING_SOURCE_FLOW_MODIFIER_MEDIUM, BleedingIndicationConstants::INDICATOR_SEVERITY_HIGH, BleedingIndicationConstants::INDICATOR_SEVERITY_LOW, and BleedingIndicationConstants::INDICATOR_SEVERITY_MEDIUM.

Referenced by RegisterBleedingIndicatorInstance().

◆ CleanupBleedingIndicators()

void GameplayEffectsData::CleanupBleedingIndicators ( )
inlineprotected

Definition at line 139 of file GEWidgetsMetaDataBleeding.c.

140 {
141 for (int i = 0; i < m_CleanupQueue.Count(); i++)
143 m_CleanupQueue.Clear();
144 }
ref array< int > m_RunningIndicators

Referenced by Update().

◆ DataInitialized()

override bool GameplayEffectsData::DataInitialized ( )
inlineprotected

Definition at line 49 of file GEWidgetsMetaDataBleeding.c.

50 {
51 return m_Initialized;
52 }

References m_Initialized.

◆ ForceStop()

override void GameplayEffectsData::ForceStop ( )
inlineprotected

stops and re-sets indicators and images even out of sequence. Should still be tied to the 'player' update, though!

Definition at line 198 of file GEWidgetsMetaDataBleeding.c.

199 {
200 super.ForceStop();
201
202 foreach (int i: m_RunningIndicators)
203 m_RegisteredInstances.Get(i).StopIndicator(true);
204 Update();
205 }
array< ref PlayerStatBase > Get()
ref map< int, ref BleedingIndicator > m_RegisteredInstances
proto native volatile void Update()

References m_RunningIndicators, and Update().

◆ GameplayEffectsDataBleeding()

void GameplayEffectsData::GameplayEffectsDataBleeding ( array< ref Widget > input,
int type,
int user_override = -1 )
inlineprotected

◆ GenerateSequenceRandomPosition()

vector GameplayEffectsData::GenerateSequenceRandomPosition ( )
inlineprotected

Definition at line 245 of file GEWidgetsMetaDataBleeding.c.

246 {
248 {
250 int index = Math.RandomInt(0, arrayCount);
252 {
253 index++;
254 if (index >= arrayCount)
255 index = 0;
256 }
257
260
261 if (frame)
262 {
263 int screenX, screenY;
264 float x, y, x_size, y_size;
265 frame.GetScreenPos(x, y);
266 frame.GetScreenSize(x_size, y_size);
267
270
271 return Vector(x, y, 0);
272 }
273 }
274 return vector.Zero;
275 }
Icon x
Icon y
static const vector Zero
Definition EnConvert.c:110
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

References Math::RandomFloatInclusive(), Math::RandomInt(), Vector(), x, y, and vector::Zero.

Referenced by SpawnBleedingIndicator().

◆ GetNextDropImage()

ImageWidget GameplayEffectsData::GetNextDropImage ( )
inlineprotected

Definition at line 113 of file GEWidgetsMetaDataBleeding.c.

114 {
117 m_LastDropIdx = 0;
118
119 return ImageWidget.Cast(m_WidgetArray[m_LastDropIdx]);
120 }

◆ GetProbabilities()

array< float > GameplayEffectsData::GetProbabilities ( int severity)
inlineprotected

Definition at line 220 of file GEWidgetsMetaDataBleeding.c.

221 {
223 if (!ret)
224 ErrorEx("No defined data for the selected severity!");
225 return ret;
226 }
enum ShapeType ErrorEx

References ErrorEx.

◆ HasDefinedHandle()

override bool GameplayEffectsData::HasDefinedHandle ( )
inlineprotected

Definition at line 44 of file GEWidgetsMetaDataBleeding.c.

45 {
46 return true;
47 }

◆ Init()

override void GameplayEffectsData::Init ( array< ref Widget > input,
int type,
Widget layout_root,
int user_override = -1 )
inlineprotected

Definition at line 26 of file GEWidgetsMetaDataBleeding.c.

27 {
29
30 m_WidgetArray.ShuffleArray(); //shuffles order of the widgets on every init
31 m_ImageWidgetCount = m_WidgetArray.Count();
32 m_BloodDropsFrame = m_LayoutRoot.FindAnyWidgetById(EffectWidgetsTypes.BLEEDING_LAYER);
33 m_Visible = g_Game.GetProfileOption(EDayZProfilesOptions.BLEEDINGINDICATION);
35 m_LastDropIdx = -1;
37
42 }
DayZGame g_Game
Definition DayZGame.c:3528
EDayZProfilesOptions
void BuildProbabilityData(int severity, float frequency)

References BuildPositioningData(), BuildProbabilityData(), g_Game, BleedingIndicationConstants::INDICATOR_SEVERITY_HIGH, BleedingIndicationConstants::INDICATOR_SEVERITY_LOW, BleedingIndicationConstants::INDICATOR_SEVERITY_MEDIUM, m_Visible, BleedingIndicationConstants::SEQUENCE_DROP_AVERAGE_HIGH, BleedingIndicationConstants::SEQUENCE_DROP_AVERAGE_LOW, and BleedingIndicationConstants::SEQUENCE_DROP_AVERAGE_MEDIUM.

◆ RegisterBleedingIndicatorInstance()

void GameplayEffectsData::RegisterBleedingIndicatorInstance ( int bit,
float flow_modifier )
inlineprotected

Definition at line 80 of file GEWidgetsMetaDataBleeding.c.

81 {
83 BleedingIndicator indicator = new BleedingIndicator(bit, severity, this); //source_ID == bit for the purpose of pairing
85 }
int CalculateSeverity(float flow_modifier)

References CalculateSeverity().

Referenced by RegisterData().

◆ RegisterData()

override void GameplayEffectsData::RegisterData ( Param p)
inlineprotected

Definition at line 54 of file GEWidgetsMetaDataBleeding.c.

55 {
56 if (m_Initialized)
57 {
58#ifdef DEVELOPER
59 ErrorEx("" + this + " is already initialized, further registration not possible!");
60#else
61 Debug.Log("ERROR: " + this + " is already initialized, further registration not possible!");
62#endif
63 return;
64 }
65
66 //<finish registration,bit,flow_modifier>
68 if (Class.CastTo(par, p))
69 {
70 if (par.param1 == true) //finish registration
71 {
72 m_Initialized = true;
73 return;
74 }
75
77 }
78 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
void RegisterBleedingIndicatorInstance(int bit, float flow_modifier)
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), ErrorEx, Debug::Log(), m_Initialized, and RegisterBleedingIndicatorInstance().

◆ SpawnBleedingIndicator()

void GameplayEffectsData::SpawnBleedingIndicator ( int source_ID,
vector position )
inlineprotected

Definition at line 87 of file GEWidgetsMetaDataBleeding.c.

88 {
89 if (m_RunningIndicators.Find(source_ID) != -1)
90 return;
91 BleedingIndicator indicator = m_RegisteredInstances.Get(source_ID);
92 //indicator.InitIndicator(position); //would be nice if we could pair the indicator position to the hit position that caused the bleeding, wouldn't it
95 }

References GenerateSequenceRandomPosition().

Referenced by Update().

◆ StopBleedingIndicator()

void GameplayEffectsData::StopBleedingIndicator ( int source_ID,
bool instant = false )
inlineprotected

Definition at line 122 of file GEWidgetsMetaDataBleeding.c.

123 {
124 m_RegisteredInstances.Get(source_ID).StopIndicator(instant); //stop queued, evaluated on update!
125 }

Referenced by Update().

◆ Update()

override void GameplayEffectsData::Update ( float timeSlice = 0,
Param p = null,
int handle = -1 )
inlineprotected

Definition at line 146 of file GEWidgetsMetaDataBleeding.c.

147 {
148 //starts or ends a bleeding indicator
149 if (p)
150 {
151 //start/stop of the indicator
152 //<state,bit,position,immediate>
154
155 //hide/show of bleeding effect visuals
156 //<state>
158
159 if (Class.CastTo(par, p))
160 {
161 bool state = par.param1;
162 if (state) //queue add indicator
163 SpawnBleedingIndicator(par.param2, par.param3);
164 else //queue stop indicator
165 StopBleedingIndicator(par.param2, par.param4);
166 }
167 else if (Class.CastTo(parShow, p) && m_Visible != parShow.param1)
168 {
169 m_Visible = parShow.param1;
171 }
172 }
173
174 //updates bleeding indicators
177
178 if (m_RunningIndicators.Count() <= 0)
179 {
180 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.BLEEDING_LAYER});
181 m_WidgetArray.ShuffleArray();
182 }
183 }
void SpawnBleedingIndicator(int source_ID, vector position)
void StopBleedingIndicator(int source_ID, bool instant=false)
void UpdateBleedingIndicators(float timeSlice)
proto native CGame GetGame()

References Class::CastTo(), CleanupBleedingIndicators(), GetGame(), m_Visible, SpawnBleedingIndicator(), StopBleedingIndicator(), and UpdateBleedingIndicators().

◆ UpdateBleedingIndicators()

void GameplayEffectsData::UpdateBleedingIndicators ( float timeSlice)
inlineprotected

Definition at line 127 of file GEWidgetsMetaDataBleeding.c.

128 {
129 BleedingIndicator bib;
130 for (int i = 0; i < m_RunningIndicators.Count(); i++)
131 {
133 bib.Update(timeSlice);
134 if (bib.GetEndNow())
136 }
137 }

Referenced by Update().

◆ UpdateVisibility()

override void GameplayEffectsData::UpdateVisibility ( bool state)
inlineprotected

Definition at line 185 of file GEWidgetsMetaDataBleeding.c.

186 {
187 m_Visible = g_Game.GetProfileOption(EDayZProfilesOptions.BLEEDINGINDICATION); //ugh
188 //manage layout visibility
190 while (w && w != m_LayoutRoot && m_Visible == state && w.IsVisibleHierarchy() != state)
191 {
192 w.Show(state);
193 w = w.GetParent();
194 }
195 }

References g_Game, m_BloodDropsFrame, and m_Visible.

Member Data Documentation

◆ m_BloodDropsFrame

Widget GameplayEffectsData::m_BloodDropsFrame
protected

Definition at line 14 of file GEWidgetsMetaDataBleeding.c.

Referenced by UpdateVisibility().

◆ m_CleanupQueue

ref array<int> GameplayEffectsData::m_CleanupQueue
protected

Definition at line 8 of file GEWidgetsMetaDataBleeding.c.

◆ m_ImageWidgetCount

int GameplayEffectsData::m_ImageWidgetCount
protected

Definition at line 11 of file GEWidgetsMetaDataBleeding.c.

◆ m_Initialized

bool GameplayEffectsData::m_Initialized
protected

Definition at line 5 of file GEWidgetsMetaDataBleeding.c.

Referenced by DataInitialized().

◆ m_LastDropIdx

int GameplayEffectsData::m_LastDropIdx
protected

Definition at line 10 of file GEWidgetsMetaDataBleeding.c.

◆ m_LastPositionFrameUsed

int GameplayEffectsData::m_LastPositionFrameUsed
protected

Definition at line 16 of file GEWidgetsMetaDataBleeding.c.

◆ m_PositioningFramesArray

ref array<Widget> GameplayEffectsData::m_PositioningFramesArray
protected

Definition at line 13 of file GEWidgetsMetaDataBleeding.c.

◆ m_ProbabilityMap

ref map<int, ref array<float> > GameplayEffectsData::m_ProbabilityMap
protected

Definition at line 12 of file GEWidgetsMetaDataBleeding.c.

◆ m_RegisteredInstances

ref map<int, ref BleedingIndicator> GameplayEffectsData::m_RegisteredInstances
protected

Definition at line 7 of file GEWidgetsMetaDataBleeding.c.

◆ m_RunningIndicators

ref array<int> GameplayEffectsData::m_RunningIndicators
protected

Definition at line 9 of file GEWidgetsMetaDataBleeding.c.

Referenced by ForceStop().

◆ m_Visible

bool GameplayEffectsData::m_Visible
protected

Definition at line 6 of file GEWidgetsMetaDataBleeding.c.


The documentation for this class was generated from the following file: