public void SetChoiceDisplay(ChoiceOption choice, PlayerData.UpgradeType type) { string text = ""; switch (type) { case PlayerData.UpgradeType.Collect_Speed: text = "Collect Speed Lv. "; break; case PlayerData.UpgradeType.Collect_Radius: text = "Collect Radius Lv. "; break; case PlayerData.UpgradeType.Collect_Efficiency: text = "Collect Efficiency Lv. "; break; case PlayerData.UpgradeType.Collect_Weight: text = "Collect Weight Lv. "; break; case PlayerData.UpgradeType.Particle_Speed: text = "Particle Speed Lv. "; break; case PlayerData.UpgradeType.Particle_Stability: text = "Particle Stability Lv. "; break; case PlayerData.UpgradeType.Time_Dilation: text = "Time Dilation Lv. "; break; } if (Game.Instance.playerData.IsMaxLevel(type)) { choice.SetText(text + "MAX"); } else { choice.SetText(text + Game.Instance.playerData.GetUpgradeLevel(type)); } }
public void SetUpgradeInfo(PlayerData.UpgradeType type) { RemoveUpgrade(); if ((int)type >= choices.Count) { return; } // Button Stuff ChoiceOption choiceOption = choices[(int)type]; choiceOption.SetButtonEvent(() => { RemoveUpgrade(); AudioManager.Instance.PlaySound(choiceClick); }); choiceOption.SetColors(ChoiceOption.defaultPressedColor, ChoiceOption.defaultHoverColor, ChoiceOption.defaultNormalColor); choiceOption.SetFocus(false); currUpgradeType = type; // Display Stuff List <AtomAmo> atomsNeeded = Game.Instance.playerData.GetCost(type); upgradeName.text = Game.Instance.playerData.GetName(type); upgradeDesc.text = Game.Instance.playerData.GetDescription(type); double currValue = System.Math.Round(Game.Instance.playerData.GetValue(type), 3); double nextValue = System.Math.Round(Game.Instance.playerData.GetNextValue(type), 3); if (type == PlayerData.UpgradeType.Collect_Efficiency) { currValue *= 100; nextValue *= 100; } upgradeCurrValue.text = "Curr Value: " + currValue + " " + Game.Instance.playerData.GetMeasurementAbbr(type); //currValue; upgradeNextValue.text = "Next Value: " + nextValue + " " + Game.Instance.playerData.GetMeasurementAbbr(type); //nextValue; bool canCraft = true; upgradeAtomName.text = ""; upgradeAtomNeed.text = ""; upgradeAtomHave.text = ""; for (int i = 0; i < atomsNeeded.Count; i++) { AtomAmo cost = atomsNeeded[i]; if (cost.atom == null) { continue; } int amoHave = Game.Instance.gameData.FindAtomData(cost.atom.GetAtomicNumber()).GetCurrAmo(); if (amoHave >= cost.amo) { upgradeAtomName.text += cost.atom.GetName() + "\n"; upgradeAtomNeed.text += cost.amo + "\n"; upgradeAtomHave.text += amoHave + "\n"; } else { upgradeAtomName.text += "<color=#ff8080>" + cost.atom.GetName() + "\n</color>"; upgradeAtomNeed.text += "<color=#ff8080>" + cost.amo + "\n</color>"; upgradeAtomHave.text += "<color=#ff8080>" + amoHave + "\n</color>"; canCraft = false; } } upgradeBtn.interactable = canCraft; }