Merge branch 'materials' of https://github.com/marcus13345/df-idle into materials

materials
Valerie 2021-07-16 20:51:23 -04:00
commit 56009f9876
2 changed files with 11 additions and 3 deletions

View File

@ -14,8 +14,8 @@ export class SelectItem {
items: ItemState<any>[];
selectedIdx: number;
static show(filter: ItemFilterFunction): Promise<ItemState<any>> {
const si = new SelectItem(filter, 1);
static show(filter: ItemFilterFunction, qty: number = 1): Promise<ItemState<any>> {
const si = new SelectItem(filter, qty);
return new Promise(res => {
si.emitter.on('selected', (itemState: ItemState<any>) => {
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();
}
}

View File

@ -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(_ => {