export default class BootScene extends Phaser.Scene {
  constructor() {
    super({ key: 'BootScene' });
  }

  preload() {
    this.load.spritesheet('symbols',       'assets/symbol_sprites.png', { frameWidth: 200, frameHeight: 100 });
    this.load.spritesheet('demon_sprites', 'assets/demon_sprites.png',  { frameWidth: 100, frameHeight: 100 });
    this.load.image('bg-gates', 'assets/gates.png');

    // Stage loop videos (stages 1–6)
    for (let i = 1; i <= 6; i++) {
      const pad = String(i).padStart(2, '0');
      this.load.video(`stage-${pad}`, `assets/video/stage-${pad}.mp4`, true);
    }

    // Stage transition videos (adjacent pairs in both directions)
    const pairs = [
      [1,2],[2,1],[2,3],[3,2],[3,4],[4,3],[4,5],[5,4],[5,6],[6,5]
    ];
    pairs.forEach(([a, b]) => {
      const pa = String(a).padStart(2, '0');
      const pb = String(b).padStart(2, '0');
      this.load.video(`stage-${pa}-${pb}`, `assets/video/stage-${pa}-${pb}.mp4`, true);
    });

    // Victory videos
    this.load.video('lord-victory', 'assets/video/lord-victory.mp4', true);
    this.load.video('sin-victory',  'assets/video/sin-victory.mp4',  true);

    // Background music
    this.load.audio('music-01-02', 'assets/music/stage-01-02.mp3');
    this.load.audio('music-03-04', 'assets/music/stage-03-04.mp3');
    this.load.audio('music-05-06', 'assets/music/stage-05-06.mp3');
    this.load.audio('music-lord-victory', 'assets/music/lord-victory.mp3');
    this.load.audio('music-sin-victory',  'assets/music/sin-victory.mp3');

    // Sound effects
    this.load.audio('sfx-spin', 'assets/fx/spin.mp3');
    this.load.audio('sfx-stop', 'assets/fx/stop.mp3');
    for (let i = 1; i <= 6; i++) {
      this.load.audio(`sfx-nomatch-${i}`, `assets/fx/nomatch${i}.mp3`);
      this.load.audio(`sfx-match-${i}`,   `assets/fx/match${i}.mp3`);
    }
    this.load.audio('sfx-coins', 'assets/fx/coins.mp3');
  }

  create() {
    this.scene.start('GameScene');
    this.scene.launch('UIScene');
  }
}
