Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_DebriefingScreenComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/GameMode/Components", description: "Debriefing screen shown after game ends")]
3 {
4 }
5 
7 class SCR_DebriefingScreenComponent : SCR_DeployMenuBaseScreenComponent
8 {
9 }
10 
13 class SCR_DebriefingScreenUnevenFourTiles : SCR_DeployMenuBaseScreenLayout
14 {
15  [Attribute(defvalue: "{F7138F20BD16D89A}UI/layouts/Menus/DeployMenu/DebriefingScreenFourUnevenTiles.layout")]
16  protected ResourceName m_sFourUnevenTilesLayout;
17 
18  [Attribute()]
19  protected ref SCR_WelcomeScreenBaseContent m_TopLeftTile;
20 
21  [Attribute()]
22  protected ref SCR_WelcomeScreenBaseContent m_TopRightTile;
23 
24  [Attribute()]
25  protected ref SCR_WelcomeScreenBaseContent m_BottomLeftTile;
26 
27  [Attribute()]
28  protected ref SCR_WelcomeScreenBaseContent m_BottomRightTile;
29 
30  protected const string WELCOME_CONTENT = "WelcomeContent";
31 
32  protected const string TOP_LEFT_TILE = "TopLeftTile";
33  protected const string TOP_RIGHT_TILE = "TopRightTile";
34  protected const string BOTTOM_LEFT_TILE = "BottomLeftTile";
35  protected const string BOTTOM_RIGHT_TILE = "BottomRightTile";
36 
37  protected const string TOP_LEFT_TILE_BUTTON = "TopLeftTileButton";
38  protected const string TOP_RIGHT_TILE_BUTTON = "TopRightTileButton";
39  protected const string BOTTOM_LEFT_TILE_BUTTON = "BottomLeftTileButton";
40  protected const string BOTTOM_RIGHT_TILE_BUTTON = "BottomRightTileButton";
41 
42  //------------------------------------------------------------------------------------------------
43  override void InitContent(SCR_WelcomeScreenMenu menu)
44  {
45  Widget targetColumn = menu.GetRootWidget().FindAnyWidget(WELCOME_CONTENT);
46  if (!targetColumn)
47  return;
48 
49  GetGame().GetWorkspace().CreateWidgets(m_sFourUnevenTilesLayout, targetColumn);
50 
51  if (m_TopLeftTile)
52  {
53  m_aScreenBaseContents.Insert(m_TopLeftTile);
54  m_TopLeftTile.InitContent(menu, TOP_LEFT_TILE, TOP_LEFT_TILE_BUTTON);
55  }
56 
57  if (m_TopRightTile)
58  {
59  m_aScreenBaseContents.Insert(m_TopRightTile);
60  m_TopRightTile.InitContent(menu, TOP_RIGHT_TILE, TOP_RIGHT_TILE_BUTTON);
61  }
62 
63  if (m_BottomLeftTile)
64  {
65  m_aScreenBaseContents.Insert(m_BottomLeftTile);
66  m_BottomLeftTile.InitContent(menu, BOTTOM_LEFT_TILE, BOTTOM_LEFT_TILE_BUTTON);
67  }
68 
69  if (m_BottomRightTile)
70  {
71  m_aScreenBaseContents.Insert(m_BottomRightTile);
72  m_BottomRightTile.InitContent(menu, BOTTOM_RIGHT_TILE, BOTTOM_RIGHT_TILE_BUTTON);
73  }
74  }
75 }
76 
79 class SCR_DebriefingScreenBigImageContent : SCR_WelcomeScreenBaseContent
80 {
81  [Attribute("", UIWidgets.ResourcePickerThumbnail, "Big image to be shown", params: "edds")]
82  protected ResourceName m_sContentImage;
83 
84  [Attribute(defvalue: "{6CD5DC3DE2C54BBE}UI/layouts/Menus/DeployMenu/DebriefingScreenBigImageTile.layout")]
85  protected ResourceName m_sBigImageLayout;
86 
87  //------------------------------------------------------------------------------------------------
92  override void InitContent(SCR_WelcomeScreenMenu menu, string column, string columnButton)
93  {
94  Widget targetTile = menu.GetRootWidget().FindAnyWidget(column);
95  if (!targetTile)
96  return;
97 
98  Widget bigImageWidget = GetGame().GetWorkspace().CreateWidgets(m_sBigImageLayout, targetTile);
99  if (!bigImageWidget)
100  return;
101 
102  ImageWidget imageWidget = ImageWidget.Cast(bigImageWidget.FindAnyWidget("ImageWidget"));
103  if (imageWidget && m_sContentImage)
104  imageWidget.LoadImageTexture(0, m_sContentImage, false, false);
105  }
106 
107  //------------------------------------------------------------------------------------------------
110  ResourceName GetImage()
111  {
112  return m_sContentImage;
113  }
114 }
115 
118 class SCR_DebriefingScreenSummaryContent : SCR_WelcomeScreenBaseContent
119 {
120  [Attribute()]
121  protected string m_sTitleText;
122 
123  [Attribute()]
124  protected string m_sSubtitleText;
125 
126  [Attribute()]
127  protected string m_sSubtitleLostText;
128 
129  [Attribute()]
130  protected string m_sDescriptionText;
131 
132  [Attribute(defvalue: "{10A7983E48474CB2}UI/layouts/Menus/DeployMenu/DebriefingScreenSummaryTile.layout")]
133  protected ResourceName m_sSummaryLayout;
134 
135  protected Widget m_wSummaryWidget;
136 
137  //------------------------------------------------------------------------------------------------
142  override void InitContent(SCR_WelcomeScreenMenu menu, string column, string columnButton)
143  {
144  m_sContentName = column;
145 
146  Widget targetTile = menu.GetRootWidget().FindAnyWidget(column);
147  if (!targetTile)
148  return;
149 
150  m_wSummaryWidget = GetGame().GetWorkspace().CreateWidgets(m_sSummaryLayout, targetTile);
151  if (!m_wSummaryWidget)
152  return;
153 
154  FillSummaryWidget();
155 
156  //Invokers for in-game possibility to update these strings
157  //SOMETHING.SOMEINVOKER().Insert(UpdateSummarySubtitle);
158  //SOMETHING.SOMEINVOKER().Insert(UpdateSummaryDescription);
159  }
160 
161  //------------------------------------------------------------------------------------------------
163  protected void FillSummaryWidget()
164  {
165  string characterRank = "";
166  string subtitle = GetSubtitleLostText();
167  IEntity player = GetGame().GetPlayerController().GetControlledEntity();
168  if (player)
169  {
170  SCR_CharacterRankComponent rankComponent = SCR_CharacterRankComponent.Cast(player.FindComponent(SCR_CharacterRankComponent));
171  if (rankComponent)
172  characterRank = rankComponent.GetCharacterRankName(player);
173  }
174 
176  if (!gamemode)
177  return;
178 
179  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
180  if (!factionManager)
181  return;
182 
183  Faction faction = Faction.Cast(factionManager.GetLocalPlayerFaction());
184  if (!faction)
185  return;
186 
187  SCR_GameModeEndData endData = gamemode.GetEndGameData();
188  if (endData)
189  {
190  array<int> winnerIds = {};
191  array<int> winnerFactionIds = {};
192  endData.GetWinnerIds(winnerIds);
193  endData.GetFactionWinnerIds(winnerFactionIds);
194  if (!winnerFactionIds.IsEmpty())
195  {
196  if (winnerFactionIds.Contains(factionManager.GetFactionIndex(faction)))
197  subtitle = GetSubtitleText();
198  }
199  else if (!winnerIds.IsEmpty())
200  {
201  int playerID = GetGame().GetPlayerController().GetPlayerId();
202  if (winnerIds.Contains(playerID))
203  subtitle = GetSubtitleText();
204  }
205  }
206 
207  RichTextWidget subtitleText = RichTextWidget.Cast(m_wSummaryWidget.FindAnyWidget("SubtitleText"));
208  if (subtitleText)
209  subtitleText.SetTextFormat(subtitle, characterRank, string.Format("<color rgba=%1>%2</color>", UIColors.SRGBAFloatToInt(UIColors.CONTRAST_COLOR), GetGame().GetPlayerManager().GetPlayerName(GetGame().GetPlayerController().GetPlayerId())));
210 
211  RichTextWidget descriptionText = RichTextWidget.Cast(m_wSummaryWidget.FindAnyWidget("DescriptionText"));
212  if (!descriptionText)
213  return;
214 
215  descriptionText.SetText(GetDescriptionText());
216 
217  if (SCR_StringHelper.IsEmptyOrWhiteSpace(GetDescriptionText()))
218  {
219  SCR_GameOverScreenManagerComponent gameOverScreenMgr = SCR_GameOverScreenManagerComponent.Cast(gamemode.FindComponent(SCR_GameOverScreenManagerComponent));
220  if (!gameOverScreenMgr)
221  return;
222 
223  SCR_GameOverScreenConfig gameOverConfig = gameOverScreenMgr.GetGameOverConfig();
224  if (!gameOverConfig)
225  return;
226 
227  SCR_BaseGameOverScreenInfo gameOverScreenInfo;
228  gameOverConfig.GetGameOverScreenInfo(gameOverScreenMgr.GetCurrentGameOverType(), gameOverScreenInfo);
229  if (!gameOverScreenInfo)
230  return;
231 
232  if (!SCR_StringHelper.IsEmptyOrWhiteSpace(gameOverScreenInfo.GetDebriefing(faction, null)))
233  descriptionText.SetText(gameOverScreenInfo.GetDebriefing(faction, null));
234  else
235  descriptionText.SetText(gameOverScreenInfo.GetSubtitle(faction, null));
236  }
237  }
238 
239  //------------------------------------------------------------------------------------------------
242  void UpdateSummarySubtitle(string subtitle)
243  {
244  m_sSubtitleText = subtitle;
245  RichTextWidget subtitleText = RichTextWidget.Cast(m_wSummaryWidget.FindAnyWidget("SubtitleText"));
246  if (subtitleText)
247  subtitleText.SetText(subtitle);
248  }
249 
250  //------------------------------------------------------------------------------------------------
253  void UpdateSummaryDescription(string description)
254  {
255  m_sDescriptionText = description;
256  RichTextWidget descriptionText = RichTextWidget.Cast(m_wSummaryWidget.FindAnyWidget("DescriptionText"));
257  if (descriptionText)
258  descriptionText.SetText(description);
259  }
260 
261  //------------------------------------------------------------------------------------------------
263  string GetTitleText()
264  {
265  return m_sTitleText;
266  }
267 
268  //------------------------------------------------------------------------------------------------
270  string GetSubtitleText()
271  {
272  return m_sSubtitleText;
273  }
274 
275  //------------------------------------------------------------------------------------------------
277  string GetSubtitleLostText()
278  {
279  return m_sSubtitleLostText;
280  }
281 
282  //------------------------------------------------------------------------------------------------
284  string GetDescriptionText()
285  {
286  return m_sDescriptionText;
287  }
288 }
289 
292 class SCR_DebriefingScreenFinishedObjectivesContent : SCR_WelcomeScreenBaseContent
293 {
294  [Attribute()]
295  protected string m_sTitleText;
296 
297  [Attribute(defvalue: "{0B7DDF77E24F0C63}UI/layouts/Menus/DeployMenu/DebriefingScreenFinishedObjectivesTile.layout")]
298  protected ResourceName m_sFinishedObjectivesTileLayout;
299 
300  [Attribute(defvalue: "{6B9E63C758849B7F}UI/layouts/Menus/DeployMenu/DebriefingScreenMissionObjective.layout")]
301  protected ResourceName m_sFinishedObjectivesLayout;
302 
303  protected Widget m_wFinishedObjectivesWidget;
304  protected ButtonWidget m_wColumnButton;
305  protected ref array<SCR_BaseTask> m_aFinishedTasks = {};
306  protected ref array<Widget> m_aFinishedObjectivesWidgets = {};
307  protected int m_iCurrentPage;
308  protected int m_iFinishedTasksCount;
309 
310  //------------------------------------------------------------------------------------------------
315  override void InitContent(SCR_WelcomeScreenMenu menu, string column, string columnButton)
316  {
317  m_sContentName = column;
318 
319  Widget targetTile = menu.GetRootWidget().FindAnyWidget(column);
320  if (!targetTile)
321  return;
322 
323  m_wFinishedObjectivesWidget = GetGame().GetWorkspace().CreateWidgets(m_sFinishedObjectivesTileLayout, targetTile);
324  if (!m_wFinishedObjectivesWidget)
325  return;
326 
327  Widget finishedObjectivesContent = m_wFinishedObjectivesWidget.FindAnyWidget("FinishedObjectivesLayout");
328  if (!finishedObjectivesContent)
329  return;
330 
331  m_wColumnButton = ButtonWidget.Cast(menu.GetRootWidget().FindAnyWidget(columnButton));
332  if (!m_wColumnButton)
333  return;
334 
335  FillFinishedObjectivesWidget(finishedObjectivesContent);
336  InitPagination();
337  HandlePagination();
338  }
339 
340  //------------------------------------------------------------------------------------------------
343  override void ToggleInteractions(bool enabled)
344  {
345  HandlePagination(enabled);
346  }
347 
348  //------------------------------------------------------------------------------------------------
351  void ProcessTasks()
352  {
353  SCR_BaseTaskManager taskManager = GetTaskManager();
354  if (!taskManager)
355  return;
356 
357  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
358  if (!factionManager)
359  return;
360 
361  Faction faction = Faction.Cast(factionManager.GetLocalPlayerFaction());
362  if (!faction)
363  return;
364 
365  array<SCR_BaseTask> activeTasks = {};
366  taskManager.GetFilteredTasks(activeTasks, faction);
367  taskManager.GetFilteredFinishedTasks(m_aFinishedTasks, faction);
368 
369  m_iFinishedTasksCount = m_aFinishedTasks.Count();
370  SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
371  if (!campaign)
372  return;
373 
374  //TODO: Due to how Task system works, we need to process this task list
375  //Just for the Conflict so only the tasks for control points that are also under faction control are displayed
376  SCR_CampaignMilitaryBaseComponent baseComponent;
377  SCR_CampaignTask campaignTask;
378  map<SCR_CampaignMilitaryBaseComponent, SCR_BaseTask> finishedTasksMap = new map <SCR_CampaignMilitaryBaseComponent, SCR_BaseTask>();
379 
380  //We fetch all the finished tasks and fill the map with them using SCR_CampaignMilitaryBaseComponent as a key
381  foreach (SCR_BaseTask task : m_aFinishedTasks)
382  {
383  campaignTask = SCR_CampaignTask.Cast(task);
384  if (!campaignTask)
385  continue;
386 
387  baseComponent = campaignTask.GetTargetBase();
388  //We let through only control points that have signal to the HQ
389  if (baseComponent && !finishedTasksMap.Contains(baseComponent) && baseComponent.IsControlPoint() && baseComponent.IsHQRadioTrafficPossible(faction, SCR_ECampaignHQRadioComms.RECEIVE))
390  finishedTasksMap.Set(baseComponent, task);
391  }
392 
393  //We fetch all the active tasks and remove all the finished tasks that have the same SCR_CampaignMilitaryBaseComponent
394  //Because that means that this task is in fact not finished as the base was lost and task recreated
395  foreach(SCR_BaseTask activeTask : activeTasks)
396  {
397  campaignTask = SCR_CampaignTask.Cast(activeTask);
398  if (!campaignTask)
399  continue;
400 
401  baseComponent = campaignTask.GetTargetBase();
402  if (baseComponent)
403  finishedTasksMap.Remove(baseComponent);
404  }
405 
406  m_aFinishedTasks.Clear();
407  foreach (SCR_BaseTask task : finishedTasksMap)
408  {
409  m_aFinishedTasks.Insert(task);
410  }
411 
412  m_iFinishedTasksCount = m_aFinishedTasks.Count();
413  }
414 
415  //------------------------------------------------------------------------------------------------
418  void FillFinishedObjectivesWidget(Widget content)
419  {
420  RichTextWidget titleText = RichTextWidget.Cast(m_wFinishedObjectivesWidget.FindAnyWidget("TitleText"));
421  if (titleText)
422  titleText.SetText(GetTitleText());
423 
424  ProcessTasks();
425 
426  int cycleCount;
427  if (m_iFinishedTasksCount < 7)
428  cycleCount = m_iFinishedTasksCount;
429  else
430  cycleCount = 6;
431 
432  //Statistics are capped for 6 at the time
433  for (int i = 0; i < cycleCount; ++i)
434  {
435  Widget objective = GetGame().GetWorkspace().CreateWidgets(m_sFinishedObjectivesLayout, content);
436  m_aFinishedObjectivesWidgets.Insert(objective);
437 
438  RichTextWidget name = RichTextWidget.Cast(objective.FindAnyWidget("ObjectiveText"));
439  SCR_EditorTask editorTask = SCR_EditorTask.Cast(m_aFinishedTasks[i]);
440  SCR_CampaignTask campaignTask = SCR_CampaignTask.Cast(m_aFinishedTasks[i]);
441  if (editorTask)
442  name.SetTextFormat(editorTask.GetTitle(), editorTask.GetLocationName());
443  else if (campaignTask)
444  name.SetTextFormat(campaignTask.GetTitle(), campaignTask.GetBaseNameWithCallsign());
445  else
446  name.SetText(m_aFinishedTasks[i].GetTitle());
447  }
448 
449  if (m_iFinishedTasksCount < 7)
450  {
451  Widget paginationWidget = m_wFinishedObjectivesWidget.FindAnyWidget("BottomTitleSizeLayout");
452  paginationWidget.SetOpacity(0);
453  }
454  else
455  {
456  Widget pages = m_wFinishedObjectivesWidget.FindAnyWidget("Pages");
457  if (!pages)
458  return;
459 
460  SCR_SelectionHintComponent pagesVisualised = SCR_SelectionHintComponent.Cast(pages.FindHandler(SCR_SelectionHintComponent));
461  if (!pagesVisualised)
462  return;
463 
464  pagesVisualised.SetItemCount(m_iFinishedTasksCount/6);
465  }
466  }
467 
468  //------------------------------------------------------------------------------------------------
470  protected void InitPagination()
471  {
472  Widget previousButtonWidget = m_wFinishedObjectivesWidget.FindAnyWidget("PrevButton");
473  if (!previousButtonWidget)
474  return;
475 
476  SCR_PagingButtonComponent previousButton = SCR_PagingButtonComponent.Cast(previousButtonWidget.FindHandler(SCR_PagingButtonComponent));
477  if (previousButton)
478  previousButton.m_OnClicked.Insert(ButtonClicked);
479 
480  Widget nextButtonWidget = m_wFinishedObjectivesWidget.FindAnyWidget("NextButton");
481  if (!nextButtonWidget)
482  return;
483 
484  SCR_PagingButtonComponent nextButton = SCR_PagingButtonComponent.Cast(nextButtonWidget.FindHandler(SCR_PagingButtonComponent));
485  if (nextButton)
486  nextButton.m_OnClicked.Insert(ButtonClicked);
487  }
488 
489  //------------------------------------------------------------------------------------------------
491  protected void ButtonClicked()
492  {
493  GetGame().GetWorkspace().SetFocusedWidget(m_wColumnButton);
494  }
495 
496  //------------------------------------------------------------------------------------------------
499  protected void HandlePagination(bool enabled = false)
500  {
501  Widget previousButtonWidget = m_wFinishedObjectivesWidget.FindAnyWidget("PrevButton");
502  if (!previousButtonWidget)
503  return;
504 
505  SCR_PagingButtonComponent previousButton = SCR_PagingButtonComponent.Cast(previousButtonWidget.FindHandler(SCR_PagingButtonComponent));
506  if (!previousButton)
507  return;
508 
509  if (enabled)
510  previousButton.m_OnActivated.Insert(PreviousButtonActivated);
511  else
512  previousButton.m_OnActivated.Remove(PreviousButtonActivated);
513 
514  Widget nextButtonWidget = m_wFinishedObjectivesWidget.FindAnyWidget("NextButton");
515  if (!nextButtonWidget)
516  return;
517 
518  SCR_PagingButtonComponent nextButton = SCR_PagingButtonComponent.Cast(nextButtonWidget.FindHandler(SCR_PagingButtonComponent));
519  if (!nextButton)
520  return;
521 
522  if (enabled)
523  nextButton.m_OnActivated.Insert(NextButtonActivated);
524  else
525  nextButton.m_OnActivated.Remove(NextButtonActivated);
526  }
527 
528  //------------------------------------------------------------------------------------------------
530  protected void PreviousButtonActivated()
531  {
532  int currentPage = GetCurrentPage();
533  currentPage--;
534  if (currentPage < 0)
535  {
536  FlipPage(0);
537  return;
538  }
539 
540  FlipPage(currentPage);
541  }
542 
543  //------------------------------------------------------------------------------------------------
545  protected void NextButtonActivated()
546  {
547  int currentPage = GetCurrentPage();
548  currentPage++;
549  if (currentPage == Math.Ceil(m_iFinishedTasksCount/6))
550  return;
551 
552  FlipPage(currentPage);
553  }
554 
555  //------------------------------------------------------------------------------------------------
558  protected void FlipPage(int currentPage)
559  {
560  RichTextWidget name;
561  for (int i = 0; i < 6; ++i)
562  {
563  m_aFinishedObjectivesWidgets[i].SetOpacity(1);
564  if (currentPage == 0)
565  {
566  name = RichTextWidget.Cast(m_aFinishedObjectivesWidgets[i].FindAnyWidget("ObjectiveText"));
567  if (i < m_iFinishedTasksCount)
568  {
569  SCR_EditorTask editorTask = SCR_EditorTask.Cast(m_aFinishedTasks[i]);
570  SCR_CampaignTask campaignTask = SCR_CampaignTask.Cast(m_aFinishedTasks[i]);
571  if (editorTask)
572  name.SetTextFormat(editorTask.GetTitle(), editorTask.GetLocationName());
573  else if (campaignTask)
574  name.SetTextFormat(campaignTask.GetTitle(), campaignTask.GetBaseNameWithCallsign());
575  else
576  name.SetText(m_aFinishedTasks[i].GetTitle());
577  }
578  else
579  {
580  m_aFinishedObjectivesWidgets[i].SetOpacity(0);
581  }
582  }
583  else
584  {
585  name = RichTextWidget.Cast(m_aFinishedObjectivesWidgets[i].FindAnyWidget("ObjectiveText"));
586  if ((currentPage * 6) + i < m_iFinishedTasksCount)
587  {
588  SCR_EditorTask editorTask = SCR_EditorTask.Cast(m_aFinishedTasks[(currentPage * 6) + i]);
589  SCR_CampaignTask campaignTask = SCR_CampaignTask.Cast(m_aFinishedTasks[(currentPage * 6) + i]);
590  if (editorTask)
591  name.SetTextFormat(editorTask.GetTitle(), editorTask.GetLocationName());
592  else if (campaignTask)
593  name.SetTextFormat(campaignTask.GetTitle(), campaignTask.GetBaseNameWithCallsign());
594  else
595  name.SetText(m_aFinishedTasks[(currentPage * 6) + i].GetTitle());
596 
597  }
598  else
599  {
600  m_aFinishedObjectivesWidgets[i].SetOpacity(0);
601  }
602  }
603  }
604 
605  SetCurrentPage(currentPage);
606 
607  Widget pages = m_wFinishedObjectivesWidget.FindAnyWidget("Pages");
608  if (!pages)
609  return;
610 
611  SCR_SelectionHintComponent pagesVisualised = SCR_SelectionHintComponent.Cast(pages.FindHandler(SCR_SelectionHintComponent));
612  if (!pagesVisualised)
613  return;
614 
615  pagesVisualised.SetItemCount(m_iFinishedTasksCount/6);
616  pagesVisualised.SetCurrentItem(currentPage);
617  }
618 
619  //------------------------------------------------------------------------------------------------
622  int GetCurrentPage()
623  {
624  return m_iCurrentPage;
625  }
626 
627  //------------------------------------------------------------------------------------------------
631  void SetCurrentPage(int page)
632  {
633  m_iCurrentPage = page;
634  }
635 
636  //------------------------------------------------------------------------------------------------
638  string GetTitleText()
639  {
640  return m_sTitleText;
641  }
642 }
643 
646 class SCR_DebriefingScreenStatisticsContent : SCR_WelcomeScreenBaseContent
647 {
648  [Attribute()]
649  protected string m_sTitleText;
650 
651  [Attribute()]
652  protected ref array<ref SCR_DebriefingScreenStatisticBaseClass> m_aStatistics;
653 
654  [Attribute(defvalue: "{64B98222099C391E}UI/layouts/Menus/DeployMenu/DebriefingScreenStatisticsTile.layout")]
655  protected ResourceName m_sStatisticsTileLayout;
656 
657  [Attribute(defvalue: "{F2B6C48FDA2E261E}UI/layouts/Menus/DeployMenu/DebriefingScreenStatistic.layout")]
658  protected ResourceName m_sStatisticsLayout;
659 
660  protected Widget m_wStatisticsWidget;
661 
662  //------------------------------------------------------------------------------------------------
667  override void InitContent(SCR_WelcomeScreenMenu menu, string column, string columnButton)
668  {
669  m_sContentName = column;
670 
671  Widget targetTile = menu.GetRootWidget().FindAnyWidget(column);
672  if (!targetTile)
673  return;
674 
675  m_wStatisticsWidget = GetGame().GetWorkspace().CreateWidgets(m_sStatisticsTileLayout, targetTile);
676  if (!m_wStatisticsWidget)
677  return;
678 
679  Widget statisticsContent = m_wStatisticsWidget.FindAnyWidget("StatsLayout");
680  if (!statisticsContent)
681  return;
682 
683  FillStatisticsWidget(statisticsContent);
684  }
685 
686  //------------------------------------------------------------------------------------------------
689  void FillStatisticsWidget(Widget content)
690  {
691  RichTextWidget titleText = RichTextWidget.Cast(m_wStatisticsWidget.FindAnyWidget("TitleText"));
692  titleText.SetText(GetTitleText());
693 
694  array<ref SCR_DebriefingScreenStatisticBaseClass> statistics = {};
695  int statisticsCount;
696  statisticsCount = GetStatistics(statistics);
697 
698  int statsCycleCount;
699  if (statisticsCount < 7)
700  statsCycleCount = statisticsCount;
701  else
702  statsCycleCount = 6;
703 
704  SCR_PlayerData playerData = GetGame().GetDataCollector().GetPlayerData(0, true, false);
705  //We Calculate the stats difference only applicable for this particular session
706  array<float> stats = playerData.CalculateStatsDifference();
707  //Statistics are capped for 6 at the time
708  for (int i = 0; i < statsCycleCount; ++i)
709  {
710  //statsCycleCount--;
711  Widget statistic = GetGame().GetWorkspace().CreateWidgets(m_sStatisticsLayout, content);
712 
713  statistics[i].InitStatistic(stats);
714  RichTextWidget name = RichTextWidget.Cast(statistic.FindAnyWidget("StatisticResult"));
715  name.SetText(statistics[i].GetStatisticResult());
716  }
717  }
718 
719  //------------------------------------------------------------------------------------------------
723  int GetStatistics(out array<ref SCR_DebriefingScreenStatisticBaseClass> statistics)
724  {
725  statistics = m_aStatistics;
726 
727  return m_aStatistics.Count();
728  }
729 
730  //------------------------------------------------------------------------------------------------
732  string GetTitleText()
733  {
734  return m_sTitleText;
735  }
736 }
737 
740 class SCR_DebriefingScreenStatisticBaseClass
741 {
742  protected string m_sStatisticResult;
743 
744  //------------------------------------------------------------------------------------------------
747  void InitStatistic(notnull array<float> stats);
748 
749  //------------------------------------------------------------------------------------------------
751  string GetStatisticResult()
752  {
753  return m_sStatisticResult;
754  }
755 }
756 
759 class SCR_DebriefingScreenStatisticShotsFired : SCR_DebriefingScreenStatisticBaseClass
760 {
761  //------------------------------------------------------------------------------------------------
762  override void InitStatistic(notnull array<float> stats)
763  {
764  m_sStatisticResult = string.Format(WidgetManager.Translate("<b>#AR-DebriefingScreen_Statistics_Rounds</b>", Math.Floor(stats[SCR_EDataStats.SHOTS])));
765  }
766 }
767 
770 class SCR_DebriefingScreenStatisticKills : SCR_DebriefingScreenStatisticBaseClass
771 {
772  //------------------------------------------------------------------------------------------------
773  override void InitStatistic(notnull array<float> stats)
774  {
775  m_sStatisticResult = string.Format(WidgetManager.Translate("<b>#AR-DebriefingScreen_Statistics_Kills</b>", Math.Floor(stats[SCR_EDataStats.AI_KILLS] + stats[SCR_EDataStats.KILLS])));
776  }
777 }
778 
781 class SCR_DebriefingScreenStatisticDeaths : SCR_DebriefingScreenStatisticBaseClass
782 {
783  //------------------------------------------------------------------------------------------------
784 
785  override void InitStatistic(notnull array<float> stats)
786  {
787  m_sStatisticResult = string.Format(WidgetManager.Translate("<b>#AR-DebriefingScreen_Statistics_Deaths</b>", Math.Floor(stats[SCR_EDataStats.DEATHS])));
788  }
789 }
790 
793 class SCR_DebriefingScreenStatisticDistanceWalked : SCR_DebriefingScreenStatisticBaseClass
794 {
795  //------------------------------------------------------------------------------------------------
796  override void InitStatistic(notnull array<float> stats)
797  {
798  m_sStatisticResult = string.Format(WidgetManager.Translate("<b>#AR-DebriefingScreen_Statistics_DistanceWalked</b>", Math.Floor(stats[SCR_EDataStats.DISTANCE_WALKED]/1000)));
799  }
800 }
801 
804 class SCR_DebriefingScreenStatisticDistanceDriven : SCR_DebriefingScreenStatisticBaseClass
805 {
806  //------------------------------------------------------------------------------------------------
807  override void InitStatistic(notnull array<float> stats)
808  {
809  m_sStatisticResult = string.Format(WidgetManager.Translate("<b>#AR-DebriefingScreen_Statistics_DistanceDriven</b>", Math.Floor(stats[SCR_EDataStats.DISTANCE_DRIVEN]/1000)));
810  }
811 }
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
SCR_BaseGameMode
Definition: SCR_BaseGameMode.c:137
SCR_BaseGameOverScreenInfo
Definition: SCR_BaseGameOverScreenInfo.c:2
m_iCurrentPage
protected int m_iCurrentPage
Definition: SCR_ContentBrowser_AddonsSubMenu.c:75
SCR_DeployMenuBaseScreenLayout
Base class for Deploy menu layouts.
Definition: SCR_DeployMenuBaseScreenComponent.c:43
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_StringHelper
Definition: SCR_StringHelper.c:1
m_sDescriptionText
protected string m_sDescriptionText
Definition: SCR_AISettingsComponent.c:43
SCR_PlayerData
Definition: SCR_PlayerData.c:2
SCR_BaseTask
A base class for tasks.
Definition: SCR_BaseTask.c:8
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
SCR_CharacterRankComponent
void SCR_CharacterRankComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_CharacterRankComponent.c:209
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition: SCR_BaseGameModeComponent.c:15
SCR_GameModeCampaign
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
Definition: SCR_GameModeCampaign.c:1927
SCR_CampaignTask
Definition: SCR_CampaignTask.c:7
SCR_PagingButtonComponent
Definition: SCR_PagingButtonComponent.c:2
SCR_DeployMenuBaseScreenComponentClass
Definition: SCR_DeployMenuBaseScreenComponent.c:2
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ContainerActionTitle
SCR_ContainerActionTitle BaseContainerCustomTitle SCR_ContainerActionTitle()] class SCR_ScenarioFrameworkActionBase
Definition: SCR_ScenarioFrameworkActions.c:43
SCR_DebriefingScreenComponentClass
Definition: SCR_DebriefingScreenComponent.c:2
GetTaskManager
SCR_BaseTaskManager GetTaskManager()
Definition: SCR_BaseTaskManager.c:7
SCR_GameModeEndData
Definition: SCR_GameModeEndData.c:4
UIColors
Definition: Constants.c:16
WELCOME_CONTENT
const protected string WELCOME_CONTENT
Definition: SCR_WelcomeScreenComponent.c:14
SCR_BaseTaskManager
Definition: SCR_BaseTaskManager.c:25
m_sSubtitleText
protected string m_sSubtitleText
Definition: SCR_VoiceoverData.c:45
SCR_EditorTask
Definition: SCR_EditorTask.c:7
InitContent
override void InitContent(SCR_WelcomeScreenMenu menu)
Definition: SCR_WelcomeScreenComponent.c:25
Faction
Definition: Faction.c:12
SCR_EDataStats
SCR_EDataStats
Definition: SCR_PlayerData.c:950
SCR_SelectionHintComponent
Definition: SCR_SelectionHintComponent.c:2
SCR_WelcomeScreenMenu
Class that handles Welcome screen menu.
Definition: SCR_WelcomeScreenMenu.c:3
BaseContainerProps
SCR_DebriefingScreenComponentClass SCR_DeployMenuBaseScreenComponentClass BaseContainerProps()
Debriefing screen component intended to be added to the GameMode.
SCR_GameOverScreenConfig
Definition: SCR_GameOverScreenConfig.c:2
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition: SCR_FactionManager.c:461
SCR_DeployMenuBaseScreenComponent
SCR_WelcomeScreenComponentClass SCR_DeployMenuBaseScreenComponent
Welcome screen component intended to be added to the GameMode.
GetSubtitleText
string GetSubtitleText()
Definition: SCR_VoiceoverData.c:60
GetPlayerId
proto external int GetPlayerId()
Definition: SCR_SpawnRequestComponent.c:39
SCR_CampaignMilitaryBaseComponent
Definition: SCR_CampaignMilitaryBaseComponent.c:38
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180