Exemplo n.º 1
0
    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;
    }