Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TaskSelectButton.c
Go to the documentation of this file.
2{
3 /*
4 protected SCR_MapUITask m_MapUiTask;
5 protected ref ScriptInvoker m_OnMapIconClick;
6
7 static const int VISIBLE = 1;
8 static const int NOT_VISIBLE = 0;
9
10 //------------------------------------------------------------------------------
11 ScriptInvoker GetOnMapIconClick()
12 {
13 if (!m_OnMapIconClick)
14 m_OnMapIconClick = new ScriptInvoker();
15
16 return m_OnMapIconClick;
17 }
18
19 //------------------------------------------------------------------------------
20 override bool OnClick(Widget w, int x, int y, int button)
21 {
22 if (m_OnMapIconClick)
23 m_OnMapIconClick.Invoke();
24
25 SCR_MapEntity mapEntity = SCR_MapEntity.GetMapInstance();
26 if (!mapEntity)
27 return false;
28
29 SCR_MapTaskListUI taskListUI = SCR_MapTaskListUI.Cast(mapEntity.GetMapUIComponent(SCR_MapTaskListUI));
30 if (!taskListUI)
31 return false;
32
33 taskListUI.ToggleTaskList(!taskListUI.IsTaskListVisible());
34
35 return false;
36 }
37
38 //------------------------------------------------------------------------------
39 override bool OnMouseEnter(Widget w, int x, int y)
40 {
41 m_MapUiTask.UpdateFocusedTask();
42
43 ButtonWidget assignButton = ButtonWidget.Cast(m_MapUiTask.GetMapWidget().FindAnyWidget("TaskTitleButton"));
44 Widget assignees = m_MapUiTask.GetMapWidget().FindAnyWidget("Assignee");
45 Widget iconHover = m_MapUiTask.GetMapWidget().FindAnyWidget("TaskIconHover");
46
47 if (!assignButton || !assignees || !iconHover)
48 return false;
49
50 assignButton.SetVisible(true);
51
52 assignees.SetEnabled(HasAssigneeBool());
53 assignees.SetOpacity(HasAssigneeInt());
54
55 iconHover.SetEnabled(true);
56 iconHover.SetOpacity(VISIBLE);
57
58 GetGame().GetInputManager().AddActionListener(UIConstants.MENU_ACTION_SELECT, EActionTrigger.DOWN, ButtonPressed);
59
60 return false;
61 }
62
63 //------------------------------------------------------------------------------
64 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
65 {
66 GetGame().GetInputManager().RemoveActionListener(UIConstants.MENU_ACTION_SELECT, EActionTrigger.DOWN, ButtonPressed);
67 return false;
68 }
69
70 //------------------------------------------------------------------------------
71 void ButtonPressed()
72 {
73 if (m_OnMapIconClick)
74 m_OnMapIconClick.Invoke();
75
76 SCR_MapEntity mapEntity = SCR_MapEntity.GetMapInstance();
77 if (!mapEntity)
78 return;
79
80 SCR_MapTaskListUI taskListUI = SCR_MapTaskListUI.Cast(mapEntity.GetMapUIComponent(SCR_MapTaskListUI));
81 if (!taskListUI)
82 return;
83
84 taskListUI.ToggleTaskList(!taskListUI.IsTaskListVisible());
85 }
86
87 //------------------------------------------------------------------------------
88 bool HasAssigneeBool()
89 {
90 SCR_BaseTask task = m_MapUiTask.GetTask();
91 if (!task)
92 return false;
93
94 if (task.GetAssigneeCount() == 0)
95 return false;
96
97 return true;
98 }
99
100 //------------------------------------------------------------------------------
101 int HasAssigneeInt()
102 {
103 SCR_BaseTask task = m_MapUiTask.GetTask();
104 if (!task)
105 return NOT_VISIBLE;
106
107 if (task.GetAssigneeCount() == 0)
108 return NOT_VISIBLE;
109
110 return VISIBLE;
111 }
112
113 //------------------------------------------------------------------------------
114 void SetRootWidgetHandler(SCR_MapUITask mapUiTask)
115 {
116 m_MapUiTask = mapUiTask;
117 }
118 */
119}