Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PingEditorUIComponent.c
Go to the documentation of this file.
1 
4 {
5  protected SCR_PingEditorComponent m_PingManager;
6  protected SCR_HoverEditableEntityFilter m_HoverFilter;
7 
8  //------------------------------------------------------------------------------------------------
9  protected void OnEditorPing(float value, EActionTrigger reason)
10  {
11  SendPing(false);
12  }
13 
14  //------------------------------------------------------------------------------------------------
15  protected void OnEditorPingUnlimitedOnly(float value, EActionTrigger reason)
16  {
17  SendPing(true);
18  }
19 
20  //------------------------------------------------------------------------------------------------
21  protected void SendPing(bool unlimitedOnly)
22  {
23  vector position;
24  SCR_CursorEditorUIComponent cursorComponent = SCR_CursorEditorUIComponent.Cast(GetRootComponent().FindComponent(SCR_CursorEditorUIComponent, true));
25  if (cursorComponent)
26  {
27  if (!cursorComponent.GetCursorWorldPos(position))
28  return;
29  }
30 
32  if (m_HoverFilter)
33  target = m_HoverFilter.GetEntityUnderCursor();
34 
35  m_PingManager.SendPing(unlimitedOnly, position, target);
36  }
37 
38  //------------------------------------------------------------------------------------------------
39  override void HandlerAttachedScripted(Widget w)
40  {
41  m_PingManager = SCR_PingEditorComponent.Cast(SCR_PingEditorComponent.GetInstance(SCR_PingEditorComponent, true));
42  if (!m_PingManager)
43  return;
44 
46 
47  InputManager inputManager = GetGame().GetInputManager();
48  if (inputManager)
49  {
50  inputManager.AddActionListener("EditorPing", EActionTrigger.DOWN, OnEditorPing);
51  inputManager.AddActionListener("EditorPingUnlimitedOnly", EActionTrigger.DOWN, OnEditorPingUnlimitedOnly);
52  }
53  }
54 
55  //------------------------------------------------------------------------------------------------
56  override void HandlerDeattached(Widget w)
57  {
58  super.HandlerDeattached(w);
59 
60  InputManager inputManager = GetGame().GetInputManager();
61  if (inputManager)
62  {
63  inputManager.RemoveActionListener("EditorPing", EActionTrigger.DOWN, OnEditorPing);
64  inputManager.RemoveActionListener("EditorPingUnlimitedOnly", EActionTrigger.DOWN, OnEditorPingUnlimitedOnly);
65  }
66  }
67 }
EEditableEntityState
EEditableEntityState
Definition: EEditableEntityState.c:37
SCR_CursorEditorUIComponent
Definition: SCR_CursorEditorUIComponent.c:3
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_PingEditorUIComponent
Definition: SCR_PingEditorUIComponent.c:3
SCR_PingEditorComponent
Definition: SCR_PingEditorComponent.c:70
m_HoverFilter
protected SCR_HoverEditableEntityFilter m_HoverFilter
Definition: SCR_PreviewEntityEditorUIComponent.c:45
SCR_HoverEditableEntityFilter
Definition: SCR_HoverEditableEntityFilter.c:6
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
SCR_BaseEditorUIComponent
Definition: SCR_BaseEditorUIComponent.c:3
position
vector position
Definition: SCR_DestructibleTreeV2.c:30