dodadno
This commit is contained in:
@@ -49,11 +49,12 @@ class StoryScene extends Phaser.Scene {
|
||||
{ label: '▶ NEW GAME', color: '#00ff41', action: () => this.startNewGame() },
|
||||
{ label: '📁 LOAD GAME', color: '#4477ff', action: () => this.loadGame() },
|
||||
{ label: '⚙️ SETTINGS', color: '#ffaa00', action: () => this.showSettings() },
|
||||
{ label: '♿ ACCESSIBILITY', color: '#44ff44', action: () => this.showAccessibility() },
|
||||
{ label: '❌ EXIT', color: '#ff4444', action: () => this.exitGame() }
|
||||
];
|
||||
|
||||
const startY = 250;
|
||||
const spacing = 80;
|
||||
const startY = 230;
|
||||
const spacing = 75;
|
||||
|
||||
buttons.forEach((btn, index) => {
|
||||
const y = startY + (index * spacing);
|
||||
@@ -208,6 +209,32 @@ class StoryScene extends Phaser.Scene {
|
||||
alert('Settings - Use ⚙️ button in-game!');
|
||||
}
|
||||
|
||||
showAccessibility() {
|
||||
console.log('♿ Opening Accessibility Menu...');
|
||||
|
||||
// Create accessibility quick menu
|
||||
const options = [
|
||||
'♿ ACCESSIBILITY OPTIONS',
|
||||
'',
|
||||
'1. High Contrast Mode',
|
||||
'2. Large Text Mode',
|
||||
'3. Color Blind Mode',
|
||||
'4. Screen Reader Support',
|
||||
'5. Reduce Flashing (Epilepsy)',
|
||||
'6. One-Handed Controls',
|
||||
'7. Audio Cues',
|
||||
'',
|
||||
'Full accessibility settings available in-game (ESC → Settings)',
|
||||
'',
|
||||
'Tip: Press 1-7 to toggle these features'
|
||||
];
|
||||
|
||||
alert(options.join('\n'));
|
||||
|
||||
// TODO: Implement full accessibility menu
|
||||
// For now, just show information
|
||||
}
|
||||
|
||||
exitGame() {
|
||||
console.log('❌ Exiting...');
|
||||
if (window.close) {
|
||||
|
||||
@@ -24,6 +24,12 @@ class UIScene extends Phaser.Scene {
|
||||
// this.createDebugInfo();
|
||||
this.createSettingsButton();
|
||||
|
||||
// ESC Pause Menu
|
||||
this.pauseMenuActive = false;
|
||||
this.input.keyboard.on('keydown-ESC', () => {
|
||||
this.togglePauseMenu();
|
||||
});
|
||||
|
||||
// Listeners for Age
|
||||
if (this.gameScene) {
|
||||
this.gameScene.events.on('update-age-ui', (data) => this.updateAge(data.gen, data.age));
|
||||
@@ -1714,4 +1720,181 @@ class UIScene extends Phaser.Scene {
|
||||
placeholder.setOrigin(0.5, 0);
|
||||
this.settingsContainer.add(placeholder);
|
||||
}
|
||||
|
||||
togglePauseMenu() {
|
||||
if (this.pauseMenuActive) {
|
||||
// Close pause menu
|
||||
if (this.pauseMenuContainer) {
|
||||
this.pauseMenuContainer.destroy();
|
||||
this.pauseMenuContainer = null;
|
||||
}
|
||||
this.pauseMenuActive = false;
|
||||
|
||||
// Resume game
|
||||
if (this.gameScene) {
|
||||
this.gameScene.physics.resume();
|
||||
}
|
||||
} else {
|
||||
// Open pause menu
|
||||
this.createPauseMenu();
|
||||
this.pauseMenuActive = true;
|
||||
|
||||
// Pause game
|
||||
if (this.gameScene) {
|
||||
this.gameScene.physics.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createPauseMenu() {
|
||||
const width = this.cameras.main.width;
|
||||
const height = this.cameras.main.height;
|
||||
|
||||
// Initialize i18n if not available
|
||||
if (!window.i18n) {
|
||||
window.i18n = new LocalizationSystem();
|
||||
}
|
||||
|
||||
this.pauseMenuContainer = this.add.container(0, 0);
|
||||
this.pauseMenuContainer.setScrollFactor(0);
|
||||
this.pauseMenuContainer.setDepth(15000);
|
||||
|
||||
// Semi-transparent background
|
||||
const bg = this.add.rectangle(0, 0, width, height, 0x000000, 0.85);
|
||||
bg.setOrigin(0);
|
||||
this.pauseMenuContainer.add(bg);
|
||||
|
||||
// Panel
|
||||
const panelW = 500;
|
||||
const panelH = 550;
|
||||
const panelX = width / 2 - panelW / 2;
|
||||
const panelY = height / 2 - panelH / 2;
|
||||
|
||||
const panel = this.add.rectangle(panelX, panelY, panelW, panelH, 0x1a1a2e, 1);
|
||||
panel.setOrigin(0);
|
||||
panel.setStrokeStyle(4, 0x00ff41);
|
||||
this.pauseMenuContainer.add(panel);
|
||||
|
||||
// Title
|
||||
const title = this.add.text(width / 2, panelY + 40, '⏸️ ' + window.i18n.t('pause.title', 'PAUSED'), {
|
||||
fontSize: '48px',
|
||||
fontFamily: 'Courier New',
|
||||
color: '#00ff41',
|
||||
fontStyle: 'bold'
|
||||
});
|
||||
title.setOrigin(0.5);
|
||||
this.pauseMenuContainer.add(title);
|
||||
|
||||
// Menu buttons
|
||||
const buttons = [
|
||||
{
|
||||
label: window.i18n.t('pause.resume', '▶ Resume'),
|
||||
color: '#00ff41',
|
||||
action: () => this.togglePauseMenu()
|
||||
},
|
||||
{
|
||||
label: window.i18n.t('pause.save', '💾 Save Game'),
|
||||
color: '#4477ff',
|
||||
action: () => this.saveGame()
|
||||
},
|
||||
{
|
||||
label: window.i18n.t('pause.settings', '⚙️ Settings'),
|
||||
color: '#ffaa00',
|
||||
action: () => { this.togglePauseMenu(); this.toggleSettingsMenu(); }
|
||||
},
|
||||
{
|
||||
label: window.i18n.t('pause.quit', '🚪 Quit to Menu'),
|
||||
color: '#ff4444',
|
||||
action: () => this.quitToMenu()
|
||||
}
|
||||
];
|
||||
|
||||
const startY = panelY + 150;
|
||||
const spacing = 90;
|
||||
|
||||
buttons.forEach((btn, index) => {
|
||||
const y = startY + (index * spacing);
|
||||
|
||||
// Button background
|
||||
const btnBg = this.add.rectangle(width / 2, y, 400, 70, 0x2a2a4e, 1);
|
||||
btnBg.setStrokeStyle(3, btn.color);
|
||||
|
||||
// Button text
|
||||
const btnText = this.add.text(width / 2, y, btn.label, {
|
||||
fontSize: '28px',
|
||||
fontFamily: 'Courier New',
|
||||
color: btn.color,
|
||||
fontStyle: 'bold'
|
||||
});
|
||||
btnText.setOrigin(0.5);
|
||||
|
||||
// Make interactive
|
||||
btnBg.setInteractive({ useHandCursor: true });
|
||||
btnBg.on('pointerover', () => {
|
||||
btnBg.setFillStyle(0x3a3a6e);
|
||||
btnText.setScale(1.05);
|
||||
});
|
||||
btnBg.on('pointerout', () => {
|
||||
btnBg.setFillStyle(0x2a2a4e);
|
||||
btnText.setScale(1.0);
|
||||
});
|
||||
btnBg.on('pointerdown', () => {
|
||||
this.tweens.add({
|
||||
targets: btnBg,
|
||||
alpha: 0.5,
|
||||
yoyo: true,
|
||||
duration: 100,
|
||||
onComplete: btn.action
|
||||
});
|
||||
});
|
||||
|
||||
this.pauseMenuContainer.add(btnBg);
|
||||
this.pauseMenuContainer.add(btnText);
|
||||
});
|
||||
|
||||
// Hint text
|
||||
const hint = this.add.text(width / 2, panelY + panelH - 30, window.i18n.t('pause.hint', 'Press ESC to resume'), {
|
||||
fontSize: '16px',
|
||||
fontFamily: 'Courier New',
|
||||
color: '#888888'
|
||||
});
|
||||
hint.setOrigin(0.5);
|
||||
this.pauseMenuContainer.add(hint);
|
||||
}
|
||||
|
||||
saveGame() {
|
||||
console.log('💾 Saving game...');
|
||||
|
||||
// TODO: Implement save system
|
||||
// For now, show notification
|
||||
if (this.gameScene && this.gameScene.events) {
|
||||
this.gameScene.events.emit('show-floating-text', {
|
||||
x: this.cameras.main.width / 2,
|
||||
y: 100,
|
||||
text: window.i18n.t('save.success', '✓ Game Saved!'),
|
||||
color: '#00ff41'
|
||||
});
|
||||
}
|
||||
|
||||
// Close pause menu after saving
|
||||
setTimeout(() => {
|
||||
this.togglePauseMenu();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
quitToMenu() {
|
||||
console.log('🚪 Quitting to main menu...');
|
||||
|
||||
// Confirm dialog
|
||||
const confirm = window.confirm(window.i18n.t('quit.confirm', 'Quit to main menu? Unsaved progress will be lost.'));
|
||||
|
||||
if (confirm) {
|
||||
// Stop all scenes
|
||||
this.scene.stop('GameScene');
|
||||
this.scene.stop('UIScene');
|
||||
|
||||
// Start menu
|
||||
this.scene.start('StoryScene');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user