From ed98029a88cd89702980ac7c40b711afddc5aeb2 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 20 十一月 2025 14:44:59 +0800
Subject: [PATCH] Merge branch 'master' of http://mobile.secondworld.net.cn:10010/r/Project_SG_scripts
---
Main/Utility/TimeUtility.cs | 86 ++++++++++++++++++++++++++++++++++++++++---
1 files changed, 80 insertions(+), 6 deletions(-)
diff --git a/Main/Utility/TimeUtility.cs b/Main/Utility/TimeUtility.cs
index e49d754..6aad2aa 100644
--- a/Main/Utility/TimeUtility.cs
+++ b/Main/Utility/TimeUtility.cs
@@ -89,7 +89,7 @@
public static readonly DateTime OriginalTime = new DateTime(1970, 1, 1, 8, 0, 0);
public static readonly DateTime ClientOriginalTime = new DateTime(1, 1, 1, 0, 0, 0);
/// <summary>
- /// 鏈嶅姟鍣ㄦ椂闂寸浉姣旇捣濮嬫椂闂寸殑绉掓暟(涓昏鏂逛究姣旇緝)
+ /// 鏈嶅姟鍣ㄦ椂闂寸浉姣旇捣濮嬫椂闂寸殑绉掓暟(鍗虫湇鍔″櫒鐨勬椂闂存埑)
/// </summary>
public static int AllSeconds
{
@@ -194,7 +194,7 @@
}
public static event Action OnServerOpenDayRefresh;
- public static void OnRefreshServerOpenDay(HA005_tagOpenServerDay package)
+ public static void OnRefreshServerOpenDay(HA103_tagMCOpenServerDay package)
{
{
OpenDay = package.Day;
@@ -251,6 +251,31 @@
int seconds = _seconds % 60;
return StringUtility.Contact(hours.ToString("D2"), ":", mins.ToString("D2"), ":", seconds.ToString("D2"));
}
+
+
+ //璇︾粏鏄剧ず
+ //xx灏忔椂xx鍒哫X绉�
+ //xx鍒哫X绉�
+ //xx绉�
+ public static string SecondsToHMSEx(int _seconds)
+ {
+ int hours = _seconds % 86400 / 3600;
+ int mins = _seconds % 3600 / 60;
+ int seconds = _seconds % 60;
+ if (hours > 0)
+ {
+ return StringUtility.Contact(hours, Language.Get("L1072"), mins, Language.Get("L1073"), seconds, Language.Get("L1075"));
+ }
+ else if (mins > 0)
+ {
+ return StringUtility.Contact(mins, Language.Get("L1073"), seconds, Language.Get("L1075"));
+ }
+ else
+ {
+ return StringUtility.Contact(seconds, Language.Get("L1075"));
+ }
+ }
+
//渚嬪瓙锛涘垎锛氱
//xx:xx
@@ -344,6 +369,42 @@
return StringUtility.Contact(hours.ToString("D2"), ":", mins.ToString("D2"), ":", seconds.ToString("D2"));
}
+ //鏋佺畝鏄剧ず
+ // x澶� 鎴栬�� x澶﹛灏忔椂
+ // x灏忔椂 鎴栬�� x灏忔椂x鍒�
+ // x鍒�
+ // x绉�
+ public static string SecondsToShortDHMS(int _seconds)
+ {
+ int days = _seconds / 86400;
+ int hours = _seconds % 86400 / 3600;
+ int mins = _seconds % 3600 / 60;
+ int seconds = _seconds % 60;
+ if (days > 0)
+ {
+ if (hours == 0)
+ {
+ return StringUtility.Contact(days, Language.Get("L1074"));
+ }
+ return StringUtility.Contact(days, Language.Get("L1074"), hours, Language.Get("L1072"));
+ }
+ else if (hours > 0)
+ {
+ if (mins == 0)
+ {
+ return StringUtility.Contact(hours, Language.Get("L1072"));
+ }
+ return StringUtility.Contact(hours, Language.Get("L1072"), mins, Language.Get("L1073"));
+ }
+ else if (mins > 0)
+ {
+ return StringUtility.Contact(mins, Language.Get("L1073"));
+ }
+ return StringUtility.Contact(seconds, Language.Get("L1075"));
+ }
+
+
+
//渚嬪瓙
//澶т簬24灏忔椂鏄剧ず锛歺澶﹛x灏忔椂xx鍒�
//灏忎簬24灏忔椂鏄剧ず锛歺x:xx:xx
@@ -359,10 +420,12 @@
}
return StringUtility.Contact(hours.ToString("D2"), ":", mins.ToString("D2"), ":", seconds.ToString("D2"));
}
+
+
//渚嬪瓙
//x澶�
//x鏃�
- //x鍒唜绉�
+ //x鍒�
//x绉�
public static string SecondsToConsumeRebate(int _seconds)
{
@@ -376,15 +439,15 @@
}
else if (hours >= 1)
{
- return StringUtility.Contact(Mathf.CeilToInt(hours), Language.Get("Hour"));
+ return StringUtility.Contact(Mathf.CeilToInt(hours), Language.Get("L1072"));
}
else if (mins >= 1)
{
- return StringUtility.Contact(mins, Language.Get("Minute"), seconds, Language.Get("RealmWin_Bewrite_35"));
+ return StringUtility.Contact(mins, Language.Get("L1073"));
}
else
{
- return StringUtility.Contact(seconds, Language.Get("RealmWin_Bewrite_35"));
+ return StringUtility.Contact(seconds, Language.Get("L1075"));
}
}
@@ -433,6 +496,17 @@
}
+ // 鍒�10鐐硅繕瑕佸灏戠锛屽鏋滃凡缁忚繃浜�10鐐癸紝杩斿洖0
+ public static int GetToTenClockSeconds()
+ {
+ var now = ServerNow;
+ if (now.Hour < 10)
+ {
+ return (int)(ServerNow - new DateTime(now.Year, now.Month, now.Day, 10, 0, 0)).TotalSeconds;
+ }
+ return 0;
+ }
+
//寮�鏈嶅ぉ缁撴潫鍊掕鏃讹紱鍗曚綅绉�
public static int GetRemindTimeByOpenDay(int days)
{
--
Gitblit v1.8.0