示例#1
0
    IEnumerator GetNetworkTime()
    {
        if(Application.internetReachability != NetworkReachability.NotReachable)
        {
            //获取指定IP的系统时间
            SNTPTimeClient client = new SNTPTime.SNTPTimeClient("202.120.2.101", "123");
            client.Connect();
            yield return client;

            NowTime = client.ReceiveTimestamp;
            Debug.Log("Net Now Time: "+NowTime);
        }
    }
示例#2
0
    IEnumerator GetNetworkTime()
    {
        LoadingBegin();

        yield return new WaitForEndOfFrame();

        if(Application.internetReachability == NetworkReachability.NotReachable)
        {
            NoNetworkAlert();
        }else
        {
            //获取指定IP的系统时间
            SNTPTimeClient client = new SNTPTime.SNTPTimeClient("202.120.2.101", "123");
            client.Connect();
            yield return client;

            NetToday = client.ReceiveTimestamp;
            YesToday = GetYestoday(NetToday);
            LoadingEnd();
        }
    }