Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_TaskAssignButton.c
Go to the documentation of this file.
1 class SCR_TaskAssignButton : ScriptedWidgetComponent
2 {
3  protected SCR_MapUITask m_MapUiTask;
4  protected ref ScriptInvoker m_OnMapIconClick;
5 
6  //------------------------------------------------------------------------------------------------
7  ScriptInvoker GetOnMapIconClick()
8  {
9  if (!m_OnMapIconClick)
10  m_OnMapIconClick = new ScriptInvoker();
11 
12  return m_OnMapIconClick;
13  }
14 
15  //------------------------------------------------------------------------------------------------
16  override bool OnClick(Widget w, int x, int y, int button)
17  {
18  if (!GetGame().GetInputManager().IsUsingMouseAndKeyboard())
19  return false;
20 
21  if (m_OnMapIconClick)
22  m_OnMapIconClick.Invoke();
23 
24  return false;
25  }
26 
27  //------------------------------------------------------------------------------------------------
28  override bool OnMouseEnter(Widget w, int x, int y)
29  {
30  Widget frame = Widget.Cast(m_MapUiTask.GetMapWidget().FindAnyWidget("Border"));
31 
32  if (frame)
33  {
34  frame.SetEnabled(true);
35  frame.SetOpacity(1);
36  }
37 
38  GetGame().GetInputManager().AddActionListener("MenuSelect", EActionTrigger.DOWN, ButtonPressed);
39  return false;
40  }
41 
42  //------------------------------------------------------------------------------------------------
43  void ButtonPressed()
44  {
45  if (m_OnMapIconClick)
46  m_OnMapIconClick.Invoke();
47  }
48  //------------------------------------------------------------------------------------------------
49  override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
50  {
51  Widget frame = Widget.Cast(m_MapUiTask.GetMapWidget().FindAnyWidget("Border"));
52 
53  if (frame)
54  {
55  frame.SetEnabled(false);
56  frame.SetOpacity(0);
57  }
58 
59  GetGame().GetInputManager().RemoveActionListener("MenuSelect", EActionTrigger.DOWN, ButtonPressed);
60  return false;
61  }
62 
63  //------------------------------------------------------------------------------------------------
64  void SetRootWidgetHandler(SCR_MapUITask mapUiTask)
65  {
66  m_MapUiTask = mapUiTask;
67  }
68 }
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_MapUITask
Definition: SCR_MapUITask.c:2
GetInputManager
protected InputManager GetInputManager()
Definition: SCR_BaseManualCameraComponent.c:65
SCR_TaskAssignButton
Definition: SCR_TaskAssignButton.c:1