コード例 #1
0
ファイル: PartyData.cs プロジェクト: ming81/TheExperiment
        public void GetSortedMembers(out SocialCharacterData[] sortedMembers)
        {
            var i = 0;
            var offlineMembers = new List <SocialCharacterData>();

            sortedMembers      = new SocialCharacterData[members.Count];
            sortedMembers[i++] = members[leaderId];
            SocialCharacterData tempMember;

            foreach (var memberId in members.Keys)
            {
                if (memberId.Equals(leaderId))
                {
                    continue;
                }
                tempMember = members[memberId];
                if (!IsOnline(memberId))
                {
                    offlineMembers.Add(tempMember);
                    continue;
                }
                sortedMembers[i++] = tempMember;
            }
            foreach (var offlineMember in offlineMembers)
            {
                sortedMembers[i++] = offlineMember;
            }
        }
コード例 #2
0
        public void GetSortedMembers(out SocialCharacterData[] sortedMembers, out byte[] sortedMemberRoles)
        {
            var i = 0;
            var offlineMembers = new List <SocialCharacterData>();

            sortedMembers          = new SocialCharacterData[members.Count];
            sortedMemberRoles      = new byte[members.Count];
            sortedMembers[i]       = members[leaderId];
            sortedMemberRoles[i++] = LeaderRole;
            SocialCharacterData tempMember;

            foreach (var memberId in members.Keys)
            {
                if (memberId.Equals(leaderId))
                {
                    continue;
                }
                tempMember = members[memberId];
                if (!IsOnline(memberId))
                {
                    offlineMembers.Add(tempMember);
                    continue;
                }
                sortedMembers[i]       = tempMember;
                sortedMemberRoles[i++] = memberRoles.ContainsKey(tempMember.id) ? memberRoles[tempMember.id] : LowestMemberRole;
            }
            foreach (var offlineMember in offlineMembers)
            {
                sortedMembers[i]       = offlineMember;
                sortedMemberRoles[i++] = memberRoles.ContainsKey(offlineMember.id) ? memberRoles[offlineMember.id] : LowestMemberRole;
            }
        }
コード例 #3
0
        public void Show(GuildRoleData[] roles, SocialCharacterData member, byte guildRole)
        {
            base.Show();

            characterId = member.id;

            if (uiTextName != null)
            {
                uiTextName.text = string.Format(nameFormat, string.IsNullOrEmpty(member.characterName) ? "Unknow" : member.characterName);
            }

            if (uiTextLevel != null)
            {
                uiTextLevel.text = string.Format(levelFormat, member.level.ToString("N0"));
            }

            if (dropdownRoles != null)
            {
                var options = new List <DropdownWrapper.OptionData>();
                options.Add(new DropdownWrapper.OptionData("None"));
                for (var i = 1; i < roles.Length; ++i)
                {
                    options.Add(new DropdownWrapper.OptionData(roles[i].roleName));
                }
                dropdownRoles.options = options;
                dropdownRoles.value   = guildRole;
            }
        }
コード例 #4
0
        public void Show(GuildRoleData[] roles, SocialCharacterData member, byte guildRole)
        {
            base.Show();

            characterId = member.id;

            if (uiTextName != null)
            {
                uiTextName.text = string.Format(
                    LanguageManager.GetText(formatKeyName),
                    string.IsNullOrEmpty(member.characterName) ? LanguageManager.GetUnknowTitle() : member.characterName);
            }

            if (uiTextLevel != null)
            {
                uiTextLevel.text = string.Format(
                    LanguageManager.GetText(formatKeyLevel),
                    member.level.ToString("N0"));
            }

            if (dropdownRoles != null)
            {
                List <DropdownWrapper.OptionData> options = new List <DropdownWrapper.OptionData>();
                options.Add(new DropdownWrapper.OptionData(LanguageManager.GetText(UILocaleKeys.UI_LABEL_NONE.ToString())));
                for (int i = 1; i < roles.Length; ++i)
                {
                    options.Add(new DropdownWrapper.OptionData(roles[i].roleName));
                }
                dropdownRoles.options = options;
                dropdownRoles.value   = guildRole;
            }
        }
コード例 #5
0
 public SocialCharacterData CreateMemberData(BasePlayerCharacterEntity playerCharacterEntity)
 {
     tempMemberData               = new SocialCharacterData();
     tempMemberData.id            = playerCharacterEntity.Id;
     tempMemberData.characterName = playerCharacterEntity.CharacterName;
     tempMemberData.dataId        = playerCharacterEntity.DataId;
     tempMemberData.level         = playerCharacterEntity.Level;
     tempMemberData.currentHp     = playerCharacterEntity.CurrentHp;
     tempMemberData.maxHp         = playerCharacterEntity.CacheMaxHp;
     tempMemberData.currentMp     = playerCharacterEntity.CurrentMp;
     tempMemberData.maxMp         = playerCharacterEntity.CacheMaxMp;
     return(tempMemberData);
 }
コード例 #6
0
        public virtual void AddMember(SocialCharacterData memberData)
        {
            if (!members.ContainsKey(memberData.id))
            {
                members.Add(memberData.id, memberData);
                return;
            }
            SocialCharacterData oldMemberData = members[memberData.id];

            oldMemberData.characterName = memberData.characterName;
            oldMemberData.dataId        = memberData.dataId;
            oldMemberData.level         = memberData.level;
            members[memberData.id]      = oldMemberData;
        }
コード例 #7
0
        public void OnClickKickFromGuild()
        {
            // If not in the guild or not leader, return
            if (!OwningCharacterCanKick() || MemberSelectionManager.SelectedUI == null)
            {
                return;
            }

            SocialCharacterData guildMember = MemberSelectionManager.SelectedUI.Data.socialCharacter;

            UISceneGlobal.Singleton.ShowMessageDialog(LanguageManager.GetText(UILocaleKeys.UI_GUILD_KICK_MEMBER.ToString()), string.Format(LanguageManager.GetText(UILocaleKeys.UI_GUILD_KICK_MEMBER_DESCRIPTION.ToString()), guildMember.characterName), false, true, true, false, null, () =>
            {
                BasePlayerCharacterController.OwningCharacter.RequestKickFromGuild(guildMember.id);
            });
        }
コード例 #8
0
        public void OnClickChangeLeader()
        {
            // If not in the party or not leader, return
            if (!OwningCharacterIsLeader() || MemberSelectionManager.SelectedUI == null)
            {
                return;
            }

            SocialCharacterData partyMember = MemberSelectionManager.SelectedUI.Data.socialCharacter;

            UISceneGlobal.Singleton.ShowMessageDialog(LanguageManager.GetText(UILocaleKeys.UI_PARTY_CHANGE_LEADER.ToString()), string.Format(LanguageManager.GetText(UILocaleKeys.UI_PARTY_CHANGE_LEADER_DESCRIPTION.ToString()), partyMember.characterName), false, true, true, false, null, () =>
            {
                BasePlayerCharacterController.OwningCharacter.RequestChangePartyLeader(partyMember.id);
            });
        }
コード例 #9
0
        public virtual void UpdateMember(SocialCharacterData memberData)
        {
            if (!members.ContainsKey(memberData.id))
            {
                return;
            }
            SocialCharacterData oldMemberData = members[memberData.id];

            oldMemberData.characterName = memberData.characterName;
            oldMemberData.dataId        = memberData.dataId;
            oldMemberData.level         = memberData.level;
            oldMemberData.currentHp     = memberData.currentHp;
            oldMemberData.maxHp         = memberData.maxHp;
            oldMemberData.currentMp     = memberData.currentMp;
            oldMemberData.maxMp         = memberData.maxMp;
            members[memberData.id]      = oldMemberData;
        }
コード例 #10
0
 public override void AddMember(SocialCharacterData memberData)
 {
     base.AddMember(memberData);
     SetMemberRole(memberData.id, IsLeader(memberData.id) ? LeaderRole : LowestMemberRole);
 }
コード例 #11
0
 public void UpdateMember(SocialCharacterData memberData, byte guildRole)
 {
     base.UpdateMember(memberData);
     SetMemberRole(memberData.id, guildRole);
 }
コード例 #12
0
 public bool TryGetMember(string id, out SocialCharacterData result)
 {
     return(members.TryGetValue(id, out result));
 }