66 【公会】基础主体 - 跨服和本服公用时间接口
| | |
| | | |
| | | void Display() |
| | | { |
| | | endTimeText.text = Language.Get("Arena14", TimeUtility.SecondsToHMS((int)(TimeUtility.GetTodayEndTime() - TimeUtility.ServerNow).TotalSeconds)); |
| | | endTimeText.text = Language.Get("Arena14", TimeUtility.SecondsToHMS((int)(TimeUtility.GetCommTodayEndTime(GuildManager.Instance.zoneID) - TimeUtility.GetCommServerNow(GuildManager.Instance.zoneID)).TotalSeconds)); |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(PlayerDatas.Instance.baseData.FightPower); |
| | | headCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | |
| | | bzAttrText.text = GetAddAttrs(bossAction); |
| | | var layer = bossAction == null ? 0 : bossAction.Value3; |
| | | var bzTime = bossAction == null ? 0 : bossAction.Value2; |
| | | int remainTime = (int)Math.Max(0, bzTime - TimeUtility.AllSeconds); |
| | | int remainTime = (int)Math.Max(0, bzTime - TimeUtility.GetCommServerTick(GuildManager.Instance.zoneID)); |
| | | if (remainTime == 0) |
| | | { |
| | | //时间到了 客户端自己清0 |
| | |
| | | { |
| | | var layerNum = action == null ? 0 : action.Value3; |
| | | var bzTime = action == null ? 0 : action.Value2; |
| | | int remainTime = (int)Math.Max(0, bzTime - TimeUtility.AllSeconds); |
| | | int remainTime = (int)Math.Max(0, bzTime - TimeUtility.GetCommServerTick(GuildManager.Instance.zoneID)); |
| | | if (remainTime == 0) |
| | | { |
| | | //时间到了 客户端自己清0 |
| | |
| | | |
| | | void OnSecondEvent() |
| | | { |
| | | endTimeText.text = Language.Get("Arena14", TimeUtility.SecondsToHMS((int)(TimeUtility.GetTodayEndTime() - TimeUtility.ServerNow).TotalSeconds)); |
| | | endTimeText.text = Language.Get("Arena14", TimeUtility.SecondsToHMS((int)(TimeUtility.GetCommTodayEndTime(GuildManager.Instance.zoneID) - TimeUtility.GetCommServerNow(GuildManager.Instance.zoneID)).TotalSeconds)); |
| | | var bossAction = GuildBossManager.Instance.GetGuildBossAction(); |
| | | ShowBzInfo(bossAction); |
| | | OtherPlayerAnimation(); |
| | |
| | | |
| | | void OnSecondEvent() |
| | | { |
| | | timeText.text = Language.Get("Guild_74", TimeUtility.SecondsToShortDHMS((int)(GuildManager.Instance.GetTodayEndTime() - GuildManager.Instance.GetServerNow()).TotalSeconds)); |
| | | timeText.text = Language.Get("Guild_74", TimeUtility.SecondsToShortDHMS((int)(TimeUtility.GetCommTodayEndTime(GuildManager.Instance.zoneID) - |
| | | TimeUtility.GetCommServerNow(GuildManager.Instance.zoneID)).TotalSeconds)); |
| | | } |
| | | |
| | | int index = 0; |
| | |
| | | void OnCut() |
| | | { |
| | | //砍价的cd限制: 公会没有记录自己砍过价,但今天有砍价记录,且退出过公会 |
| | | if (GuildManager.Instance.zhenbaogeCutState == 0 && GuildManager.Instance.needCheckCutCD && (GuildManager.Instance.GetServerTick() - PlayerDatas.Instance.baseData.leaveFamilyTime) / 60 < GuildManager.Instance.zbgChangFamilyCD ) |
| | | if (GuildManager.Instance.zhenbaogeCutState == 0 && GuildManager.Instance.needCheckCutCD && (TimeUtility.GetCommServerTick(GuildManager.Instance.zoneID) - PlayerDatas.Instance.baseData.leaveFamilyTime) / 60 < GuildManager.Instance.zbgChangFamilyCD ) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("ZhenbaogeCut1", GuildManager.Instance.zbgChangFamilyCD - (GuildManager.Instance.GetServerTick() - PlayerDatas.Instance.baseData.leaveFamilyTime) / 60); |
| | | SysNotifyMgr.Instance.ShowTip("ZhenbaogeCut1", GuildManager.Instance.zbgChangFamilyCD - (TimeUtility.GetCommServerTick(GuildManager.Instance.zoneID) - PlayerDatas.Instance.baseData.leaveFamilyTime) / 60); |
| | | return; |
| | | } |
| | | if (GuildManager.Instance.zhenbaogeCutState == 0) |
| | |
| | | OnRefreshCrossServerInfoEvent?.Invoke();
|
| | | }
|
| | |
|
| | | // 获取当前时间, 公会跨区前取本服时间,跨服后取跨服时间
|
| | | public DateTime GetServerNow()
|
| | | {
|
| | | if (zoneID == 0)
|
| | | {
|
| | | return TimeUtility.ServerNow;
|
| | | }
|
| | | else
|
| | | {
|
| | | return TimeUtility.CrossServerNow;
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetServerTick()
|
| | | {
|
| | | if (zoneID == 0)
|
| | | {
|
| | | return TimeUtility.AllSeconds;
|
| | | }
|
| | | else
|
| | | {
|
| | | return TimeUtility.AllSecondsCrossServer;
|
| | | }
|
| | | }
|
| | |
|
| | | public DateTime GetTodayEndTime()
|
| | | {
|
| | | var now = GetServerNow().AddDays(1);
|
| | | return new DateTime(now.Year, now.Month, now.Day);
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
|
| | |
| | | punishTime = quitGuildPunishTime[Math.Min(quitCount, quitGuildPunishTime.Length - 1)];
|
| | | }
|
| | |
|
| | | return punishTime * 60 - (GetServerTick() - PlayerDatas.Instance.baseData.leaveFamilyTime);
|
| | | return punishTime * 60 - (TimeUtility.GetCommServerTick(zoneID)- PlayerDatas.Instance.baseData.leaveFamilyTime);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | if (GetServerNow().Hour < 10)
|
| | | if (TimeUtility.GetCommServerNow(zoneID).Hour < 10)
|
| | | return;
|
| | |
|
| | | if (zhenbaogeCutState == 0)
|
| | |
| | | { |
| | | return (int)(GetTodayEndTime() - ServerNow).TotalSeconds; |
| | | } |
| | | |
| | | #region 跨服和本服公用接口 |
| | | //当有的功能会从本服功能变成跨服功能的时候统一用这些接口处理时间 |
| | | //各自的功能传自己的zoneID |
| | | |
| | | // 获取当前时间, 公会跨区前取本服时间,跨服后取跨服时间 |
| | | public static DateTime GetCommServerNow(int zoneID = 0) |
| | | { |
| | | if (zoneID == 0) |
| | | { |
| | | return ServerNow; |
| | | } |
| | | else |
| | | { |
| | | return CrossServerNow; |
| | | } |
| | | } |
| | | |
| | | public static int GetCommServerTick(int zoneID = 0) |
| | | { |
| | | if (zoneID == 0) |
| | | { |
| | | return AllSeconds; |
| | | } |
| | | else |
| | | { |
| | | return AllSecondsCrossServer; |
| | | } |
| | | } |
| | | |
| | | public static DateTime GetCommTodayEndTime(int zoneID = 0) |
| | | { |
| | | var now = GetCommServerNow(zoneID).AddDays(1); |
| | | return new DateTime(now.Year, now.Month, now.Day); |
| | | } |
| | | #endregion |
| | | } |