Esempio n. 1
0
    /// <summary>
    /// saves all information that the user entered into the menu
    /// </summary>
    public void saveSettings()
    {
        // TODO : covert HelperSetter to ValidationHelper
        StringFunct setEcoName       = new StringFunct(ecoEditor.setName);
        bool        a                = HelperValidator.setName(ecoNameTextBox, errorObj, setEcoName);
        IntFunct    setAPPC          = new IntFunct(ecoEditor.setAbilityPointsPerCreature);
        bool        b                = HelperValidator.setIntegerFunct(abilityPtsPerCreatTextBox, setAPPC, errorObj);
        IntFunct    setCommBits      = new IntFunct(ecoEditor.setCommBits);
        bool        c                = HelperValidator.setIntegerFunct(commBitsText, setCommBits, errorObj);
        IntFunct    setDistinctPheno = new IntFunct(ecoEditor.setDistinctPhenotypeNum);
        bool        d                = HelperValidator.setIntegerFunct(distinctPhenoText, setDistinctPheno, errorObj);

        // saves tentative resource options to Ecosystem object
        ecoEditor.saveResourceOptions();

        // TODO : don't forget to call EcosystemEditor save methods


        /** call methods to save ecoEditor data to actual Ecosystem object **/

        // saves tentative resource options to Ecosystem object
        ecoEditor.saveResourceOptions();

        ecoEditor.saveFoundersToSpecies();

        ecoEditor.addCurrentPopulationToEcosystem();

        ecoEditor.saveMap();
    }
Esempio n. 2
0
    // calls EcosystemEditor method to save ecosystem name
    public static bool setName(GameObject textBox, GameObject errorObj, StringFunct stringSetter)
    {
        bool   valid    = false;
        string nameText = textBox.GetComponent <Text>().text;

        if (nameText.Equals(""))
        {
            string errorText = "Empty input error.";
            Debug.LogError(errorText);
            errorObj.GetComponent <Text>().text = errorText;
            errorObj.SetActive(true);
        }
        else
        {
            stringSetter(nameText);
            valid = true;
        }
        return(valid);
    }