diff --git a/src/ui/SelectItem.ts b/src/ui/SelectItem.ts index fb49a59..97493e3 100644 --- a/src/ui/SelectItem.ts +++ b/src/ui/SelectItem.ts @@ -14,8 +14,8 @@ export class SelectItem { items: ItemState[]; selectedIdx: number; - static show(filter: ItemFilterFunction): Promise> { - const si = new SelectItem(filter, 1); + static show(filter: ItemFilterFunction, qty: number = 1): Promise> { + const si = new SelectItem(filter, qty); return new Promise(res => { si.emitter.on('selected', (itemState: ItemState) => { res(itemState); @@ -64,6 +64,14 @@ export class SelectItem { } }); this.items = Game.current.inv.items.filter(filter); + this.update(); this.open(); } + + + + update() { + this.box.setContent('test'); + panels.screen.render(); + } } \ No newline at end of file diff --git a/src/ui/UI.ts b/src/ui/UI.ts index 4dbf920..d248fd2 100644 --- a/src/ui/UI.ts +++ b/src/ui/UI.ts @@ -1,4 +1,3 @@ - import chalk from 'chalk'; import blessed from 'neo-blessed'; import ansi from 'sisteransi'; @@ -99,6 +98,7 @@ export function start() { process.stdout.write(ansi.cursor.hide); + // todo make a real menu screen.key(['C-c'], function() { process.stdout.write(ansi.cursor.show); setTimeout(_ => {