Esempio 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();
                }
            });
        }
Esempio n. 2
0
        private void UpdateGuildUIs(GuildData guild)
        {
            if (guild == null)
            {
                return;
            }

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

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

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

            SocialCharacterData[] members;
            byte[] memberRoles;
            guild.GetSortedMembers(out members, out memberRoles);
            MemberList.Generate(members, (index, guildMember, ui) =>
            {
                SocialCharacterEntityTuple guildMemberEntity = new SocialCharacterEntityTuple();
                guildMemberEntity.socialCharacter            = guildMember;

                UIGuildCharacter uiGuildMember = ui.GetComponent <UIGuildCharacter>();
                uiGuildMember.uiSocialGroup    = this;
                uiGuildMember.Setup(guildMemberEntity, memberRoles[index], guild.GetRole(memberRoles[index]));
                uiGuildMember.Show();
                MemberSelectionManager.Add(uiGuildMember);
                if (selectedIdx == index)
                {
                    uiGuildMember.OnClickSelect();
                }
            });

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

            RoleSelectionManager.DeselectSelectedUI();
            RoleSelectionManager.Clear();

            RoleList.Generate(guild.GetRoles(), (index, guildRole, ui) =>
            {
                UIGuildRole uiGuildRole = ui.GetComponent <UIGuildRole>();
                uiGuildRole.Data        = guildRole;
                uiGuildRole.Show();
                RoleSelectionManager.Add(uiGuildRole);
                if (selectedIdx == index)
                {
                    uiGuildRole.OnClickSelect();
                }
            });

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

            SkillSelectionManager.DeselectSelectedUI();
            SkillSelectionManager.Clear();

            SkillList.Generate(GameInstance.GuildSkills.Values, (index, guildSkill, ui) =>
            {
                UIGuildSkill uiGuildSkill = ui.GetComponent <UIGuildSkill>();
                uiGuildSkill.Data         = new GuildSkillTuple(guildSkill, guild.GetSkillLevel(guildSkill.DataId));
                uiGuildSkill.Show();
                SkillSelectionManager.Add(uiGuildSkill);
                if (selectedIdx == index)
                {
                    uiGuildSkill.OnClickSelect();
                }
            });
        }