43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import {D} from "./engine/public.ts";
|
|
import {Point, Size} from "./engine/datatypes.ts";
|
|
import {FG_BOLD, FG_TEXT} from "./colors.ts";
|
|
import {ALL_STATS} from "./datatypes.ts";
|
|
import {getPlayerProgress} from "./playerprogress.ts";
|
|
import {getHuntMode} from "./huntmode.ts";
|
|
import {getStateManager} from "./statemanager.ts";
|
|
|
|
export class Hud {
|
|
get size(): Size {
|
|
return new Size(96, 176)
|
|
}
|
|
|
|
update() { }
|
|
|
|
draw() {
|
|
// D.fillRect(new Point(-4, -4), this.size.add(new Size(8, 8)), BG_INSET)
|
|
D.drawText(getPlayerProgress().name, new Point(0, 0), FG_BOLD)
|
|
D.drawText(`Level ${getHuntMode().getDepth()}`, new Point(0, 16), FG_TEXT)
|
|
D.drawText(`Turn ${getStateManager().getTurn()}/${getStateManager().getMaxTurns()}`, new Point(0, 32), FG_TEXT)
|
|
|
|
let y = 64;
|
|
let prog = getPlayerProgress();
|
|
for (let s of ALL_STATS.values()) {
|
|
D.drawText(`${s}`, new Point(0, y), FG_BOLD)
|
|
D.drawText(`${prog.getStat(s)}`, new Point(32, y), FG_TEXT)
|
|
let talent = prog.getTalent(s);
|
|
if (talent) {
|
|
D.drawText(`(+${talent})`, new Point(56, y), FG_TEXT)
|
|
}
|
|
y += 16;
|
|
}
|
|
D.drawText("EXP", new Point(0, 144), FG_BOLD);
|
|
D.drawText(`${prog.getExperience()}`, new Point(32, 144), FG_TEXT);
|
|
D.drawText("BLD", new Point(0, 160), FG_BOLD);
|
|
D.drawText(`${prog.getBlood()}cc`, new Point(32, 160), FG_TEXT);
|
|
}
|
|
}
|
|
|
|
let active = new Hud();
|
|
export function getHud(): Hud {
|
|
return active;
|
|
} |