3 protected const int NUMBER_OF_TEXTWIDGETS = 6;
4 protected const int NAME_TIMEOUT = 5000;
5 protected const int NAME_CHANGE_DELAY = 3000;
6 protected const float NAME_ANIMATION_TIME = 0.5;
7 protected const float NAME_ANIMATION_CREDITS = 0.6;
8 protected const int BACKGROUND_CHANGE_INTERVAL = 10000;
9 protected const ref array<ref int> PAGE_NAME_SIZE = {14, 12, 10, 9, 8, 7, 7};
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;
28 override void OnMenuOpen()
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"));
38 m_wLastDepartment = RichTextWidget.Cast(holder.FindAnyWidget(
"DeptName"));
39 m_wLastText = RichTextWidget.Cast(holder.FindAnyWidget(
"Names"));
42 m_aDepartments.Insert(dept);
43 m_aNames.Insert(name);
47 for(
int i = 0; i < NUMBER_OF_TEXTWIDGETS; i++)
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);
57 for(
int i, count = m_aDepartments.Count(); i<count; i++)
59 m_aDepartments[i].GetParent().SetVisible(
false);
66 back.m_OnActivated.Insert(EndCredits);
70 licenses.m_OnActivated.Insert(OnLicenses);
72 Resource container = BaseContainerTools.LoadContainer(m_sNamesLists);
73 if (container && container.IsValid())
78 list.GetCreditsDepartmentList(m_aCreditsNameList);
79 list.GetBackgrounds(m_aCreditsBackgrounds);
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);
98 void ChangeBackground()
100 if (!m_CurrentBackground)
101 m_CurrentBackground = m_aCreditsBackgrounds.GetRandomElement();
104 int backgroundIndex = m_aCreditsBackgrounds.Find(m_CurrentBackground);
106 if (m_aCreditsBackgrounds.Count() == backgroundIndex)
109 m_CurrentBackground = m_aCreditsBackgrounds.Get(backgroundIndex);
112 m_wBackgroundImage.LoadImageTexture(0, m_CurrentBackground);
116 void ShowNames(
int departments,
int names)
120 for(
int i, count = m_aDepartments.Count(); i<count; i++)
122 m_aDepartments[i].GetParent().SetVisible(
false);
131 ref array<ref SCR_CreditsPersonName> CreditsNames = {};
133 if (departments == m_aCreditsNameList.Count())
140 for (
int x = departments, count = m_aCreditsNameList.Count(); x < count; x++)
143 deptName = m_aCreditsNameList[x].GetDeptName();
144 CreditsNames.Clear();
145 m_aCreditsNameList[x].GetCreditsNamesList(CreditsNames);
146 nameCount = nameCount + CreditsNames.Count();
154 counter = CreditsNames.Count() - names;
155 nameCount -= counter;
161 if (nameCount > PAGE_NAME_SIZE[cycleCount])
162 names = nameCount - PAGE_NAME_SIZE[cycleCount];
166 m_aDepartments[cycleCount].GetParent().SetVisible(
true);
167 m_aDepartments[cycleCount].SetText(deptName);
171 m_wLastDepartment.GetParent().SetVisible(
true);
172 m_wLastDepartment.SetText(deptName);
178 for (
int i = counter, countx = CreditsNames.Count(); i < countx - names; i++)
183 nameGlobal = nameGlobal + CreditsNames[i].GetPersonName() +
"<br/>";
188 if (nameGlobal ==
"")
189 m_aDepartments[cycleCount].GetParent().SetVisible(
false);
193 m_wLastText.SetText(nameGlobal)
196 m_aNames[cycleCount].SetText(nameGlobal);
207 if (nameCount == PAGE_NAME_SIZE[cycleCount])
212 if (departments >= m_aCreditsNameList.Count())
219 if (departments >= m_aCreditsNameList.Count() - 2)
227 deptName = m_aCreditsNameList[deptCount].GetDeptName();
229 if (deptName.Contains(
"EnfLead") || deptName.Contains(
"Associate") || deptName.Contains(
"Community") || deptName.Contains(
"Platform") || deptName.Contains(
"LeadProducer"))
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"))
237 AnimateWidget.Opacity(m_wCreditsMain, 1, NAME_ANIMATION_TIME);
238 GetGame().GetCallqueue().CallLater(HideNames,NAME_TIMEOUT,
false,deptCount,names);
242 void HideNames(
int departments,
int names)
244 AnimateWidget.Opacity(m_wCreditsMain, 0, NAME_ANIMATION_TIME);
245 GetGame().GetCallqueue().CallLater(ShowNames,NAME_CHANGE_DELAY,
false,departments,names);
251 GetGame().GetCallqueue().Remove(ShowNames);
252 GetGame().GetCallqueue().Remove(HideNames);
253 GetGame().GetCallqueue().Remove(ChangeBackground);