142 lines
4.5 KiB
JavaScript
142 lines
4.5 KiB
JavaScript
/**
|
|
* VISUAL SOUND CUE SYSTEM - QUICK TEST SCRIPT
|
|
* Copy-paste this into browser console (F12) to test all features
|
|
*/
|
|
|
|
console.log('🧪 Visual Sound Cue System - Quick Test');
|
|
console.log('========================================');
|
|
|
|
// Get GameScene
|
|
const gameScene = game.scene.getScene('GameScene');
|
|
|
|
if (!gameScene || !gameScene.visualSoundCueSystem) {
|
|
console.error('❌ Visual Sound Cue System not found!');
|
|
console.log('Make sure the game is running and you are in GameScene');
|
|
} else {
|
|
console.log('✅ Visual Sound Cue System found!');
|
|
console.log('');
|
|
|
|
// Create test functions
|
|
window.testHeartbeat = () => {
|
|
console.log('💓 Testing heartbeat (25% health)...');
|
|
gameScene.visualSoundCueSystem.updateHeartbeat(25);
|
|
console.log('✅ Heartbeat should be pulsing in top-left corner');
|
|
};
|
|
|
|
window.testDamage = (direction = 'left') => {
|
|
console.log(`🎯 Testing damage indicator (${direction})...`);
|
|
gameScene.visualSoundCueSystem.showDamageIndicator(direction, 20);
|
|
console.log('✅ Arrow should appear showing damage direction');
|
|
};
|
|
|
|
window.testFlash = (type = 'danger') => {
|
|
console.log(`⚡ Testing screen flash (${type})...`);
|
|
const messages = {
|
|
danger: '[DANGER!]',
|
|
warning: '[WARNING!]',
|
|
info: '[INFO]',
|
|
success: '[SUCCESS!]'
|
|
};
|
|
gameScene.visualSoundCueSystem.showScreenFlash(type, messages[type]);
|
|
console.log('✅ Screen should flash with icon');
|
|
};
|
|
|
|
window.testSubtitle = (text = 'Test Subtitle', speaker = null) => {
|
|
console.log(`💬 Testing subtitle: "${text}"...`);
|
|
gameScene.visualSoundCueSystem.showSubtitle(text, 3000, speaker);
|
|
console.log('✅ Subtitle should appear at bottom');
|
|
};
|
|
|
|
window.testAll = () => {
|
|
console.log('🎬 Running ALL tests...');
|
|
console.log('');
|
|
|
|
// Test 1: Heartbeat
|
|
setTimeout(() => {
|
|
console.log('Test 1/5: Heartbeat');
|
|
testHeartbeat();
|
|
}, 0);
|
|
|
|
// Test 2: Damage Indicators
|
|
setTimeout(() => {
|
|
console.log('Test 2/5: Damage Indicators');
|
|
testDamage('up');
|
|
}, 2000);
|
|
|
|
setTimeout(() => {
|
|
testDamage('down');
|
|
}, 2500);
|
|
|
|
setTimeout(() => {
|
|
testDamage('left');
|
|
}, 3000);
|
|
|
|
setTimeout(() => {
|
|
testDamage('right');
|
|
}, 3500);
|
|
|
|
// Test 3: Screen Flashes
|
|
setTimeout(() => {
|
|
console.log('Test 3/5: Screen Flashes');
|
|
testFlash('danger');
|
|
}, 5000);
|
|
|
|
setTimeout(() => {
|
|
testFlash('warning');
|
|
}, 6000);
|
|
|
|
setTimeout(() => {
|
|
testFlash('info');
|
|
}, 7000);
|
|
|
|
setTimeout(() => {
|
|
testFlash('success');
|
|
}, 8000);
|
|
|
|
// Test 4: Subtitles
|
|
setTimeout(() => {
|
|
console.log('Test 4/5: Subtitles');
|
|
testSubtitle('Simple subtitle message');
|
|
}, 9000);
|
|
|
|
setTimeout(() => {
|
|
testSubtitle('Message with speaker', 'System');
|
|
}, 12000);
|
|
|
|
// Test 5: Sound Events
|
|
setTimeout(() => {
|
|
console.log('Test 5/5: Sound Events');
|
|
gameScene.visualSoundCueSystem.onSoundPlayed('pickup', { item: 'Wood' });
|
|
}, 15000);
|
|
|
|
setTimeout(() => {
|
|
gameScene.visualSoundCueSystem.onSoundPlayed('harvest');
|
|
}, 16000);
|
|
|
|
setTimeout(() => {
|
|
gameScene.visualSoundCueSystem.onSoundPlayed('build');
|
|
}, 17000);
|
|
|
|
setTimeout(() => {
|
|
gameScene.visualSoundCueSystem.onSoundPlayed('achievement', { message: '[LEVEL UP!]' });
|
|
}, 18000);
|
|
|
|
setTimeout(() => {
|
|
console.log('');
|
|
console.log('✅ All tests completed!');
|
|
console.log('Check the game screen for visual indicators');
|
|
}, 20000);
|
|
};
|
|
|
|
// Print available commands
|
|
console.log('📋 Available Test Commands:');
|
|
console.log('');
|
|
console.log('testHeartbeat() - Show heartbeat (low health)');
|
|
console.log('testDamage("left") - Show damage indicator (up/down/left/right)');
|
|
console.log('testFlash("danger") - Show screen flash (danger/warning/info/success)');
|
|
console.log('testSubtitle("text") - Show subtitle');
|
|
console.log('testAll() - Run all tests sequentially');
|
|
console.log('');
|
|
console.log('💡 TIP: Run testAll() to see everything!');
|
|
}
|