lcy
6 天以前 3b2a6bb9047cfce9f501593b3669a9c1af6c5df4
Main/Utility/TimeUtility.cs
@@ -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分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
@@ -345,8 +370,8 @@
    }
    //极简显示
    // x天x小时
    // x小时x分
    // x天 或者 x天x小时
    // x小时 或者 x小时x分
    // x分
    // x秒
    public static string SecondsToShortDHMS(int _seconds)
@@ -357,10 +382,18 @@
        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)
@@ -387,10 +420,12 @@
        }
        return StringUtility.Contact(hours.ToString("D2"), ":", mins.ToString("D2"), ":", seconds.ToString("D2"));
    }
    //例子
    //x天
    //x时
    //x分x秒
    //x分
    //x秒
    public static string SecondsToConsumeRebate(int _seconds)
    {
@@ -404,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"));
        }
    }
@@ -461,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)
    {