public void RemoveAtomA() { if (atomA != null && atomChoices.Count > atomA.GetAtomicNumber()) { ChoiceOption choiceOption = atomChoices[atomA.GetAtomicNumber() - 1]; var atom = atomA; choiceOption.SetButtonEvent(() => { SetAtom(atom); AudioManager.Instance.PlaySound(choiceClickSound); }); choiceOption.SetColors(ChoiceOption.defaultNormalColor, ChoiceOption.defaultHoverColor, ChoiceOption.defaultPressedColor); choiceOption.SetFocus(false); } //if (atomA != null) { // atomChoices[atomA.GetAtomicNumber() - 1].SetInteractable(true); //} atomA = null; AtomInfo info = Game.Instance.gameData.GetUknownInfo(); atomAText.text = info.GetAtom().GetName(); atomAImage.sprite = info.GetImage(); splitBtn.interactable = false; infoText.text = ""; atomResultImage.sprite = info.GetImage(); atomResultText.text = info.GetAtom().GetName(); atomAAmoText.text = ""; atomAAmo.value = 0; atomABtn.interactable = false; }
public void SetAtomA(Atom atom) { if (atom != null && atomChoices.Count > atom.GetAtomicNumber()) { ChoiceOption choiceOption = atomChoices[atom.GetAtomicNumber() - 1]; choiceOption.SetButtonEvent(() => { RemoveAtomA(); AudioManager.Instance.PlaySound(choiceClickSound); }); choiceOption.SetColors(ChoiceOption.defaultPressedColor, ChoiceOption.defaultHoverColor, ChoiceOption.defaultNormalColor); choiceOption.SetFocus(false); } atomA = atom; //atomChoices[atomA.GetAtomicNumber() - 1].SetInteractable(false); AtomInfo info = Game.Instance.gameData.FindAtomInfo(atom.GetAtomicNumber()); AtomData data = Game.Instance.gameData.FindAtomData(atom.GetAtomicNumber()); atomAText.text = info.GetAtom().GetName(); atomAImage.sprite = info.GetImage(); atomAAmo.maxValue = data.GetCurrAmo(); SetAtomAAmoText(); atomABtn.interactable = true; }
public void Setup(Atom a) { atom = a; AtomData data = Game.Instance.gameData.FindAtomData(atom.GetAtomicNumber()); AtomInfo info = Game.Instance.gameData.FindAtomInfo(atom.GetAtomicNumber()); if (!data.IsDiscovered()) { info = Game.Instance.gameData.GetUknownInfo(); data = Game.Instance.gameData.GetUknownData(); a = Game.Instance.gameData.GetUknown(); } // Display nameText.text = a.GetName(); atomicNumberText.text = "Atomic Number: \n" + (a.GetAtomicNumber() == -1 ? "?" : "" + a.GetAtomicNumber()); atomImage.sprite = info.GetImage(); // Data currAmoText.text = "Current Amo: " + data.GetCurrAmo(); passiveGainText.text = "";// "Passive Gain: " + data.GetPassiveGain(); // What to do with this??? totalCollectedText.text = "Total Atoms: " + data.GetTotalCollected(); totalUsedText.text = "Total Used: " + data.GetTotalUsed(); // Description var size = descriptionText.GetPreferredValues(info.GetDescription(), descriptionText.rectTransform.rect.width, Mathf.Infinity); size.x = descriptionContent.sizeDelta.x; size.y = Mathf.Abs(size.y) + 5; descriptionContent.sizeDelta = size; //descriptionText.rectTransform.sizeDelta = size; descriptionText.text = info.GetDescription(); descriptionScroll.value = 1; typeText.text = "Type: " + info.GetCategoryString(); weightText.text = "Weight: " + (info.GetWeight() == -1 ? "???" : "" + info.GetWeight()); densityText.text = "Density: " + (info.GetDensity() == -1 ? "???" : info.GetDensity() + " g/cm<sup>3</sup>"); // Isotope protonsText.text = "P: " + (info.GetProtons() == -1 ? "?" : "" + info.GetProtons()); electronsText.text = "E: " + (info.GetElectrons() == -1 ? "?" : "" + info.GetElectrons()); neutronsText.text = "N: " + (info.GetNeutrons() == -1 ? "?" : "" + info.GetNeutrons()); radioactiveText.text = "Is Radioactive: " + !info.IsStable();// + " " + info.GetHalfLife() + " " + info.GetStability(); string isotopeString = "Isotopes:\n<size=80%>\t"; var isotopes = info.GetIsotopes(); if (isotopes.Length > 0) { isotopeString += isotopes[0] + "\n\t"; } for (int i = 1; i < isotopes.Length /*&& i < 7*/; i++) // MAximum of 7 isotopes??? { isotopeString += isotopes[i] + "\n\t"; } isotopeText.text = isotopeString; // Area string placesString = "Places:\n"; var places = info.GetPlacesToBeFound(); if (places.Length > 0) { placesString += " " + places[0] + "\n"; } for (int i = 1; i < places.Length; i++) { placesString += " " + places[i] + "\n"; } placesText.text = placesString; string originsString = "Origins:\n"; var origins = info.GetOrigins(); if (origins.Length > 0) { originsString += " " + origins[0] + "\n"; } for (int i = 1; i < origins.Length; i++) { originsString += " " + origins[i] + "\n"; } originsText.text = originsString; }