/// <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(); }
public void setSteps() { string text = stepsText.GetComponent <Text>().text; bool valid = HelperValidator.validateIntegerString(text); if (valid) { threader.setSteps(Int32.Parse(text)); } }
public bool IsValid(bool validateAge = true) { if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Email) || !HelperValidator.IsValidEmail(Email)) { return(false); } if ((Age < 0 || Age > 250) && validateAge) { return(false); } return(true); }
/// <summary> /// saves all information that the user entered into the menu /// </summary> public void saveSettings() { string name = resNameText.GetComponent <Text>().text; ecoEditor.addResource(name); lrEditor = ecoEditor.lre; // TODO : covert HelperSetter to ValidationHelper string amtstoredString = amtStoredText.GetComponent <Text>().text; if (HelperValidator.validateFloatString(amtstoredString)) { lrEditor.setAmountOfResource(float.Parse(amtstoredString)); } string maxAmtString = maxAmtText.GetComponent <Text>().text; if (HelperValidator.validateFloatString(maxAmtString)) { lrEditor.setMaxAmt(float.Parse(maxAmtString)); } string renAmtString = renewAmtText.GetComponent <Text>().text; if (HelperValidator.validateFloatString(renAmtString)) { lrEditor.setRenewalAmt(float.Parse(renAmtString)); } string amtConsString = amtConsText.GetComponent <Text>().text; if (HelperValidator.validateFloatString(amtConsString)) { lrEditor.setAmtConsumedPerTime(float.Parse(amtConsString)); } // TODO: validate floats ( < 1) float prop; float.TryParse(propExtractText.GetComponent <Text>().text, out prop); lrEditor.setProportionExtracted(prop); ecoEditor.saveResource(); // saves to tentative resources }