ClientNow() public static method

客户端时间
public static ClientNow ( ) : long
return long
Exemplo n.º 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;
            }
        }
Exemplo n.º 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
        }
Exemplo n.º 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);
        }
Exemplo n.º 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
        }
Exemplo n.º 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);
            }
        }