// MARK: - SaveDialogDelegate public void DidConfirmSave(SaveDialog dialog, string name) { if (string.IsNullOrEmpty(name)) { dialog.ShowErrorMessage("Please enter a name for your creature!"); return; } try { editor.SaveCurrentDesign(name); } catch (IllegalFilenameException e) { dialog.ShowErrorMessage(string.Format("The creature name cannot contain: {0}", new string(FileUtil.INVALID_FILENAME_CHARACTERS))); Debug.LogError(e.Message); return; } dialog.Close(); }
public void DidChangeValue(SaveDialog dialog, string value) { if (CreatureSerializer.CreatureExists(value)) { dialog.ShowErrorMessage(string.Format("The existing save for {0} will be overwritten!", value)); } else { dialog.ResetErrors(); } }
/// <summary> /// Attempts to save the current creature. Shows an error screen if something went wrong. /// </summary> /// <param name="name">Name.</param> public void SaveCreature(string name) { saveDialog.ResetErrors(); if (name == "") { saveDialog.ShowErrorMessage("The Creature name is empty."); return; } try { CreatureSaver.WriteSaveFile(name, joints, bones, muscles); } catch (IllegalFilenameException e) { saveDialog.ShowErrorMessage("The name can't contain . (dots) or _ (underscores)."); print(e.Message); return; } // The save was successful saveDialog.gameObject.SetActive(false); buttonManager.Refresh(); }