Files
novafarma/docs/guides/test_closed_captions.js
2025-12-12 22:46:38 +01:00

153 lines
5.0 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* CLOSED CAPTIONS & VISUAL SOUND CUES - QUICK TEST SCRIPT
*
* Copy-paste this into browser console (F12) to test all features
* Make sure the game is running first!
*/
// Get the Visual Sound Cue System
const visualCues = game.scene.scenes[1].visualSoundCues;
console.log('🎬 Starting Closed Captions & Visual Sound Cues Test Suite...\n');
// Test 1: Basic Sound Effects
console.log('📢 Test 1: Basic Sound Effects');
setTimeout(() => {
visualCues.onSoundPlayed('damage', { direction: 'left', amount: 25 });
}, 1000);
setTimeout(() => {
visualCues.onSoundPlayed('pickup', { item: 'Carrot' });
}, 2500);
setTimeout(() => {
visualCues.onSoundPlayed('harvest');
}, 4000);
setTimeout(() => {
visualCues.onSoundPlayed('build');
}, 5500);
// Test 2: Speaker Names & Colors
console.log('👥 Test 2: Speaker Names & Colors');
setTimeout(() => {
visualCues.showSubtitle('Hello, adventurer!', 3000, 'NPC');
}, 7000);
setTimeout(() => {
visualCues.showSubtitle('GRRRR!', 3000, 'Enemy');
}, 10500);
setTimeout(() => {
visualCues.showSubtitle('Achievement unlocked!', 3000, 'System');
}, 14000);
// Test 3: Directional Arrows
console.log('➡️ Test 3: Directional Arrows');
setTimeout(() => {
visualCues.showSubtitle('Sound from the left', 3000, 'System', 'left');
}, 17500);
setTimeout(() => {
visualCues.showSubtitle('Sound from the right', 3000, 'System', 'right');
}, 21000);
setTimeout(() => {
visualCues.showSubtitle('Sound from everywhere', 3000, 'System', 'both');
}, 24500);
// Test 4: Fishing Bobber Visual Queue
console.log('🎣 Test 4: Fishing Bobber Visual Queue');
setTimeout(() => {
visualCues.onSoundPlayed('fishing_cast');
}, 28000);
setTimeout(() => {
visualCues.onSoundPlayed('fishing_bite');
}, 30000);
// Test 5: Opacity Control
console.log('📊 Test 5: Opacity Control');
setTimeout(() => {
visualCues.showSubtitle('Testing opacity...', 5000, 'System');
visualCues.setSubtitleOpacity(1.0);
}, 33000);
setTimeout(() => {
visualCues.setSubtitleOpacity(0.5);
}, 35000);
setTimeout(() => {
visualCues.setSubtitleOpacity(0.2);
}, 37000);
setTimeout(() => {
visualCues.setSubtitleOpacity(0.8); // Back to default
}, 39000);
// Test 6: All Sound Types
console.log('🔊 Test 6: All Sound Types');
const soundTypes = [
{ type: 'dig', delay: 41000 },
{ type: 'plant', delay: 42500 },
{ type: 'footsteps', delay: 44000, data: { direction: 'left' } },
{ type: 'door', delay: 45500 },
{ type: 'chest', delay: 47000 },
{ type: 'water', delay: 48500 },
{ type: 'fire', delay: 50000 },
{ type: 'explosion', delay: 51500 },
{ type: 'npc_talk', delay: 53000, data: { text: 'Can you help me?', speaker: 'NPC', direction: 'right' } },
{ type: 'enemy_growl', delay: 56500, data: { direction: 'left' } },
{ type: 'danger', delay: 58000 },
{ type: 'night', delay: 60500 },
{ type: 'achievement', delay: 63000, data: { message: 'First Harvest!' } }
];
soundTypes.forEach(sound => {
setTimeout(() => {
visualCues.onSoundPlayed(sound.type, sound.data || {});
}, sound.delay);
});
// Test 7: Toggle Features
console.log('⚙️ Test 7: Toggle Features');
setTimeout(() => {
console.log('Disabling speaker names...');
visualCues.toggleSpeakerNames(false);
visualCues.showSubtitle('No speaker name shown', 3000, 'NPC');
}, 66000);
setTimeout(() => {
console.log('Re-enabling speaker names...');
visualCues.toggleSpeakerNames(true);
visualCues.showSubtitle('Speaker name is back!', 3000, 'NPC');
}, 69500);
setTimeout(() => {
console.log('Disabling directional arrows...');
visualCues.toggleDirectionalArrows(false);
visualCues.showSubtitle('No arrows', 3000, 'System', 'left');
}, 73000);
setTimeout(() => {
console.log('Re-enabling directional arrows...');
visualCues.toggleDirectionalArrows(true);
visualCues.showSubtitle('Arrows are back!', 3000, 'System', 'right');
}, 76500);
// Test 8: Custom Speaker Colors
console.log('🎨 Test 8: Custom Speaker Colors');
setTimeout(() => {
visualCues.addSpeakerColor('Merchant', '#ffa500'); // Orange
visualCues.showSubtitle('Welcome to my shop!', 3000, 'Merchant');
}, 80000);
setTimeout(() => {
visualCues.addSpeakerColor('Wizard', '#9370db'); // Purple
visualCues.showSubtitle('I sense magic nearby...', 3000, 'Wizard');
}, 83500);
// Final Summary
setTimeout(() => {
console.log('\n✅ Test Suite Complete!');
console.log('📋 Summary:');
console.log(' - Closed Captions: ✅');
console.log(' - Speaker Names & Colors: ✅');
console.log(' - Directional Arrows: ✅');
console.log(' - Opacity Control: ✅');
console.log(' - Fishing Bobber Queue: ✅');
console.log(' - All Sound Types: ✅');
console.log(' - Toggle Features: ✅');
console.log(' - Custom Speakers: ✅');
console.log('\n🎉 All features working correctly!');
console.log('\n📖 See CLOSED_CAPTIONS_TESTING.md for detailed testing guide');
}, 87000);
console.log('\n⏱ Test will run for ~90 seconds. Watch the screen!\n');