private void GetReward_OnClick() { foreach (var item in Reward.Reward.RewardDbList) { if (item.IdReward == IdReward) { // if (Item.NameItem == "Gold") { Player.Player.Coin += item.Count; } if (Item.NameItem == "Energy") { Player.Player.Energy += item.Count; } if (Item.NameItem == "IAP") { Player.Player.IAP += item.Count; } item.Status = 1; PublicClass.stringNotify = "Received " + item.Count.ToString() + " " + Item.NameItem; PublicClass.indexNotify = 8; SceneManager.LoadSceneAsync("notifyBox", LoadSceneMode.Additive); Player.Save(); break; } } Reward.Save(); Load(); }
void Start() { Items = GetComponent <item>(); Items.Load(); DateTime d = GetNistTime(); switch (d.DayOfWeek) { case DayOfWeek.Monday: indexDay = 1; break; case DayOfWeek.Tuesday: indexDay = 2; break; case DayOfWeek.Wednesday: indexDay = 3; break; case DayOfWeek.Thursday: indexDay = 4; break; case DayOfWeek.Friday: indexDay = 5; break; case DayOfWeek.Saturday: indexDay = 6; break; case DayOfWeek.Sunday: indexDay = 7; break; } // Reward = GetComponent <reward>(); // Reward.Load(); // if (indexDay == 1) { if (Reward.Reward.RewardDbList[0].Status == 0) { for (int i = 0; i < Reward.Reward.RewardDbList.Length; i++) { Reward.Reward.RewardDbList[i].Status = 0; } Reward.Save(); } } // foreach (var item in Reward.Reward.RewardDbList) { var e = Instantiate(ItemReward, ContentView); var RewardS = e.GetComponent <ItemRewardControll>(); RewardS.Reward = item; RewardS.IsGetReward = item.IdReward == indexDay; foreach (var itemItem in Items.Player.ItemDbList) { if (item.IdItem == itemItem.IdItem) { RewardS.Item = itemItem; break; } } } }