Ejemplo n.º 1
0
        private void UpdatePartyUIs(PartyData party)
        {
            if (party == null)
            {
                return;
            }

            memberAmount = party.CountMember();
            UpdateUIs();

            int selectedIdx = MemberSelectionManager.SelectedUI != null?MemberSelectionManager.IndexOf(MemberSelectionManager.SelectedUI) : -1;

            MemberSelectionManager.DeselectSelectedUI();
            MemberSelectionManager.Clear();

            SocialCharacterData[] members;
            party.GetSortedMembers(out members);
            MemberList.Generate(members, (index, partyMember, ui) =>
            {
                SocialCharacterEntityTuple partyMemberEntity = new SocialCharacterEntityTuple();
                partyMemberEntity.socialCharacter            = partyMember;

                UISocialCharacter uiPartyMember = ui.GetComponent <UISocialCharacter>();
                uiPartyMember.uiSocialGroup     = this;
                uiPartyMember.Data = partyMemberEntity;
                uiPartyMember.Show();
                MemberSelectionManager.Add(uiPartyMember);
                if (selectedIdx == index)
                {
                    uiPartyMember.OnClickSelect();
                }
            });
        }
Ejemplo n.º 2
0
 public virtual bool CanAddPartyMember(BasePlayerCharacterEntity inviteCharacterEntity, BasePlayerCharacterEntity acceptCharacterEntity, out int partyId, out PartyData party)
 {
     partyId = 0;
     party   = null;
     if (inviteCharacterEntity == null || acceptCharacterEntity == null || !IsServer)
     {
         return(false);
     }
     if (acceptCharacterEntity.PartyId > 0)
     {
         SendServerGameMessage(acceptCharacterEntity.ConnectionId, GameMessage.Type.JoinedAnotherParty);
         return(false);
     }
     partyId = inviteCharacterEntity.PartyId;
     if (partyId <= 0 || !parties.TryGetValue(partyId, out party))
     {
         SendServerGameMessage(acceptCharacterEntity.ConnectionId, GameMessage.Type.CharacterNotJoinedParty);
         return(false);
     }
     if (party.CountMember() >= party.MaxMember())
     {
         SendServerGameMessage(acceptCharacterEntity.ConnectionId, GameMessage.Type.PartyMemberReachedLimit);
         return(false);
     }
     return(true);
 }