public bool checkNameIsValid() { if (sampleText.text == "") { Debug.Log("Name cannot be blank"); AudioManager.Play("Wait"); return(false); } Debug.Log("sampleText.text = " + sampleText.text); if (LoadProfileList.checkForName(sampleText.text) == true) { Debug.Log("Name is not Valid"); AudioManager.Play("Wait"); return(false); } else { //file with this name doesnt exist yet, so create new file SaveProfile.saveProfile(sampleText.text); Debug.Log("Name is Good, created new profile!"); return(true); } }
/* * // Start is called before the first frame update * void Start() * { * buttonID = GetComponent<MenuPlayerButtonScript>().buttonID; * } * private void OnEnable() * { * Start(); * } */ /* * // Update is called once per frame * void Update() * { * if (playerMenu.GetComponent<PlayerMenuScript>().currentButton == buttonID) * { * if (Input.GetKeyDown(KeyCode.D)) * { * AudioManager.Play("Joined"); * LoadProfileList.RemoveName(text.text); * Debug.Log("Should have removed" + text.text); * playerMenu.GetComponent<PlayerMenuScript>().GotoPreviousMenu(); * } * } * } */ public void RemoveName() { if (LoadProfileList.checkForName(text.text) == true) { LoadProfileList.RemoveName(text.text); playerMenu.GetComponent <PlayerMenuScript>().GotoPreviousMenu(); AudioManager.Play("Back"); } else { AudioManager.Play("Wait"); } }