Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
StanceIndicator.c
Go to the documentation of this file.
1 class StanceIndicator : SCR_InfoDisplay
2 {
3  // Stances
4  const string STANCE_STAND = "{9DF327726AD6B515}UI/Textures/StanceIndicator/stance_stand.edds";
5  const string STANCE_CROUCH = "{90ED76A233697F90}UI/Textures/StanceIndicator/stance_crouch.edds";
6  const string STANCE_PRONE = "{A7117D97ED663EC4}UI/Textures/StanceIndicator/stance_prone.edds";
7 
8  private ImageWidget m_wStance = null;
9  private ECharacterStance m_eCurrentStance = ECharacterStance.PRONE;
10  private SCR_PlayerController m_PlayerController;
11 
12  protected static StanceIndicator s_Instance = null;
13  sealed static StanceIndicator GetInstance() { return s_Instance; }
14 
15  //------------------------------------------------------------------------------------------------
16  override void OnStartDraw(IEntity owner)
17  {
18  super.OnStartDraw(owner);
19  if (m_wRoot)
20  {
21  m_wStance = ImageWidget.Cast(m_wRoot.FindAnyWidget("Image0"));
22  if (m_wStance)
23  {
24  m_wStance.LoadImageTexture((int)ECharacterStance.PRONE, STANCE_PRONE);
25  m_wStance.LoadImageTexture((int)ECharacterStance.CROUCH, STANCE_CROUCH);
26  m_wStance.LoadImageTexture((int)ECharacterStance.STAND, STANCE_STAND);
27  }
28  m_wRoot.SetOpacity(0);
29  }
30 
31 
32  ArmaReforgerScripted game = GetGame();
33  if (!game)
34  return;
35 
36  m_PlayerController = SCR_PlayerController.Cast(game.GetPlayerController());
37  }
38 
39  //------------------------------------------------------------------------------------------------
40  override void UpdateValues(IEntity owner, float timeSlice)
41  {
42  if (!m_wRoot || !m_wStance || !m_PlayerController)
43  return;
44 
45 
46 /* CharacterStance stance = CharacterStance.STANCE_ERECT;
47  CharacterEntity character = CharacterEntity.Cast(owner);
48  if (character)
49  {
50  stance = character.GetCurrentStance();
51  }
52 
53  if (m_eCurrentStance != stance)
54  {
55  m_eCurrentStance = stance;
56  m_wStance.SetImage(stance);
57 
58  // Update widget size
59  int x;
60  int y;
61  m_wStance.GetImageSize(stance,x,y);
62  float fx = (float)x * 0.3;
63  float fy = (float)y * 0.3;
64  m_wStance.SetSize(fx,fy);
65 
66  if (stance == ECharacterStance.STAND)
67  {
68  if (m_wRoot.GetOpacity() > 0 || m_wRoot.IsVisible())
69  AnimateWidget.Opacity(m_wRoot, 0, UIConstants.FADE_RATE_SLOW);
70  }
71  else
72  {
73  if (m_wRoot.GetOpacity() < 1 || !m_wRoot.IsVisible())
74  AnimateWidget.Opacity(m_wRoot, 1, UIConstants.FADE_RATE_DEFAULT);
75  }
76  }*/
77  }
78 };
SCR_PlayerController
Definition: SCR_PlayerController.c:31
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
StanceIndicator
Definition: StanceIndicator.c:1
ECharacterStance
ECharacterStance
Definition: ECharacterStance.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
s_Instance
SCR_SpawnerSlotManagerClass s_Instance
Class used for managing changes and removals of slots present in world.
m_PlayerController
SCR_CampaignNetworkComponentClass m_PlayerController
Takes care of Campaign-specific server <> client communication and requests.