ClientNow() public static méthode

客户端时间
public static ClientNow ( ) : long
Résultat long
Exemple #1
0
        public static void Error(string msg)
        {
            DateTime dateTime = DateTime.Now;
            string   s        = $"{dateTime.ToString("yyyy-MM-dd HH:mm:ss")} {TimeHelper.ClientNow()} {msg}";

            error.WriteLine(s);
            if (IsNeedFlush)
            {
                error.Flush();
            }

            info.WriteLine(s);
            if (IsNeedFlush)
            {
                info.Flush();
            }

#if UNITY_EDITOR
            UnityEngine.Debug.LogError(s);
#endif

            long timeNow = TimeHelper.ClientNow();
            if (timeNow - SendToServerTime > SendToServerFrequency)
            {
                SendToServerTime = timeNow;
            }
        }
Exemple #2
0
        public void Debug(string msg)
        {
#if UNITY_EDITOR
            DateTime dateTime = DateTime.Now;
            string   s        = $"{dateTime.ToString("yyyy-MM-dd HH:mm:ss")} {TimeHelper.ClientNow()} {msg}";
            UnityEngine.Debug.Log(s);
#endif
        }
Exemple #3
0
        /// <summary>
        /// 登陆前是客户端时间,登陆后是同步过的服务器时间
        /// </summary>
        /// <returns></returns>
        public static long Now()
        {
            TimeComponent gameTimeComponent = Game.Scene?.GetComponent <TimeComponent>();

            if (gameTimeComponent == null)
            {
                return(TimeHelper.ClientNow());
            }
            long t = gameTimeComponent.Now();

            return(t);
        }
Exemple #4
0
        public static void Debug(string msg)
        {
#if UNITY_EDITOR
            DateTime dateTime = DateTime.Now;
            string   s        = $"{dateTime.ToString("yyyy-MM-dd HH:mm:ss")} {TimeHelper.ClientNow()} {msg}";
            UnityEngine.Debug.Log(s);

            info.WriteLine(s);
            if (IsNeedFlush)
            {
                info.Flush();
            }
#endif
        }
Exemple #5
0
        public void Error(string msg)
        {
            DateTime dateTime = DateTime.Now;
            string   s        = $"{dateTime.ToString("yyyy-MM-dd HH:mm:ss")} {TimeHelper.ClientNow()} {msg}";

            error.WriteLine(s);
            if (IsNeedFlush)
            {
                error.Flush();
            }

#if UNITY_EDITOR
            UnityEngine.Debug.LogError(s);
#endif

            long timeNow = TimeHelper.ClientNow();
            if (timeNow - SendToServerTime > SendToServerFrequency)
            {
                SendToServerTime = timeNow;
                Share.Scene.GetComponent <EventComponent>().Run(EventIdType.LogError, s);
            }
        }