25'ten fazla konu seçemezsiniz
Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
|
- using System;
- using System.Collections.Generic;
- using SUISS.Core;
- using UnityEngine;
- using UnityEngine.SceneManagement;
-
- public class CIGSessionRestarter : SingletonMonobehaviour<CIGSessionRestarter>
- {
- public void RestartNow()
- {
- if (SingletonMonobehaviour<PopupManager>.Instance.PopupIsOpen())
- {
- SingletonMonobehaviour<PopupManager>.Instance.CloseRecursive(false);
- }
- CIGLoadingScreen.MarkReturnToLoadingScreen();
- SceneManager.LoadScene("LoadingScreen");
- }
-
- public bool ApplicationPause(bool isPaused)
- {
- if (isPaused)
- {
- this._pauseTime = DateTime.UtcNow;
- this._isPaused = true;
- }
- else if (this._isPaused)
- {
- this._isPaused = false;
- if (this._criticalProcesses.Count == 0 && (DateTime.UtcNow - this._pauseTime).TotalSeconds > (double)this.SessionIdleSeconds)
- {
- this.RestartNow();
- return true;
- }
- }
- return false;
- }
-
- public void RegisterCriticalProcess(object process)
- {
- this._criticalProcesses.Add(process);
- }
-
- public void UnregisterCriticalProcess(object process)
- {
- this._criticalProcesses.Remove(process);
- }
-
- public float SessionIdleSeconds
- {
- get
- {
- return (!Debug.isDebugBuild) ? 900f : 60f;
- }
- }
-
- private DateTime _pauseTime;
-
- private bool _isPaused;
-
- private List<object> _criticalProcesses = new List<object>();
- }
|