3 protected bool m_bMissionDataRetrieved;
5 protected const string AUTHOR_FORMAT =
"#AR-AuthorLoadingScreen";
6 protected const string AUTHOR_UNKNOWN =
"#AR-Author_Unknown";
8 protected const float MAX_DESCRIPTION_LENGTH = 1000;
9 protected const float FADE_TIME = 1;
11 private float m_fLoadingTime_MissionDataRetrieved;
12 private float m_fProgressBar_Progress;
15 protected Widget m_wBuildVersion;
18 override protected void HandlerAttached(Widget w)
20 super.HandlerAttached(w);
26 override protected void InitWidgets()
30 m_Widgets.m_wContentOverlay.SetOpacity(0);
33 m_Widgets.m_wPreloadContent.SetVisible(
true);
35 m_Widgets.m_wContentOverlay.SetVisible(
true);
36 m_Widgets.m_wBlackOverlay.SetVisible(
true);
38 #ifdef DEBUG_LOADING_SCREENS
39 m_Widgets.m_wCrossplayWarning.SetVisible(
true);
40 m_Widgets.m_wModdedWarning.SetVisible(
true);
42 m_Widgets.m_wCrossplayWarning.SetVisible(
false);
43 m_Widgets.m_wModdedWarning.SetVisible(
false);
50 #ifdef DEBUG_LOADING_SCREENS
51 PrintFormat(
">> %1 >> OnMissionDataRetrieved | header: %2",
this, header);
55 m_wBuildVersion =
GetGame().GetWorkspace().CreateWidgets(
"{B7A765172F0BD4D9}UI/layouts/Common/GameVersionWatermark.layout",
m_wRoot);
56 m_wBuildVersion.SetZOrder(1);
57 m_wBuildVersion.SetVisible(
false);
66 if (m_LoadingHintComponent)
67 m_Widgets.m_wHintText.AddHandler(m_LoadingHintComponent);
70 string description = header.m_sDetails;
71 if (description ==
string.Empty)
72 description = header.m_sDescription;
74 description = WidgetManager.Translate(description);
76 if (description.Length() > MAX_DESCRIPTION_LENGTH)
78 description = description.Substring(0, MAX_DESCRIPTION_LENGTH);
82 string image = header.m_sLoadingScreen;
83 if (image ==
string.Empty)
84 image = header.m_sIcon;
87 m_Widgets.m_wTitle.SetText(header.m_sName);
90 m_Widgets.m_wDescription.SetText(description);
94 if (header.m_sAuthor.IsEmpty())
95 m_Widgets.m_wAuthor.SetText(AUTHOR_UNKNOWN);
98 string author = WidgetManager.Translate(AUTHOR_FORMAT);
99 m_Widgets.m_wAuthor.SetText(author + header.m_sAuthor);
105 m_Widgets.m_wLoadingImage.LoadImageTexture(0, image);
109 m_bMissionDataRetrieved =
true;
110 m_fLoadingTime_MissionDataRetrieved = m_fLoadingTime;
114 override void OnHide()
116 if (m_bMissionDataRetrieved)
122 if (m_LoadingHintComponent)
123 m_LoadingHintComponent.OnLoadingFinished();
125 SaveLoadingTime(m_fLoadingTime);
130 override void Update(
float timeSlice,
float progress = 0,
float minDurationRatio = 0)
132 super.Update(timeSlice, progress, minDurationRatio);
134 #ifdef DEBUG_LOADING_SCREENS
135 PrintFormat(
">> %1 >> Update | timeSlice: %2 | progress: %3 | m_fLoadingTime: %4",
this, timeSlice, progress, m_fLoadingTime);
138 if (!m_bMissionDataRetrieved)
142 if (m_LoadingHintComponent)
143 m_LoadingHintComponent.Update(timeSlice);
146 SetProgressBar(progress);
150 m_SpinnerComp.Update(timeSlice);
153 if (m_fLoadingTime <= m_fLoadingTime_MissionDataRetrieved + FADE_TIME)
155 Fade(
m_Widgets.m_wContentOverlay,
true, FADE_TIME, timeSlice);
158 else if (m_fLoadingTime <= m_fLoadingTime_MissionDataRetrieved + 2 * FADE_TIME)
160 m_Widgets.m_wPreloadContent.SetVisible(
false);
162 m_wBuildVersion.SetVisible(
true);
164 Fade(
m_Widgets.m_wContentOverlay,
false, FADE_TIME, timeSlice);
169 m_Widgets.m_wPreloadContent.SetVisible(
false);
171 m_Widgets.m_wContentOverlay.SetOpacity(0);
176 protected void SetProgressBar(
float progress)
182 if (progress < m_fProgressBar_Progress)
183 progress = m_fProgressBar_Progress;
184 else if (progress > m_fProgressBar_Progress)
185 m_fProgressBar_Progress = progress;
187 HorizontalLayoutSlot.SetFillWeight(
m_Widgets.m_wProgressBarFill, progress);
188 HorizontalLayoutSlot.SetFillWeight(
m_Widgets.m_wProgressBarSpace, 1 - progress);
192 void SetJoiningCrossPlay(
bool isCrossPlay)
194 m_Widgets.m_wCrossplayWarning.SetVisible(isCrossPlay);
198 void SetLoadingModded(
bool isModded)
200 m_Widgets.m_wModdedWarning.SetVisible(isModded);