Exemplo 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();
    }
Exemplo n.º 2
0
    /*
     * Create populator (with population),
     * set population parameters
     * generate population
     * saves population and adds it to list of populations
     * adds population to map, and saves map
     * */
    public void populateSpecies(string name, float populationDeviation, int popSize, int maxPopSize)
    {
        SpeciesPopulator populator = ecoCreator.populateSpecies(name);

        populator.SetAbilityStandardDeviation(1);
        populator.setNetworkWeightStandardDeviation(populationDeviation);
        populator.setMaxPopSize(maxPopSize);
        populator.populateRandom(popSize);
        ecoCreator.saveCurrentPopulation();
        ecoCreator.addCurrentPopulationToEcosystem();
        ecoCreator.addCurrentPopulationToMap();
        ecoCreator.saveMap(); // need to save updated tentative map

        // TODO: Include system for saving a temporary map to the actual map.
        // this applies to both the MapEditor, and SpeciesPopulator.
    }