Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_VoteHintCondition.c
Go to the documentation of this file.
1[BaseContainerProps(), SCR_BaseContainerHintCondition()]
3{
4 [Attribute("0", UIWidgets.ComboBox, "Type of tracked vote.", enums: ParamEnumArray.FromEnum(EVotingType))]
5 protected EVotingType m_Type;
6
7 [Attribute()]
8 protected bool m_bShowInPlayerList;
9
10 //------------------------------------------------------------------------------------------------
11 protected void OnVotingStart(EVotingType type, int value)
12 {
13 if (type == m_Type && IsPlayerListMenu())
14 Activate();
15 }
16
17 //------------------------------------------------------------------------------------------------
18 protected void OnVotingEnd(EVotingType type, int value, int winner)
19 {
20 if (type == m_Type && IsPlayerListMenu())
21 Deactivate();
22 }
23
24 //------------------------------------------------------------------------------------------------
25 protected void OnVoteLocal(EVotingType type, int value)
26 {
27 if (type == m_Type && IsPlayerListMenu())
28 Deactivate();
29 }
30
31 //------------------------------------------------------------------------------------------------
32 protected void OnPlayerListMenu(bool isOpened)
33 {
34 if (!isOpened)
35 return;
36
37 SCR_VotingManagerComponent votingManager = SCR_VotingManagerComponent.GetInstance();
38 if (votingManager && votingManager.IsVoting(m_Type))
39 Activate();
40 }
41
42 //------------------------------------------------------------------------------------------------
43 protected bool IsPlayerListMenu()
44 {
46 return true;
47
48 MenuManager menuManager = GetGame().GetMenuManager();
49 return !menuManager || menuManager.FindMenuByPreset(ChimeraMenuPreset.PlayerListMenu);
50 }
51
52 //------------------------------------------------------------------------------------------------
53 override protected void OnInitCondition(Managed owner)
54 {
55 SCR_VotingManagerComponent votingManager = SCR_VotingManagerComponent.GetInstance();
56 if (!votingManager)
57 return;
58
59 votingManager.GetOnVotingStart().Insert(OnVotingStart);
60 votingManager.GetOnVotingEnd().Insert(OnVotingEnd);
61 votingManager.GetOnVoteLocal().Insert(OnVoteLocal);
62 votingManager.GetOnRemoveVoteLocal().Insert(OnVotingStart);
63
65 }
66
67 //------------------------------------------------------------------------------------------------
68 override protected void OnExitCondition(Managed owner)
69 {
70 SCR_VotingManagerComponent votingManager = SCR_VotingManagerComponent.GetInstance();
71 if (!votingManager)
72 return;
73
74 votingManager.GetOnVotingStart().Remove(OnVotingStart);
75 votingManager.GetOnVotingEnd().Remove(OnVotingEnd);
76 votingManager.GetOnVoteLocal().Remove(OnVoteLocal);
77 votingManager.GetOnRemoveVoteLocal().Remove(OnVotingStart);
78
80 }
81}
ChimeraMenuPreset
Menu presets.
EVotingType
Definition EVotingType.c:2
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
EDamageType type
void SCR_VotingManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
proto external MenuBase FindMenuByPreset(ScriptMenuPresetEnum preset)
Finds first menu/dialog with given preset index, or nullptr when there is no such menu opened.
static ScriptInvoker GetOnPlayerListMenu()
void OnVotingStart(EVotingType type, int value)
void OnVotingEnd(EVotingType type, int value, int winner)
void OnVoteLocal(EVotingType type, int value)
SCR_FieldOfViewSettings Attribute