Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WelcomeScreenFocusWidgetComponent.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
3 class SCR_WelcomeScreenFocusWidgetComponent : ScriptedWidgetComponent
4 {
5  [Attribute()]
6  protected string m_sTargetContent;
7 
8  [Attribute()]
9  protected string m_sTargetHighlight;
10 
11  [Attribute()]
12  protected string m_sDeployMenuClass;
13 
14  //------------------------------------------------------------------------------------------------
15  override event bool OnFocus(Widget w, int x, int y)
16  {
17  if (!SCR_StringHelper.IsEmptyOrWhiteSpace(m_sTargetContent) && !SCR_StringHelper.IsEmptyOrWhiteSpace(m_sTargetHighlight))
18  ToggleInteractions(true, w);
19 
20  return false;
21  }
22 
23  //------------------------------------------------------------------------------------------------
24  override event bool OnFocusLost(Widget w, int x, int y)
25  {
26  if (!SCR_StringHelper.IsEmptyOrWhiteSpace(m_sTargetContent) && !SCR_StringHelper.IsEmptyOrWhiteSpace(m_sTargetHighlight))
27  ToggleInteractions(false, w);
28 
29  return false;
30  }
31 
32  //------------------------------------------------------------------------------------------------
34  void ToggleInteractions(bool enabled, Widget w)
35  {
36  BaseGameMode gameMode = GetGame().GetGameMode();
37  if (!gameMode || !w)
38  return;
39 
40  SCR_DeployMenuBaseScreenComponent deployMenuBase;
41  if ("SCR_WelcomeScreenComponent" == m_sDeployMenuClass)
42  deployMenuBase = SCR_WelcomeScreenComponent.Cast(gameMode.FindComponent(SCR_WelcomeScreenComponent));
43  else if ("SCR_DebriefingScreenComponent" == m_sDeployMenuClass)
44  deployMenuBase = SCR_DebriefingScreenComponent.Cast(gameMode.FindComponent(SCR_DebriefingScreenComponent));
45 
46  if (!deployMenuBase)
47  return;
48 
49  SCR_DeployMenuBaseScreenLayout baseLayout = deployMenuBase.GetBaseLayout();
50  if (!baseLayout)
51  return;
52 
53  array<ref SCR_WelcomeScreenBaseContent> screenBaseContents = {};
54  baseLayout.GetScreenBaseContents(screenBaseContents);
55 
56  foreach (SCR_WelcomeScreenBaseContent content : screenBaseContents)
57  {
58  if (content.GetContentName() != m_sTargetContent)
59  continue;
60 
61  if (content.GetIsInteractible())
62  {
63  content.ToggleInteractions(enabled);
64 
65  if (enabled)
66  w.FindAnyWidget(m_sTargetHighlight).SetOpacity(0.5);
67  else
68  w.FindAnyWidget(m_sTargetHighlight).SetOpacity(0);
69  }
70  else
71  {
72  w.SetFlags(WidgetFlags.NOFOCUS);
73  }
74  }
75  }
76 
77  //------------------------------------------------------------------------------------------------
79  override event void HandlerAttached(Widget w)
80  {
81  if (!SCR_StringHelper.IsEmptyOrWhiteSpace(m_sTargetContent) && !SCR_StringHelper.IsEmptyOrWhiteSpace(m_sTargetHighlight))
82  GetGame().GetCallqueue().CallLater(ToggleInteractions, 100, false, false, w);
83  }
84 };
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
SCR_WelcomeScreenFocusWidgetComponent
Class that handles focusing of widgets for the Welcome and Debriefing screens.
Definition: SCR_WelcomeScreenFocusWidgetComponent.c:3
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_DeployMenuBaseScreenComponent
SCR_WelcomeScreenComponentClass SCR_DeployMenuBaseScreenComponent
Welcome screen component intended to be added to the GameMode.