| | |
| | |
|
| | | public 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; // 珍宝阁记录类型
|
| | | public const int GuildBossActionType = 18; //讨伐
|
| | |
|
| | | // 申请的公会列表
|
| | | private List<int> m_FairyRequesteds = new List<int>();
|
| | | // 公会自定义记录附加数据,按类型存储
|
| | |
| | |
|
| | | public byte[] donateCntList;
|
| | | public event Action DonateCntListEvent;
|
| | | public event Action<bool> EnterOrQuitGuildEvent; //进入或退出公会事件
|
| | | public event Action<bool> EnterOrQuitGuildEvent; //true进入或false退出公会事件
|
| | |
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | ParseConfig();
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitialize;
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitializeEx;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
|
| | | PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent;
|
| | | TimeMgr.Instance.OnHourEvent += UpdateZBGRedpoint;
|
| | | }
|
| | | public override void Release()
|
| | | {
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitialize;
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitializeEx;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
|
| | | PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent;
|
| | | TimeMgr.Instance.OnHourEvent -= UpdateZBGRedpoint;
|
| | | }
|
| | |
|
| | |
|
| | | void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | ClearGuildData();
|
| | | donateCntList = null;
|
| | | }
|
| | |
|
| | | void OnBeforePlayerDataInitializeEx()
|
| | | {
|
| | | guildChanged = false;
|
| | | isQueryZBGYet = false;
|
| | | }
|
| | |
|
| | | void OnPlayerLoginOk()
|
| | |
| | | UpdateDonateRedPoint();
|
| | | QueryZBGFamilyInfo();
|
| | | }
|
| | | |
| | |
|
| | | void PlayerDataRefreshEvent(PlayerDataType type)
|
| | | {
|
| | | if(type == PlayerDataType.default33)
|
| | | if (type == PlayerDataType.default33)
|
| | | {
|
| | | UpdateDonateRedPoint();
|
| | | }
|
| | |
| | |
|
| | | void ClearGuildData()
|
| | | {
|
| | | PlayerDatas.Instance.baseData.FamilyId = 0;
|
| | | m_FairyRequesteds.Clear();
|
| | | familyActions.Clear();
|
| | | guildChanged = false;
|
| | | applyList.Clear();
|
| | | PlayerDatas.Instance.fairyData.ClearData();
|
| | |
|
| | | isQueryZBGYet = false;
|
| | | zhenbaogeCutState = 0;
|
| | | familyZBGActions.Clear();
|
| | | sortPlayerCut.Clear();
|
| | | }
|
| | | |
| | |
|
| | | //退出公会
|
| | | public void AfterQuitGuild()
|
| | | {
|
| | |
| | | UIManager.Instance.GetUI<MainWin>()?.ClickFunc(0);
|
| | |
|
| | |
|
| | | isQueryZBGYet = false;
|
| | | zhenbaogeCutState = 0;
|
| | | familyZBGActions.Clear();
|
| | | sortPlayerCut.Clear();
|
| | | |
| | | // isQueryZBGYet = false;
|
| | | // zhenbaogeCutState = 0;
|
| | | // familyZBGActions.Clear();
|
| | | // sortPlayerCut.Clear();
|
| | |
|
| | | UpdateZBGRedpoint();
|
| | | UpdateDonateRedPoint();
|
| | | EnterOrQuitGuildEvent?.Invoke(false);
|
| | | }
|
| | |
|
| | | //注意上线通知公会数据时也会触发
|
| | | //注意上线通知公会数据时也会触发; 但断线重连不会触发
|
| | | public async UniTask AfterEnterGuild()
|
| | | {
|
| | | //这里还没有公会数据, 后续的包会更新公会数据
|
| | | await UniTask.Delay(100);
|
| | | UpdateDonateRedPoint();
|
| | | UpdateZBGRedpoint();
|
| | | QueryZBGFamilyInfo();
|
| | | EnterOrQuitGuildEvent?.Invoke(true);
|
| | | }
|
| | |
|
| | |
| | | public int renameFairyNameMoneyType;
|
| | |
|
| | |
|
| | | |
| | |
|
| | |
|
| | | //珍宝阁(行商)
|
| | | public int zhenbaogeCutState = 0;
|
| | |
| | | public event Action UpdateZhenbaogeEvent;
|
| | | public bool isQueryZBGYet = false;
|
| | | public float lastZBGStartTime = 0; //过天刷新用
|
| | | public const int ZBGFamilyActionType = 16;
|
| | |
|
| | | //{id:数据} 砍价行为,value1为玩家ID,特殊约定为1时为家族的数据
|
| | | public Dictionary<int, HA513_tagMCFamilyActionInfo.tagMCFamilyAction> familyZBGActions = new Dictionary<int, HA513_tagMCFamilyActionInfo.tagMCFamilyAction>();
|
| | | public List<int> sortPlayerCut = new List<int>();
|
| | |
| | | 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");
|
| | | rankShowMaxCnt = int.Parse(config.Numerical1);
|
| | | pageCnt = int.Parse(config.Numerical2);
|
| | | queryPointNum = int.Parse(config.Numerical3);
|
| | | }
|
| | |
|
| | |
|
| | |
| | |
|
| | |
|
| | |
|
| | |
|
| | | #region 仙盟商店开启
|
| | | public int fairyStoreLimit = 0;
|
| | | public bool fairyStoreOpen
|
| | |
| | | #region 公会自定义记录
|
| | | public void UpdateFamilyAction(HA513_tagMCFamilyActionInfo _package)
|
| | | {
|
| | | if (PlayerDatas.Instance.fairyData == null ||
|
| | | PlayerDatas.Instance.fairyData.fairy == null ||
|
| | | PlayerDatas.Instance.fairyData.fairy.FamilyID != _package.FamilyID)
|
| | | if (PlayerDatas.Instance.baseData.FamilyId != _package.FamilyID)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 行商 砍价
|
| | | if (UpdateHawkerAction(_package))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 徽章
|
| | | if (GuildEmblemModel.Instance.UpdateEmblemAction(_package))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 公会讨伐
|
| | | if (GuildBossManager.Instance.UpdateGuildBossInfo(_package))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //上面各个功能要return
|
| | | UpdataCommonAction(_package);
|
| | | }
|
| | |
|
| | | // 通用记录 只适用单条数据的记录情况 或有服务端保证列表全部信息直接覆盖,其他功能比较复杂各自负责存储
|
| | | void UpdataCommonAction(HA513_tagMCFamilyActionInfo _package)
|
| | | {
|
| | | if (!familyActions.ContainsKey((int)_package.FamilyID))
|
| | | {
|
| | | familyActions.Add((int)_package.FamilyID, new Dictionary<int, HA513_tagMCFamilyActionInfo.tagMCFamilyAction[]>());
|
| | |
| | |
|
| | | familyActions[(int)_package.FamilyID][_package.ActionType] = _package.FamilyActionList;
|
| | |
|
| | | UpdateHawkerAction(_package);
|
| | |
|
| | | FamilyActionInfoEvent?.Invoke((int)_package.FamilyID, _package.ActionType);
|
| | | }
|
| | |
|
| | | // 通用记录 |
| | | public bool TryGetFamilyActions(int actionType, out HA513_tagMCFamilyActionInfo.tagMCFamilyAction[] familyAction)
|
| | | {
|
| | | familyAction = null;
|
| | |
| | | public List<int> pageIndexList = new List<int>(); //正常是按页查询,顺序添加即可
|
| | | public int curPageIndex;
|
| | | public int totalPageCount;
|
| | |
|
| | | public int lastPage = -1;
|
| | | public int pageCnt; //每页查询条数
|
| | | int queryPointNum; //查询点
|
| | | public int rankShowMaxCnt;
|
| | |
|
| | | 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;
|
| | |
|
| | | if (index >= rankShowMaxCnt)
|
| | | {
|
| | | //超过服务器已上榜的总数量,比如总榜单是100名,当前只有8名玩家上榜,往下滚动就不再查询
|
| | | return;
|
| | | }
|
| | | //Debug.LogFormat("分页查询:请求第 {0} 页 (当前index:{1})", page + 1, index);
|
| | | SendFindGuild(string.Empty, page + 1, pageCnt);
|
| | | }
|
| | | }
|
| | |
|
| | | //查找公会列表
|
| | | public void OnRefreshGuildViewList(HA523_tagMCFamilyViewList vNetData)
|
| | |
| | | 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)
|
| | | {
|
| | |
| | | return;
|
| | | }
|
| | | lastChangeMarkTime = Time.time;
|
| | | if (UIManager.Instance.IsOpened<GuildHallWin>())
|
| | | if ((netPack.Type == 1 || netPack.Type == 2) && UIManager.Instance.IsOpened<GuildBaseWin>())
|
| | | {
|
| | | RequestGuildData();
|
| | | }
|
| | |
| | | #endregion
|
| | |
|
| | | #region 珍宝阁
|
| | | |
| | |
|
| | |
|
| | | public void UpdateZhenbaogeInfo(HA512_tagMCFamilyZhenbaogeInfo netPack)
|
| | | {
|
| | |
| | | //登录后首次打开查询,换新仙盟查询
|
| | | public void QueryZBGFamilyInfo()
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.FamilyId == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (isQueryZBGYet)
|
| | | return;
|
| | |
|
| | | QueryFamilyAction((int)PlayerDatas.Instance.baseData.FamilyId, 16);
|
| | |
|
| | | QueryFamilyAction((int)PlayerDatas.Instance.baseData.FamilyId, ZBGFamilyActionType);
|
| | |
|
| | | isQueryZBGYet = true;
|
| | | }
|
| | |
| | |
|
| | |
|
| | | //更新砍价信息
|
| | | public void UpdateHawkerAction(HA513_tagMCFamilyActionInfo vNetData)
|
| | | public bool UpdateHawkerAction(HA513_tagMCFamilyActionInfo vNetData)
|
| | | {
|
| | | if (vNetData.ActionType != ZBGFamilyActionType)
|
| | | {
|
| | | return;
|
| | | return false;
|
| | | }
|
| | | bool restart = false;
|
| | | if (vNetData.FamilyActionList.Length == 1 && vNetData.FamilyActionList[0].Value1 == 1)
|
| | |
|
| | | for (int i = 0; i < vNetData.FamilyActionList.Length; i++)
|
| | | {
|
| | | int playerID = (int)vNetData.FamilyActionList[i].Value1;
|
| | | if (playerID != 1)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (familyZBGActions.ContainsKey(1) && familyZBGActions[1].Time != vNetData.FamilyActionList[0].Time)
|
| | | {
|
| | | familyZBGActions.Clear();
|
| | |
| | | restart = true;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | for (int i = 0; i < vNetData.FamilyActionList.Length; i++)
|
| | | {
|
| | |
| | |
|
| | | UpdateFamilyActionEvent?.Invoke(restart);
|
| | | UpdateZBGRedpoint();
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | //砍价人数
|
| | |
| | | }
|
| | |
|
| | |
|
| | | public Dictionary <int, FairyMember> tmpNoCutMembers = new Dictionary<int, FairyMember>();
|
| | | public Dictionary<int, FairyMember> tmpNoCutMembers = new Dictionary<int, FairyMember>();
|
| | |
|
| | | //未议价成员
|
| | | public void CalcNoCutMembers()
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | foreach(var playerID in fairy.memberIDList)
|
| | | foreach (var playerID in fairy.memberIDList)
|
| | | {
|
| | | if (!familyZBGActions.ContainsKey(playerID))
|
| | | {
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | |
|
| | | #region 红点
|
| | | Redpoint hallRedpoint = new Redpoint(MainRedDot.MainGuildRedpoint, MainRedDot.guildHallRedpointID);
|
| | | Redpoint donateRedpoint = new Redpoint(MainRedDot.guildHallRedpointID, MainRedDot.guildHallRedpointID * 10);
|
| | |
|
| | | Redpoint donateRedpoint = new Redpoint(MainRedDot.guildHallRedpointID, MainRedDot.donateRedpointID);
|
| | | //珍宝阁(行商)
|
| | | Redpoint zbgRedpoint = new Redpoint(MainRedDot.MainGuildRedpoint, MainRedDot.MainGuildRedpoint * 100 + 1);
|
| | | Redpoint zbgRedpoint = new Redpoint(MainRedDot.MainGuildRedpoint, MainRedDot.hawkerRedpointID);
|
| | |
|
| | | void UpdateDonateRedPoint()
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | public void UpdateZBGRedpoint()
|
| | | {
|
| | | zbgRedpoint.state = RedPointState.None;
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | if (TimeUtility.ServerNow.Hour < 10)
|
| | | return;
|
| | |
|
| | | if (zhenbaogeCutState == 0)
|
| | | {
|