Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ActionHintWidgetTooltip.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
3 {
4  protected SCR_ActionHintWidgetTooltipPreset m_ActionPreset;
5  protected SCR_InputButtonComponent m_ActionDisplay;
6 
7  protected const string WIDGET_ACTION = "Action";
8 
9  //------------------------------------------------------------------------------------------------
10  override void InitContents()
11  {
12  super.InitContents();
13 
14  m_ActionPreset = SCR_ActionHintWidgetTooltipPreset.Cast(m_Preset);
15  if (!m_ActionPreset)
16  return;
17 
18  Widget action = m_wTooltipProxy.FindAnyWidget(WIDGET_ACTION);
19  if (action)
20  m_ActionDisplay = SCR_InputButtonComponent.FindComponent(action);
21 
22  if (!m_ActionDisplay)
23  return;
24 
25  SetAction(m_ActionPreset.m_sAction);
26  SetActionColor(m_ActionPreset.m_ActionColor);
27  }
28 
29  //------------------------------------------------------------------------------------------------
30  bool SetAction(string action)
31  {
32  if (!m_ActionDisplay || action.IsEmpty())
33  return false;
34 
35  m_ActionDisplay.SetAction(action);
36  return true;
37  }
38 
39  //------------------------------------------------------------------------------------------------
40  bool SetActionColor(Color color)
41  {
42  if (!m_ActionDisplay)
43  return false;
44 
45  m_ActionDisplay.SetColorActionDisabled(color);
46  return true;
47  }
48 
49  //------------------------------------------------------------------------------------------------
50  bool ResetAction()
51  {
52  return SetAction(GetDefaultAction());
53  }
54 
55  //------------------------------------------------------------------------------------------------
56  bool ResetActionColor()
57  {
58  return SetActionColor(GetDefaultActionColor());
59  }
60 
61  //------------------------------------------------------------------------------------------------
62  string GetDefaultAction()
63  {
64  if (!m_ActionPreset)
65  return string.Empty;
66 
67  return m_ActionPreset.m_sDefaultAction;
68  }
69 
70  //------------------------------------------------------------------------------------------------
71  Color GetDefaultActionColor()
72  {
73  if (!m_ActionPreset)
74  return Color.FromInt(UIColors.NEUTRAL_INFORMATION.PackToInt());
75 
76  return Color.FromInt(m_ActionPreset.m_DefaultActionColor.PackToInt());
77  }
78 }
79 
80 //------------------------------------------------------------------------------------------------
82 class SCR_ActionHintWidgetTooltipPreset : SCR_ScriptedWidgetTooltipPreset
83 {
84  [Attribute("", desc: "action to display")]
85  string m_sAction;
86 
87  [Attribute(UIColors.GetColorAttribute(UIColors.IDLE_ACTIVE))]
88  ref Color m_ActionColor;
89 
90  string m_sDefaultAction;
91  Color m_DefaultActionColor;
92 
93  //------------------------------------------------------------------------------------------------
94  override void Init()
95  {
96  super.Init();
97  m_sDefaultAction = m_sAction;
98  m_DefaultActionColor = m_ActionColor;
99  }
100 }
BaseContainerProps
SCR_ActionHintWidgetTooltip SCR_ScriptedWidgetTooltip BaseContainerProps()
m_ActionPreset
protected SCR_ActionHintWidgetTooltipPreset m_ActionPreset
Definition: SCR_ActionHintWidgetTooltip.c:2
WIDGET_ACTION
const protected string WIDGET_ACTION
Definition: SCR_ActionHintWidgetTooltip.c:5
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_ActionHintWidgetTooltip
Definition: SCR_ActionHintWidgetTooltip.c:2
Init
void Init(IEntity entity=null, vector worldPos=vector.Zero, float timestamp=0.0, EAITargetInfoCategory category=0)
Definition: SCR_AITargetInfo.c:27
Attribute
typedef Attribute
Post-process effect of scripted camera.
UIColors
Definition: Constants.c:16
SCR_BaseContainerCustomTitleField
SCR_ActionHintWidgetTooltip SCR_ScriptedWidgetTooltip SCR_BaseContainerCustomTitleField("m_sTag")
Definition: SCR_ActionHintWidgetTooltip.c:81
m_Preset
ref SCR_ScriptedWidgetTooltipPreset m_Preset
Definition: SCR_BrowserHoverTooltipComponent.c:3
m_wTooltipProxy
protected Widget m_wTooltipProxy
Definition: SCR_ScriptedWidgetTooltip.c:21
m_ActionDisplay
protected SCR_InputButtonComponent m_ActionDisplay
Definition: SCR_ActionHintWidgetTooltip.c:3
SCR_ScriptedWidgetTooltip
Definition: SCR_ScriptedWidgetTooltip.c:15
SCR_InputButtonComponent
Definition: SCR_InputButtonComponent.c:1