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_Credits.c
Go to the documentation of this file.
1
class
SCR_Credits
:
ChimeraMenuBase
2
{
3
protected
const
int
NUMBER_OF_TEXTWIDGETS
= 6;
4
protected
const
int
NAME_TIMEOUT
= 5000;
//How long will names appear on screen 5000
5
protected
const
int
NAME_CHANGE_DELAY
= 3000;
//Delay between names 3000
6
protected
const
float
NAME_ANIMATION_TIME
= 0.5;
//How long will fadeout animation
7
protected
const
float
NAME_ANIMATION_CREDITS
= 0.6;
8
protected
const
int
BACKGROUND_CHANGE_INTERVAL
= 10000;
9
protected
static
const
ref array<int>
PAGE_NAME_SIZE
= { 14, 12, 10, 9, 8, 7, 7 };
10
11
protected
ResourceName
m_sNamesLists
=
"{3D0DE92D54AEA7D9}Configs/Credits/credits.conf"
;
12
protected
ResourceName
m_sMusicFile
=
"{27FAA69A3BD0473C}Sounds/Music/Ingame/Samples/MU_MilitaryBasePositive_BEYOND THE VEIL v2.wav"
;
13
private
ref array<ref SCR_CreditsDepartmentHeader> m_aCreditsNameList = {};
14
private
ref array<ResourceName> m_aCreditsBackgrounds = {};
15
private
ResourceName m_CurrentBackground;
16
protected
Widget
m_wFooter
;
17
protected
Widget
m_wCreditsMain
;
18
protected
ImageWidget
m_wBackgroundImage
;
19
protected
ImageWidget
m_wSideVignette
;
20
protected
TextWidget
m_wCreditsText
;
21
protected
ref array<ref RichTextWidget>
m_aDepartments
= {};
22
protected
ref array<ref RichTextWidget>
m_aNames
= {};
23
protected
bool
m_bLastCycle
;
24
protected
RichTextWidget
m_wLastDepartment
;
25
protected
RichTextWidget
m_wLastText
;
26
27
//------------------------------------------------------------------------------------------------
28
override
void
OnMenuOpen
()
29
{
30
m_wFooter
=
GetRootWidget
().FindAnyWidget(
"Footer"
);
31
m_wBackgroundImage
=
ImageWidget
.Cast(
GetRootWidget
().FindAnyWidget(
"BackgroundImage"
));
32
m_wSideVignette
=
ImageWidget
.Cast(
GetRootWidget
().FindAnyWidget(
"BackgroundVignette"
));
33
m_wCreditsText
=
RichTextWidget
.Cast(
GetRootWidget
().FindAnyWidget(
"Credits"
));
34
m_wCreditsMain
=
GetRootWidget
().FindAnyWidget(
"VerticalLayoutOP"
);
35
RichTextWidget
dept =
RichTextWidget
.Cast(
GetRootWidget
().FindAnyWidget(
"DeptName"
));
36
RichTextWidget
name =
RichTextWidget
.Cast(
GetRootWidget
().FindAnyWidget(
"Names"
));
37
Widget
holder =
GetRootWidget
().FindAnyWidget(
"lastFrame"
);
38
m_wLastDepartment
=
RichTextWidget
.Cast(holder.FindAnyWidget(
"DeptName"
));
39
m_wLastText
=
RichTextWidget
.Cast(holder.FindAnyWidget(
"Names"
));
40
41
m_bLastCycle
=
false
;
42
m_aDepartments
.Insert(dept);
43
m_aNames
.Insert(name);
44
45
//Set up text widgets for later use
46
47
for
(
int
i = 0; i <
NUMBER_OF_TEXTWIDGETS
; i++)
48
{
49
dept =
RichTextWidget
.Cast(name.GetParent().GetSibling().FindAnyWidget(
"DeptName"
));
50
name =
RichTextWidget
.Cast(name.GetParent().GetSibling().FindAnyWidget(
"Names"
));
51
m_aDepartments
.Insert(dept);
52
m_aNames
.Insert(name);
53
}
54
55
//Make them invisible TODO: Change in Widget
56
57
for
(
int
i, count =
m_aDepartments
.Count(); i<count; i++)
58
{
59
m_aDepartments
[i].GetParent().SetVisible(
false
);
60
}
61
62
super.OnMenuOpen();
63
// Subscribe to buttons
64
SCR_InputButtonComponent
back =
SCR_InputButtonComponent
.
GetInputButtonComponent
(
UIConstants
.BUTTON_BACK,
m_wFooter
);
65
if
(back)
66
back.
m_OnActivated
.Insert(
EndCredits
);
67
68
SCR_InputButtonComponent
licenses =
SCR_InputButtonComponent
.
GetInputButtonComponent
(
"Licenses"
,
m_wFooter
);
69
if
(licenses)
70
licenses.
m_OnActivated
.Insert(
OnLicenses
);
71
72
Resource
container =
BaseContainerTools
.LoadContainer(
m_sNamesLists
);
73
if
(container && container.IsValid())
74
{
75
SCR_CreditsHeader
list =
SCR_CreditsHeader
.Cast(
BaseContainerTools
.CreateInstanceFromContainer(container.GetResource().ToBaseContainer()));
76
if
(list)
77
{
78
list.GetCreditsDepartmentList(m_aCreditsNameList);
79
list.GetBackgrounds(m_aCreditsBackgrounds);
80
}
81
}
82
StartCredits
();
83
}
84
85
//------------------------------------------------------------------------------------------------
86
void
StartCredits
()
87
{
88
ChangeBackground
();
89
90
AnimateWidget
.
Opacity
(
m_wBackgroundImage
, 1,
NAME_ANIMATION_TIME
);
91
AnimateWidget
.
Opacity
(
m_wSideVignette
, 1,
NAME_ANIMATION_CREDITS
);
92
AnimateWidget
.
Opacity
(
m_wCreditsText
, 1,
NAME_ANIMATION_CREDITS
);
93
GetGame
().GetCallqueue().CallLater(
ShowNames
, 3000,
false
,0,0);
94
GetGame
().GetCallqueue().CallLater(
ChangeBackground
,
BACKGROUND_CHANGE_INTERVAL
,
true
);
95
}
96
97
//------------------------------------------------------------------------------------------------
98
void
ChangeBackground
()
99
{
100
if
(!m_CurrentBackground)
101
m_CurrentBackground = m_aCreditsBackgrounds.GetRandomElement();
102
else
103
{
104
int
backgroundIndex = m_aCreditsBackgrounds.Find(m_CurrentBackground);
105
backgroundIndex++;
106
if
(m_aCreditsBackgrounds.Count() == backgroundIndex)
107
backgroundIndex = 0;
108
109
m_CurrentBackground = m_aCreditsBackgrounds.Get(backgroundIndex);
110
}
111
112
m_wBackgroundImage
.LoadImageTexture(0, m_CurrentBackground);
113
}
114
115
//------------------------------------------------------------------------------------------------
116
void
ShowNames
(
int
departments,
int
names)
117
{
118
//Initial variables and an array
119
120
for
(
int
i, count =
m_aDepartments
.Count(); i<count; i++)
121
{
122
m_aDepartments
[i].GetParent().SetVisible(
false
);
123
}
124
125
string
deptName;
126
int
deptCount = 0;
127
int
nameCount = 0;
128
int
cycleCount = 0;
129
int
counter = 0;
130
string
nameGlobal;
131
ref array<ref SCR_CreditsPersonName> CreditsNames = {};
132
133
if
(departments == m_aCreditsNameList.Count())
134
{
135
EndCredits
();
136
return
;
137
}
138
139
//Master FOR cycle for going throught departments. This BREAKS when there is no more free space on screen
140
for
(
int
x = departments, count = m_aCreditsNameList.Count(); x < count; x++)
141
{
142
//Get the department name and set it, also get number of names
143
deptName = m_aCreditsNameList[x].GetDeptName();
144
CreditsNames.Clear();
145
m_aCreditsNameList[x].GetCreditsNamesList(CreditsNames);
146
nameCount = nameCount + CreditsNames.Count();
147
148
counter = 0;
149
150
//If there are more names from the previous screen to be shown now, subtract the number of names from previous screen to be shown
151
152
if
(names > 0)
153
{
154
counter = CreditsNames.Count() - names;
155
nameCount -= counter;
156
names = 0;
157
}
158
159
//If there are more names in this department than there is screen space, save the number of names to be shown on the next screen
160
161
if
(nameCount >
PAGE_NAME_SIZE
[cycleCount])
162
names = nameCount -
PAGE_NAME_SIZE
[cycleCount];
163
164
if
(!
m_bLastCycle
)
165
{
166
m_aDepartments
[cycleCount].GetParent().SetVisible(
true
);
167
m_aDepartments
[cycleCount].SetText(deptName);
168
}
169
else
170
{
171
m_wLastDepartment
.GetParent().SetVisible(
true
);
172
m_wLastDepartment
.SetText(deptName);
173
}
174
175
//for cycle for getting all names from department to one string
176
nameGlobal =
""
;
177
178
for
(
int
i = counter, countx = CreditsNames.Count(); i < countx - names; i++)
179
{
180
if
(i<0)
181
i = 0;
182
183
nameGlobal = nameGlobal + CreditsNames[i].GetPersonName() +
"<br/>"
;
184
}
185
186
//if there are no names to be shown, dont make the dept. name visible
187
188
if
(nameGlobal ==
""
)
189
m_aDepartments
[cycleCount].GetParent().SetVisible(
false
);
190
191
if
(
m_bLastCycle
)
192
{
193
m_wLastText
.SetText(nameGlobal)
194
}
195
else
196
m_aNames
[cycleCount].SetText(nameGlobal);
197
198
//if there are names to be shown, there is no more space on screen. Break loop and change screens.
199
200
deptCount = x;
201
if
(names > 0)
202
break
;
203
//If there are no names, show next department
204
deptCount++;
205
206
//If there are exactly the number of names to be shown, next screen
207
if
(nameCount ==
PAGE_NAME_SIZE
[cycleCount])
208
break
;
209
210
//If the loop is over, end it
211
212
if
(departments >= m_aCreditsNameList.Count())
213
{
214
EndCredits
();
215
}
216
217
cycleCount++;
218
219
if
(departments >= m_aCreditsNameList.Count() - 2)
220
{
221
m_bLastCycle
=
true
;
222
break
;
223
}
224
225
if
(!
m_bLastCycle
)
226
{
227
deptName = m_aCreditsNameList[deptCount].GetDeptName();
228
229
if
(deptName.Contains(
"EnfLead"
) || deptName.Contains(
"Associate"
) || deptName.Contains(
"Community"
) || deptName.Contains(
"Platform"
) || deptName.Contains(
"LeadProducer"
))
230
continue
;
231
else
232
if
(deptName.Contains(
"Lead"
) || deptName.Contains(
"Composer"
) || deptName.Contains(
"MarketingProduction"
) || deptName.Contains(
"Consultants"
) || deptName.Contains(
"Manager"
) || deptName.Contains(
"Photographer"
) || deptName.Contains(
"CEO"
) || deptName.Contains(
"AnimationOutsource"
) || deptName.Contains(
"ReforgerBabies"
) || deptName.Contains(
"LegalNotices"
))
233
break
;
234
}
235
}
236
//Switch to next slide with animation
237
AnimateWidget
.
Opacity
(
m_wCreditsMain
, 1,
NAME_ANIMATION_TIME
);
238
GetGame
().GetCallqueue().CallLater(
HideNames
,
NAME_TIMEOUT
,
false
,deptCount,names);
239
}
240
241
//------------------------------------------------------------------------------------------------
242
void
HideNames
(
int
departments,
int
names)
243
{
244
AnimateWidget
.
Opacity
(
m_wCreditsMain
, 0,
NAME_ANIMATION_TIME
);
245
GetGame
().GetCallqueue().CallLater(
ShowNames
,
NAME_CHANGE_DELAY
,
false
,departments,names);
246
}
247
248
//------------------------------------------------------------------------------------------------
249
void
EndCredits
()
250
{
251
GetGame
().GetCallqueue().Remove(
ShowNames
);
252
GetGame
().GetCallqueue().Remove(
HideNames
);
253
GetGame
().GetCallqueue().Remove(
ChangeBackground
);
254
GetGame
().GetMenuManager().CloseMenuByPreset(
ChimeraMenuPreset
.CreditsMenu)
255
}
256
257
void
OnLicenses
()
258
{
259
//GetGame().GetMenuManager().CloseMenuByPreset(ChimeraMenuPreset.CreditsMenu);
260
GetGame
().GetMenuManager().OpenMenu(
ChimeraMenuPreset
.CreditsLicensesMenu);
261
262
}
263
};
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition
ChimeraMenuBase.c:4
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
GetRootWidget
Widget GetRootWidget()
Definition
SCR_ModularButtonComponent.c:189
AnimateWidget
Definition
AnimateWidget.c:3
AnimateWidget::Opacity
static WidgetAnimationOpacity Opacity(Widget widget, float targetValue, float speed, bool toggleVisibility=false)
Definition
AnimateWidget.c:167
BaseContainerTools
Definition
BaseContainerTools.c:13
ChimeraMenuBase
Constant variables used in various menus.
Definition
ChimeraMenuBase.c:72
ImageWidget
Definition
ImageWidget.c:13
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
ResourceName
Definition
ResourceName.c:13
RichTextWidget
Definition
RichTextWidget.c:13
SCR_CreditsHeader
Definition
SCR_CreditsNameList.c:38
SCR_Credits
Definition
SCR_Credits.c:2
SCR_Credits::NAME_ANIMATION_CREDITS
const float NAME_ANIMATION_CREDITS
Definition
SCR_Credits.c:7
SCR_Credits::m_wCreditsMain
Widget m_wCreditsMain
Definition
SCR_Credits.c:17
SCR_Credits::BACKGROUND_CHANGE_INTERVAL
const int BACKGROUND_CHANGE_INTERVAL
Definition
SCR_Credits.c:8
SCR_Credits::m_wLastDepartment
RichTextWidget m_wLastDepartment
Definition
SCR_Credits.c:24
SCR_Credits::ShowNames
void ShowNames(int departments, int names)
Definition
SCR_Credits.c:116
SCR_Credits::NUMBER_OF_TEXTWIDGETS
const int NUMBER_OF_TEXTWIDGETS
Definition
SCR_Credits.c:3
SCR_Credits::m_wFooter
Widget m_wFooter
Definition
SCR_Credits.c:16
SCR_Credits::m_wBackgroundImage
ImageWidget m_wBackgroundImage
Definition
SCR_Credits.c:18
SCR_Credits::HideNames
void HideNames(int departments, int names)
Definition
SCR_Credits.c:242
SCR_Credits::m_wLastText
RichTextWidget m_wLastText
Definition
SCR_Credits.c:25
SCR_Credits::m_sMusicFile
ResourceName m_sMusicFile
Definition
SCR_Credits.c:12
SCR_Credits::OnMenuOpen
override void OnMenuOpen()
Definition
SCR_Credits.c:28
SCR_Credits::NAME_TIMEOUT
const int NAME_TIMEOUT
Definition
SCR_Credits.c:4
SCR_Credits::m_bLastCycle
bool m_bLastCycle
Definition
SCR_Credits.c:23
SCR_Credits::m_wCreditsText
TextWidget m_wCreditsText
Definition
SCR_Credits.c:20
SCR_Credits::PAGE_NAME_SIZE
static const ref array< int > PAGE_NAME_SIZE
Definition
SCR_Credits.c:9
SCR_Credits::StartCredits
void StartCredits()
Definition
SCR_Credits.c:86
SCR_Credits::EndCredits
void EndCredits()
Definition
SCR_Credits.c:249
SCR_Credits::m_aNames
ref array< ref RichTextWidget > m_aNames
Definition
SCR_Credits.c:22
SCR_Credits::NAME_ANIMATION_TIME
const float NAME_ANIMATION_TIME
Definition
SCR_Credits.c:6
SCR_Credits::m_sNamesLists
ResourceName m_sNamesLists
Definition
SCR_Credits.c:11
SCR_Credits::ChangeBackground
void ChangeBackground()
Definition
SCR_Credits.c:98
SCR_Credits::OnLicenses
void OnLicenses()
Definition
SCR_Credits.c:257
SCR_Credits::NAME_CHANGE_DELAY
const int NAME_CHANGE_DELAY
Definition
SCR_Credits.c:5
SCR_Credits::m_aDepartments
ref array< ref RichTextWidget > m_aDepartments
Definition
SCR_Credits.c:21
SCR_Credits::m_wSideVignette
ImageWidget m_wSideVignette
Definition
SCR_Credits.c:19
SCR_InputButtonComponent
Definition
SCR_InputButtonComponent.c:2
SCR_InputButtonComponent::m_OnActivated
ref ScriptInvoker m_OnActivated
Definition
SCR_InputButtonComponent.c:153
SCR_InputButtonComponent::GetInputButtonComponent
static SCR_InputButtonComponent GetInputButtonComponent(string name, notnull Widget parent, bool searchAllChildren=true)
Definition
SCR_InputButtonComponent.c:1212
TextWidget
Definition
TextWidget.c:16
UIConstants
Definition
Constants.c:151
Widget
Definition
Widget.c:13
scripts
Game
Credits
SCR_Credits.c
Generated by
1.17.0