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); } }
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(); } }