public static void CMD_SaveMapAs()
 {
     if (EditorSubsystem.getInstance().IsTesting())
     {
         Logger.Log("Cannot save in testing mode.");
         return;
     }
     System.Windows.Application.Current.Dispatcher.Invoke(() =>
     {
         SaveFileDialog dlg  = new SaveFileDialog();
         dlg.OverwritePrompt = false;
         dlg.DefaultExt      = ".mocha";
         dlg.Filter          = "Mocha Map Files (.mocha)|*.mocha";
         DialogResult result = dlg.ShowDialog();
         if (result == DialogResult.OK)
         {
             // EngineManagerViewModel.instance.BusyMessage = "... Saving Map ...";
             string filename = dlg.FileName;
             Dispatcher.CurrentDispatcher.Invoke(() => { EngineManagerViewModel.instance.SelectedGameObjects.Clear(); });
             EditorSubsystemManaged.getInstance().QueueAction(() =>
             {
                 StateSerializer ss = new StateSerializer(); ss.SaveCurrentState(filename);
             });
             Dispatcher.CurrentDispatcher.Invoke(() => { EngineManagerViewModel.instance.currentLoadedMap = filename; });
             // EngineManagerViewModel.instance.BusyMessage = null;
         }
     });
 }
Пример #2
0
 private void TestCurrentPosButton_Click(object sender, RoutedEventArgs e)
 {
     if ((DataContext as EngineManagerViewModel).IsConnected)
     {
         if (EditorSubsystem.getInstance().IsTesting())
         {
             return;
         }
         EditorSubsystemManaged.getInstance().QueueAction(() =>
         {
             StateSerializer ss = new StateSerializer(); ss.SaveCurrentState("_Testing_Temp.mocha");
         });
         EditorSubsystemManaged.getInstance().QueueAction(() =>
         {
             if (BeginTest())
             {
                 GameObject playerObj = GameObject.From(GameObject.GetGameObjectWithTag("Player"));
                 if (playerObj == null)
                 {
                     MessageBox.Show("Test from Current Position requires\nan object with the \'Player\' tag set.");
                 }
                 else
                 {
                     playerObj.transform.SetPosition(EditorSubsystem.getInstance().EditorCamera().gameObject.transform.GetGlobalPosition());
                 }
             }
         });
     }
 }
Пример #3
0
 private void TestStartButton_Click(object sender, RoutedEventArgs e)
 {
     if ((DataContext as EngineManagerViewModel).IsConnected)
     {
         if (EditorSubsystem.getInstance().IsTesting())
         {
             return;
         }
         EditorSubsystemManaged.getInstance().QueueAction(() =>
         {
             StateSerializer ss = new StateSerializer(); ss.SaveCurrentState("_Testing_Temp.mocha");
         });
         EditorSubsystemManaged.getInstance().QueueAction(() =>
         {
             BeginTest();
         });
     }
 }
        public static int gridExtent = 30;          //number of grid lines

        public static void CMD_SaveMap()
        {
            if (EditorSubsystem.getInstance().IsTesting())
            {
                Logger.Log("Cannot save in testing mode.");
                return;
            }
            //EngineManagerViewModel.instance.BusyMessage = "... Saving Map ...";
            EngineManagerViewModel.instance.SelectedGameObjects.Clear();     //safety check, remove the selected object so no weird binding happens
            string currentLoadedMap = EngineManagerViewModel.instance.currentLoadedMap;

            if (currentLoadedMap != null)
            {
                EditorSubsystemManaged.getInstance().QueueAction(() => { StateSerializer ss = new StateSerializer(); ss.SaveCurrentState(currentLoadedMap); });
            }
            else
            {
                System.Windows.MessageBox.Show("Save As, Before Saving...");
            }
            // EngineManagerViewModel.instance.BusyMessage = null;        }
        }