ArchiveUI.chooseBetwoonStrings

This commit is contained in:
2022-12-18 06:12:02 +00:00
parent 25f61c16c9
commit 5ba1f22bf9
4 changed files with 23 additions and 1 deletions

View File

@@ -23,10 +23,13 @@ enum CommandArgType {
// Make the user select Entry(s) when called interactively // Make the user select Entry(s) when called interactively
OneEntry; // This constructor must be disambiguated from the typedef "Entry" OneEntry; // This constructor must be disambiguated from the typedef "Entry"
Entries(min:Null<Int>, max:Null<Int>); Entries(min:Null<Int>, max:Null<Int>);
// TODO Tag -- make sure a tag input is a valid haxe variable name for tagsMatch compatibility // TODO Tag -- make sure a tag input is a valid haxe variable name for tagsMatch compatibility
// TODO VarTag // TODO VarTag
// What I really want is tags autocomplete, which is UNREALISTIC
// TODO playground name -- choose from archive.playgrounds // TODO File
// TODO Files
Position; Position;

View File

@@ -407,6 +407,13 @@
(SelectEntries []) (SelectEntries [])
(when playgroundSystem (playgroundSystem.switchPlaygroundKey name)) (when playgroundSystem (playgroundSystem.switchPlaygroundKey name))
[]) [])
(defCommand ChoosePlayground []
(ui.chooseBetweenStrings
"Choose a playground:"
(for =>key _ archive.playgrounds (if (= key "default") (continue) key))
->pg (SwitchPlayground pg))
[])
(defCommand AddConnections [entries (SelectedEntries 1 null) entriesToConnect (Entries 1 null)] (defCommand AddConnections [entries (SelectedEntries 1 null) entriesToConnect (Entries 1 null)]
(for e entries (for e entries

View File

@@ -75,4 +75,9 @@ interface ArchiveUI {
* A way to tell NAT where the cursor is * A way to tell NAT where the cursor is
*/ */
function cursorPosition():Option<Position>; function cursorPosition():Option<Position>;
/**
* Prompt the user between some string options
*/
function chooseBetweenStrings(prompt:String, choices:Array<String>, resolve:String->Void):Void;
} }

View File

@@ -230,6 +230,13 @@
(displayMessage prompt) (displayMessage prompt)
(set resolvePosition resolve)) (set resolvePosition resolve))
(method :Void chooseBetweenStrings [prompt :Array<String> choices resolve]
(clearUI)
(displayMessage prompt)
(doFor choice choices
(uiWindow.makeText choice null ->_ {(clearUI)(resolve choice)}))
(uiWindow.show))
(method :Option<Position> cursorPosition [] (method :Option<Position> cursorPosition []
(let [pos (FlxG.mouse.getWorldPosition FlxG.camera)] (let [pos (FlxG.mouse.getWorldPosition FlxG.camera)]
(Some (object x pos.x y pos.y z 0.0)))) (Some (object x pos.x y pos.y z 0.0))))