Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_ButtonBoxMultiSelectAttributeUIComponent.c
Go to the documentation of this file.
1
3
class
SCR_ButtonBoxMultiSelectAttributeUIComponent
:
SCR_ButtonBoxAttributeUIComponent
4
{
5
protected
bool
m_bUseCustomFlags
=
false
;
6
7
override
void
Init
(
Widget
w,
SCR_BaseEditorAttribute
attribute)
8
{
9
//Get if uses custom flags
10
array<ref SCR_BaseEditorAttributeEntry> entries =
new
array<ref SCR_BaseEditorAttributeEntry>;
11
attribute.
GetEntries
(entries);
12
13
foreach
(SCR_BaseEditorAttributeEntry entry: entries)
14
{
15
SCR_EditorAttributePresetMultiSelectEntry
multiSelectPresetEntry =
SCR_EditorAttributePresetMultiSelectEntry
.Cast(entry);
16
if
(multiSelectPresetEntry)
17
{
18
m_bUseCustomFlags
= multiSelectPresetEntry.GetUsesCustomFlags();
19
break
;
20
}
21
}
22
23
super.Init(w, attribute);
24
}
25
26
override
void
SetFromVar
(
SCR_BaseEditorAttributeVar
var)
27
{
28
if
(!var)
29
return
;
30
31
int
count =
m_ToolBoxComponent
.GetNumItems();
32
vector
flags
= var.
GetVector
();
33
int
value;
34
35
if
(!
m_bUseCustomFlags
)
36
{
37
int
index
= 0;
38
int
flagPerIndex = 0;
39
int
flag = 1;
40
41
//Set State
42
for
(
int
i = 0; i < count; i++)
43
{
44
value =
flags
[
index
];
45
m_ToolBoxComponent
.SetItemSelected(i, (value & flag),
false
);
46
flag *= 2;
47
flagPerIndex++;
48
49
if
(flagPerIndex >= 31)
50
{
51
flagPerIndex = 0;
52
flag = 1;
53
index
++;
54
55
if
(
index
> 2)
56
break
;
57
}
58
}
59
}
60
else
61
{
62
value =
flags
[0];
63
64
//Check if has custom flag
65
for
(
int
i = 0; i < count; i++)
66
{
67
m_ToolBoxComponent
.SetItemSelected(i, (value & (
int
)
m_ButtonBoxData
.GetEntryFloatValue(i)),
false
);
68
}
69
70
}
71
72
m_bButtonValueInitCalled
=
true
;
73
74
SetFromVarOrDefault
();
75
}
76
77
//x is index, y is selectState
78
override
bool
OnChangeInternal
(
Widget
w,
int
x,
int
y,
bool
finished)
79
{
80
if
(!
m_bButtonValueInitCalled
)
81
return
false
;
82
83
SCR_BaseEditorAttribute
attribute =
GetAttribute
();
84
if
(!attribute)
85
return
false
;
86
SCR_BaseEditorAttributeVar
var = attribute.
GetVariable
(
true
);
87
88
vector
flags
;
89
int
count =
m_ToolBoxComponent
.GetNumItems();
90
if
(!
m_bUseCustomFlags
)
91
{
92
flags
=
Vector
(0,0,0);
93
int
index
= 0;
94
int
flagPerIndex = 0;
95
int
flag = 1;
96
int
value;
97
98
for
(
int
i = 0; i < count; i++)
99
{
100
//If selected add
101
if
(
m_ToolBoxComponent
.IsItemSelected(i))
102
{
103
value =
flags
[
index
];
104
value |= flag;
105
flags
[
index
] = value;
106
}
107
108
flag *= 2;
109
flagPerIndex++;
110
111
if
(flagPerIndex >= 31)
112
{
113
flagPerIndex = 0;
114
flag = 1;
115
index
++;
116
117
if
(
index
> 2)
118
break
;
119
}
120
}
121
}
122
else
123
{
124
int
flagValues =
flags
[0];
125
126
for
(
int
i = 0; i < count; i++)
127
{
128
if
(
m_ToolBoxComponent
.IsItemSelected(i))
129
flagValues |= (
int
)
m_ButtonBoxData
.GetEntryFloatValue(i);
130
else
131
flagValues &= ~(
int
)
m_ButtonBoxData
.GetEntryFloatValue(i);
132
}
133
134
flags
[0] = flagValues;
135
}
136
var.
SetVector
(
flags
);
137
AttributeValueChanged
();
138
return
false
;
139
}
140
141
protected
override
void
OnMultiSelectButton
(
SCR_ToolboxComponent
toolbox,
int
index
,
bool
state)
142
{
143
super.OnMultiSelectButton(toolbox,
index
, state);
144
OnChangeInternal
(toolbox.GetRootWidget(),
index
, state,
false
);
145
}
146
};
flags
SCR_EAIThreatSectorFlags flags
Definition
AIControlComponentSerializer.c:16
SCR_EditorAttributePresetMultiSelectEntry
void SCR_EditorAttributePresetMultiSelectEntry(int buttonsOnRow, bool hasRandomizeButton, ResourceName iconOfRandomizeButton=string.Empty, bool hasIcon=false, bool hasButtonDescription=false, string buttonDescription=string.Empty, int buttonHeight=-1, int customFlags=false)
Definition
SCR_BaseEditorAttribute.c:822
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
SCR_BaseEditorAttribute
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Definition
SCR_BaseEditorAttribute.c:4
SCR_BaseEditorAttribute::GetVariable
sealed SCR_BaseEditorAttributeVar GetVariable(bool createWhenNull=false)
Definition
SCR_BaseEditorAttribute.c:307
SCR_BaseEditorAttribute::GetEntries
int GetEntries(notnull array< ref SCR_BaseEditorAttributeEntry > outEntries)
Definition
SCR_BaseEditorAttribute.c:458
SCR_BaseEditorAttributeUIComponent::GetAttribute
Get attribute this component represents return Editor attribute *SCR_BaseEditorAttribute GetAttribute()
Definition
SCR_BaseEditorAttributeUIComponent.c:59
SCR_BaseEditorAttributeUIComponent::SetFromVarOrDefault
void SetFromVarOrDefault()
Definition
SCR_BaseEditorAttributeUIComponent.c:92
SCR_BaseEditorAttributeUIComponent::AttributeValueChanged
void AttributeValueChanged()
Definition
SCR_BaseEditorAttributeUIComponent.c:289
SCR_BaseEditorAttributeVar
Definition
SCR_BaseEditorAttributeVar.c:2
SCR_BaseEditorAttributeVar::SetVector
void SetVector(vector value)
Definition
SCR_BaseEditorAttributeVar.c:66
SCR_BaseEditorAttributeVar::GetVector
vector GetVector()
Definition
SCR_BaseEditorAttributeVar.c:74
SCR_ButtonBoxAttributeUIComponent
Definition
SCR_ButtonBoxAttributeUIComponent.c:4
SCR_ButtonBoxAttributeUIComponent::m_ButtonBoxData
ref SCR_BaseEditorAttributeFloatStringValues m_ButtonBoxData
Definition
SCR_ButtonBoxAttributeUIComponent.c:25
SCR_ButtonBoxAttributeUIComponent::m_ToolBoxComponent
SCR_ToolboxComponent m_ToolBoxComponent
Definition
SCR_ButtonBoxAttributeUIComponent.c:23
SCR_ButtonBoxAttributeUIComponent::m_bButtonValueInitCalled
bool m_bButtonValueInitCalled
Definition
SCR_ButtonBoxAttributeUIComponent.c:27
SCR_ButtonBoxMultiSelectAttributeUIComponent
Definition
SCR_ButtonBoxMultiSelectAttributeUIComponent.c:4
SCR_ButtonBoxMultiSelectAttributeUIComponent::SetFromVar
override void SetFromVar(SCR_BaseEditorAttributeVar var)
Definition
SCR_ButtonBoxMultiSelectAttributeUIComponent.c:26
SCR_ButtonBoxMultiSelectAttributeUIComponent::m_bUseCustomFlags
bool m_bUseCustomFlags
Definition
SCR_ButtonBoxMultiSelectAttributeUIComponent.c:5
SCR_ButtonBoxMultiSelectAttributeUIComponent::OnMultiSelectButton
override void OnMultiSelectButton(SCR_ToolboxComponent toolbox, int index, bool state)
Definition
SCR_ButtonBoxMultiSelectAttributeUIComponent.c:141
SCR_ButtonBoxMultiSelectAttributeUIComponent::Init
override void Init(Widget w, SCR_BaseEditorAttribute attribute)
Definition
SCR_ButtonBoxMultiSelectAttributeUIComponent.c:7
SCR_ButtonBoxMultiSelectAttributeUIComponent::OnChangeInternal
override bool OnChangeInternal(Widget w, int x, int y, bool finished)
Definition
SCR_ButtonBoxMultiSelectAttributeUIComponent.c:78
SCR_ToolboxComponent
Definition
SCR_ToolboxComponent.c:3
Widget
Definition
Widget.c:13
int
Definition
int.c:13
vector
Definition
vector.c:13
Vector
proto native vector Vector(float x, float y, float z)
scripts
Game
Editor
UI
Components
Attributes
SCR_ButtonBoxMultiSelectAttributeUIComponent.c
Generated by
1.17.0