private void SelectTab(UpgradeButton button, bool useSound = true) { selectedButton = button; button.image.sprite = selectedTabSprite; infoPanel.gameObject.SetActive(true); var upgradeType = button.GetUpgradeType(); var upgradeData = GameManager.Instance.upgradeTextData; var data = upgradeData.GetUpgradeTextData(upgradeType); upgradeDescription.text = data.descrptionText; itemImage.sprite = data.sprite; //int index = infoPanel.transform.GetSiblingIndex(); button.transform.SetAsLastSibling(); itemImage.transform.SetAsLastSibling(); var pos = button.transform.localPosition; pos.y = selectedPosY; LeanTween.moveLocal(button.gameObject, pos, 0.15f).setIgnoreTimeScale(true).setEaseOutBack(); if (useSound) { EventManager.UI.onTapButton?.Invoke(true); } }
public void OnPressUnlockUpgradeButton() { unlockInfoPanel.gameObject.SetActive(true); selectedButton = unlockUpgradeButton; var upgradeType = selectedButton.GetUpgradeType(); var upgradeData = GameManager.Instance.upgradeTextData; var data = upgradeData.GetUpgradeTextData(upgradeType); unlockDescription.text = data.descrptionText; unlockItemImage.sprite = data.sprite; }
private void DeselectTab(UpgradeButton button) { button.image.sprite = deselectedTabSprite; var pos = button.transform.localPosition; pos.y = deselectedPosY; button.transform.localPosition = pos; int index = infoPanel.transform.GetSiblingIndex(); button.transform.SetSiblingIndex(--index); }
private void SetupUpdgradeButtons() { var upgradeTextData = GameManager.Instance.upgradeTextData; var upgrades = GetUpgradesForCurrentLevel(); UpgradeData data = null; unlockUpgradeButton.gameObject.SetActive(upgrades.isUnlock); if (upgrades.isUnlock) { data = upgradeTextData.GetUpgradeTextData(upgrades.unlockUpgrade); unlockUpgradeButton.gameObject.SetActive(true); unlockUpgradeButton.SetText(data.buttonText); unlockUpgradeButton.SetUpgradeType(upgrades.unlockUpgrade); for (int i = 0; i < upgradeButtons.Length; i++) { upgradeButtons[i].gameObject.SetActive(false); } } else { for (int i = 0; i < upgradeButtons.Length; i++) { UpgradeButton btn = upgradeButtons[i]; UpgradeType upgradeType = UpgradeType.NONE; if (i == 0) { upgradeType = upgrades.upgrade_01; } else if (i == 1) { upgradeType = upgrades.upgrade_02; } else if (i == 2) { upgradeType = upgrades.upgrade_03; } data = upgradeTextData.GetUpgradeTextData(upgradeType); btn.SetUpgradeType(upgradeType); btn.SetText(data.buttonText); btn.SetIcon(data.sprite); btn.gameObject.SetActive(true); } } }