| | |
| | | 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 |
| | | { |
| | |
| | | return StringUtility.Contact(hours.ToString("D2"), ":", mins.ToString("D2"), ":", seconds.ToString("D2")); |
| | | } |
| | | |
| | | //详细显示 |
| | | //xx小时xx分XX秒 |
| | | //xx分XX秒 |
| | | //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 |
| | | public static string SecondsToMS(int _seconds) |
| | |
| | | return StringUtility.Contact(hours.ToString("D2"), ":", mins.ToString("D2"), ":", seconds.ToString("D2")); |
| | | } |
| | | |
| | | //极简显示 |
| | | // x天 或者 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小时xx分 |
| | | //小于24小时显示:xx:xx:xx |
| | | public static string SecondsToDHMSEx(int _seconds) |
| | | { |
| | | int days = _seconds / 86400; |
| | | int hours = _seconds % 86400 / 3600; |
| | | int mins = _seconds % 3600 / 60; |
| | | int seconds = _seconds % 60; |
| | | if (days > 0) |
| | | { |
| | | return StringUtility.Contact(days, Language.Get("L1074"), hours.ToString("D2"), Language.Get("L1072"), mins.ToString("D2"), Language.Get("L1073")); |
| | | } |
| | | return StringUtility.Contact(hours.ToString("D2"), ":", mins.ToString("D2"), ":", seconds.ToString("D2")); |
| | | } |
| | | |
| | | |
| | | //例子 |
| | | //x天 |
| | | //x时 |
| | | //x分x秒 |
| | | //x分 |
| | | //x秒 |
| | | public static string SecondsToConsumeRebate(int _seconds) |
| | | { |
| | |
| | | } |
| | | 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")); |
| | | } |
| | | } |
| | | |