| | |
| | | using UnityEngine;
|
| | |
|
| | |
|
| | | public class GuildManager : GameSystemManager<GuildManager>
|
| | | public partial class GuildManager : GameSystemManager<GuildManager>
|
| | | {
|
| | | // 家族自定义记录类型
|
| | | public const int CustomyActionType = 0; //通用
|
| | | public const int MemberChangeActionType = 12; //公会变更记录
|
| | | public const int FamilyActionsType = 15; // 公会记录徽章类型15
|
| | | public const int ZBGFamilyActionType = 16; // 珍宝阁记录类型
|
| | |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
|
| | | PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent;
|
| | | TimeMgr.Instance.OnHourEvent += UpdateZBGRedpoint;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += OnRefreshFairyInfo;
|
| | | }
|
| | | public override void Release()
|
| | | {
|
| | |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
|
| | | PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent;
|
| | | TimeMgr.Instance.OnHourEvent -= UpdateZBGRedpoint;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= OnRefreshFairyInfo;
|
| | | }
|
| | |
|
| | | private void OnRefreshFairyInfo()
|
| | | {
|
| | | UpdateRequestRedpoint();
|
| | | UpdateDonateRedPoint();
|
| | | }
|
| | |
|
| | | void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | zoneID = 0;
|
| | | crossServerIDList.Clear();
|
| | | ClearGuildData();
|
| | | donateCntList = null;
|
| | | }
|
| | |
|
| | | void OnBeforePlayerDataInitializeEx()
|
| | | {
|
| | | guildChanged = false;
|
| | | isQueryZBGYet = false;
|
| | | //增量的形式
|
| | | PlayerDatas.Instance.fairyData.ClearData();
|
| | | }
|
| | |
|
| | | void OnPlayerLoginOk()
|
| | |
| | | PlayerDatas.Instance.baseData.FamilyId = 0;
|
| | | m_FairyRequesteds.Clear();
|
| | | familyActions.Clear();
|
| | | guildChanged = false;
|
| | | applyList.Clear();
|
| | | PlayerDatas.Instance.fairyData.ClearData();
|
| | |
|
| | |
| | |
|
| | |
|
| | | //珍宝阁(行商)
|
| | | public int zhenbaogeCutState = 0;
|
| | | int m_ZhenbaogeCutState = 0;
|
| | | public int zhenbaogeCutState
|
| | | {
|
| | | get
|
| | | {
|
| | | if (familyZBGActions.Count - 1 >= 50)
|
| | | {
|
| | | //砍价人数超过上限后可直接购买
|
| | | m_ZhenbaogeCutState = 1;
|
| | | }
|
| | | return m_ZhenbaogeCutState;
|
| | | }
|
| | | set
|
| | | {
|
| | |
|
| | | m_ZhenbaogeCutState = value;
|
| | | }
|
| | | }
|
| | | public int zhenbaogeBuyState = 0;
|
| | | public bool needCheckCutCD = false;
|
| | | public event Action UpdateZhenbaogeEvent;
|
| | |
| | | public int zbgOrgPriceValue;
|
| | | public int zbgChangFamilyCD;
|
| | | public List<int> cutCntListForTalk = new List<int>();
|
| | |
|
| | | public int familyRecordMaxCount;
|
| | |
|
| | | void ParseConfig()
|
| | | {
|
| | |
| | | zbgOrgPriceValue = int.Parse(config.Numerical2);
|
| | | zbgChangFamilyCD = int.Parse(config.Numerical3);
|
| | | cutCntListForTalk = JsonMapper.ToObject<List<int>>(config.Numerical4);
|
| | |
|
| | | config = FuncConfigConfig.Get("FamilyNote");
|
| | | familyRecordMaxCount = int.Parse(config.Numerical1);
|
| | |
|
| | |
|
| | | config = FuncConfigConfig.Get("FamilyBillboardSet");
|
| | | pageCnt = int.Parse(config.Numerical1);
|
| | | queryPointNum = int.Parse(config.Numerical2);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | punishTime = quitGuildPunishTime[Math.Min(quitCount, quitGuildPunishTime.Length - 1)];
|
| | | }
|
| | |
|
| | | return punishTime * 60 - (TimeUtility.AllSeconds - PlayerDatas.Instance.baseData.leaveFamilyTime);
|
| | | return punishTime * 60 - (TimeUtility.GetCommServerTick(zoneID)- PlayerDatas.Instance.baseData.leaveFamilyTime);
|
| | | }
|
| | |
|
| | |
|
| | |
| | |
|
| | | // 查找的公会ID:公会数据
|
| | | public Dictionary<int, FairyData> guildsDict = new Dictionary<int, FairyData>();
|
| | | public int myFairyRank;
|
| | | // 按查询页存储
|
| | | public List<int> pageIndexList = new List<int>(); //正常是按页查询,顺序添加即可
|
| | | public int curPageIndex;
|
| | | public int totalPageCount;
|
| | |
|
| | | public int lastPage = -1;
|
| | | public int pageCnt; //每页查询条数
|
| | | int queryPointNum; //查询点
|
| | |
|
| | | public bool isPowerSort
|
| | | {
|
| | | get
|
| | | {
|
| | | return LocalSave.GetBool($"GuildApplyList_IsPowerSort_{PlayerDatas.Instance.PlayerId}");
|
| | | }
|
| | | set
|
| | | {
|
| | | LocalSave.SetBool($"GuildApplyList_IsPowerSort_{PlayerDatas.Instance.PlayerId}", value);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | public FairyData GetFairyDataByRank(int rank)
|
| | | {
|
| | | if (rank < 1)
|
| | | return null;
|
| | | int index = rank - 1;
|
| | | FairyData fairyData = GetFairyDataByIndex(index);
|
| | | return fairyData;
|
| | | }
|
| | |
|
| | | public FairyData GetFairyDataByIndex(int index)
|
| | | {
|
| | | if (pageIndexList.IsNullOrEmpty() || index < 0 || index >= pageIndexList.Count)
|
| | | return null;
|
| | | int fairyID = pageIndexList[index];
|
| | | FairyData fairyData = GetFairyData(fairyID);
|
| | | return fairyData;
|
| | | }
|
| | |
|
| | | public FairyData GetFairyData(int fairyID)
|
| | | {
|
| | | return guildsDict.TryGetValue(fairyID, out var data) ? data : null;
|
| | | }
|
| | |
|
| | | public void ResetQueryParam()
|
| | | {
|
| | | pageCnt = 20;
|
| | | lastPage = -1;
|
| | | queryPointNum = 12;
|
| | | }
|
| | |
|
| | | public void ListenRankPage(int index)
|
| | | {
|
| | | int page = index / pageCnt;
|
| | | if (index > page * pageCnt + queryPointNum)
|
| | | {
|
| | | if (lastPage >= page)
|
| | | return;
|
| | | lastPage = page;
|
| | | SendFindGuild(string.Empty, page + 1, pageCnt);
|
| | | }
|
| | | }
|
| | |
|
| | | //查找公会列表
|
| | | public void OnRefreshGuildViewList(HA523_tagMCFamilyViewList vNetData)
|
| | |
| | | SetFairyViewData(data, guildInfo);
|
| | | pageIndexList.Add((int)guildInfo.FamilyID);
|
| | | }
|
| | |
|
| | | myFairyRank = (int)vNetData.Rank; //0-没有公会或没有在榜上;>0-对应排名
|
| | |
|
| | | if (OnRefreshFairyList != null)
|
| | | {
|
| | |
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | public void SendFindGuildNoDecrypt(string msg, int pageIndex = 0, int pageSize = 20)
|
| | | {
|
| | | if (pageIndex == 0)
|
| | | {
|
| | | //默认查询第一页即代表重新开始查询,清空之前的数据
|
| | | guildsDict.Clear();
|
| | | pageIndexList.Clear();
|
| | | }
|
| | | var pack = new CA620_tagCMViewFamilyPage();
|
| | | pack.Msg = msg;
|
| | | pack.MsgLen = (byte)msg.Length;
|
| | | pack.PageIndex = (byte)pageIndex;
|
| | | pack.ShowCount = (byte)pageSize;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | public static void SetFairyViewData(FairyData data, HA523_tagMCFamilyViewList.tagMCFamilyView view)
|
| | | {
|
| | | data.Rank = view.Rank;
|
| | | data.FamilyID = (int)view.FamilyID;
|
| | | data.FamilyName = view.FamilyName;
|
| | | data.LeaderID = (int)view.LeaderID;
|
| | | data.LeaderServerID = (int)view.LeaderServerID;
|
| | | data.LeaderName = view.LeaderName;
|
| | | data.FamilyLV = view.FamilyLV;
|
| | | data.JoinReview = view.JoinReview;
|
| | |
| | | data.EmblemWord = view.EmblemWord;
|
| | | data.totalFightPower = view.FightPowerEx * Constants.ExpPointValue + view.FightPower;
|
| | | data.MemberCount = view.MemberCount;
|
| | |
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 查看目标公会
|
| | | public Dictionary<int, FairyData> viewGuildsDict = new Dictionary<int, FairyData>();
|
| | |
|
| | | public event Action OnUpdateViewFamilyInfo;
|
| | |
|
| | | public void UpdateViewFamilyInfo(HA519_tagSCTagFamilyInfo pack)
|
| | | {
|
| | | FairyData data = new FairyData();
|
| | | SetFairyViewData(data, pack);
|
| | | viewGuildsDict[(int)data.FamilyID] = data;
|
| | | OnUpdateViewFamilyInfo?.Invoke();
|
| | | }
|
| | |
|
| | | public static void SetFairyViewData(FairyData data, HA519_tagSCTagFamilyInfo view)
|
| | | {
|
| | | data.FamilyID = (int)view.FamilyID;
|
| | | data.FamilyName = view.FamilyName;
|
| | | data.LeaderID = (int)view.LeaderID;
|
| | | data.LeaderServerID = (int)view.LeaderServerID;
|
| | | data.LeaderName = view.LeaderName;
|
| | | data.FamilyLV = view.FamilyLV;
|
| | | data.ServerID = (int)view.ServerID;
|
| | | data.EmblemID = (int)view.EmblemID;
|
| | | data.EmblemWord = view.EmblemWord;
|
| | | data.totalFightPower = view.FightPowerEx * Constants.ExpPointValue + view.FightPower;
|
| | | data.MemberCount = view.MemberCount;
|
| | | }
|
| | |
|
| | | public void SendViewGuild(int fairyID, int serverID)
|
| | | {
|
| | | var pack = new CA619_tagCSViewTagFamily();
|
| | | pack.FamilyID = (uint)fairyID;
|
| | | pack.DataServerID = (uint)serverID;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 申请列表
|
| | | public event Action OnRefreshApplyList;
|
| | | private List<FairyApply> applyList = new List<FairyApply>();
|
| | | private Redpoint memberRedpoint = new Redpoint(107, 10702);
|
| | | private Redpoint applyRedpoint = new Redpoint(10702, 1070201);
|
| | | private Redpoint applyRedpoint = new Redpoint(MainRedDot.MainGuildRedpoint, 1070201);
|
| | |
|
| | | //申请加入的玩家信息
|
| | | public void OnRefreshRequestJoinPlayerInfo(HA522_tagMCFamilyReqJoinInfo vNetData)
|
| | |
| | | }
|
| | | UpdateRequestRedpoint();
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | void UpdateRequestRedpoint()
|
| | | {
|
| | |
| | | SysNotifyMgr.Instance.ShowTip("jiazu_lhs_202580");
|
| | | return;
|
| | | }
|
| | |
|
| | | if (guildsDict[id].JoinLVMin > PlayerDatas.Instance.baseData.realmLevel && RealmConfig.HasKey(guildsDict[id].JoinLVMin))
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("GuildApply01", RealmConfig.Get(guildsDict[id].JoinLVMin).Name);
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return 0;
|
| | | }
|
| | |
|
| | | public void SendJoinFamilyReply(int tagPlayerID, bool isOK)
|
| | | {
|
| | | CA621_tagCMJoinFamilyReply pack = new CA621_tagCMJoinFamilyReply();
|
| | | pack.TagPlayerID = (uint)tagPlayerID;
|
| | | pack.IsOK = (byte)(isOK ? 1 : 0);
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | public void SendChangeFamilyJoin(int joinReview, int joinLVMin)
|
| | | {
|
| | | CA622_tagCMChangeFamilyJoin pack = new CA622_tagCMChangeFamilyJoin();
|
| | | pack.JoinReview = (byte)joinReview;
|
| | | pack.JoinLVMin = (ushort)joinLVMin;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | public void SendRequestJoinFamilyByPlayer(int tagPlayerID)
|
| | | {
|
| | | CA601_tagCMRequestJoinFamilyByPlayer pack = new CA601_tagCMRequestJoinFamilyByPlayer();
|
| | | pack.TagPlayerID = (uint)tagPlayerID;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | List<string> optionStrings = null;
|
| | | List<int> options = null;
|
| | | public bool TryGetApplyOptions(out List<int> optionKeys, out List<string> optionValues)
|
| | | {
|
| | | optionKeys = null;
|
| | | optionValues = null;
|
| | |
|
| | | if (options == null)
|
| | | {
|
| | | options = new List<int>();
|
| | | options = new List<int>(RealmConfig.GetKeys());
|
| | | options.Sort();
|
| | | options.Remove(0);
|
| | | }
|
| | |
|
| | | if (optionStrings == null)
|
| | | {
|
| | | optionStrings = new List<string>();
|
| | | foreach (int lv in options)
|
| | | {
|
| | | if (!RealmConfig.HasKey(lv))
|
| | | continue;
|
| | | RealmConfig realmConfig = RealmConfig.Get(lv);
|
| | | optionStrings.Add(UIHelper.AppendColor(OfficialRankManager.Instance.GetOfficialRankColor(realmConfig.Quality), realmConfig.Name));
|
| | | }
|
| | | }
|
| | |
|
| | | if (options.IsNullOrEmpty() || optionStrings.IsNullOrEmpty() || options.Count != optionStrings.Count)
|
| | | return false;
|
| | | optionKeys = options;
|
| | | optionValues = optionStrings;
|
| | | return true;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | float lastChangeMarkTime = 0; //打开界面情况下避免短时间多次立即请求,C/S通信也是有时间间隔
|
| | | public bool guildChanged = false;
|
| | | //Type:0-无;1-成员加入;2-成员退出;3-收人设置修改;4-公告修改;5-徽章修改;6-盟主变更;7-成员职位变更;8-成员上线;9-成员离线;
|
| | | //公会数据变化,请求新的公会信息,如在打开公会列表时请求,其他功能根据自身情况请求
|
| | | public void UpdateGuildDataChangeMark(HA521_tagMCFamilyChange netPack)
|
| | | {
|
| | | guildChanged = true;
|
| | | if (Time.time - lastChangeMarkTime < 0.2f)
|
| | | {
|
| | | //小优化 如果有问题也可以去除
|
| | | return;
|
| | | }
|
| | | lastChangeMarkTime = Time.time;
|
| | | if (UIManager.Instance.IsOpened<GuildHallWin>())
|
| | | {
|
| | | RequestGuildData();
|
| | | }
|
| | | }
|
| | |
|
| | | public void RequestGuildData()
|
| | | {
|
| | | if (guildChanged)
|
| | | {
|
| | | guildChanged = false;
|
| | | var pack = new CA626_tagCMGetFamilyInfo();
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | public void SendKickFairy(uint playerID)
|
| | | {
|
| | |
| | | return false;
|
| | | }
|
| | | bool restart = false;
|
| | | |
| | |
|
| | | for (int i = 0; i < vNetData.FamilyActionList.Length; i++)
|
| | | {
|
| | | int playerID = (int)vNetData.FamilyActionList[i].Value1;
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | |
|
| | | #region 红点
|
| | |
|
| | | Redpoint donateRedpoint = new Redpoint(MainRedDot.guildHallRedpointID, MainRedDot.donateRedpointID);
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | if (TimeUtility.ServerNow.Hour < 10)
|
| | | if (TimeUtility.GetCommServerNow(zoneID).Hour < 10)
|
| | | return;
|
| | |
|
| | | if (zhenbaogeCutState == 0)
|