ArchiveUI showPrefixMap and hidePrefixMap
This commit is contained in:
@@ -16,6 +16,9 @@ interface ArchiveUI {
|
||||
*/
|
||||
var shortcutHandler(default, null):Null<KeyShortcutHandler<Entry>>;
|
||||
|
||||
function showPrefixMap(map:Map<String,ShortcutKey<Entry>>):Void;
|
||||
function hidePrefixMap():Void;
|
||||
|
||||
/**
|
||||
* A PlaygroundSystem that will display interactible entry representations
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,12 @@
|
||||
{
|
||||
(when (and ui ui.shortcutHandler)
|
||||
(unless setup
|
||||
(set ui.shortcutHandler.onSelectItem (invokeEntry.bind archive ui))
|
||||
(set ui.shortcutHandler.onSelectPrefixMap ui.showPrefixMap)
|
||||
(set ui.shortcutHandler.onSelectItem
|
||||
->e {
|
||||
(ui.hidePrefixMap)
|
||||
(invokeEntry archive ui e)
|
||||
})
|
||||
(set ui.shortcutHandler.onBadKey ->[key map] (ui.displayMessage "$key is not mapped to a shortcut in this context: $map"))
|
||||
(set setup true))
|
||||
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
(set FlxG.sound.volumeDownKeys null)
|
||||
(set FlxG.sound.volumeUpKeys null)
|
||||
|
||||
(set shortcutHandler.onSelectPrefixMap ->map {
|
||||
(clearUI)
|
||||
(doFor =>key thing map
|
||||
(displayMessage "$key - $thing"))})
|
||||
|
||||
// TODO find a better way to pass the archiveDir to a HaxeFlixel game
|
||||
(let [archiveDir
|
||||
(or (Sys.getEnv "NAT_DIR") (throw "NAT_DIR environment variable must be set"))
|
||||
@@ -101,6 +96,14 @@
|
||||
|
||||
(FlxG.camera.calculateScrollBounds entryGroup SCROLL_BOUND_MARGIN))
|
||||
|
||||
(method :Void showPrefixMap [:Map<String,ShortcutKey<Entry>> map]
|
||||
(clearUI)
|
||||
(doFor =>key thing map
|
||||
(displayMessage "$key - $thing")))
|
||||
|
||||
(method :Void hidePrefixMap []
|
||||
(clearUI))
|
||||
|
||||
(defAlias &ident sh (cast shortcutHandler FlxKeyShortcutHandler<Dynamic>))
|
||||
(method &override :Void update [:Float elapsed]
|
||||
(super.update elapsed)
|
||||
|
||||
Reference in New Issue
Block a user