Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SliderBloodAttributeComponent.c
Go to the documentation of this file.
2{
3 [Attribute("BloodUnconsciousBar", desc: "Image that shows when Character becomes conscious")]
4 protected string m_sUnconsciousBarName;
5
6 [Attribute("BloodUnconsciousBarTop", desc: "Set at the end of the bar")]
7 protected string m_sUnconsciousBarTopName;
8
9 [Attribute("BloodUnconsciousFillRight", desc: "Filler make sure the bar is set the correct size")]
11
12 [Attribute("1", desc: "Size of the BarTop")]
13 protected float m_iUnconsciousBarTopSize;
14
15 protected float m_fUnconsciousLevel;
16
20
21 override void Init(Widget w, SCR_BaseEditorAttribute attribute)
22 {
23 m_UnconsciousBar = w.FindAnyWidget(m_sUnconsciousBarName);
26
28
30 return;
31
33 if (!var)
34 return;
35
36 vector bloodData = var.GetVector();
37
38 m_fUnconsciousLevel = bloodData[1] * 100;
39
40 super.Init(w, attribute);
41 }
42
48 {
50 }
51
53 {
54 super.SetSliderSettings(var, sliderData);
56 }
57
58 //Sets a default state for the UI and var value if conflicting attribute
60 {
61 super.SetVariableToDefaultValue(var);
63 }
64
66 {
67 super.SetFromVar(var);
69 }
70
71 override bool OnChangeInternal(Widget w, int x, int y, bool finished)
72 {
73 super.OnChangeInternal(w, x, y, finished);
75 return false;
76 }
77
78 protected void UpdateBloodSlider()
79 {
80 float value = m_SliderWidgetComponent.GetValue();
81
82 if (value >= m_fUnconsciousLevel)
83 {
84 m_UnconsciousBarTop.SetVisible(true);
86 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(100 - m_fUnconsciousLevel, 0, 100));
87 }
88 else
89 {
90 if (value >= m_iUnconsciousBarTopSize)
91 {
92 m_UnconsciousBarTop.SetVisible(true);
93 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(value - m_iUnconsciousBarTopSize, 0 , 100));
94 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(100 - value, 0, 100));
95 }
96 else
97 {
98 m_UnconsciousBarTop.SetVisible(false);
99 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(value, 0 , 100));
100 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(100 - value, 0, 100));
101 }
102 }
103 }
104};
void SCR_BaseEditorAttributeEntrySlider(SCR_EditorAttributeBaseValues sliderValues)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Math.c:13
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
sealed SCR_BaseEditorAttributeVar GetVariableOrCopy()
override void SetFromVar(SCR_BaseEditorAttributeVar var)
override void Init(Widget w, SCR_BaseEditorAttribute attribute)
override void SetVariableToDefaultValue(SCR_BaseEditorAttributeVar var)
override void SetSliderSettings(SCR_BaseEditorAttributeVar var, SCR_BaseEditorAttributeEntrySlider sliderData)
override bool OnChangeInternal(Widget w, int x, int y, bool finished)
SCR_FieldOfViewSettings Attribute