Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_UITaskAssignComponent.c
Go to the documentation of this file.
1 class SCR_UITaskAssignComponent : ScriptedWidgetComponent
2 {
3  protected int m_iTaskID = SCR_BaseTask.INVALID_TASK_ID;
4  protected SCR_ETaskButtonActions m_EAction;
5 
6  //------------------------------------------------------------------------------------------------
8  void SetAction(SCR_ETaskButtonActions action)
9  {
10  m_EAction = action;
11  }
12 
13  //------------------------------------------------------------------------------------------------
15  int GetTaskID()
16  {
17  return m_iTaskID;
18  }
19 
20  //------------------------------------------------------------------------------------------------
22  void SetTaskID(int taskID)
23  {
24  m_iTaskID = taskID;
25  }
26 
27  //------------------------------------------------------------------------------------------------
28  override bool OnMouseEnter(Widget w, int x, int y)
29  {
30  SCR_UITaskManagerComponent.PanMapToTask(m_iTaskID);
31 
32  return false;
33  }
34 
35  //------------------------------------------------------------------------------------------------
36  override bool OnClick(Widget w, int x, int y, int button)
37  {
38  if (m_iTaskID == -1)
39  return false;
40  // Find local player controller
41  PlayerController playerController = GetGame().GetPlayerController();
42  if (!playerController)
43  return false;
44 
45  // Find task network component to send RPC to server
46  SCR_TaskNetworkComponent taskNetworkComponent = SCR_TaskNetworkComponent.Cast(playerController.FindComponent(SCR_TaskNetworkComponent));
47  if (!taskNetworkComponent)
48  return false;
49 
50  switch (m_EAction)
51  {
52  case SCR_ETaskButtonActions.ASSIGN_TASK:
53  taskNetworkComponent.RequestAssignment(m_iTaskID);
54  break;
55 
56  case SCR_ETaskButtonActions.ABANDON_TASK:
57  taskNetworkComponent.AbandonTask(m_iTaskID);
58  break;
59 
60  case SCR_ETaskButtonActions.CANCEL_TASK:
61  taskNetworkComponent.CancelTask(m_iTaskID);
62  break;
63  }
64 
65  return false;
66  }
67 }
SCR_ETaskButtonActions
SCR_ETaskButtonActions
Definition: SCR_ETaskButtonActions.c:2
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_BaseTask
A base class for tasks.
Definition: SCR_BaseTask.c:8
SCR_UITaskManagerComponent
void SCR_UITaskManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_UITaskManagerComponent.c:1096
SCR_TaskNetworkComponent
void SCR_TaskNetworkComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_TaskNetworkComponent.c:207
SCR_UITaskAssignComponent
Definition: SCR_UITaskAssignComponent.c:1