"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.GameOverContainer = void 0;
class GameOverContainer extends Phaser.GameObjects.Container {
  constructor(scene) {
    super(scene, 0, 0);
    this.scene = scene;
    this.width = 200;
    this.height = 200;
    this.gameOverText = this.scene.add.image(0, 0, "game-over");
    this.restartText = this.scene.add.image(0, 80, "restart").setInteractive();
    this.setVisible(true);
    this.init();
    this.scene.add.existing(this);
  }
  init() {
    this.add([this.gameOverText, this.restartText]).setAlpha(0).setDepth(3);

    // Handle resizing
    this.scene.scale.once('resize', this.scaleToFit, this);
    this.scene.scale.once('resize', this.positionOnMountain, this);
  }
  positionOnMountain() {
    this.setY(this.scene.scale.height / 2);
    this.setX(this.scene.scale.width / 2);
    this.setVisible(true);
  }
  scaleToFit() {
    var _this$scene$mountain, _this$scene$mountain2;
    // Use the scale factor from the Sky class to maintain consistency
    const height = this.height * (((_this$scene$mountain = this.scene.mountain) === null || _this$scene$mountain === void 0 ? void 0 : _this$scene$mountain.scaleFactors.height) || 1);
    const width = this.width * (((_this$scene$mountain2 = this.scene.mountain) === null || _this$scene$mountain2 === void 0 ? void 0 : _this$scene$mountain2.scaleFactors.width) || 1);
    // Apply the scale factor to the player
    this.gameOverText.setDisplaySize(width * 4, height);
    this.restartText.setDisplaySize(width, height);
  }
}
exports.GameOverContainer = GameOverContainer;