Exemple #1
0
 /// <summary>Initializes a new instance of the <see cref="T:Gorgon.Editor.SpriteEditor.ImporterPlugInSettings"/> class.</summary>
 public ImporterPlugInSettings()
 {
     ID = Guid.NewGuid();
     WriteSettingsCommand          = new EditorCommand <object>(DoWriteSettings);
     LoadPlugInAssemblyCommand     = new EditorCommand <object>(DoLoadPlugInAssembly);
     UnloadPlugInAssembliesCommand = new EditorCommand <object>(DoUnloadPlugInAssemblies, CanUnloadPlugInAssemblies);
 }
Exemple #2
0
        public static void Main()
        {
            try
            {
                using (IEngine engine = EngineFactory.Create(new EngineOptions.Builder().Build()))
                {
                    Console.WriteLine("Engine created");

                    using (IBrowser browser = engine.CreateBrowser())
                    {
                        Console.WriteLine("Browser created");

                        browser.Navigation.LoadUrl("http://www.google.com")
                        .Wait();
                        // Inserts "TeamDev DotNetBrowser" text into Google Search field.
                        browser.MainFrame.Execute(EditorCommand.InsertText("TeamDev DotNetBrowser"));
                        // Inserts a new line into Google Search field to simulate Enter.
                        browser.MainFrame.Execute(EditorCommand.InsertNewLine());

                        Thread.Sleep(3000);
                        // The page will now contain search results.
                        Console.WriteLine("Page contents:");
                        Console.WriteLine(browser.MainFrame.Document.DocumentElement.InnerText);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine("Press any key to terminate...");
            Console.ReadKey();
        }
Exemple #3
0
        internal static bool GetEnabled(EditorCommand command)
        {
            var sf = App.SelectedShapefile;

            if (sf == null)
            {
                return(false);
            }

            switch (command)
            {
            case EditorCommand.Undo:
                return(App.Map.UndoList.UndoCount > 0);

            case EditorCommand.Redo:
                return(App.Map.UndoList.RedoCount > 0);

            case EditorCommand.Copy:
                return(sf.NumSelected > 0);

            case EditorCommand.Cut:
                return(sf.NumSelected > 0 && sf.InteractiveEditing);

            case EditorCommand.Paste:
                return(!OperationHelper.BufferIsEmpty && sf.InteractiveEditing);
            }
            return(false);
        }
        public static void Main()
        {
            try
            {
                using (IEngine engine = EngineFactory.Create(new EngineOptions.Builder().Build()))
                {
                    Console.WriteLine("Engine created");

                    using (IBrowser browser = engine.CreateBrowser())
                    {
                        Console.WriteLine("Browser created");
                        browser.Size = new Size(700, 500);
                        browser.Navigation.LoadUrl("https://www.teamdev.com").Wait();

                        browser.MainFrame.Execute(EditorCommand.SelectAll());


                        Console.WriteLine("Current selection:");
                        Console.WriteLine($"\tSelected text: {browser.MainFrame.SelectedText}");
                        Console.WriteLine($"\tSelected HTML:  {browser.MainFrame.SelectedHtml}");
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine("Press any key to terminate...");
            Console.ReadKey();
        }
 private void ExtensionService_ExtensionRemovedAsync(object sender, EditorCommand e)
 {
     _languageServer?.SendNotification <ExtensionCommandRemovedNotification>("powerShell/extensionCommandRemoved",
                                                                             new ExtensionCommandRemovedNotification
     {
         Name = e.Name,
     });
 }
 private void ExtensionService_ExtensionAddedAsync(object sender, EditorCommand e)
 {
     _languageServer.SendNotification <ExtensionCommandAddedNotification>("powerShell/extensionCommandAdded",
                                                                          new ExtensionCommandAddedNotification
     {
         Name        = e.Name,
         DisplayName = e.DisplayName
     });
 }
 private async void ExtensionService_ExtensionRemoved(object sender, EditorCommand e)
 {
     await this.SendEvent(
         ExtensionCommandRemovedNotification.Type,
         new ExtensionCommandRemovedNotification
     {
         Name = e.Name,
     });
 }
Exemple #8
0
        private static void Edit(AppViewModel item, EditorCommand command)
        {
            var view = item?.Workspace?.SelectedItem?.View;

            if (view is IEditor editor)
            {
                command.Execute(editor.Editor);
                Keyboard.Focus(editor.Editor);
            }
        }
 private async void ExtensionService_ExtensionAdded(object sender, EditorCommand e)
 {
     await this.SendEvent(
         ExtensionCommandAddedNotification.Type,
         new ExtensionCommandAddedNotification
     {
         Name        = e.Name,
         DisplayName = e.DisplayName
     });
 }
            public override bool TryGetCommand(string commandId, out EditorCommand command)
            {
                var commandSpec = GetCommandSpec(commandId);

                if (commandSpec == null)
                {
                    command = default(EditorCommand);
                    return(false);
                }

                command = ToEditorCommand(commandSpec, commandId);
                return(true);
            }
Exemple #11
0
            public void Update (IEditor editor, EditorCommand editorCommand)
            {
                this.editor = editor;
                this.editorCommand = editorCommand;

                if (editor == null) {
                    editorCommand = default(EditorCommand);
                    status = EditorCommandStatus.Unsupported;
                } else
                    status = editor.GetCommandStatus (editorCommand);

                CanExecuteChanged?.Invoke (this, EventArgs.Empty);
            }
        public async Task CanUpdateRegisteredCommand()
        {
            // Register a command and then update it
            await extensionService.PowerShellContext.ExecuteScriptStringAsync(TestUtilities.NormalizeNewlines(
                                                                                  "function Invoke-Extension { Write-Output \"Extension output!\" }\n" +
                                                                                  "Register-EditorCommand -Name \"test.function\" -DisplayName \"Function extension\" -Function \"Invoke-Extension\"\n" +
                                                                                  "Register-EditorCommand -Name \"test.function\" -DisplayName \"Updated Function extension\" -Function \"Invoke-Extension\""));

            // Wait for the add and update events
            await this.AssertExtensionEvent(EventType.Add, "test.function");

            EditorCommand updatedCommand = await this.AssertExtensionEvent(EventType.Update, "test.function");

            Assert.Equal("Updated Function extension", updatedCommand.DisplayName);
        }
Exemple #13
0
        public void Bind(IEditor editor)
        {
            currentEditor = editor;

            if (editor == null || !editor.TryGetCommand(commandId, out command))
            {
                command = default(EditorCommand);
                status  = EditorCommandStatus.Unsupported;
            }
            else
            {
                Title  = command.Title;
                status = editor.GetCommandStatus(command);
            }

            Hidden = status == EditorCommandStatus.Hidden || status == EditorCommandStatus.Unsupported;
        }
        /// <summary>
        /// Unregisters an existing EditorCommand based on its registered name.
        /// </summary>
        /// <param name="commandName">The name of the command to be unregistered.</param>
        public void UnregisterCommand(string commandName)
        {
            EditorCommand existingCommand = null;

            if (this.editorCommands.TryGetValue(commandName, out existingCommand))
            {
                this.editorCommands.Remove(commandName);
                this.OnCommandRemoved(existingCommand);
            }
            else
            {
                throw new KeyNotFoundException(
                          string.Format(
                              "Command '{0}' is not registered",
                              commandName));
            }
        }
        public EditorToggleContextualMenuChoice(string name, List<string> labels, float textSize, List<EditorCommand> commands)
            : base(name, labels, new Text(labels[0], @"Pixelite") { SizeX = textSize })
        {
            if (commands.Count != labels.Count)
            {
                Commands = new List<EditorCommand>();

                for (int i = 0; i < labels.Count; i++)
                    Commands.Add(commands[0]);
            }

            else
            {
                Commands = commands;
            }

            Command = Commands[CurrentIndex];
        }
Exemple #16
0
        public static void OnDoEditorCommandCallback(EditorCommand editorCommand, TimelinableTrackBase[] tracks)
        {
            switch (editorCommand)
            {
            case EditorCommand.Copy:
                break;

            case EditorCommand.Paste:
                DoEditorOperation_Paste(tracks);
                break;

            case EditorCommand.Delete:
                DoEditorOperation_Delete(tracks);
                break;

            default:
                break;
            }
        }
        public async Task CanRegisterAndInvokeCommandWithScriptBlock()
        {
            await extensionService.PowerShellContext.ExecuteScriptStringAsync(
                "Register-EditorCommand -Name \"test.scriptblock\" -DisplayName \"ScriptBlock extension\" -ScriptBlock { $global:extensionValue = 10 }");

            // Wait for the add event
            EditorCommand command = await this.AssertExtensionEvent(EventType.Add, "test.scriptblock");

            // Invoke the command
            await extensionService.InvokeCommandAsync("test.scriptblock", this.commandContext);

            // Assert the expected value
            PSCommand psCommand = new PSCommand();

            psCommand.AddScript("$global:extensionValue");
            var results = await powerShellContext.ExecuteCommandAsync <int>(psCommand);

            Assert.Equal(10, results.FirstOrDefault());
        }
        public async Task CanRegisterAndInvokeCommandWithCmdletName()
        {
            await extensionService.PowerShellContext.ExecuteScriptStringAsync(
                TestUtilities.NormalizeNewlines("function Invoke-Extension { $global:extensionValue = 5 }\n") +
                "Register-EditorCommand -Name \"test.function\" -DisplayName \"Function extension\" -Function \"Invoke-Extension\"");

            // Wait for the add event
            EditorCommand command = await this.AssertExtensionEvent(EventType.Add, "test.function");

            // Invoke the command
            await extensionService.InvokeCommandAsync("test.function", this.commandContext);

            // Assert the expected value
            PSCommand psCommand = new PSCommand();

            psCommand.AddScript("$global:extensionValue");
            var results = await powerShellContext.ExecuteCommandAsync <int>(psCommand);

            Assert.Equal(5, results.FirstOrDefault());
        }
        /// <summary>
        /// Registers a new EditorCommand with the ExtensionService and
        /// causes its details to be sent to the host editor.
        /// </summary>
        /// <param name="editorCommand">The details about the editor command to be registered.</param>
        /// <returns>True if the command is newly registered, false if the command already exists.</returns>
        public bool RegisterCommand(EditorCommand editorCommand)
        {
            bool commandExists =
                this.editorCommands.ContainsKey(
                    editorCommand.Name);

            // Add or replace the editor command
            this.editorCommands[editorCommand.Name] = editorCommand;

            if (!commandExists)
            {
                this.OnCommandAdded(editorCommand);
            }
            else
            {
                this.OnCommandUpdated(editorCommand);
            }

            return(!commandExists);
        }
        public async Task CanUnregisterCommand()
        {
            string        filePath      = TestUtilities.NormalizePath("C:\\Temp\\Test.ps1");
            ScriptFile    currentFile   = new(new Uri(filePath), "This is a test file", new Version("7.0"));
            EditorContext editorContext = new(
                editorOperations : null,
                currentFile,
                new BufferPosition(line : 1, column : 1),
                BufferRange.None);

            const string commandName        = "test.scriptblock";
            const string commandDisplayName = "ScriptBlock extension";

            EditorCommand removedCommand = null;

            extensionCommandService.CommandRemoved += (object _, EditorCommand command) => removedCommand = command;

            // Add the command and wait for the add event
            await psesHost.ExecutePSCommandAsync(
                new PSCommand()
                .AddCommand("Register-EditorCommand")
                .AddParameter("Name", commandName)
                .AddParameter("DisplayName", commandDisplayName)
                .AddParameter("ScriptBlock", ScriptBlock.Create("Write-Output \"Extension output!\"")),
                CancellationToken.None).ConfigureAwait(true);

            // Remove the command and wait for the remove event
            await psesHost.ExecutePSCommandAsync(
                new PSCommand().AddCommand("Unregister-EditorCommand").AddParameter("Name", commandName),
                CancellationToken.None).ConfigureAwait(true);

            Assert.NotNull(removedCommand);
            Assert.Equal(commandName, removedCommand.Name);
            Assert.Equal(commandDisplayName, removedCommand.DisplayName);

            // Ensure that the command has been unregistered
            await Assert.ThrowsAsync <KeyNotFoundException>(
                () => extensionCommandService.InvokeCommandAsync("test.scriptblock", editorContext)).ConfigureAwait(true);
        }
        public async Task CanUpdateRegisteredCommand()
        {
            EditorCommand updatedCommand = null;

            extensionCommandService.CommandUpdated += (object _, EditorCommand command) => updatedCommand = command;

            const string commandName        = "test.function";
            const string commandDisplayName = "Updated function extension";

            // Register a command and then update it
            await psesHost.ExecutePSCommandAsync(
                new PSCommand().AddScript(
                    "function Invoke-Extension { Write-Output \"Extension output!\" }; " +
                    $"Register-EditorCommand -Name {commandName} -DisplayName \"Old function extension\" -Function Invoke-Extension; " +
                    $"Register-EditorCommand -Name {commandName} -DisplayName \"{commandDisplayName}\" -Function Invoke-Extension"),
                CancellationToken.None).ConfigureAwait(true);

            // Wait for the add and update events
            Assert.NotNull(updatedCommand);
            Assert.Equal(commandName, updatedCommand.Name);
            Assert.Equal(commandDisplayName, updatedCommand.DisplayName);
        }
        public async Task CanRegisterAndInvokeCommandWithScriptBlock()
        {
            string        filePath      = TestUtilities.NormalizePath("C:\\Temp\\Test.ps1");
            ScriptFile    currentFile   = new(new Uri(filePath), "This is a test file", new Version("7.0"));
            EditorContext editorContext = new(
                editorOperations : null,
                currentFile,
                new BufferPosition(line : 1, column : 1),
                BufferRange.None);

            EditorCommand commandAdded = null;

            extensionCommandService.CommandAdded += (object _, EditorCommand command) => commandAdded = command;

            const string commandName        = "test.scriptblock";
            const string commandDisplayName = "ScriptBlock extension";

            await psesHost.ExecutePSCommandAsync(
                new PSCommand()
                .AddCommand("Register-EditorCommand")
                .AddParameter("Name", commandName)
                .AddParameter("DisplayName", commandDisplayName)
                .AddParameter("ScriptBlock", ScriptBlock.Create("$global:extensionValue = 10")),
                CancellationToken.None).ConfigureAwait(true);

            Assert.NotNull(commandAdded);
            Assert.Equal(commandName, commandAdded.Name);
            Assert.Equal(commandDisplayName, commandAdded.DisplayName);

            // Invoke the command
            await extensionCommandService.InvokeCommandAsync("test.scriptblock", editorContext).ConfigureAwait(true);

            // Assert the expected value
            PSCommand         psCommand = new PSCommand().AddScript("$global:extensionValue");
            IEnumerable <int> results   = await psesHost.ExecutePSCommandAsync <int>(psCommand, CancellationToken.None).ConfigureAwait(true);

            Assert.Equal(10, results.FirstOrDefault());
        }
Exemple #23
0
        void btnCommand_Checked(object sender, EventArgs e)
        {
            ToolStripButton clickBtn = sender as ToolStripButton;

            if (!clickBtn.Checked)
            {
                return;
            }

            EditorCommand cmd = (EditorCommand)clickBtn.Tag;

            bool ok = true;

            if (cmd == EditorCommand.TerrainMode)
            {
                ok = NLevelEditorEngine.Instance.BindSelectedActorToTerrainEd();
                if (!ok)
                {
                    NexusEditor.Program.ShowError("Please Select a Terrain First!");
                }
            }

            // 开启或者关闭导航图编辑模式
            if (cmd == EditorCommand.NavigateMapMode)
            {
                NLevelEditorEngine.Instance.NavigateMapEd.BeginNavigateMapEditor(NLevelEditorEngine.Instance.MainLevel);
            }
            else
            {
                NLevelEditorEngine.Instance.NavigateMapEd.EndNavigateMapEditor();
            }

            if (ok)
            {
                NLevelEditorEngine.Instance.Command = cmd;
            }
        }
 private void OnCommandRemoved(EditorCommand command)
 {
     this.CommandRemoved?.Invoke(this, command);
 }
Exemple #25
0
 public void addCommand(Graphics imgGra, EditorCommand command)
 {
     this.history.Push(command);
     command.process(imgGra);
 }
 /// <summary>
 /// Returns all registered EditorCommands.
 /// </summary>
 /// <returns>An Array of all registered EditorCommands.</returns>
 public EditorCommand[] GetCommands()
 {
     EditorCommand[] commands = new EditorCommand[this.editorCommands.Count];
     this.editorCommands.Values.CopyTo(commands, 0);
     return(commands);
 }
 public bool RegisterCommand(EditorCommand editorCommand) => _extensionService.RegisterCommand(editorCommand);
 private void OnCommandRemoved(object sender, EditorCommand editorCommand)
 {
     CommandRemoved?.Invoke(this, editorCommand);
 }
        private void DoExecuteEditorCommand(EditorCommand command)
        {
            // toggle editor mode command
            if (command.Name == "PlaytestState")
            {
                Simulator.EditorState = EditorState.Playtest;
                Simulator.SyncLevel();
                Simulator.Initialize();
                Simulator.SyncPlayers();
            }

            else if (command.Name == "EditState")
            {
                Simulator.EditorState = EditorState.Editing;
                Simulator.Initialize();
                Simulator.SyncPlayers();
            }

            else if (command.Name == "RestartSimulation")
            {
                if (Simulator.EditorState == EditorState.Editing)
                    Simulator.SyncLevel();
                
                Simulator.Initialize();
                Simulator.SyncPlayers();
            }

            else if (command.Name == "PauseSimulation")
            {
                Simulator.State = GameState.Paused;
            }

            else if (command.Name == "ResumeSimulation")
            {
                Simulator.State = GameState.Running;
            }

            else if (command.Name == "NewLevel")
            {
                Simulator.LevelDescriptor = Main.LevelsFactory.GetEmptyDescriptor();
                Simulator.Initialize();
                Simulator.SyncPlayers();
            }

            else if (command.Name == "SaveLevel")
            {
                Simulator.SyncLevel();

                var descriptor = Simulator.LevelDescriptor;

                if (!Main.LevelsFactory.UserDescriptors.ContainsKey(descriptor.Infos.Id))
                {
                    Main.LevelsFactory.UserDescriptors.Add(descriptor.Infos.Id, descriptor);

                    ((LevelsPanel) Panels[EditorPanel.Load]).Initialize();
                    ((LevelsPanel) Panels[EditorPanel.Delete]).Initialize();
                }

                Main.LevelsFactory.SaveUserDescriptorOnDisk(descriptor.Infos.Id);
            }


            NotifyEditorCommandExecuted(command);
        }
 public EditorTextContextualMenuChoice(string name, string label, float textSize, EditorCommand command)
     : base(name, new Text(label, @"Pixelite") { SizeX = textSize })
 {
     Command = command;
 }
 public void DoEditorCommandExecuted(EditorCommand command)
 {
     if (command.Name == "AddOrRemovePowerUp")
         Initialize();
 }
        public override void SetChoice(int index)
        {
            base.SetChoice(index);

            Command = Commands[CurrentIndex];
        }
Exemple #33
0
 public void ExecuteCommand(EditorCommand command)
 {
 }
        public void DoEditorCommandExecuted(EditorCommand command)
        {
            if (command.Name == "AddOrRemovePowerUp")
            {
                InitializePowerUpsAndTurrets();
                CheckAvailablePowerUps();

                foreach (var pl in Players.Values)
                    pl.Initialize();

                return;
            }


            if (command.Type == EditorCommandType.Panel)
            {
                if (((EditorPanelCommand) command).Show)
                {
                    foreach (var player in Players.Values)
                    {
                        player.ActualSelection.CelestialBody = null;
                        player.ActualSelection.Turret = null;
                        player.ActualSelection.TurretToPlace = null;

                        NotifyPlayerChanged(player);
                    }

                    UpdateSelection = false;

                    foreach (var player in Players.Values)
                        player.UpdateSelectionz = false;
                }

                else
                {
                    UpdateSelection = true;

                    foreach (var player in Players.Values)
                        player.UpdateSelectionz = true;
                }

                return;
            }
        }
Exemple #35
0
 public bool TryGetCommand(string commandId, out EditorCommand command)
 {
     command = default(EditorCommand);
     return(false);
 }
Exemple #36
0
 public EditorCommandStatus GetCommandStatus(EditorCommand command)
 => EditorCommandStatus.Unsupported;
        public void DoEditorCommandExecuted(EditorCommand command)
        {
            if (command.Name == "PlaytestState" || command.Name == "EditState")
            {
                ((EditorToggleContextualMenuChoice) GeneralMenu.SubMenus[EditorGeneralMenuChoice.File].GetChoice(4)).Next();
                return;
            }


            if (command.Name == "PauseSimulation" || command.Name == "ResumeSimulation")
            {
                ((EditorToggleContextualMenuChoice) GeneralMenu.SubMenus[EditorGeneralMenuChoice.File].GetChoice(6)).Next();
                return;
            }

            if (command.Name == "ShowCelestialBodiesPaths" || command.Name == "HideCelestialBodiesPaths")
            {
                ((EditorToggleContextualMenuChoice) GeneralMenu.SubMenus[EditorGeneralMenuChoice.Battlefield].GetChoice(1)).Next();
                return;
            }


            if (command.Type == EditorCommandType.Panel)
            {
                var panelCommand = (EditorPanelCommand) command;

                Panels[panelCommand.Panel].Fade(panelCommand.Show ? 0 : 255, panelCommand.Show ? 255 : 0, 500);
                return;
            }


            if (command.Type == EditorCommandType.CelestialBody)
                DoEditorCelestialBodyCommandExecuted((EditorCelestialBodyCommand) command);
        }
        public void DoEditorCommandExecuted(EditorCommand c)
        {
            if (c.Type != EditorCommandType.CelestialBody)
                return;

            var command = (EditorCelestialBodyCommand) c;

            if (command.Name == "AddPlanet")
            {
                command.CelestialBody.PathPriority = GetLowestPathPriority(CelestialBodies) - 1;
                command.CelestialBody.AliveOverride = true;
                command.CelestialBody.CanSelectOverride = true;
                CelestialBodies.Add(command.CelestialBody);
            }

            else if (command.Name == "Remove")
            {
                command.CelestialBody.LifePoints = 0;
                command.CelestialBody.AliveOverride = false;
            }

            else if (command.Name == "ToggleSpeed")
            {
                command.CelestialBody.SetSpeed(command.Speed);
            }

            else if (command.Name == "ToggleAsset")
            {
                command.CelestialBody.SetImage(command.AssetName);
            }

            else if (command.Name == "PushFirst")
            {
                if (!Path.ContainsCelestialBody(command.CelestialBody))
                    AddToStartingPath(command.CelestialBody);

                Path.RemoveCelestialBody(command.CelestialBody);
                command.CelestialBody.PathPriority = GetLowestPathPriority(CelestialBodies) - 1;
                Path.AddCelestialBody(command.CelestialBody, false);
            }


            else if (command.Name == "PushLast")
            {
                if (!Path.ContainsCelestialBody(command.CelestialBody))
                    AddToStartingPath(command.CelestialBody);

                Path.RemoveCelestialBody(command.CelestialBody);
                command.CelestialBody.PathPriority = GetHighestPathPriority(CelestialBodies) + 1;
                Path.AddCelestialBody(command.CelestialBody, false);
            }


            else if (command.Name == "ToggleSize")
            {
                command.CelestialBody.SetSize(command.Size);
                command.CelestialBody.SetImage(command.CelestialBody.PartialImageName);
            }


            else if (command.Name == "HasMoons")
            {
                command.CelestialBody.SetHasMoons(command.HasMoons);
            }


            else if (command.Name == "FollowPath")
            {
                command.CelestialBody.FollowPath = command.FollowPath;
            }


            else if (command.Name == "CanSelect")
            {
                command.CelestialBody.CanSelect = command.CanSelect;
            }


            else if (command.Name == "StraightLine")
            {
                command.CelestialBody.StraightLine = command.StraightLine;
            }


            else if (command.Name == "Invincible")
            {
                command.CelestialBody.Invincible = command.Invincible;
            }


            else if (command.Name == "AddGravitationalTurret")
            {
                AddToStartingPath(command.CelestialBody);
            }

            else if (command.Name == "RemoveGravitationalTurret")
            {
                RemoveFromStartingPath(command.CelestialBody);
            }

            else if (command.Name == "Clear")
            {
                foreach (var cb in CelestialBodies)
                {
                    if (cb is AsteroidBelt)
                        continue;

                    cb.LifePoints = 0;
                    cb.AliveOverride = false;
                }
            }
        }
        public override void Previous()
        {
            base.Previous();

            Command = Commands[CurrentIndex];
        }
 private void ExecuteCommand(EditorCommand command)
 {
     if (command is EditorCelestialBodyCommand)
         DoExecuteEditorCelestialBodyCommand((EditorCelestialBodyCommand) command);
     else if (command is EditorPanelCommand)
         DoExecuteEditorPanelCommand((EditorPanelCommand) command);
     else
         DoExecuteEditorCommand(command);
 }
        public override void Next()
        {
            base.Next();

            Command = Commands[CurrentIndex];
        }
 private void NotifyEditorCommandExecuted(EditorCommand command)
 {
     if (EditorCommandExecuted != null)
         EditorCommandExecuted(command);
 }
Exemple #43
0
 public void addCommand(EditorCommand command)
 {
     this.history.Push(command);
     command.process();
     this.onPropertyChange("Count");
 }
 private async void ExtensionService_ExtensionRemoved(object sender, EditorCommand e)
 {
     await this.extensionEventQueue.EnqueueAsync(
         new Tuple <EventType, EditorCommand>(EventType.Remove, e));
 }
        private void SetCurrentCommand(EditorCommand command)
        {
            CurrentEditorCommand = command;

            switch (command)
            {
                case EditorCommand.Paint:
                case EditorCommand.PaintArea:
                case EditorCommand.CreateTeleportEnd:
                case EditorCommand.CreateTeleportStart:
                case EditorCommand.SetImpassable:
                case EditorCommand.SetPassable:
                case EditorCommand.SetStartupSpot:
                    Cursor = Cursors.Hand;
                    break;
                case EditorCommand.Select:
                    Cursor = Cursors.Arrow;
                    break;
                case EditorCommand.Erase:
                    Cursor = Cursors.Cross;
                    break;
            }
        }
        public void DoEditorCommandExecuted(EditorCommand c)
        {
            switch (c.Type)
            {
                case EditorCommandType.CelestialBody:
                    DoEditorCelestialBodyCommand((EditorCelestialBodyCommand) c);
                    break;

                case EditorCommandType.Player:
                    DoEditorPlayerCommand((EditorPlayerCommand) c);
                    break;
            }
        }
        public void DoEditorCommandExecuted(EditorCommand command)
        {
            if (command.Name == "AddOrRemovePowerUp")
            {
                MenuPowerUps.Position = new Vector3(-550, 200, 0);
                MenuPowerUps.Initialize();
            }

            else if (command.Name == "Clear")
            {
                //PlayerLives.CelestialBody = null;
            }

            else if (command.Name == "AddPlanet" || command.Name == "PushFirst" || command.Name == "PushLast")
            {
                //PlayerLives.CelestialBody = Level.CelestialBodyToProtect;
            }

            else if (command.Name == "Remove")
            {
                //PlayerLives.CelestialBody = Level.CelestialBodyToProtect;
            }

            else if (command.Name == "ToggleSize")
            {
                var c = (EditorCelestialBodyCommand) command;

                //if (c.CelestialBody == PlayerLives.CelestialBody)
                //{
                //    PlayerLives.CelestialBody = null;
                //    PlayerLives.CelestialBody = c.CelestialBody;
                //}
            }

            else if (command.Name == "ShowCelestialBodiesPaths")
            {
                AdvancedView.Visible = true;
            }

            else if (command.Name == "HideCelestialBodiesPaths")
            {
                AdvancedView.Visible = false;
            }
        }