feat: complete Style 32 overhaul & Tiled integration fix

- Enforced 'Style 32 - Dark Chibi Vector' for all ground assets.
- Fixed critical Prologue-to-Game crash (function renaming).
- Implemented Tiled JSON/TMX auto-conversion.
- Updated Asset Manager to visualize 1800+ assets.
- Cleaned up project structure (new assets/grounds folder).
- Auto-Ground logic added to GameScene.js.
This commit is contained in:
2026-01-11 20:08:56 +01:00
parent 16e4284964
commit 7264ec6fc0
97 changed files with 49754 additions and 690 deletions

View File

@@ -434,6 +434,43 @@ class LocalizationSystem {
};
return names[code] || code;
}
/**
* INJECT EXTERNAL JSON DATA (loaded via Phaser)
*/
setExternalData(data) {
try {
// Merge intro texts into translations
for (const lang in data) {
if (!this.translations[lang]) {
this.translations[lang] = {};
}
// Add intro polaroid texts
if (data[lang].intro_polaroids) {
this.translations[lang].intro_polaroids = data[lang].intro_polaroids;
}
// Add menu texts
if (data[lang].menu) {
Object.assign(this.translations[lang], data[lang].menu);
}
// Add title/subtitle
if (data[lang].game_title) {
this.translations[lang].game_title = data[lang].game_title;
}
if (data[lang].subtitle) {
this.translations[lang].subtitle = data[lang].subtitle;
}
}
console.log('✅ Localization data injected successfully');
return true;
} catch (error) {
console.warn('⚠️ Could not inject localization data:', error);
return false;
}
}
}
// Global instance

View File

@@ -12,26 +12,37 @@ class SoundManager {
playSFX(key) {
if (this.isMuted) return;
if (this.scene.sound.get(key)) {
this.scene.sound.play(key, { volume: this.sfxVolume });
} else if (key === 'chop' && this.scene.sound.get('wood_chop')) {
// SAFE CHECK: Check cache instead of active instances
if (this.scene.cache.audio.exists(key)) {
try {
this.scene.sound.play(key, { volume: this.sfxVolume });
} catch (e) {
console.warn(`🔊 Failed to play SFX ${key}:`, e);
// Fallback to beep if playback fails
this.playFallbackBeep(key);
}
} else if (key === 'chop' && this.scene.cache.audio.exists('wood_chop')) {
// Priority for real wood chop sound
this.scene.sound.play('wood_chop', { volume: this.sfxVolume });
} else {
// Enhanced placeholder beeps
if (key === 'chop') {
this.beepChop();
} else if (key === 'pickup') {
this.beepPickup();
} else if (key === 'plant') {
this.beepPlant();
} else if (key === 'harvest') {
this.beepHarvest();
} else if (key === 'build') {
this.beepBuild();
} else if (key === 'dig') {
this.beepDig();
}
this.playFallbackBeep(key);
}
}
playFallbackBeep(key) {
if (key === 'chop') {
this.beepChop();
} else if (key === 'pickup') {
this.beepPickup();
} else if (key === 'plant') {
this.beepPlant();
} else if (key === 'harvest') {
this.beepHarvest();
} else if (key === 'build') {
this.beepBuild();
} else if (key === 'dig') {
this.beepDig();
}
}
@@ -43,9 +54,15 @@ class SoundManager {
this.currentMusic.stop();
}
if (this.scene.sound.get(key)) {
this.currentMusic = this.scene.sound.add(key, { volume: this.musicVolume, loop: loop });
this.currentMusic.play();
if (this.scene.cache.audio.exists(key)) {
try {
this.currentMusic = this.scene.sound.add(key, { volume: this.musicVolume, loop: loop });
this.currentMusic.play();
} catch (e) {
console.warn(`🎵 Failed to play music ${key}:`, e);
}
} else {
console.warn(`🎵 Music key not found: ${key}`);
}
}
@@ -259,9 +276,15 @@ class SoundManager {
playAmbient(key, loop = true) {
if (this.isMuted) return;
if (this.currentAmbient) this.currentAmbient.stop();
if (!this.scene.sound.get(key)) return;
this.currentAmbient = this.scene.sound.add(key, { volume: this.sfxVolume * 0.5, loop: loop });
this.currentAmbient.play();
if (!this.scene.cache.audio.exists(key)) return;
try {
this.currentAmbient = this.scene.sound.add(key, { volume: this.sfxVolume * 0.5, loop: loop });
this.currentAmbient.play();
} catch (e) {
console.warn(`🍃 Failed to play ambient ${key}:`, e);
}
}
stopAmbient() {

View File

@@ -11,7 +11,7 @@
* Style 32 Dark-Chibi Noir compatible
*/
export default class WaterPhysicsSystem {
class WaterPhysicsSystem {
constructor(scene) {
this.scene = scene;