3 [
Attribute(
"#AR-Notification_Sticky_GroupInvite")]
7 SCR_PlayerControllerGroupComponent m_PlayerControllerGroupComponent;
11 protected void ShowGroupInviteNotification(
int groupId,
bool isInit =
false)
13 SCR_AIGroup playerGroup = m_GroupManager.FindGroup(groupId);
16 Print(
string.Format(
"SCR_GroupInviteStickyNotificationUIComponent could not find group with ID %1!", groupId.ToString()), LogLevel.ERROR);
20 string company, platoon, squad, character, format;
21 playerGroup.GetCallsigns(company, platoon, squad, character, format);
23 string invitingPlayerName = m_PlayerControllerGroupComponent.GetGroupInviteFromPlayerName();
25 m_Text.SetTextFormat(m_sGroupInviteText, company, platoon, squad, format, invitingPlayerName);
27 SetStickyActive(
true, !isInit);
31 protected void OnInviteReceived(
int groupId,
int fromPlayerId)
33 ShowGroupInviteNotification(groupId);
37 protected void OnInviteAcceptedOrCancelled(
int groupId)
39 SetStickyActive(
false);
45 super.OnInit(notificationLog);
55 m_PlayerControllerGroupComponent = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
56 if (!m_PlayerControllerGroupComponent)
58 Print(
"SCR_GroupInviteStickyNotificationUIComponent could not find SCR_PlayerControllerGroupComponent!", LogLevel.ERROR);
62 m_PlayerControllerGroupComponent.GetOnInviteReceived().Insert(OnInviteReceived);
63 m_PlayerControllerGroupComponent.GetOnInviteAccepted().Insert(OnInviteAcceptedOrCancelled);
64 m_PlayerControllerGroupComponent.GetOnInviteCancelled().Insert(OnInviteAcceptedOrCancelled);
66 int groupInviteID = m_PlayerControllerGroupComponent.GetGroupInviteID();
68 if (groupInviteID > -1)
69 ShowGroupInviteNotification(groupInviteID,
true);
75 protected override void OnButton()
77 MenuManager menuManager =
GetGame().GetMenuManager();
83 protected override void OnDestroy()
85 if (!m_PlayerControllerGroupComponent)
88 m_PlayerControllerGroupComponent.GetOnInviteReceived().Remove(OnInviteReceived);
89 m_PlayerControllerGroupComponent.GetOnInviteAccepted().Remove(OnInviteAcceptedOrCancelled);
90 m_PlayerControllerGroupComponent.GetOnInviteCancelled().Remove(OnInviteAcceptedOrCancelled);