From 8b9aeec94402c30c4a441c0aceb9af7393693f31 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 15 Feb 2023 11:44:13 -0700 Subject: [PATCH] Move typeCommand() into ArchiveController --- .../nat-archive-tool/src/nat/ArchiveController.kiss | 10 ++++++++++ .../source/PlayState.kiss | 9 +-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/projects/nat-archive-tool/src/nat/ArchiveController.kiss b/projects/nat-archive-tool/src/nat/ArchiveController.kiss index 6df30088..58da2642 100644 --- a/projects/nat-archive-tool/src/nat/ArchiveController.kiss +++ b/projects/nat-archive-tool/src/nat/ArchiveController.kiss @@ -282,6 +282,16 @@ (prop &mut :PlaygroundSystem playgroundSystem null) +(method :Void typeCommand [] + (when ui.shortcutHandler (ui.shortcutHandler.cancel)) + (ui.enterText + "Command:" + ->command + (tryRunCommand command) + Math.POSITIVE_INFINITY)) + +// TODO typeShortcut + (defNew [&prop :Archive archive &prop :ArchiveUI ui] [&mut :Array _selectedEntries [] diff --git a/projects/nat-flixel-desktop-playground/source/PlayState.kiss b/projects/nat-flixel-desktop-playground/source/PlayState.kiss index 308e29fe..a1e6f6d3 100644 --- a/projects/nat-flixel-desktop-playground/source/PlayState.kiss +++ b/projects/nat-flixel-desktop-playground/source/PlayState.kiss @@ -78,7 +78,7 @@ // Press ENTER to type a command to run (when (and !textInput FlxG.keys.justPressed.ENTER) (set confirmQuit false) - (typeCommand)) + (controller.typeCommand)) (when (and textInput !textInput.alive) (set textInput null)) @@ -118,13 +118,6 @@ (withWritableComponents archive e [positions Positions] (+= .z (dictGet positions (spriteSystem.getPlaygroundKey)) 1)))))) -(method :Void typeCommand [] - (sh.cancel) - (enterText - "command to run:" - ->commandName (controller.tryRunCommand commandName) - Math.POSITIVE_INFINITY)) - (prop &mut :ArchiveController controller) (prop &mut :Archive archive)