From fb0345c8f9815f1b9f655d6363da3a9cedd3944f Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期一, 10 九月 2018 11:25:07 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
Utility/TimeUtility.cs | 50 ++++++++++++++++++++++++++++++++++----------------
1 files changed, 34 insertions(+), 16 deletions(-)
diff --git a/Utility/TimeUtility.cs b/Utility/TimeUtility.cs
index 899009d..1771abf 100644
--- a/Utility/TimeUtility.cs
+++ b/Utility/TimeUtility.cs
@@ -10,8 +10,10 @@
/// <summary>
/// 褰撳墠鏈嶅姟鍣ㄦ椂闂�
/// </summary>
- public static DateTime ServerNow {
- get {
+ public static DateTime ServerNow
+ {
+ get
+ {
float tick = Time.realtimeSinceStartup - _checkTime;
DateTime real = _serverTime.AddSeconds(tick);
return real;
@@ -22,37 +24,43 @@
/// <summary>
/// 骞翠唤
/// </summary>
- public static int Year {
+ public static int Year
+ {
get { return ServerNow.Year; }
}
/// <summary>
/// 鏈堜唤
/// </summary>
- public static int Month {
+ public static int Month
+ {
get { return ServerNow.Month; }
}
/// <summary>
/// 澶�
/// </summary>
- public static int Day {
+ public static int Day
+ {
get { return ServerNow.Day; }
}
/// <summary>
/// 灏忔椂
/// </summary>
- public static int Hour {
+ public static int Hour
+ {
get { return ServerNow.Hour; }
}
/// <summary>
/// 鍒嗛挓
/// </summary>
- public static int Minute {
+ public static int Minute
+ {
get { return ServerNow.Minute; }
}
/// <summary>
/// 绉�
/// </summary>
- public static int Second {
+ public static int Second
+ {
get { return ServerNow.Second; }
}
/// <summary>
@@ -63,24 +71,31 @@
/// <summary>
/// 鏈嶅姟鍣ㄦ椂闂寸浉姣旇捣濮嬫椂闂寸殑绉掓暟(涓昏鏂逛究姣旇緝)
/// </summary>
- public static int AllSeconds {
- get {
+ public static int AllSeconds
+ {
+ get
+ {
TimeSpan t = ServerNow - OriginalTime;
return t.Seconds;
}
}
- public static int OpenDay {
+ public static int OpenDay
+ {
get; private set;
}
- public static bool IsMixServer {
+ public static bool IsMixServer
+ {
get; private set;
}
- public static int MixOpenDay {
+ public static int MixOpenDay
+ {
get; private set;
}
+
+ public static DateTime openServerTime;
public static int OpenWeekCnt
{
@@ -124,10 +139,11 @@
{
DateTime n = new DateTime(vNetData.Year, vNetData.Month, vNetData.Day, vNetData.Hour, vNetData.Minute, vNetData.Second);
_serverTime = n;
- DebugEx.Log("OnRefreshServerTime鏈堜唤锛�"+_serverTime.Month);
+ DebugEx.Log("OnRefreshServerTime鏈堜唤锛�" + _serverTime.Month);
_checkTime = Time.realtimeSinceStartup;
if (OnServerTimeRefresh != null) OnServerTimeRefresh();
- TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.SyncServerTime, 60, (float tick) => {
+ TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.SyncServerTime, 60, (float tick) =>
+ {
SyncServerTime();
}, 60);
}
@@ -137,7 +153,9 @@
OpenDay = package.Day;
IsMixServer = package.IsMixServer == 1;
MixOpenDay = package.MixDay;
- if (OnServerOpenDayRefresh != null) {
+ DateTime.TryParse(package.OpenServerTime, out openServerTime);
+ if (OnServerOpenDayRefresh != null)
+ {
OnServerOpenDayRefresh();
}
}
--
Gitblit v1.8.0