public bool IsActive() { alarmTime = GameData.GetDate("alarm"); TimeSpan timeSpan = alarmTime - DateTime.Now; return(timeSpan.Seconds > 1); }
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); }
private void OnEnable() { alarmTime = GameData.GetDate("alarm"); Active = true; StartCoroutine(StartCountdownRoutine()); }