Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_GroupFlagImageComponent.c
Go to the documentation of this file.
2 {
3  protected int m_iPicID = -1;
4  protected ResourceName m_sImageSet;
5  protected bool m_bIsFromImageset;
6 
7  [Attribute("145 100 0")]
8  protected vector m_vImageSize; //160 90 old values, caused stretching
9 
10  //------------------------------------------------------------------------------------------------
11  override void HandlerAttached(Widget w)
12  {
13  super.HandlerAttached(w);
14  Resize();
15  }
16 
17  //------------------------------------------------------------------------------------------------
19  void SetFlagButtonFromImageSet(string name)
20  {
21  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
22  if (!factionManager)
23  return;
24 
25  SCR_Faction playerFaction = SCR_Faction.Cast(factionManager.GetLocalPlayerFaction());
26  if (!playerFaction)
27  return;
28 
29  ResourceName res = playerFaction.GetGroupFlagImageSet();
30  if (!res)
31  return;
32 
33  m_wImage.LoadImageFromSet(0, res, name);
34 
35  Resize();
36  }
37 
38  //------------------------------------------------------------------------------------------------
40  void SetFlagButtonFromTexture(ResourceName name)
41  {
42  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
43  if (!factionManager)
44  return;
45 
46  SCR_Faction playerFaction = SCR_Faction.Cast(factionManager.GetLocalPlayerFaction());
47  if (!playerFaction)
48  return;
49 
50  ResourceName imageSetResource = playerFaction.GetGroupFlagImageSet();
51  array<ResourceName> textures = {};
52  playerFaction.GetGroupFlagTextures(textures);
53 
54  m_wImage.LoadImageTexture(0, textures[textures.Find(name)]);
55 
56  Resize();
57  }
58 
59  //------------------------------------------------------------------------------------------------
62  void Resize(float scale = 1)
63  {
64  m_wImage.SetSize(m_vImageSize[0] * scale, m_vImageSize[1] * scale);
65  }
66 
67  //------------------------------------------------------------------------------------------------
69  void SetIsFromImageset(bool value)
70  {
71  m_bIsFromImageset = value;
72  }
73 
74  //------------------------------------------------------------------------------------------------
76  bool GetIsFromImageset()
77  {
78  return m_bIsFromImageset;
79  }
80 
81  //------------------------------------------------------------------------------------------------
83  int GetImageID()
84  {
85  return m_iPicID;
86  }
87 
88  //------------------------------------------------------------------------------------------------
90  void SetImageID(int ID)
91  {
92  m_iPicID = ID;
93  }
94 
95  //------------------------------------------------------------------------------------------------
97  void SetImageSet(ResourceName imageSet)
98  {
99  m_sImageSet = imageSet;
100  }
101 
102  //------------------------------------------------------------------------------------------------
104  ResourceName GetImageSet()
105  {
106  return m_sImageSet;
107  }
108 }
SCR_GroupFlagImageComponent
Definition: SCR_GroupFlagImageComponent.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_sImageSet
ResourceName m_sImageSet
Definition: SCR_MapToolMenuUI.c:8
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_wImage
protected ImageWidget m_wImage
Definition: SCR_BackendImageComponent.c:248
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition: SCR_FactionManager.c:461
SCR_ButtonImageComponent
Definition: SCR_ButtonImageComponent.c:2
SCR_Faction
Definition: SCR_Faction.c:6