import { InterfaceManager } from './support/interfaceManager.js';

export class UIScene extends Phaser.Scene {

    constructor() {
        super({ key: 'UIScene' });
    }

    init(data) {

    }

    preload() {
        this.load.font('neuropol', 'assets/NEUROPOL.ttf');
        this.load.image('intMain', 'assets/intMain.png');
        this.load.image('redArrow', 'assets/redArrow.png');
        this.load.image('intTop', 'assets/intTop.png');
        this.load.image('gold', 'assets/gold.png');
        this.load.spritesheet('nextWave', 'assets/nextWave.png', {
            frameHeight: 150,
            frameWidth: 150
        });
    }

    create() {
        this.interfaceManager = new InterfaceManager(this);
        this.levelScene = this.scene.get('Level');
        this.cameras.main.setBounds(0, 0, 1600, 900);
    }

    update(time, delta) {
        this.interfaceManager.update(time, delta);
    }

    addGold(amount) {
        this.interfaceManager.gold += amount;
        this.updateGold();
    }

    removeGold(amount) {
        this.interfaceManager.gold -= amount;
        this.updateGold();
    }

    updateGold() {
        this.interfaceManager.goldText.setText(`${this.interfaceManager.gold}`);
    }
}