public void ForbiddenDaysIsWeekInForbiddenDays() { var startDate = new DateTime(2018, 10, 03); // Monday var weekdaySlots = new DailySlot[][] { new DailySlot[] // Sunday { new DailySlot { StartTime = new DateTime(1, 1, 1, 10, 00, 00), EndTime = new DateTime(1, 1, 1, 11, 00, 00) }, new DailySlot { StartTime = new DateTime(1, 1, 1, 16, 00, 00), EndTime = new DateTime(1, 1, 1, 17, 00, 00) } }, new DailySlot[] { }, // Monday new DailySlot[] { }, // Tuesday new DailySlot[] { }, // Wednesday new DailySlot[] // Thursday { new DailySlot { StartTime = new DateTime(1, 1, 1, 10, 00, 00), EndTime = new DateTime(1, 1, 1, 11, 00, 00) }, new DailySlot { StartTime = new DateTime(1, 1, 1, 16, 00, 00), EndTime = new DateTime(1, 1, 1, 17, 00, 00) } }, new DailySlot[] { }, // Friday new DailySlot[] { } // Saturday }; Assert.IsTrue(PlannerScheduler.IsWeekInForbiddenDays(startDate, weekdaySlots, new DateTime[] { new DateTime(2018, 10, 4) })); Assert.IsTrue(PlannerScheduler.IsWeekInForbiddenDays(startDate, weekdaySlots, new DateTime[] { new DateTime(2018, 10, 9) })); }
public bool NextReward() { if (IndexReward > (dailyPanel.slots.Length - 1)) { return(false); } else if (IndexReward == (dailyPanel.slots.Length - 1)) { DailySlot next = dailyPanel.getSlot(IndexReward); if (next != null) { next.IsOpen = true; // progress.SetActive(false); } return(false); } else { DailySlot next = dailyPanel.getSlot(IndexReward); if (next != null) { next.IsOpen = true; } IndexReward++; return(true); } }
public static void LoadResource(DailyPanel dailyPanel) { // TO DO somethin.... dailyPanel.Clear(); string[] s = PlayerPrefsX.GetStringArray(KeySave.DAILY_REWARD); for (int i = 0; i < s.Length && i < dailyPanel.slots.Length; i++) { DailySlot slot = dailyPanel.slots[i]; string[] temp = s[i].Split(','); for (int j = 0; j < temp.Length; j++) { slot.ID = int.Parse(temp[j]); slot.IsOpen = Boolean.Parse(temp[++j]); slot.IsRecieve = Boolean.Parse(temp[++j]); } } }
public void RecieveReward(DailySlot slot) { if (slot.ID <= IndexReward && !slot.IsRecieve && slot.IsOpen) { slot.IsRecieve = true; if (IndexReward == (dailyPanel.slots.Length - 1)) { if (dailyPanel.IsRecieveAll()) { IndexReward = -1; dailyPanel.Clear(); dailyReward._checktime(); } } dailyPanel.SaveData(); } else { } }