3 protected const string REQUESTER_ENTRY_LAYOUT =
"{B3381965FF7747CE}UI/layouts/Menus/GroupSlection/GroupRequestEntry.layout";
5 protected ref array<Widget> m_aEntryWidgets = {};
6 protected VerticalLayoutWidget m_wContent;
9 override void OnTabShow()
15 GetOnJoinRequestRespond().Insert(UpdateRequesters);
19 override void OnTabRemove()
23 GetOnJoinRequestRespond().Remove(UpdateRequesters);
29 if (!m_OnJoinRequestRespond)
32 return m_OnJoinRequestRespond;
36 void UpdateRequesters()
46 VerticalLayoutWidget content = VerticalLayoutWidget.Cast(m_wMenuRoot.FindAnyWidget(
"Content"));
50 for (
int i = 0, count = m_aEntryWidgets.Count(); i < count ;i++)
52 content.RemoveChild(m_aEntryWidgets[i]);
55 m_aEntryWidgets.Clear();
57 array<int> requesterIDs = {};
59 group.GetRequesterIDs(requesterIDs);
61 for (
int i = 0, count = requesterIDs.Count(); i < count ;i++)
63 Widget entryWidget =
GetGame().GetWorkspace().CreateWidgets(REQUESTER_ENTRY_LAYOUT, content);
67 TextWidget playerName = TextWidget.Cast(entryWidget.FindAnyWidget(
"PlayerName"));
71 ButtonWidget refuseWidget = ButtonWidget.Cast(entryWidget.FindAnyWidget(
"Refuse"));
75 ButtonWidget acceptWidget = ButtonWidget.Cast(entryWidget.FindAnyWidget(
"Accept"));
91 m_aEntryWidgets.Insert(entryWidget);
93 entry.SetPlayerID(requesterIDs[i]);
95 playerName.SetText(
GetGame().GetPlayerManager().GetPlayerName(requesterIDs[i]));
97 acceptButton.m_OnClicked.Insert(AcceptToJoinPrivateGroup);
98 refuseButton.m_OnClicked.Insert(RefuseJoinPrivateGroup);
106 groupMenu.UpdateTabs();
110 void AcceptToJoinPrivateGroup()
112 Widget widgetEntry =
GetRootWidget().FindAnyWidget(
"RequesterEntry");
121 if (!playerGroupComponent)
124 playerGroupComponent.AcceptJoinPrivateGroup(entry.GetPlayerID(),
true);
126 GetGame().GetCallqueue().CallLater(InvokeOnJoinRequestRespond, 200);
130 void RefuseJoinPrivateGroup()
132 Widget widgetEntry =
GetRootWidget().FindAnyWidget(
"RequesterEntry");
141 if (!playerGroupComponent)
144 playerGroupComponent.AcceptJoinPrivateGroup(entry.GetPlayerID(),
false);
146 GetGame().GetCallqueue().CallLater(InvokeOnJoinRequestRespond, 200);
150 protected void InvokeOnJoinRequestRespond()
152 if (m_OnJoinRequestRespond)
153 m_OnJoinRequestRespond.Invoke();