generated from ztimson/template
Fixed minor prod issues
All checks were successful
Build and publish / Build Container (push) Successful in 1m27s
All checks were successful
Build and publish / Build Container (push) Successful in 1m27s
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
cursor: url('/cursor.png'), auto !important;
|
cursor: url('/assets/cursor.png'), auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
@@ -42,6 +42,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="game"></div>
|
||||||
<jukebox-component id="jukebox"></jukebox-component>
|
<jukebox-component id="jukebox"></jukebox-component>
|
||||||
<llm-component id="llm"></llm-component>
|
<llm-component id="llm"></llm-component>
|
||||||
|
|
||||||
|
|||||||
@@ -21,17 +21,12 @@ class JukeboxComponent extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
// Cleanup listeners when component is removed
|
|
||||||
if(this.unsubscribeWorld) this.unsubscribeWorld();
|
if(this.unsubscribeWorld) this.unsubscribeWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
setupAPIListeners() {
|
setupAPIListeners() {
|
||||||
// Listen for world loaded events to auto-load music 🎧
|
|
||||||
this.unsubscribeWorld = this.api.on('world:loaded', (data) => {
|
this.unsubscribeWorld = this.api.on('world:loaded', (data) => {
|
||||||
console.log('🎵 Jukebox detected world loaded:', data.theme.name);
|
if(data.theme?.music) this.loadMusic(data.theme.music, data.theme);
|
||||||
if (data.theme?.music) {
|
|
||||||
this.loadMusic(data.theme.music, data.theme);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +34,11 @@ class JukeboxComponent extends HTMLElement {
|
|||||||
this.shadowRoot.innerHTML = `
|
this.shadowRoot.innerHTML = `
|
||||||
<style>
|
<style>
|
||||||
:host { display: block; }
|
:host { display: block; }
|
||||||
|
#simple-mute-btn {
|
||||||
|
position: fixed;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
}
|
||||||
.audio-controls {
|
.audio-controls {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -89,7 +89,6 @@ class JukeboxComponent extends HTMLElement {
|
|||||||
background: var(--button-bg, #6366f1);
|
background: var(--button-bg, #6366f1);
|
||||||
border: 2px solid var(--dialogue-border, #000);
|
border: 2px solid var(--dialogue-border, #000);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
cursor: pointer;
|
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
box-shadow: 0 3px 0 var(--button-shadow, #4338ca);
|
box-shadow: 0 3px 0 var(--button-shadow, #4338ca);
|
||||||
transition: transform 0.1s;
|
transition: transform 0.1s;
|
||||||
@@ -144,7 +143,6 @@ class JukeboxComponent extends HTMLElement {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
this.shadowRoot.getElementById('simple-mute-btn').addEventListener('click', () => this.toggleMute());
|
this.shadowRoot.getElementById('simple-mute-btn').addEventListener('click', () => this.toggleMute());
|
||||||
this.shadowRoot.getElementById('mute-btn').addEventListener('click', () => this.toggleMute());
|
this.shadowRoot.getElementById('mute-btn').addEventListener('click', () => this.toggleMute());
|
||||||
this.shadowRoot.getElementById('prev-btn').addEventListener('click', () => this.previousTrack());
|
this.shadowRoot.getElementById('prev-btn').addEventListener('click', () => this.previousTrack());
|
||||||
@@ -155,7 +153,7 @@ class JukeboxComponent extends HTMLElement {
|
|||||||
if (!musicConfig) return;
|
if (!musicConfig) return;
|
||||||
|
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
this.isPlaylistMode = Array.isArray(musicConfig) && musicConfig.length > 1;
|
this.isPlaylistMode = Array.isArray(musicConfig);
|
||||||
this.playlist = Array.isArray(musicConfig) ? musicConfig : [musicConfig];
|
this.playlist = Array.isArray(musicConfig) ? musicConfig : [musicConfig];
|
||||||
this.currentTrackIndex = 0;
|
this.currentTrackIndex = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ class LlmComponent extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dialogue-header {
|
.dialogue-header {
|
||||||
cursor: pointer;
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
padding: 12px 20px;
|
padding: 12px 20px;
|
||||||
background: var(--dialogue-header-bg, #fff);
|
background: var(--dialogue-header-bg, #fff);
|
||||||
@@ -126,7 +125,6 @@ class LlmComponent extends HTMLElement {
|
|||||||
font-family: 'Courier New', monospace;
|
font-family: 'Courier New', monospace;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: 0 3px 0 var(--button-shadow, #2a5a9a);
|
box-shadow: 0 3px 0 var(--button-shadow, #2a5a9a);
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -347,7 +345,6 @@ class LlmComponent extends HTMLElement {
|
|||||||
background: #e74c3c;
|
background: #e74c3c;
|
||||||
border: none;
|
border: none;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
cursor: pointer;
|
|
||||||
padding: 2px 6px;
|
padding: 2px 6px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -408,7 +405,6 @@ class LlmComponent extends HTMLElement {
|
|||||||
font-family: 'Courier New', monospace;
|
font-family: 'Courier New', monospace;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: 0 3px 0 var(--button-shadow, #2a5a9a);
|
box-shadow: 0 3px 0 var(--button-shadow, #2a5a9a);
|
||||||
transition: background 0.2s;
|
transition: background 0.2s;
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ class Game {
|
|||||||
this.otherPlayers = new Map();
|
this.otherPlayers = new Map();
|
||||||
this.isMoving = false;
|
this.isMoving = false;
|
||||||
this.dialogue = null;
|
this.dialogue = null;
|
||||||
this.audioManager = null;
|
|
||||||
this.keys = {};
|
this.keys = {};
|
||||||
|
|
||||||
// Use global singleton 🌍
|
// Use global singleton 🌍
|
||||||
@@ -215,7 +214,6 @@ class Game {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onCurrentPlayers: (players) => {
|
onCurrentPlayers: (players) => {
|
||||||
console.log('👥 Current players:', players);
|
|
||||||
players.forEach(player => {
|
players.forEach(player => {
|
||||||
if (player.socketId !== this.api.worldSocket.id) {
|
if (player.socketId !== this.api.worldSocket.id) {
|
||||||
this.addOtherPlayer(player);
|
this.addOtherPlayer(player);
|
||||||
@@ -224,7 +222,6 @@ class Game {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onPlayerJoined: (player) => {
|
onPlayerJoined: (player) => {
|
||||||
console.log('👋 Player joined:', player.name);
|
|
||||||
this.addOtherPlayer(player);
|
this.addOtherPlayer(player);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -236,7 +233,6 @@ class Game {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onPlayerLeft: (data) => {
|
onPlayerLeft: (data) => {
|
||||||
console.log('👋 Player left:', data.socketId);
|
|
||||||
const sprite = this.otherPlayers.get(data.socketId);
|
const sprite = this.otherPlayers.get(data.socketId);
|
||||||
if (sprite) {
|
if (sprite) {
|
||||||
this.app.stage.removeChild(sprite);
|
this.app.stage.removeChild(sprite);
|
||||||
@@ -297,7 +293,7 @@ class Game {
|
|||||||
resolution: window.devicePixelRatio || 1,
|
resolution: window.devicePixelRatio || 1,
|
||||||
autoDensity: true
|
autoDensity: true
|
||||||
});
|
});
|
||||||
document.body.appendChild(this.app.view);
|
document.getElementById('game').appendChild(this.app.view);
|
||||||
|
|
||||||
const tiles = new PIXI.Container();
|
const tiles = new PIXI.Container();
|
||||||
this.app.stage.addChild(tiles);
|
this.app.stage.addChild(tiles);
|
||||||
|
|||||||
@@ -6,10 +6,7 @@
|
|||||||
"image": "/assets/background.jpg",
|
"image": "/assets/background.jpg",
|
||||||
"style": "cover"
|
"style": "cover"
|
||||||
},
|
},
|
||||||
"music": [
|
"music": "/assets/music.mp3",
|
||||||
"/assets/mystery_acorns.mp3",
|
|
||||||
"/assets/crunchy_leaves.mp3"
|
|
||||||
],
|
|
||||||
"colors": {
|
"colors": {
|
||||||
"tileTop": "#7a5a8c",
|
"tileTop": "#7a5a8c",
|
||||||
"tileSide": "#4a2d5a",
|
"tileSide": "#4a2d5a",
|
||||||
|
|||||||
Reference in New Issue
Block a user