| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | |
|
| | |
|
| | | /** 玩家仙盟相关信息缓存数据 */
|
| | |
| | | public FairyMember mine = null;
|
| | | public event Action OnRefreshFairyInfo;
|
| | | public event Action OnRefreshFairyMine; //玩家在公会里的数据
|
| | | private Dictionary<int, FairyMember> memberDic = new Dictionary<int, FairyMember>();
|
| | | Dictionary<int, FairyMember> memberDic = new Dictionary<int, FairyMember>();
|
| | | public List<int> memberIDList = new List<int>();
|
| | |
|
| | | // 0-成员,1-精英,2-副盟主,3-盟主
|
| | | public int leaderID;
|
| | | // // 精英
|
| | | // public List<int> elitePlayerIDList = new List<int>();
|
| | | public string leaderName;
|
| | | // // 副盟主
|
| | | // public List<int> deputyLeaderPlayerIDList = new List<int>();
|
| | | public List<int> deputyLeaderPlayerIDList = new List<int>();
|
| | |
|
| | | //差异更新 需增删改 memberDic memberIDList deputyLeaderPlayerIDList
|
| | | public void OnRefreshGuildInfo(HA520_tagMCRoleFamilyInfo vNetData)
|
| | | {
|
| | | if (fairy == null)
|
| | |
| | | fairy.totalFightPower = vNetData.FightPowerEx * Constants.ExpPointValue + vNetData.FightPower;
|
| | | fairy.Broadcast = vNetData.Broadcast;
|
| | | fairy.LeaderID = (int)vNetData.LeaderID;
|
| | | fairy.MemberCount = vNetData.MemberCount;
|
| | |
|
| | | mine = null;
|
| | | fairy.lastChangeNameTick = (int)vNetData.Extra1;
|
| | |
|
| | | memberDic.Clear();
|
| | |
|
| | | for (int i = 0; i < vNetData.MemberCount; i++)
|
| | | {
|
| | | FairyMember member = new FairyMember();
|
| | |
| | | OnRefreshFairyMine?.Invoke();
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | // 0-成员,1-精英,2-副盟主,3-盟主
|
| | |
|
| | | // if (member.FmLV == 1)
|
| | | // {
|
| | | // eliteList.Add(member);
|
| | | // }
|
| | | // else if (member.FamilyLV == 2)
|
| | | // {
|
| | | // deputyLeaderList.Add(member);
|
| | | // }
|
| | | if (deputyLeaderPlayerIDList.Contains(member.PlayerID) && member.FmLV != 2)
|
| | | {
|
| | | deputyLeaderPlayerIDList.Remove(member.PlayerID);
|
| | | }
|
| | | else if (member.FmLV == 2 && !deputyLeaderPlayerIDList.Contains(member.PlayerID))
|
| | | {
|
| | | // 对应的变更 和 退出需同步修改
|
| | | deputyLeaderPlayerIDList.Add(member.PlayerID);
|
| | | }
|
| | |
|
| | |
|
| | | if (member.FmLV == 3)
|
| | | {
|
| | | leaderID = (int)member.PlayerID;
|
| | | leaderID = member.PlayerID;
|
| | | leaderName = member.Name;
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | if (mine.FmLV == 3 && mine.PlayerID != leaderID)
|
| | | {
|
| | | mine.FmLV = 0;
|
| | | }
|
| | | RefreshMemberIDList();
|
| | |
|
| | | if (OnRefreshFairyInfo != null) OnRefreshFairyInfo();
|
| | | }
|
| | |
|
| | |
|
| | | public void DeleteMember(HA524_tagSCFamilyMemDel netPack)
|
| | | {
|
| | | if (memberDic.ContainsKey((int)netPack.PlayerID))
|
| | | {
|
| | | memberDic.Remove((int)netPack.PlayerID);
|
| | | RefreshMemberIDList();
|
| | | }
|
| | | if (deputyLeaderPlayerIDList.Contains((int)netPack.PlayerID))
|
| | | {
|
| | | deputyLeaderPlayerIDList.Remove((int)netPack.PlayerID);
|
| | | }
|
| | |
|
| | | OnRefreshFairyInfo?.Invoke();
|
| | | }
|
| | |
|
| | | void RefreshMemberIDList()
|
| | | {
|
| | | memberIDList.Clear();
|
| | | memberIDList.AddRange(memberDic.Keys);
|
| | | memberIDList.Sort(SortMember);
|
| | | fairy.MemberCount = memberIDList.Count;
|
| | | }
|
| | |
|
| | | public FairyMember GetMember(int playerid)
|
| | |
| | | FairyMember member = null;
|
| | | memberDic.TryGetValue(playerid, out member);
|
| | | return member;
|
| | | }
|
| | |
|
| | | public List<int> GetMemberIDList()
|
| | | {
|
| | | return memberDic.Keys.ToList();
|
| | | }
|
| | |
|
| | |
|
| | |
| | | fairy = null;
|
| | | mine = null;
|
| | | memberDic.Clear();
|
| | | memberIDList.Clear();
|
| | | leaderID = 0;
|
| | | leaderName = string.Empty;
|
| | | }
|
| | |
|
| | | int SortMember(int id1, int id2)
|
| | | {
|
| | | var memberA = memberDic[id1];
|
| | | var memberB = memberDic[id2];
|
| | | if (memberA.FmLV != memberB.FmLV)
|
| | | {
|
| | | return memberB.FmLV.CompareTo(memberA.FmLV);
|
| | | }
|
| | |
|
| | | if (memberA.FightPower != memberB.FightPower)
|
| | | {
|
| | | return memberB.FightPower.CompareTo(memberA.FightPower);
|
| | | }
|
| | |
|
| | | if (memberA.JoinTime != memberB.JoinTime)
|
| | | {
|
| | | return memberA.JoinTime.CompareTo(memberB.JoinTime);
|
| | | }
|
| | | return memberA.PlayerID.CompareTo(memberB.PlayerID);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public long totalFightPower;
|
| | | public string Broadcast;
|
| | | public int LeaderID; //族长玩家ID
|
| | | public int LeaderServerID; //族长服务器ID
|
| | | public int MemberCount;
|
| | | public int lastChangeNameTick;
|
| | |
|
| | | //查找增加的字段
|
| | | public string LeaderName;
|
| | |
| | | public class FairyApply
|
| | | {
|
| | | public int PlayerID;
|
| | | public string Name; |
| | | public string Name;
|
| | | public int ReqTime; //申请时间戳
|
| | | public int LV; //等级
|
| | | public int Job; //职业
|
| | |
| | | public int Face; //基本脸型
|
| | | public int FacePic; //头像框
|
| | | public int TitleID; //称号
|
| | | public long FightPower; |
| | | public long FightPower;
|
| | | public int ServerID; //所属区服ID
|
| | | public int IsOnLine; //是否在线
|
| | | }
|