void OnApplicationFocus(bool focus) { #if UNITY_ANDROID || UNITY_IPHONE if (!Application.isEditor) { long timeSpan = 0; if (!focus) { lt = System.DateTime.Now; } else { if (lt == null) { lt = System.DateTime.Now; } timeSpan = HelpUtil.GetTimeSpan(lt); if (timeSpan < 0) { timeSpan = 0; } //Debug.Log("OnApplicationFocus timeSpan " + timeSpan.ToString()); } publisher.NotifyMonoFocus(focus, timeSpan); } #endif }
void OnApplicationPause(bool pause) { //Debug.Log("OnApplicationPause !!!!!!!" + pause.ToString()); long timeSpan = 0; if (pause) { lt = System.DateTime.Now; isPause = true; } else { if (lt == null) { lt = System.DateTime.Now; } timeSpan = HelpUtil.GetTimeSpan(lt); if (timeSpan < 0) { timeSpan = 0; } if (isPause) { isPause = false; Debug.Log("OnApplicationPause !!!!!!!" + timeSpan); Debug.Log("Application is back form pause!!!!!!!"); Debug.Log("ThirdPartyPlatform.mIs360Logining is :" + ThirdPartyPlatform.mIs360Logining); //if (!ThirdPartyPlatform.mIs360Logining) //{ // if (timeSpan > 4 * 60 * 1000) // { // ThirdPartyPlatform.CloseSDK(); // Globals.Instance.IsStarterRestart = true; // StartCoroutine(InvokeStaterRestartDelegate()); // return ; // } // else if (timeSpan > 60 * 1000) // { // Globals.Instance.MGSNetManager.clearPendingQueueAndReconnect(); // } //} } } publisher.NotifyMonoPause(pause, timeSpan); }