Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_GroupSubMenuPlayerlist.c
Go to the documentation of this file.
2{
5
7
8 //------------------------------------------------------------------------------------------------
9 override void OnMenuUpdate(float tDelta)
10 {
11 GetGame().GetInputManager().ActivateContext("GroupMenuContext");
12 }
13
14 //------------------------------------------------------------------------------------------------
15 override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index)
16 {
17 super.OnTabCreate(menuRoot, buttonsLayout, index);
18
21 }
22
23 //------------------------------------------------------------------------------------------------
34
35 //------------------------------------------------------------------------------------------------
44
45 //------------------------------------------------------------------------------------------------
46 override protected void UpdateGroups(SCR_PlayerControllerGroupComponent playerGroupController)
47 {
48 super.UpdateGroups(playerGroupController);
49
50 if (playerGroupController == m_PlayerGroupController)
52 }
53
54 //------------------------------------------------------------------------------------------------
56 {
57 m_VolunteerForGroupLeaderButton = CreateNavigationButton("MenuVolunteerLeaderGroup", "#AR-Player_Groups_Leader_Volunteer", true, false);
59 return;
60
62 }
63
64 //------------------------------------------------------------------------------------------------
65 protected void CreateViewProfileButton()
66 {
67 m_ViewProfileButton = CreateNavigationButton("MenuViewProfile", "", true);
69 return;
70
71 // Dynamically add the component to update the button label dpending on platform. TODO: allow sub menus to create different layouts of buttons
73 if (!handler)
74 return;
75
76 m_ViewProfileButton.GetRootWidget().AddHandler(handler);
77 handler.Init();
78
80
81 m_ViewProfileButton.GetRootWidget().SetZOrder(0);
82 m_ViewProfileButton.m_OnActivated.Insert(OnViewProfile);
83 }
84
85 //------------------------------------------------------------------------------------------------
86 protected void OnPlayerTileFocus(int id)
87 {
90 }
91
92 //------------------------------------------------------------------------------------------------
93 protected void OnPlayerTileFocusLost(int id)
94 {
96 }
97
98 //------------------------------------------------------------------------------------------------
99 protected void OnViewProfile()
100 {
101 GetGame().GetPlayerManager().ShowUserProfile(m_iLastSelectedPlayerId);
102 }
103
104 //------------------------------------------------------------------------------------------------
105 protected void UpdateViewProfileButton(bool forceHidden = false)
106 {
108 return;
109
110 SetNavigationButtonVisible(m_ViewProfileButton, !forceHidden && GetGame().GetPlayerManager().IsUserProfileAvailable(m_iLastSelectedPlayerId));
111 }
112
113 //------------------------------------------------------------------------------------------------
116 {
118 return;
119
120 int groupId = m_PlayerGroupController.GetGroupID();
121
122 // Selected group is not player's group, hide both buttons
123 if (groupId != m_PlayerGroupController.GetSelectedGroupID())
124 {
125 m_GroupSettingsButton.SetVisible(false, false);
126 m_VolunteerForGroupLeaderButton.SetVisible(false, false);
127 return;
128 }
129
130 SCR_AIGroup group = m_GroupManager.FindGroup(groupId);
131 if (!group)
132 return;
133
134 bool isGroupLeader = group.GetLeaderID() == m_PlayerGroupController.GetPlayerID();
135
136 // Group leader can see Group Settings button, other group members can see Volunteer button
137 m_GroupSettingsButton.SetVisible(isGroupLeader, false);
138
139 // If volunteering for Group Leader is not enabled, disable and hide the button
140 if (!m_GroupManager.IsGroupLeaderVolunteeringAllowed())
141 {
142 m_VolunteerForGroupLeaderButton.SetVisible(false, false);
143 m_VolunteerForGroupLeaderButton.SetEnabled(false);
144 return;
145 }
146
147 m_VolunteerForGroupLeaderButton.SetVisible(!isGroupLeader, false);
148
149 if (isGroupLeader)
150 return;
151
153 if (!manager)
154 return;
155
156 // Volunteer button is enabled only when player does not have voting cooldown
157 if (manager.GetCurrentVoteCooldownForLocalPlayer(EVotingType.GROUP_LEADER) > 0)
158 m_VolunteerForGroupLeaderButton.SetEnabled(false);
159 else
160 m_VolunteerForGroupLeaderButton.SetEnabled(true);
161 }
162}
AddonBuildInfoTool id
EVotingType
Definition EVotingType.c:2
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
void SCR_VotingManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
static ScriptInvoker GetOnPlayerLeaderChanged()
int GetLeaderID()
SCR_GroupsManagerComponent m_GroupManager
SCR_InputButtonComponent m_GroupSettingsButton
SCR_PlayerControllerGroupComponent m_PlayerGroupController
override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index)
void UpdateGroups(SCR_PlayerControllerGroupComponent playerGroupController)
void UpdateGroupSettingsButtons()
Displays or hides Volunteer button and Group Settings button based on the player role in group.
override void OnMenuUpdate(float tDelta)
SCR_InputButtonComponent m_ViewProfileButton
SCR_InputButtonComponent m_VolunteerForGroupLeaderButton
void UpdateViewProfileButton(bool forceHidden=false)
static ScriptInvokerInt GetOnPlayerTileFocusLost()
static ScriptInvokerInt GetOnPlayerTileFocus()
SCR_InputButtonComponent CreateNavigationButton(string actionName, string label, bool rightFooter=false, bool show=true)
void SetNavigationButtonVisible(SCR_InputButtonComponent button, bool show, bool animate=false)