Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseFloatValueHolderEditorAttribute.c
Go to the documentation of this file.
1
4{
5 [Attribute(desc: "Values")]
6 protected ref array<ref SCR_EditorAttributeFloatStringValueHolder> m_aValues;
7
8 //------------------------------------------------------------------------------------------------
9 override int GetEntries(notnull array<ref SCR_BaseEditorAttributeEntry> outEntries)
10 {
12 return outEntries.Count();
13 }
14
15 //------------------------------------------------------------------------------------------------
16 protected int ConvertValueToIndex(float value)
17 {
19 {
20 if (valueHolder.GetFloatValue() == value)
21 return index;
22 }
23
24 return -1;
25 }
26
27 //------------------------------------------------------------------------------------------------
28 protected bool ConvertIndexToValue(int index, out float outValue)
29 {
30 if (!m_aValues.IsIndexValid(index))
31 return false;
32
33 outValue = m_aValues[index].GetFloatValue();
34 return true;
35 }
36
37 //------------------------------------------------------------------------------------------------
38 //~ Validate if the attribute has the enums set up correctly
39 protected bool ValidateEnumValues(typename enumType, bool checkEnumCount = true)
40 {
41 array<int> enumValues = {};
42 if (m_aValues.Count() != SCR_Enum.GetEnumValues(enumType, enumValues) && checkEnumCount)
43 Print("SCR_BaseFloatValueHolderEditorAttribute enum value count is not equal to the attribute list count. Some enums of type '" + enumType + "' might not be able to be set via the attribute config.", LogLevel.WARNING);
44
46 {
47 //~ Check if the values in the config exists in the enum value
48 if (!enumValues.Contains(value.GetFloatValue()))
49 {
50 Print("SCR_BaseFloatValueHolderEditorAttribute has an invalid value it is trying to set ('" + value.GetFloatValue() + "') which does not exist in the '" + enumType + "' enum", LogLevel.ERROR);
51 return false;
52 }
53 }
54
55 return true;
56 }
57};
58
61{
62 [Attribute()]
64
65 [Attribute(uiwidget: UIWidgets.LocaleEditBox)]
67
68 [Attribute(uiwidget: UIWidgets.LocaleEditBox)]
70
71 [Attribute()]
72 protected float m_fEntryFloatValue;
73
74 // Hack to get this to work with imagesets, as it was made without them in mind
75 protected string m_sIconSetPath;
76 protected string m_sIconName;
77 protected bool m_bIsImageset;
78
79 //------------------------------------------------------------------------------------------------
80 void SetIcon(ResourceName newIcon, bool isImageset = false)
81 {
82 m_Icon = newIcon;
83 m_bIsImageset = isImageset;
84 }
85
86 //------------------------------------------------------------------------------------------------
88 {
89 return m_Icon;
90 }
91
92 //------------------------------------------------------------------------------------------------
93 string GetIconName()
94 {
95 return m_sIconName;
96 }
97
98 //------------------------------------------------------------------------------------------------
100 {
101 return m_bIsImageset;
102 }
103
104 //------------------------------------------------------------------------------------------------
105 void SetName(string newName)
106 {
107 m_sEntryName = newName;
108 }
109
110 //------------------------------------------------------------------------------------------------
111 string GetName()
112 {
113 return m_sEntryName;
114 }
115
116 //------------------------------------------------------------------------------------------------
117 void SetDescription(string newDescription)
118 {
119 m_sEntryDescription = newDescription;
120 }
121
122 //------------------------------------------------------------------------------------------------
124 {
125 return m_sEntryDescription;
126 }
127
128 //------------------------------------------------------------------------------------------------
129 void SetFloatValue(float newValue)
130 {
131 m_fEntryFloatValue = newValue;
132 }
133
134 //------------------------------------------------------------------------------------------------
136 {
137 return m_fEntryFloatValue;
138 }
139
140 //------------------------------------------------------------------------------------------------
141 void SetWithUIInfo(SCR_UIInfo info, float value)
142 {
143 SetName(info.GetName());
144 SetIcon(info.GetIconPath());
145 SetFloatValue(value);
146
147 if (m_Icon.IsEmpty())
148 {
149 SetIcon(info.GetImageSetPath(), true);
151 }
152 }
153
154 //------------------------------------------------------------------------------------------------
155 void SetWithUIInfo(UIInfo info, float value)
156 {
157 SetName(info.GetName());
158 SetIcon(info.GetIconPath());
159 SetFloatValue(value);
160 }
161
162}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
void SCR_BaseEditorAttributeFloatStringValues(array< ref SCR_EditorAttributeFloatStringValueHolder > values)
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Attribute base for Name, icon and float value for other attributes to inherent from.
override int GetEntries(notnull array< ref SCR_BaseEditorAttributeEntry > outEntries)
bool ValidateEnumValues(typename enumType, bool checkEnumCount=true)
ref array< ref SCR_EditorAttributeFloatStringValueHolder > m_aValues
void SetIcon(ResourceName newIcon, bool isImageset=false)
string GetIconSetName()
Definition SCR_UIInfo.c:65
ResourceName GetIconPath()
Definition SCR_UIInfo.c:20
ResourceName GetImageSetPath()
Definition SCR_UIInfo.c:47
UIInfo - allows to define UI elements.
Definition UIInfo.c:14
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute