| | |
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using System.Text;
|
| | | using Cysharp.Threading.Tasks;
|
| | | using LitJson;
|
| | | using UnityEngine;
|
| | |
|
| | |
|
| | | public class GuildManager : GameSystemManager<GuildManager>
|
| | | public partial class GuildManager : GameSystemManager<GuildManager>
|
| | | {
|
| | | // 家族自定义记录类型
|
| | | 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 Dictionary<int, Dictionary<int, HA513_tagMCFamilyActionInfo.tagMCFamilyAction[]>> familyActions = new Dictionary<int, Dictionary<int, HA513_tagMCFamilyActionInfo.tagMCFamilyAction[]>>();
|
| | | public event Action<int, int> FamilyActionInfoEvent; //公会自定义记录, 其他功能从这获取
|
| | |
|
| | | public override void Init()
|
| | | //要操作哪个成员的索引
|
| | | int m_MemberOPIndex = -1;
|
| | | public event Action MemberOPIndexEvent;
|
| | | public int memberOPIndex
|
| | | {
|
| | | ParseConfig();
|
| | | // PlayerDatas.Instance.fairyData.OnRefreshFairyMine += OnRefreshFairyMine;
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
|
| | | }
|
| | | public override void Release()
|
| | | {
|
| | | // PlayerDatas.Instance.fairyData.OnRefreshFairyMine -= OnRefreshFairyMine;
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
|
| | | }
|
| | |
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | m_FairyRequesteds.Clear();
|
| | | familyActions.Clear();
|
| | | guildChanged = false;
|
| | | applyList.Clear();
|
| | | PlayerDatas.Instance.fairyData.ClearData();
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | private void OnRefreshFairyMine()
|
| | | {
|
| | | if (!PlayerDatas.Instance.fairyData.HasFairy)
|
| | | get { return m_MemberOPIndex; }
|
| | | set
|
| | | {
|
| | | //退出公会
|
| | | familyActions.Clear();
|
| | | m_MemberOPIndex = value;
|
| | | MemberOPIndexEvent?.Invoke();
|
| | | }
|
| | | }
|
| | |
|
| | | public byte[] donateCntList;
|
| | | public event Action DonateCntListEvent;
|
| | | public event Action<bool> EnterOrQuitGuildEvent; //true进入或false退出公会事件
|
| | |
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | ParseConfig();
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitialize;
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitializeEx;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
|
| | | PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent;
|
| | | TimeMgr.Instance.OnHourEvent += UpdateZBGRedpoint;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += OnRefreshFairyInfo;
|
| | | }
|
| | | public override void Release()
|
| | | {
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitialize;
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitializeEx;
|
| | | 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()
|
| | | {
|
| | | isQueryZBGYet = false;
|
| | | //增量的形式
|
| | | PlayerDatas.Instance.fairyData.ClearData();
|
| | | }
|
| | |
|
| | | void OnPlayerLoginOk()
|
| | | {
|
| | | UpdateDonateRedPoint();
|
| | | QueryZBGFamilyInfo();
|
| | | }
|
| | |
|
| | | void PlayerDataRefreshEvent(PlayerDataType type)
|
| | | {
|
| | | if (type == PlayerDataType.default33)
|
| | | {
|
| | | UpdateDonateRedPoint();
|
| | | }
|
| | | }
|
| | |
|
| | | void ClearGuildData()
|
| | | {
|
| | | PlayerDatas.Instance.baseData.FamilyId = 0;
|
| | | m_FairyRequesteds.Clear();
|
| | | familyActions.Clear();
|
| | | applyList.Clear();
|
| | | PlayerDatas.Instance.fairyData.ClearData();
|
| | |
|
| | | isQueryZBGYet = false;
|
| | | zhenbaogeCutState = 0;
|
| | | familyZBGActions.Clear();
|
| | | sortPlayerCut.Clear();
|
| | | }
|
| | |
|
| | | //退出公会
|
| | | public void AfterQuitGuild()
|
| | | {
|
| | | //退出公会
|
| | | ClearGuildData();
|
| | | //需要转到HomeWin界面 且关闭公会相关界面(父子继承关闭)
|
| | | UIManager.Instance.GetUI<MainWin>()?.ClickFunc(0);
|
| | |
|
| | |
|
| | | // 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);
|
| | | }
|
| | |
|
| | |
|
| | | #region 配置
|
| | |
| | | public int renameFairyNameCost;
|
| | | public int renameFairyNameMoneyType;
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | //珍宝阁(行商)
|
| | | 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 bool isQueryZBGYet = false;
|
| | | public float lastZBGStartTime = 0; //过天刷新用
|
| | |
|
| | | //{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 event Action<bool> UpdateFamilyActionEvent;
|
| | | public int zbgPriceType;
|
| | | public int zbgOrgPriceValue;
|
| | | public int zbgChangFamilyCD;
|
| | | public List<int> cutCntListForTalk = new List<int>();
|
| | | public int familyRecordMaxCount;
|
| | |
|
| | | void ParseConfig()
|
| | | {
|
| | | DirtyWordConfig.DirtyWordInit();
|
| | | DirtyNameConfig.DirtyNameInit();
|
| | |
|
| | | var config = FuncConfigConfig.Get("CreateFamily");
|
| | | createFairyCost = int.Parse(config.Numerical1);
|
| | | createMoneyType = int.Parse(config.Numerical2);
|
| | |
| | | config = FuncConfigConfig.Get("FamilyRename");
|
| | | renameFairyNameCD = int.Parse(config.Numerical2);
|
| | | var arr = ConfigParse.GetMultipleStr<int>(config.Numerical1);
|
| | | renameFairyNameCost = arr[0];
|
| | | renameFairyNameMoneyType = arr[1];
|
| | | renameFairyNameMoneyType = arr[0];
|
| | | renameFairyNameCost = arr[1];
|
| | |
|
| | | config = FuncConfigConfig.Get("Zhenbaoge");
|
| | | zbgPriceType = int.Parse(config.Numerical1);
|
| | | 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);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | if (quitType == 0)
|
| | | {
|
| | | //被踢
|
| | | quitCount = PlayerDatas.Instance.baseData.leaveGuildInfo / 10 % 10;
|
| | | quitCount = PlayerDatas.Instance.baseData.leaveGuildInfo / 10 % 10 - 1;
|
| | | if (quitCount < 0) return 0;
|
| | | if (beQuitGuildPunishTime.Length != 0)
|
| | | punishTime = beQuitGuildPunishTime[Math.Min(quitCount, beQuitGuildPunishTime.Length - 1)];
|
| | | }
|
| | | else if (quitType == 1)
|
| | | {
|
| | | //主动退出
|
| | | quitCount = PlayerDatas.Instance.baseData.leaveGuildInfo / 100;
|
| | | quitCount = PlayerDatas.Instance.baseData.leaveGuildInfo / 100 - 1;
|
| | | if (quitCount < 0) return 0;
|
| | | if (quitGuildPunishTime.Length != 0)
|
| | | punishTime = quitGuildPunishTime[Math.Min(quitCount, quitGuildPunishTime.Length - 1)];
|
| | | }
|
| | |
|
| | | return TimeUtility.AllSeconds - PlayerDatas.Instance.baseData.leaveFamilyTime - punishTime * 60;
|
| | | return punishTime * 60 - (TimeUtility.GetCommServerTick(zoneID)- PlayerDatas.Instance.baseData.leaveFamilyTime);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | int error;
|
| | |
|
| | | //获取name的字节长度,name可能是中文 或者其他占用3个字符的符号
|
| | | if (!UIHelper.SatisfyNameLength(name, out error))
|
| | | if (!CheckName(name))
|
| | | {
|
| | | // TODO 暂时按中文长度提示, 不同语言可根据情况修改
|
| | | if (error == 1)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("NameError2", 7);
|
| | | return;
|
| | | }
|
| | | else if (error == 2)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("NameError1", 2);
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | if (!CheckFairyNameLimit(name, out error))
|
| | | {
|
| | | ShowFairyNameErrorTip(error);
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | #endregion
|
| | | public bool CheckName(string name)
|
| | | {
|
| | | int error;
|
| | |
|
| | | //获取name的字节长度,name可能是中文 或者其他占用3个字符的符号
|
| | | if (!UIHelper.SatisfyNameLength(name, out error))
|
| | | {
|
| | | // TODO 暂时按中文长度提示, 不同语言可根据情况修改
|
| | | if (error == 1)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("NameError2", 7);
|
| | | return false;
|
| | | }
|
| | | else if (error == 2)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("NameError1", 2);
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | if (!CheckFairyNameLimit(name, out error))
|
| | | {
|
| | | ShowFairyNameErrorTip(error);
|
| | | return false;
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | |
|
| | |
|
| | |
| | |
|
| | |
|
| | |
|
| | | // 公会自定义记录
|
| | | #region 公会自定义记录
|
| | | public void UpdateFamilyAction(HA513_tagMCFamilyActionInfo _package)
|
| | | {
|
| | | 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;
|
| | |
|
| | | FamilyActionInfoEvent?.Invoke((int)_package.FamilyID, _package.ActionType);
|
| | | }
|
| | |
|
| | | // 通用记录 |
| | | public bool TryGetFamilyActions(int actionType, out HA513_tagMCFamilyActionInfo.tagMCFamilyAction[] familyAction)
|
| | | {
|
| | | familyAction = null;
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | public void QueryFamilyAction(int familyID, int actionType)
|
| | | {
|
| | | var pack = new CA617_tagCMQueryFamilyAction();
|
| | | pack.FamilyID = (uint)familyID;
|
| | | pack.ActionType = (byte)actionType;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | |
|
| | |
|
| | | #region 仙盟列表
|
| | |
| | |
|
| | | // 查找的公会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 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()
|
| | | {
|
| | | if (PlayerDatas.Instance.fairyData.HasFairy && PlayerDatas.Instance.fairyData.IsCanFunc(LimitFunc.CanCall))
|
| | |
| | | //id 0 代表一键加入
|
| | | public void SendApplyGuild(int id, int type)
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Fairy, true))
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Guild, true))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | |
|
| | | if (type == 0)
|
| | | {
|
| | | if (m_FairyRequesteds.Count >= requestGuildCount)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("GuildSys9");
|
| | | return;
|
| | | }
|
| | |
|
| | | var cdSeconds = GetJoinCD();
|
| | | if (cdSeconds > 0)
|
| | | {
|
| | |
| | | if (guildsDict[id].MemberCount >= FamilyConfig.Get(guildsDict[id].FamilyLV).MemberMax)
|
| | | {
|
| | | 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
|
| | |
|
| | |
|
| | | public bool guildChanged = false;
|
| | | //公会数据变化,请求新的公会信息,如在打开公会列表时请求,其他功能根据自身情况请求
|
| | | public void UpdateGuildDataChangeMark(HA521_tagMCFamilyChange netPack)
|
| | | {
|
| | | if (netPack.Type > 0)
|
| | | {
|
| | | guildChanged = true;
|
| | | }
|
| | | }
|
| | |
|
| | | public void RequestGuildData()
|
| | | {
|
| | | if (guildChanged)
|
| | | {
|
| | | guildChanged = false;
|
| | | var pack = new CA626_tagCMGetFamilyInfo();
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | public void SendKickFairy(uint playerID)
|
| | | {
|
| | |
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | |
|
| | |
|
| | | //获取需要公会职位等级
|
| | | public int GetNeedGuildJobLV(int guildFuncID)
|
| | | {
|
| | | if (guildWorkToLevel.ContainsKey(guildFuncID))
|
| | | {
|
| | | return guildWorkToLevel[guildFuncID];
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | |
|
| | | public void SendChangeMemberLV(int playerID, int lv)
|
| | | {
|
| | | var pack = new CA625_tagCMChangeFamilyMemLV();
|
| | | pack.PlayerID = (uint)playerID;
|
| | | pack.FmLV = (byte)lv;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | public void KickMember(int playerID)
|
| | | {
|
| | | var pack = new CA605_tagCMDeleteFamilyMember();
|
| | | pack.MemberID = (uint)playerID;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | public void QuitGuild()
|
| | | {
|
| | |
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
|
| | | Language.Get("Guild_46"), (bool isOK) =>
|
| | | {
|
| | | if (isOK)
|
| | | {
|
| | | if (PlayerDatas.Instance.fairyData.fairy.MemberCount > 1 &&
|
| | | PlayerDatas.Instance.fairyData.mine.FmLV == 3)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("GuildSys15");
|
| | | return;
|
| | | }
|
| | | var pack = new CA603_tagCMLeaveFamily();
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | | });
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | #region 捐赠
|
| | |
|
| | | public void UpdateDonateInfo(HA502_tagSCDonateCntInfo netPack)
|
| | | {
|
| | | donateCntList = netPack.DonateCntList;
|
| | | DonateCntListEvent?.Invoke();
|
| | | UpdateDonateRedPoint();
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 珍宝阁
|
| | |
|
| | |
|
| | | public void UpdateZhenbaogeInfo(HA512_tagMCFamilyZhenbaogeInfo netPack)
|
| | | {
|
| | | //砍价状态:仙盟里记录已砍价才是真的已砍价状态,封包中的砍价状态用于判断cd间隔使用
|
| | | needCheckCutCD = netPack.CutState == 1;
|
| | | zhenbaogeBuyState = netPack.BuyState;
|
| | | UpdateZhenbaogeEvent?.Invoke();
|
| | | UpdateZBGRedpoint();
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | //登录后首次打开查询,换新仙盟查询
|
| | | public void QueryZBGFamilyInfo()
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.FamilyId == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (isQueryZBGYet)
|
| | | return;
|
| | |
|
| | |
|
| | | QueryFamilyAction((int)PlayerDatas.Instance.baseData.FamilyId, ZBGFamilyActionType);
|
| | |
|
| | | isQueryZBGYet = true;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | //更新砍价信息
|
| | | public bool UpdateHawkerAction(HA513_tagMCFamilyActionInfo vNetData)
|
| | | {
|
| | | if (vNetData.ActionType != ZBGFamilyActionType)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | bool restart = false;
|
| | |
|
| | | 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();
|
| | | sortPlayerCut.Clear();
|
| | | restart = true;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | for (int i = 0; i < vNetData.FamilyActionList.Length; i++)
|
| | | {
|
| | | int playerID = (int)vNetData.FamilyActionList[i].Value1;
|
| | | familyZBGActions[playerID] = vNetData.FamilyActionList[i];
|
| | |
|
| | | }
|
| | |
|
| | | if (familyZBGActions.ContainsKey((int)PlayerDatas.Instance.baseData.PlayerID))
|
| | | {
|
| | | //自己是否已砍价 从列表中查找
|
| | | zhenbaogeCutState = 1;
|
| | | }
|
| | | else
|
| | | {
|
| | | zhenbaogeCutState = 0;
|
| | | }
|
| | |
|
| | |
|
| | | sortPlayerCut = familyZBGActions.Keys.ToList();
|
| | | if (sortPlayerCut.Contains(1))
|
| | | sortPlayerCut.Remove(1);
|
| | | sortPlayerCut.Sort((a, b) => { return familyZBGActions[a].Time.CompareTo(familyZBGActions[b].Time); });
|
| | |
|
| | | UpdateFamilyActionEvent?.Invoke(restart);
|
| | | UpdateZBGRedpoint();
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | //砍价人数
|
| | | public int GetZBGFamilyActionCount()
|
| | | {
|
| | | return Math.Max(0, familyZBGActions.Count - 1);
|
| | | }
|
| | |
|
| | | public int GetTalkState()
|
| | | {
|
| | | int cnt = GetZBGFamilyActionCount();
|
| | | for (int i = 0; i < cutCntListForTalk.Count; i++)
|
| | | {
|
| | | if (cnt < cutCntListForTalk[i])
|
| | | {
|
| | | return i;
|
| | | }
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public int[][] GetZBGItems()
|
| | | {
|
| | | if (!familyZBGActions.ContainsKey(1))
|
| | | return null;
|
| | |
|
| | | return JsonMapper.ToObject<int[][]>(familyZBGActions[1].UseData);
|
| | | }
|
| | |
|
| | | public void OnZhenbaogeOP(byte type)
|
| | | {
|
| | | var pack = new CA616_tagCMZhenbaogeOP();
|
| | | pack.OpType = type;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | |
|
| | | public Dictionary<int, FairyMember> tmpNoCutMembers = new Dictionary<int, FairyMember>();
|
| | |
|
| | | //未议价成员
|
| | | public void CalcNoCutMembers()
|
| | | {
|
| | | tmpNoCutMembers.Clear();
|
| | | var fairy = PlayerDatas.Instance.fairyData;
|
| | | if (fairy == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | foreach (var playerID in fairy.memberIDList)
|
| | | {
|
| | | if (!familyZBGActions.ContainsKey(playerID))
|
| | | {
|
| | | tmpNoCutMembers[playerID] = fairy.GetMember(playerID);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 红点
|
| | |
|
| | | Redpoint donateRedpoint = new Redpoint(MainRedDot.guildHallRedpointID, MainRedDot.donateRedpointID);
|
| | | //珍宝阁(行商)
|
| | | Redpoint zbgRedpoint = new Redpoint(MainRedDot.MainGuildRedpoint, MainRedDot.hawkerRedpointID);
|
| | |
|
| | | void UpdateDonateRedPoint()
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Guild))
|
| | | {
|
| | | return;
|
| | | }
|
| | | donateRedpoint.state = RedPointState.None;
|
| | | if (PlayerDatas.Instance.fairyData.fairy == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //只有第一档的才需要红点
|
| | | var config = FamilyDonateConfig.Get(1);
|
| | | if (donateCntList == null)
|
| | | {
|
| | | if (UIHelper.CheckMoneyCount(config.MoneyType, config.MoneyValue))
|
| | | donateRedpoint.state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | | if (donateCntList != null && donateCntList.Length > 0)
|
| | | {
|
| | | if (donateCntList[0] < config.DailyCnt)
|
| | | {
|
| | | if (UIHelper.CheckMoneyCount(config.MoneyType, config.MoneyValue))
|
| | | donateRedpoint.state = RedPointState.Simple;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateZBGRedpoint()
|
| | | {
|
| | | zbgRedpoint.state = RedPointState.None;
|
| | |
|
| | | if (!PlayerDatas.Instance.fairyData.HasFairy)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (TimeUtility.GetCommServerNow(zoneID).Hour < 10)
|
| | | return;
|
| | |
|
| | | if (zhenbaogeCutState == 0)
|
| | | {
|
| | | zbgRedpoint.state = RedPointState.Simple;
|
| | | }
|
| | | else if (zhenbaogeBuyState == 0)
|
| | | {
|
| | | if (familyZBGActions[1].Value3 > 0)
|
| | | {
|
| | | zbgRedpoint.state = RedPointState.Simple;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 加密数字
|
| | |
|
| | |
| | | SysNotifyMgr.Instance.ShowTip("GuildSys6");
|
| | | return "";
|
| | | }
|
| | | |
| | |
|
| | | encryptedStr = encryptedStr.Substring(1);
|
| | |
|
| | | if (reverseMap.IsNullOrEmpty())
|
| | |
| | | }
|
| | | return originalStr.ToString().TrimStart('0'); // 去除前导零
|
| | | }
|
| | | |
| | | |
| | |
|
| | |
|
| | | int[] GenerateReverseMap(int[] map)
|
| | | {
|
| | | for (int i = 0; i < map.Length; i++)
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | }
|
| | |
|
| | | // 权限ID: 1-收人,2-变更职位,3-发布公告,4-踢人
|
| | | public enum GuildFuncType
|
| | | {
|
| | | Accept = 1,
|
| | | ChangeJob = 2,
|
| | | PublishNotice = 3,
|
| | | Kick = 4,
|
| | |
|
| | | } |