Example #1
0
        private void HandleOfflineTime()
        {
            AppGame.GetLevelData().lastDateTimeSeconds = 0;
            if (App.GetLevelData().isLoaded)
            {
                if (App.GetLevelData().IsOfflineTimerOn)
                {
                    if (App.GetLevelData().LastDateTime != "" && !string.IsNullOrEmpty(App.GetLevelData().LastDateTime))
                    {
                        DateTime now = DateTime.Now;

                        DateTime last = DateTime.Parse(App.GetLevelData().LastDateTime, CultureInfo.InvariantCulture);

                        TimeSpan span = now - last;

                        // D.Log("span seconds = "+span.Seconds);
                        // D.Log("span minutes = "+span.Minutes);
                        // D.Log("span hours = "+span.Hours);
                        // D.Log("span days = "+span.Days);

                        App.GetLevelData().lastDateTimeSeconds = span.Seconds + (span.Minutes * 60) + (span.Hours * 60 * 60) + (span.Days * 24 * 60 * 60);
                    }
                    else
                    {
                        App.GetLevelData().LastDateTime = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                    }
                    App.Notify(Notification.OfflineSecondsSet);
                }
                _isTimerHandled = true;
            }
        }
Example #2
0
 // Use this for initialization
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         DestroyImmediate(this);
     }
     LoadInfo();
 }
Example #3
0
        public override void OnNotificationReceived(Notification notification, NotificationParam param = null)
        {
            if (!AppGame.GetLevelData().IsVibrationOn)
            {
                return;
            }

            switch (notification)
            {
            case Notification.HapticSelectionChange:
                PlayHaptic(HapticTypes.Selection);
                break;

            case Notification.HapticImpactLight:
                PlayHaptic(HapticTypes.LightImpact);
                break;

            case Notification.HapticImpactMedium:
                PlayHaptic(HapticTypes.MediumImpact);
                break;

            case Notification.HapticImpactHeavy:
                PlayHaptic(HapticTypes.HeavyImpact);
                break;

            case Notification.HapticSuccess:
                PlayHaptic(HapticTypes.Success);
                break;

            case Notification.HapticWarning:
                PlayHaptic(HapticTypes.Warning);
                break;

            case Notification.HapticFailure:
                PlayHaptic(HapticTypes.Failure);
                break;

            case Notification.HapticSoft:
                PlayHaptic(HapticTypes.SoftImpact);
                break;

            case Notification.HapticRigid:
                PlayHaptic(HapticTypes.RigidImpact);
                break;
            }
        }