Пример #1
0
        /// <summary>
        /// Save the current state including free prize times
        /// </summary>
        public override void SaveState()
        {
            MyDebug.Log("FreePrizeManager: SaveState");

            PreferencesFactory.SetString("FreePrize.NextCountdownStart", NextCountdownStart.ToString(CultureInfo.InvariantCulture));
            PreferencesFactory.SetString("FreePrize.NextPrize", NextFreePrizeAvailable.ToString(CultureInfo.InvariantCulture));
            PreferencesFactory.Save();
        }
        /// <summary>
        /// Save the current state including free prize times
        /// </summary>
        public override void SaveState()
        {
            MyDebug.Log("FreePrizeManager: SaveState");

            PlayerPrefs.SetString("FreePrize.NextCountdownStart", NextCountdownStart.ToString());
            PlayerPrefs.SetString("FreePrize.NextPrize", NextFreePrizeAvailable.ToString());
            PlayerPrefs.Save();
        }
Пример #3
0
    /// <summary>
    /// Recalculate new times for a new countdown
    /// </summary>
    public void StartNewCountdown()
    {
        float seconds = DateTimeUtils.SecondsTillMidnight();

        NextCountdownStart     = UnbiasedTime.Instance.Now().AddSeconds(UnityEngine.Random.Range(DelayRangeToNextCountdown.Min, DelayRangeToNextCountdown.Max + 1));
        NextFreePrizeAvailable = NextCountdownStart.AddSeconds(seconds);

        SaveState();
    }
Пример #4
0
        /// <summary>
        /// Recalculate new times for a new countdown
        /// </summary>
        public void StartNewCountdown()
        {
            SetCurrentPrizeAmount();

            NextCountdownStart = DateTime.UtcNow.AddSeconds(UnityEngine.Random.Range(DelayRangeToNextCountdown.Min, DelayRangeToNextCountdown.Max + 1));

            NextFreePrizeAvailable = NextCountdownStart.AddSeconds(UnityEngine.Random.Range(TimeRangeToNextPrize.Min, TimeRangeToNextPrize.Max + 1));

            SaveState();
        }
Пример #5
0
 /// <summary>
 /// Returns the time until the next countdown will start.
 /// </summary>
 /// <returns></returns>
 TimeSpan GetTimeToCountdown()
 {
     return(NextCountdownStart.Subtract(DateTime.UtcNow));
 }
Пример #6
0
 /// <summary>
 /// Returns the time until the next countdown will start.
 /// </summary>
 /// <returns></returns>
 TimeSpan GetTimeToCountdown()
 {
     return(NextCountdownStart.Subtract(UnbiasedTime.Instance.Now()));
 }