Merge branch 'materials' of https://github.com/marcus13345/df-idle into materials
commit
56009f9876
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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(_ => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue