Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_RequestToJoinSubMenu.c
Go to the documentation of this file.
2{
4 protected ref array<Widget> m_aEntryWidgets = {};
6
7 protected const string REQUESTER_ENTRY_LAYOUT = "{B3381965FF7747CE}UI/layouts/Menus/GroupSlection/GroupRequestEntry.layout";
8 protected const string INPUT_CONTEXT_NAME = "GroupMenuContext";
9 protected const string CONTENT_HOLDER_WIDGET = "Content";
10 protected const string PLAYER_NAME_WIDGET = "PlayerName";
11 protected const string PLATFORM_ICON_WIDGET = "PlatformImage";
12
13 //------------------------------------------------------------------------------------------------
14 override void OnTabShow()
15 {
16 super.OnTabShow();
17
19
22 }
23
24 //------------------------------------------------------------------------------------------------
25 override void OnTabRemove()
26 {
27 super.OnTabRemove();
28
31 }
32
33 //------------------------------------------------------------------------------------------------
34 override void OnMenuUpdate(float tDelta)
35 {
36 GetGame().GetInputManager().ActivateContext(INPUT_CONTEXT_NAME);
37 }
38
39 //------------------------------------------------------------------------------------------------
47
48 //------------------------------------------------------------------------------------------------
50 {
51 SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
52 if (!groupsManager)
53 return;
54
55 SCR_AIGroup group = groupsManager.GetPlayerGroup(GetGame().GetPlayerController().GetPlayerId());
56 if (!group)
57 return;
58
60 if (!content)
61 return;
62
63 for (int i = 0, count = m_aEntryWidgets.Count(); i < count ;i++)
64 {
65 content.RemoveChild(m_aEntryWidgets[i]);
66 }
67
68 m_aEntryWidgets.Clear();
69
70 array<int> requesterIDs = {};
71 group.GetRequesterIDs(requesterIDs);
72
73 ButtonWidget focusedElement;
74 Widget entryWidget;
75 TextWidget playerName;
76 ImageWidget platformIcon;
77 SCR_JoinRequestEntry entryMenu;
79 foreach (int requesterId : requesterIDs)
80 {
81 entryWidget = GetGame().GetWorkspace().CreateWidgets(REQUESTER_ENTRY_LAYOUT, content);
82 if (!entryWidget)
83 continue;
84
85 playerName = TextWidget.Cast(entryWidget.FindAnyWidget(PLAYER_NAME_WIDGET));
86 if (!playerName)
87 continue;
88
89 platformIcon = ImageWidget.Cast(entryWidget.FindAnyWidget(PLATFORM_ICON_WIDGET));
90
91 entryMenu = SCR_JoinRequestEntry.Cast(entryWidget.FindHandler(SCR_JoinRequestEntry));
92 if (!entryMenu)
93 continue;
94
95 if (!focusedElement)
96 focusedElement = ButtonWidget.Cast(entryWidget);
97
98 m_aEntryWidgets.Insert(entryWidget);
99
100 entryMenu.SetParentMenu(this);
101 entryMenu.SetPlayerID(requesterId);
102 entryMenu.Init(entryWidget);
103
104 playerName.SetText(SCR_PlayerNamesFilterCache.GetInstance().GetPlayerDisplayName(requesterId));
105
106 if (platformIcon && playerController)
107 playerController.SetPlatformImageTo(requesterId, platformIcon);
108 }
109
110 GetGame().GetWorkspace().SetFocusedWidget(focusedElement);
111
112 // TODO: a sub menu tab should not call a method on the menu class. This should be an invoker
114 if (!groupMenu)
115 return;
116
117 groupMenu.UpdateTabs();
118 }
119
120 //------------------------------------------------------------------------------------------------
126}
class RestAPIHelper< JsonApiStruct T > content
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
Constant variables used in various menus.
static ChimeraMenuBase GetOwnerMenu(Widget w)
Returns parent menu of a widget.
int GetRequesterIDs(out array< int > valueArray)
static ScriptInvoker GetOnJoinPrivateGroupRequest()
void SetPlayerID(int value)
void Init(Widget w)
void SetParentMenu(SCR_RequestToJoinSubmenu menu)
ref ScriptInvokerVoid m_OnJoinRequestRespond
override void OnMenuUpdate(float tDelta)
ref array< Widget > m_aEntryWidgets
ScriptInvokerVoid GetOnJoinRequestRespond()
proto external PlayerController GetPlayerController()
proto external int GetPlayerId()