Ejemplo n.º 1
0
    private string SaveDataSentences(string fileContent, GUI_TextFieldButton currentButton, string sentences)
    {
        ExtensionFilter[] filter = new ExtensionFilter[]
        {
            new ExtensionFilter("Sentence", sentences),
        };

        var path = currentButton.SavePath;

        if (string.IsNullOrEmpty(path))
        {
            path = StandaloneFileBrowser.SaveFilePanel("Save Sentence", GetRootDirectory(), currentButton.GetButtonName(), filter);
        }
        else if (_showDialog)
        {
            var directory = Path.GetDirectoryName(path);
            path = StandaloneFileBrowser.SaveFilePanel("Save Sentence", directory, currentButton.GetButtonName(), filter);
        }

        if (!string.IsNullOrEmpty(path))
        {
            if (!Path.HasExtension(path) || Path.GetExtension(path) != "." + SENTENCES)
            {
                path += "." + SENTENCES;
            }
            File.WriteAllText(path, fileContent);
            _lastChoosenDirectory = Path.GetDirectoryName(path);
            currentButton.SetSavePath(path);
        }

        return(path);
    }
Ejemplo n.º 2
0
    private void RemoveTextInstance(GUI_TextFieldButton arg0)
    {
        if (_currentSelectedButton == arg0)
        {
            SaveText(arg0, _field);
        }

        if (arg0.HasUnsavedChanges)
        {
            var messageBox = GameManager.Instance.CreateMessageBox();
            messageBox.Init($"Do you want to save the changes you made in \"{arg0.GetButtonName()}\"?");
            messageBox.OnSaveButtonClickedEvent.AddListener(() => MessageBoxSaveButtonClickedEventListener(arg0));
            messageBox.OnDontSaveButtonClickedEvent.AddListener(() => MessageBoxDontSaveButtonClickedEventListener(arg0));
        }
        else
        {
            MessageBoxDontSaveButtonClickedEventListener(arg0);
        }
    }