Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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  {
45  if (!m_bShowInPlayerList)
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 
64  SCR_PlayerListMenu.GetOnPlayerListMenu().Insert(OnPlayerListMenu);
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 
79  SCR_PlayerListMenu.GetOnPlayerListMenu().Remove(OnPlayerListMenu);
80  }
81 }
SCR_BaseEditorHintCondition
Definition: SCR_BaseEditorHintCondition.c:2
SCR_PlayerListMenu
Definition: SCR_PlayerListMenu.c:33
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_Type
protected EEditableEntityType m_Type
Definition: SCR_EntitiesToolbarEditorUIComponent.c:3
Deactivate
protected void Deactivate()
Definition: SCR_BaseHintCondition.c:27
Activate
protected void Activate()
Definition: SCR_BaseHintCondition.c:9
EVotingType
EVotingType
Definition: EVotingType.c:1
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition: ChimeraMenuBase.c:3
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
SCR_VotingManagerComponent
void SCR_VotingManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_VotingManagerComponent.c:878
SCR_VoteGameMasterCondition
Definition: SCR_VoteHintCondition.c:2
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468