Arma Reforger Explorer
1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BaseGroup.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
4
class
SCR_BaseGroup
: ScriptedSelectionMenuEntry
5
{
7
protected
IEntity m_pOwner;
9
protected
ref array<ref SCR_BaseGroupEntry> m_aEntries;
11
protected
int
m_iSelectedIndex;
13
protected
SCR_BaseGroupEntry
m_pSelectedEntry;
15
protected
BaseSelectionMenu
m_pSourceMenu;
16
17
//------------------------------------------------------------------------------------------------
19
protected
override
bool
CanBePerformedScript(IEntity user,
BaseSelectionMenu
sourceMenu)
20
{
21
// TODO: Define actual logic?
22
if
(m_iSelectedIndex < 0)
23
return
false
;
24
25
if
(m_iSelectedIndex > Count() - 1)
26
return
false
;
27
28
return
m_aEntries
[m_iSelectedIndex].CanBePerformed(user, sourceMenu);
29
}
30
31
//------------------------------------------------------------------------------------------------
32
protected
override
bool
GetEntryNameScript(out
string
outName)
33
{
34
if
(m_pSelectedEntry)
35
{
36
auto
entryName = m_pSelectedEntry.GetEntryName();
37
outName = entryName;
38
return
true
;
39
}
40
41
outName =
"Empty"
;
42
return
true
;
43
}
44
45
//------------------------------------------------------------------------------------------------
46
protected
override
UIInfo
GetUIInfoScript()
47
{
48
if
(m_pSelectedEntry)
49
{
50
return
m_pSelectedEntry.GetUIInfo();
51
}
52
53
return
null
;
54
}
55
56
//------------------------------------------------------------------------------------------------
58
int
Count() {
return
m_aEntries
.Count(); }
59
60
//------------------------------------------------------------------------------------------------
62
void
SelectNext()
63
{
64
auto
index
= m_iSelectedIndex+1;
65
if
(
index
> Count() -1)
66
index
= 0;
67
68
Select(
index
);
69
}
70
71
//------------------------------------------------------------------------------------------------
73
void
SelectPrevious()
74
{
75
auto
index
= m_iSelectedIndex-1;
76
if
(
index
< 0)
77
index
= Count() - 1;
78
79
Select(
index
);
80
}
81
82
//------------------------------------------------------------------------------------------------
85
void
Select(
int
index
)
86
{
87
// Deselect selected item
88
if
(
index
== -1)
89
{
90
if
(m_pSelectedEntry)
91
m_pSelectedEntry.OnDonePerform(m_pOwner, m_pSourceMenu);
92
93
94
m_pSelectedEntry =
null
;
95
m_iSelectedIndex = -1;
96
return
;
97
}
98
99
// Make sure selection is valid and not out of range
100
if
(index < 0 || index > Count() -1)
101
return
;
102
103
// Try to actually select the entry
104
SCR_BaseGroupEntry
entry =
m_aEntries
[
index
];
105
if
(entry)
106
{
107
// Deselect previous entry
108
if
(m_pSelectedEntry && m_pSelectedEntry != entry)
109
{
110
m_pSelectedEntry.OnDonePerform(m_pOwner, m_pSourceMenu);
111
m_pSelectedEntry =
null
;
112
}
113
114
m_pSelectedEntry = entry;
115
m_iSelectedIndex =
index
;
116
}
117
}
118
120
protected
override
void
OnPerform(IEntity user,
BaseSelectionMenu
sourceMenu)
121
{
122
if
(m_pSelectedEntry)
123
{
124
m_pSelectedEntry.Perform(user, sourceMenu);
125
}
126
}
127
128
//------------------------------------------------------------------------------------------------
130
IEntity GetOwner() {
return
m_pOwner; }
131
132
//------------------------------------------------------------------------------------------------
134
SCR_BaseGroupEntry
GetSelectedEntry() {
return
m_pSelectedEntry; }
135
136
//------------------------------------------------------------------------------------------------
138
void
SCR_BaseGroup
(IEntity owner, array<ref SCR_BaseGroupEntry> entries)
139
{
140
// Assign the owner entity
141
m_pOwner = owner;
142
143
// Prepare array and set all the entries
144
m_aEntries
=
new
array<ref SCR_BaseGroupEntry>();
145
foreach
(
auto
entry : entries)
146
m_aEntries
.Insert(entry);
147
}
148
};
UIInfo
UIInfo - declare object, allows to define UI elements.
Definition:
UIInfo.c:13
SCR_BaseGroupEntry
An abstract wrapper to provide common interface for items that can be stored in a BaseGroup.
Definition:
SCR_BaseGroupEntry.c:3
m_aEntries
protected ref array< ref SCR_TextsTaskManagerEntry > m_aEntries
Definition:
SCR_TextsTaskManagerComponent.c:3
SCR_BaseGroup
Definition:
SCR_BaseGroup.c:4
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition:
SCR_DestructionSynchronizationComponent.c:17
BaseSelectionMenu
Definition:
BaseSelectionMenu.c:12
scripts_Arma_Reforger_v1.1.0.42
scripts
Game
ItemSelection
SCR_BaseGroup.c
Generated by
1.8.17