Beispiel #1
0
        public override void Execute(CommandQueue queue, CommandEntry entry)
        {
            if (entry.Arguments.Count < 1)
            {
                ShowUsage(queue, entry);
                return;
            }
            string key = entry.GetArgument(queue, 0);

            if (key == "\0CALLBACK")
            {
                return;
            }
            if (entry.InnerCommandBlock == null)
            {
                queue.HandleError(entry, "Must have a block of commands!");
                return;
            }
            Key k = KeyHandler.GetKeyForName(key);

            KeyHandler.BindKey(k, entry.InnerCommandBlock, entry.BlockStart);
            entry.Good(queue, "Keybind updated for " + KeyHandler.keystonames[k] + ".");
            CommandStackEntry cse = queue.CommandStack.Peek();

            cse.Index = entry.BlockEnd + 2;
        }
        public static void Execute(CommandQueue queue, CommandEntry entry)
        {
            if (entry.Arguments.Count < 1)
            {
                ShowUsage(queue, entry);
                return;
            }
            Client TheClient = (entry.Command as GP_BindblockCommand).TheClient;
            string key       = entry.GetArgument(queue, 0);

            if (key == "\0CALLBACK")
            {
                return;
            }
            if (entry.InnerCommandBlock == null)
            {
                queue.HandleError(entry, "Must have a block of commands!");
                return;
            }
            if (!Enum.TryParse(key, true, out GamePadButton btn))
            {
                queue.HandleError(entry, "Unknown button: " + key);
                return;
            }
            TheClient.Gamepad.BindButton(btn, entry.InnerCommandBlock, entry.BlockStart);
            entry.GoodOutput(queue, "Keybind updated for " + btn + ".");
            CommandStackEntry cse = queue.CommandStack.Peek();

            cse.Index = entry.BlockEnd + 2;
        }
Beispiel #3
0
    public void UndoLastServerCommand()
    {
        if (undoStack.Count == 0)
        {
            return;
        }


        CommandStackEntry lastEntry = undoStack.Pop();

        LogManager.Instance.MakeEntryActive(lastEntry.logEntry, false);
        Command lastCommand = lastEntry.command;

        redoStack.Push(lastEntry);
        lastCommand.UnExecuteServerCommand(true);

        var entry = lastCommand.GetLogEntry();

        entry.TypeText = "Undo";
        LogManager.Instance.AddEntry(entry);

        RpcSetRedoButtonInteractable(true);
        if (undoStack.Count == 0)
        {
            RpcSetUndoButtonInteractable(false);
        }

        LogManager.Instance.RpcShowLogPopup(entry.Text);
    }