コード例 #1
0
        void OnApplicationPause(bool pauseStatus)
        {
            if (Data == null)
            {
                return;
            }
            if (pauseStatus)
            {
                Time.timeScale = 0;
                #if UNITY_IOS
                NotificationServices.ClearLocalNotifications();
                NotificationServices.CancelAllLocalNotifications();
                ScheduleNotification();
                #endif

                PlayerPrefs.SetString("_gameCloseTime", System.DateTime.Now.ToString());
                Data.SetAchievementData(AchievementManager.GetAchievementKeeper());
                SaveLoadHelper.SaveGame(Data);
            }
            else
            {
                HandleDroppedMage();
                Time.timeScale = 1;
                #if UNITY_IOS
                //Debug.Log("Local notification count = " + NotificationServices.localNotificationCount);

                //if (NotificationServices.localNotificationCount > 0) {
                //    Debug.Log(NotificationServices.localNotifications[0].alertBody);
                //}

                // cancel all notifications first.
                NotificationServices.ClearLocalNotifications();
                NotificationServices.CancelAllLocalNotifications();
                #endif

                CalculateIdleIncomeAndShowNotification();
                StartCoroutine(WaveManager.SendWave());
            }
        }