public void Initialize(DayGift day) { dayStr = LanguageManager.Instance.GetLocalizedValue("Menu", "Gift_day"); claimedStr = LanguageManager.Instance.GetLocalizedValue("Menu", "Gift_Claimed"); cross.SetActive(day.isCrossed); dayNumber.text = dayStr + day.id.ToString(); if (day.isToday) { claim.SetActive(true); if (day.isClaimed) { dayNumber.text = claimedStr; claim.SetActive(false); } } amount.text = day.amount.ToString(); }
void UpdateInfo() { if (days != null) { for (int i = 0; i < days.Length; i++) { Destroy(days[i].gameObject); } } gifts = new DayGift[7]; days = new RewardDay[7]; isClaimed = data.isClaimedGift; for (int i = 0; i < days.Length; i++) { days[i] = Instantiate(dayPref, content.transform).GetComponent <RewardDay>(); DayGift gift = new DayGift(); gift.isCrossed = false; gift.isToday = false; gift.isClaimed = false; if (i < currentDayInARow) { gift.isCrossed = true; } else if (i == currentDayInARow) { gift.isToday = true; gift.isClaimed = isClaimed; } gift.id = i + 1; switch (i) { case 0: gift.amount = 50; break; case 1: gift.amount = 100; break; case 2: gift.amount = 200; break; case 3: gift.amount = 400; break; case 4: gift.amount = 600; break; case 5: gift.amount = 1000; break; case 6: gift.amount = 2000; break; } days[i].Initialize(gift); gifts[i] = gift; } }