public void ViewSquadInfoInviteClicked(UXButton button) { SquadInvite squadInvite = (SquadInvite)button.Tag; Squad orCreateSquad = Service.LeaderboardController.GetOrCreateSquad(squadInvite.SquadId); this.DisplaySquadInfoView(orCreateSquad, false, null); Service.EventManager.SendEvent(EventId.SquadNext, null); }
public void AddSquadInvite(SquadInvite invite) { if (this.SquadInvites == null) { this.SquadInvites = new List <SquadInvite>(); } this.SquadInvites.Add(invite); Service.Get <EventManager>().SendEvent(EventId.SquadJoinInviteReceived, invite); }
private AbstractLeaderboardRowView AddSquadInviteRow(SquadInvite invite, SocialTabs tab, FactionToggle faction, int position) { if (invite == null || string.IsNullOrEmpty(invite.SquadId)) { return(null); } Squad orCreateSquad = Service.LeaderboardController.GetOrCreateSquad(invite.SquadId); if (!this.IsFactionToggleValidFactionType(faction, orCreateSquad.Faction) || position >= 51) { return(null); } return(new LeaderboardRowSquadInviteView(this, this.gridLoadHelper.GetGrid(), this.itemTemplate, tab, faction, position, invite, orCreateSquad)); }
public override ISerializable FromObject(object obj) { List <object> list = obj as List <object>; if (list != null) { int i = 0; int count = list.Count; while (i < count) { SquadInvite squadInvite = new SquadInvite(); squadInvite.FromObject(list[i]); this.SquadInvites.Add(squadInvite); i++; } } return(this); }
public LeaderboardRowSquadInviteView(AbstractLeaderboardScreen screen, UXGrid grid, UXElement templateItem, SocialTabs tab, FactionToggle faction, int position, SquadInvite invite, Squad squad) : base(screen, grid, templateItem, tab, faction, position, squad) { this.invite = invite; base.InitBaseView(); this.InitFullView(); }
public void OnNewSquadMsgsReceived(List <SquadMsg> msgs) { bool flag = false; Squad currentSquad = this.StateManager.GetCurrentSquad(); bool flag2 = false; string playerId = Service.CurrentPlayer.PlayerId; int i = 0; int count = msgs.Count; while (i < count) { SquadMsg squadMsg = msgs[i]; uint timeForNewMsgFiltering = this.GetTimeForNewMsgFiltering(squadMsg); if (squadMsg.TimeSent >= timeForNewMsgFiltering) { bool flag3 = squadMsg.OwnerData == null || squadMsg.OwnerData.PlayerId == null; bool flag4 = squadMsg.OwnerData != null && squadMsg.OwnerData.PlayerId == playerId; switch (squadMsg.Type) { case SquadMsgType.Join: case SquadMsgType.InviteAccepted: case SquadMsgType.Leave: flag = true; break; case SquadMsgType.JoinRequestAccepted: { string text = (squadMsg.SquadData == null) ? null : squadMsg.SquadData.Id; if (flag4 && !string.IsNullOrEmpty(text)) { this.StateManager.OnSquadJoinApplicationAccepted(text); Squad currentSquad2 = this.StateManager.GetCurrentSquad(); this.ClearPrefsForNewSquad(currentSquad2.Level); } flag = true; break; } case SquadMsgType.JoinRequestRejected: { string text2 = (squadMsg.SquadData == null) ? null : squadMsg.SquadData.Id; if (flag3 && !string.IsNullOrEmpty(text2)) { this.StateManager.OnSquadJoinApplicationRejected(text2); } break; } case SquadMsgType.Ejected: if (flag3) { this.LeaveSquad(Service.Lang.Get("CURRENT_PLAYER_EJECTED", new object[0])); } else { SquadUtils.RemoveSquadMember(currentSquad, squadMsg.OwnerData.PlayerId); } flag = true; break; case SquadMsgType.Promotion: case SquadMsgType.Demotion: { SquadRole role = (squadMsg.MemberData == null) ? SquadRole.Member : squadMsg.MemberData.MemberRole; if (flag4) { this.StateManager.Role = role; } SquadUtils.SetSquadMemberRole(currentSquad, squadMsg.OwnerData.PlayerId, role); break; } case SquadMsgType.TroopDonation: if (squadMsg.DonationData != null && squadMsg.DonationData.RecipientId == playerId) { if (!string.IsNullOrEmpty(squadMsg.DonationData.RequestId)) { SquadMsg msgById = this.MsgManager.GetMsgById(squadMsg.DonationData.RequestId); if (msgById != null && msgById.RequestData != null && msgById.RequestData.IsWarRequest) { flag = true; break; } } string text3 = (squadMsg.OwnerData == null) ? null : squadMsg.OwnerData.PlayerId; Dictionary <string, int> donations = squadMsg.DonationData.Donations; if (text3 != null && donations != null) { SquadMember squadMemberById = SquadUtils.GetSquadMemberById(currentSquad, text3); string donorName = (squadMemberById == null) ? null : squadMemberById.MemberName; this.StateManager.OnSquadTroopsReceived(donations, text3, donorName); } } break; case SquadMsgType.WarMatchMakingBegin: flag = true; this.WarManager.OnWarMatchMakingBegin(); break; case SquadMsgType.WarMatchMakingCancel: if (!flag4) { this.WarManager.CancelMatchMaking(); } flag = true; break; case SquadMsgType.WarStarted: case SquadMsgType.WarBuffBaseAttackStart: case SquadMsgType.WarBuffBaseAttackComplete: case SquadMsgType.WarPlayerAttackStart: case SquadMsgType.WarPlayerAttackComplete: case SquadMsgType.WarEnded: this.WarManager.HandleWarEventMsg(squadMsg); break; case SquadMsgType.WarPrepared: flag = true; break; case SquadMsgType.SquadLevelUp: flag2 = true; this.OnSquadLeveledUp(squadMsg); break; case SquadMsgType.PerkUnlocked: flag2 = true; this.OnPerkUnlocked(squadMsg); break; case SquadMsgType.PerkUpgraded: flag2 = true; this.OnPerkUpgraded(squadMsg); break; case SquadMsgType.PerkInvest: flag2 = true; this.OnPerkInvestment(squadMsg); break; case SquadMsgType.Invite: if (squadMsg.FriendInviteData != null && flag3) { SquadInvite invite = SquadMsgUtils.GenerateSquadInvite(squadMsg); this.StateManager.AddSquadInvite(invite); } break; case SquadMsgType.InviteRejected: { string text4 = (squadMsg.FriendInviteData == null) ? null : squadMsg.FriendInviteData.PlayerId; if (text4 != null && flag3) { this.StateManager.PlayersInvitedToSquad.Remove(text4); } break; } } SquadMsgType[] array = null; switch (squadMsg.Type) { case SquadMsgType.JoinRequestAccepted: case SquadMsgType.JoinRequestRejected: array = new SquadMsgType[] { SquadMsgType.JoinRequest }; break; case SquadMsgType.Leave: case SquadMsgType.Ejected: array = new SquadMsgType[] { SquadMsgType.JoinRequest, SquadMsgType.ShareBattle, SquadMsgType.TroopRequest }; break; } if (array != null && squadMsg.OwnerData != null) { this.MsgManager.RemoveMsgsByType(squadMsg.OwnerData.PlayerId, array); } } i++; } if (flag2) { Service.PerkViewController.UpdateLastViewedPerkTime(); } if (flag) { this.UpdateCurrentSquad(); } }
private void UpdateSquadDataForInvite(SquadInvite invite, LeaderboardController leaderboardController) { this.squadIdsRequiringDetails.Add(invite.SquadId); leaderboardController.UpdateSquadDetails(invite.SquadId, new LeaderboardController.OnUpdateSquadData(this.OnSquadDataUpdated)); }