Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WelcomeScreenFocusWidgetComponent.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
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 {
18 ToggleInteractions(true, w);
19
20 return false;
21 }
22
23 //------------------------------------------------------------------------------------------------
24 override event bool OnFocusLost(Widget w, int x, int y)
25 {
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
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 {
82 GetGame().GetCallqueue().CallLater(ToggleInteractions, 100, false, false, w);
83 }
84};
class RestAPIHelper< JsonApiStruct T > content
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_WelcomeScreenComponentClass SCR_DeployMenuBaseScreenComponent
Welcome screen component intended to be added to the GameMode.
Base class for Deploy menu layouts.
int GetScreenBaseContents(out array< ref SCR_WelcomeScreenBaseContent > screenBaseContents)
static bool IsEmptyOrWhiteSpace(string input)
Class that handles focusing of widgets for the Welcome and Debriefing screens.
override event bool OnFocusLost(Widget w, int x, int y)
override event bool OnFocus(Widget w, int x, int y)
void ToggleInteractions(bool enabled, Widget w)
Toggles interactions for said widget.
override event void HandlerAttached(Widget w)
When widget is initialised, we set the ToggleInteraction logic on false by default.
SCR_FieldOfViewSettings Attribute
WidgetFlags
Widget flags. See enf::Widget::SetFlags().
Definition WidgetFlags.c:14