public void Initialize() { if (initialized) { return; } enable = false; initializedTime = (int)DateTime.Now.ToUnixTime(); incrementCount = 0; notifications = new Dictionary <long, NotificationInfo>(); // イベント登録. ApplicationEventHandler.OnQuitAsObservable() .Subscribe(_ => OnSuspend()) .AddTo(Disposable); ApplicationEventHandler.OnSuspendAsObservable() .Subscribe(_ => OnSuspend()) .AddTo(Disposable); ApplicationEventHandler.OnResumeAsObservable() .Subscribe(_ => OnResume()) .AddTo(Disposable); initialized = true; }
//----- property ----- //----- method ----- public void Initialize() { disposable = new LifetimeDisposable(); initializedTime = (int)DateTime.Now.ToUnixTime(); incrementCount = 0; notifications = new Dictionary <long, NotificationInfo>(); ApplicationEventHandler.OnQuitAsObservable().Subscribe(_ => OnSuspend()).AddTo(disposable.Disposable); ApplicationEventHandler.OnSuspendAsObservable().Subscribe(_ => OnSuspend()).AddTo(disposable.Disposable); ApplicationEventHandler.OnResumeAsObservable().Subscribe(_ => OnResume()).AddTo(disposable.Disposable); #if UNITY_ANDROID && !UNITY_EDITOR PlatformInitialize(); #elif UNITY_IOS && !UNITY_EDITOR PlatformInitialize(); #endif // 過去に登録した通知を削除. Clear(); }