Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PlayerTeleportFeedbackUIComponent.c
Go to the documentation of this file.
1 class SCR_PlayerTeleportFeedbackUIComponent: ScriptedWidgetComponent
2 {
3  [Attribute("0.5", desc: "Long fade delay when moved in and out of vehicles. In seconds.")]
4  protected float m_fLongFadeDelay;
5 
6  [Attribute("TeleportingText", desc: "Teleport Text widget name")]
7  protected string m_sTeleportTextName;
8 
9  protected SCR_FadeUIComponent m_FadeUIComponent;
10  protected SCR_FadeUIComponent m_TeleportTextFadeUIComponent;
11  protected Widget m_wRoot;
12 
13  protected void OnPlayerTeleported(bool editorIsOpen, bool longFade, SCR_EPlayerTeleportedReason teleportReason)
14  {
15  if (editorIsOpen)
16  return;
17 
18  m_FadeUIComponent.CancelFade(false);
19  m_wRoot.SetOpacity(1);
20  m_wRoot.SetVisible(true);
21 
22  if (!longFade)
23  {
24  m_FadeUIComponent.FadeOut(false);
25 
26  if (m_TeleportTextFadeUIComponent)
27  m_TeleportTextFadeUIComponent.GetFadeWidget().SetVisible(false);
28  }
29  else
30  {
31  m_FadeUIComponent.DelayedFadeOut(m_fLongFadeDelay * 1000, false);
32 
33  if (m_TeleportTextFadeUIComponent)
34  m_TeleportTextFadeUIComponent.FadeIn(true);
35  }
36 
37  }
38 
39  override void HandlerAttached(Widget w)
40  {
41  m_wRoot = w;
42  m_FadeUIComponent = SCR_FadeUIComponent.Cast(w.FindHandler(SCR_FadeUIComponent));
43 
44  if (!m_FadeUIComponent)
45  {
46  Print("'SCR_PlayerTeleportFeedbackUIComponent' could not find 'm_FadeUIComponent', make sure the fadecomponent is added before this component", LogLevel.ERROR);
47  return;
48  }
49 
51  if (!playerController)
52  return;
53 
54  SCR_PlayerTeleportedFeedbackComponent playerTeleportedComponent = SCR_PlayerTeleportedFeedbackComponent.Cast(playerController.FindComponent(SCR_PlayerTeleportedFeedbackComponent));
55  if (!playerTeleportedComponent)
56  {
57  Print("'SCR_PlayerTeleportFeedbackUIComponent' could not find 'SCR_PlayerTeleportedFeedbackComponent', make sure it is added to the player controller", LogLevel.ERROR);
58  return;
59  }
60 
61  Widget teleportTextWidget = w.FindAnyWidget(m_sTeleportTextName);
62  if (teleportTextWidget)
63  {
64  m_TeleportTextFadeUIComponent = SCR_FadeUIComponent.Cast(teleportTextWidget.FindHandler(SCR_FadeUIComponent));
65  }
66 
67 
68  playerTeleportedComponent.GetOnPlayerTeleported().Insert(OnPlayerTeleported);
69  }
70  override void HandlerDeattached(Widget w)
71  {
72  if (!m_FadeUIComponent)
73  return;
74 
76  if (!playerController)
77  return;
78 
79  SCR_PlayerTeleportedFeedbackComponent playerTeleportedComponent = SCR_PlayerTeleportedFeedbackComponent.Cast(playerController.FindComponent(SCR_PlayerTeleportedFeedbackComponent));
80  if (!playerTeleportedComponent)
81  return;
82 
83  playerTeleportedComponent.GetOnPlayerTeleported().Remove(OnPlayerTeleported);
84 
85  }
86 };
SCR_EPlayerTeleportedReason
SCR_EPlayerTeleportedReason
Definition: SCR_PlayerTeleportedFeedbackComponent.c:50
SCR_PlayerController
Definition: SCR_PlayerController.c:31
SCR_FadeUIComponent
Definition: SCR_FadeUIComponent.c:1
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
SCR_PlayerTeleportFeedbackUIComponent
Definition: SCR_PlayerTeleportFeedbackUIComponent.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
Attribute
typedef Attribute
Post-process effect of scripted camera.