101 lines
2.2 KiB
JavaScript
101 lines
2.2 KiB
JavaScript
|
|
import { LitElement, html, css } from "lit";
|
||
|
|
|
||
|
|
export class CombatHUD extends LitElement {
|
||
|
|
static get styles() {
|
||
|
|
return css`
|
||
|
|
:host {
|
||
|
|
display: block;
|
||
|
|
position: absolute;
|
||
|
|
top: 0;
|
||
|
|
left: 0;
|
||
|
|
width: 100%;
|
||
|
|
height: 100%;
|
||
|
|
pointer-events: none;
|
||
|
|
font-family: "Courier New", monospace;
|
||
|
|
color: white;
|
||
|
|
}
|
||
|
|
|
||
|
|
.header {
|
||
|
|
position: absolute;
|
||
|
|
top: 20px;
|
||
|
|
left: 50%;
|
||
|
|
transform: translateX(-50%);
|
||
|
|
background: rgba(0, 0, 0, 0.8);
|
||
|
|
border: 2px solid #ff0000;
|
||
|
|
padding: 15px 30px;
|
||
|
|
text-align: center;
|
||
|
|
pointer-events: auto;
|
||
|
|
}
|
||
|
|
|
||
|
|
.status-bar {
|
||
|
|
margin-top: 5px;
|
||
|
|
font-size: 1.2rem;
|
||
|
|
color: #ff6666;
|
||
|
|
}
|
||
|
|
|
||
|
|
.turn-indicator {
|
||
|
|
position: absolute;
|
||
|
|
top: 100px;
|
||
|
|
left: 30px;
|
||
|
|
background: rgba(0, 0, 0, 0.8);
|
||
|
|
border: 2px solid #ff0000;
|
||
|
|
padding: 10px 20px;
|
||
|
|
font-size: 1rem;
|
||
|
|
}
|
||
|
|
|
||
|
|
.instructions {
|
||
|
|
position: absolute;
|
||
|
|
bottom: 30px;
|
||
|
|
left: 50%;
|
||
|
|
transform: translateX(-50%);
|
||
|
|
background: rgba(0, 0, 0, 0.7);
|
||
|
|
border: 1px solid #555;
|
||
|
|
padding: 10px 20px;
|
||
|
|
font-size: 0.9rem;
|
||
|
|
color: #ccc;
|
||
|
|
text-align: center;
|
||
|
|
}
|
||
|
|
`;
|
||
|
|
}
|
||
|
|
|
||
|
|
static get properties() {
|
||
|
|
return {
|
||
|
|
currentState: { type: String },
|
||
|
|
currentTurn: { type: String },
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
constructor() {
|
||
|
|
super();
|
||
|
|
this.currentState = null;
|
||
|
|
this.currentTurn = "PLAYER";
|
||
|
|
window.addEventListener("gamestate-changed", (e) => {
|
||
|
|
this.currentState = e.detail.newState;
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
render() {
|
||
|
|
// Only show during COMBAT state
|
||
|
|
if (this.currentState !== "STATE_COMBAT") {
|
||
|
|
return html``;
|
||
|
|
}
|
||
|
|
|
||
|
|
return html`
|
||
|
|
<div class="header">
|
||
|
|
<h2>COMBAT ACTIVE</h2>
|
||
|
|
<div class="status-bar">Turn: ${this.currentTurn}</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="turn-indicator">
|
||
|
|
<div>State: ${this.currentState}</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="instructions">
|
||
|
|
Use WASD or Arrow Keys to move cursor | SPACE/ENTER to select
|
||
|
|
</div>
|
||
|
|
`;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
customElements.define("combat-hud", CombatHUD);
|