Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_Credits.c
Go to the documentation of this file.
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;
21 protected ref array<ref RichTextWidget> m_aDepartments = {};
22 protected ref array<ref RichTextWidget> m_aNames = {};
23 protected bool m_bLastCycle;
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
65 if (back)
66 back.m_OnActivated.Insert(EndCredits);
67
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 }
83 }
84
85 //------------------------------------------------------------------------------------------------
96
97 //------------------------------------------------------------------------------------------------
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
238 GetGame().GetCallqueue().CallLater(HideNames,NAME_TIMEOUT,false,deptCount,names);
239 }
240
241 //------------------------------------------------------------------------------------------------
242 void HideNames(int departments, int names)
243 {
245 GetGame().GetCallqueue().CallLater(ShowNames,NAME_CHANGE_DELAY,false,departments,names);
246 }
247
248 //------------------------------------------------------------------------------------------------
250 {
251 GetGame().GetCallqueue().Remove(ShowNames);
252 GetGame().GetCallqueue().Remove(HideNames);
253 GetGame().GetCallqueue().Remove(ChangeBackground);
254 GetGame().GetMenuManager().CloseMenuByPreset(ChimeraMenuPreset.CreditsMenu)
255 }
256
258 {
259 //GetGame().GetMenuManager().CloseMenuByPreset(ChimeraMenuPreset.CreditsMenu);
260 GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.CreditsLicensesMenu);
261
262 }
263};
ChimeraMenuPreset
Menu presets.
ArmaReforgerScripted GetGame()
Definition game.c:1398
Widget GetRootWidget()
static WidgetAnimationOpacity Opacity(Widget widget, float targetValue, float speed, bool toggleVisibility=false)
Constant variables used in various menus.
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
const float NAME_ANIMATION_CREDITS
Definition SCR_Credits.c:7
Widget m_wCreditsMain
Definition SCR_Credits.c:17
const int BACKGROUND_CHANGE_INTERVAL
Definition SCR_Credits.c:8
RichTextWidget m_wLastDepartment
Definition SCR_Credits.c:24
void ShowNames(int departments, int names)
const int NUMBER_OF_TEXTWIDGETS
Definition SCR_Credits.c:3
Widget m_wFooter
Definition SCR_Credits.c:16
ImageWidget m_wBackgroundImage
Definition SCR_Credits.c:18
void HideNames(int departments, int names)
RichTextWidget m_wLastText
Definition SCR_Credits.c:25
ResourceName m_sMusicFile
Definition SCR_Credits.c:12
override void OnMenuOpen()
Definition SCR_Credits.c:28
const int NAME_TIMEOUT
Definition SCR_Credits.c:4
bool m_bLastCycle
Definition SCR_Credits.c:23
TextWidget m_wCreditsText
Definition SCR_Credits.c:20
static const ref array< int > PAGE_NAME_SIZE
Definition SCR_Credits.c:9
void StartCredits()
Definition SCR_Credits.c:86
void EndCredits()
ref array< ref RichTextWidget > m_aNames
Definition SCR_Credits.c:22
const float NAME_ANIMATION_TIME
Definition SCR_Credits.c:6
ResourceName m_sNamesLists
Definition SCR_Credits.c:11
void ChangeBackground()
Definition SCR_Credits.c:98
void OnLicenses()
const int NAME_CHANGE_DELAY
Definition SCR_Credits.c:5
ref array< ref RichTextWidget > m_aDepartments
Definition SCR_Credits.c:21
ImageWidget m_wSideVignette
Definition SCR_Credits.c:19
static SCR_InputButtonComponent GetInputButtonComponent(string name, notnull Widget parent, bool searchAllChildren=true)