Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkActionShowHint.c
Go to the documentation of this file.
3{
4 [Attribute()]
5 string m_sTitle;
6
7 [Attribute()]
8 string m_sText;
9
10 [Attribute()]
11 string m_sActionName;
12
13 [Attribute()]
14 string m_sActionText;
15
16 [Attribute(defvalue: "15")]
17 int m_iTimeout;
18
19 [Attribute()]
20 FactionKey m_sFactionKey;
21
22 [Attribute(desc: "Getter to get either a specific player or array of player entities")]
23 ref SCR_ScenarioFrameworkGet m_Getter;
24
25 protected static const string DOUBLE_LINE_SPACE = "<br/><br/>";
26
27 //------------------------------------------------------------------------------------------------
28 override void OnActivate(IEntity object)
29 {
30 if (!CanActivate())
31 return;
32
34 if (!scenarioFrameworkSystem)
35 return;
36
37 PlayerManager playerManager = GetGame().GetPlayerManager();
38 if (!playerManager)
39 return;
40
41 int playerID = -1;
42 if (EntityUtils.IsPlayer(object))
43 playerID = playerManager.GetPlayerIdFromControlledEntity(object);
44
45 array<IEntity> aEntities;
46
47 if (m_Getter)
48 {
49 // Getter takes the priority. We set it back to -1 in case that object was player.
50 playerID = -1;
51
52 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
53 if (!entityWrapper)
54 {
55 SCR_ScenarioFrameworkParam<array<IEntity>> arrayOfEntitiesWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
56 if (!arrayOfEntitiesWrapper)
57 return;
58
59 aEntities = arrayOfEntitiesWrapper.GetValue();
60 if (!aEntities)
61 return;
62 }
63 else
64 {
65 IEntity entityFrom = entityWrapper.GetValue();
66 if (entityFrom)
67 playerID = playerManager.GetPlayerIdFromControlledEntity(entityFrom);
68 }
69 }
70
72
73 if (!aEntities)
74 {
75 ShowHint(playerID);
76 }
77 else
78 {
79 foreach (IEntity entity : aEntities)
80 {
81 if (!EntityUtils.IsPlayer(entity))
82 continue;
83
84 playerID = playerManager.GetPlayerIdFromControlledEntity(entity);
85 ShowHint(playerID);
86 }
87 }
88 }
89
90 //------------------------------------------------------------------------------------------------
91 void ShowHint(int playerID)
92 {
94 if (!scenarioFrameworkSystem)
95 return;
96
97 // Resolve Alias
98 SCR_FactionAliasComponent factionAliasComponent = SCR_FactionAliasComponent.Cast(GetGame().GetFactionManager().FindComponent(SCR_FactionAliasComponent));
99 if (factionAliasComponent)
100 m_sFactionKey = factionAliasComponent.ResolveFactionAlias(m_sFactionKey);
101
102 scenarioFrameworkSystem.ShowHint(m_sText, m_sTitle, m_iTimeout, m_sFactionKey, playerID);
103 }
104
105 //------------------------------------------------------------------------------------------------
107 {
108 if (!SCR_StringHelper.IsEmptyOrWhiteSpace(m_sActionName))
109 m_sText = string.Format("%1%2%3%2<action name='%4' scale='1.7'/><br>", m_sText, DOUBLE_LINE_SPACE, m_sActionText, m_sActionName);
110 }
111
112}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
static SCR_ScenarioFrameworkSystem GetInstance()
void ShowHint(string sTitle, string sSubtitle, int timeOut, FactionKey factionKey="", int playerID=-1)
static bool IsEmptyOrWhiteSpace(string input)
SCR_FieldOfViewSettings Attribute