public void SetTimer(int minutes) { alarmTime = DateTime.Now.AddMinutes(minutes); GameData.SaveDate("alarm", alarmTime); Active = true; StartCoroutine(StartCountdownRoutine()); }
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); }