public void ShowGetRewardButton() { if (library.money.GetMoney() >= GameplayConstants.PurchasePrice && (PreferencesSaver.GetNumReward() + 1) < GameplayConstants.OrderOpeningReward.Length) { getRewardButton.gameObject.SetActive(true); } else { getRewardButton.gameObject.SetActive(false); } }
public void ShowReward() { closeButton.SetActive(false); PreferencesSaver.AddRewardNum(); int numReward = PreferencesSaver.GetNumReward(); if (numReward < GameplayConstants.OrderOpeningReward.Length) { img.GetComponent <Image>().sprite = Resources.Load <Sprite>("Images/Backgrounds/" + GameplayConstants.OrderOpeningReward[numReward]); } iTween.ValueTo(gameObject, iTween.Hash("from", img.GetComponent <RectTransform>().rect.height / 2f, "to", -library.canvas.GetComponent <RectTransform>().rect.height / 2f, "delay", 0.5f, "time", 2f, "onupdate", (System.Action <object>)(newVal => { //endScreen.GetComponent<CanvasGroup>().alpha = (float)newVal; img.GetComponent <RectTransform>().anchoredPosition = new Vector2(img.GetComponent <RectTransform>().anchoredPosition.x, (float)newVal); } ), "oncomplete", "OnCompleteShow", "easetype", iTween.EaseType.easeOutElastic, "oncompletetarget", gameObject )); PreferencesSaver.SetCurrentElementInMarket(GameplayConstants.OrderOpeningReward[numReward]); PreferencesSaver.SetOpenElementInMarket(GameplayConstants.OrderOpeningReward[numReward]); library.money.AddMoney(-GameplayConstants.PurchasePrice); library.money.SaveMoney(); library.screenController.endScreen.GetComponent <EndScreen>().HideRewardButton(); }