public void OnOpenButtonClick()
        {
            // If no selection, do nothing
            if (CurrentlySelectedEntry == null)
            {
                return;
            }

            string filename = CurrentlySelectedEntry.Text.GetComponent <Text>().text;
            string fullname = filename + ".json";
            string fullpath = Directories.SAVEFILE_FOLDER_FULL_PATH + "/" + fullname;

            // If file has invalid name, show error dialog
            if (filename.IndexOfAny(Path.GetInvalidFileNameChars()) != -1 ||
                String.IsNullOrWhiteSpace(filename))
            {
                MessageBoxFactory.MakeFromConfig(OpenBadNameMessageBoxConfig, this);
                return;
            }

            // If file does not exist, show error dialog
            if (!File.Exists(fullpath))
            {
                MessageBoxFactory.MakeFromConfig(OpenNoFileMessageBoxConfig, this);
                return;
            }

            // Run callback to open circuit, close message box, and unfreeze canvas
            MessageBoxTriggerData triggerData = new MessageBoxTriggerData
            {
                ButtonPressed = MessageBoxButtonType.Positive,
                Sender        = this,
                TextInput     = filename
            };

            TriggerTarget.Trigger(triggerData);
        }
 public override void Trigger(MessageBoxTriggerData triggerData)
 {
     // shouldn't be accepting triggers
     throw new NotImplementedException();
 }
Exemple #3
0
 public abstract void Trigger(MessageBoxTriggerData triggerData);
Exemple #4
0
 public override void Trigger(MessageBoxTriggerData triggerData)
 {
     // shouldn't be accepting triggers
     throw new InvalidOperationException();
 }