コード例 #1
0
        public bool IsActive()
        {
            alarmTime = GameData.GetDate("alarm");
            TimeSpan timeSpan = alarmTime - DateTime.Now;

            return(timeSpan.Seconds > 1);
        }
コード例 #2
0
ファイル: DailyBonus.cs プロジェクト: Crazy0wl/Magnet_Balls_2
        public override bool Show(float delay = 0f)
        {
            collecting = false;
            if (FixedDay > 0)
            {
                base.Show(delay);
                InitButtons(FixedDay);
                return(true);
            }

            DateTime lastStartDate = GameData.GetDate("last_start_date");

            lastStartDate = new DateTime(lastStartDate.Year, lastStartDate.Month, lastStartDate.Day);
            DateTime nowDate  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            TimeSpan timeSpan = nowDate - lastStartDate;

            if (timeSpan.Days == 1)
            {
                if (GameData.DailyBonusDay < 7)
                {
                    GameData.DailyBonusDay++;
                }
                else
                {
                    GameData.DailyBonusDay = 1;
                }
                if (base.Show(delay))
                {
                    GameData.SaveDate("last_start_date", DateTime.Now);
                    InitButtons(GameData.DailyBonusDay);
                    return(true);
                }
            }
            else if (timeSpan.Days > 1)
            {
                GameData.DailyBonusDay = 1;
                if (base.Show())
                {
                    GameData.SaveDate("last_start_date", DateTime.Now);
                    InitButtons(GameData.DailyBonusDay);
                    return(true);
                }
            }
            return(false);
        }
コード例 #3
0
 private void OnEnable()
 {
     alarmTime = GameData.GetDate("alarm");
     Active    = true;
     StartCoroutine(StartCountdownRoutine());
 }