import { Container, Text } from 'pixi.js';
import { Spine } from 'pixi-spine';

export default class BasicWin extends Container
{
    spine: Spine;
    betValueText: Text;
    isShown: boolean;

    constructor()
    {
        super();

        this._create();
    }

    _create()
    {
        this.betValueText = new Text();
        this.betValueText.style = {
            fill: 0xffffff,
            stroke: 0x000000,
            strokeThickness: 3,
            fontSize: 40,
            fontFamily: 'Arial',
            letterSpacing: 0,
        };
        this.betValueText.anchor.set(0.5);
        this.addChild(this.betValueText);
        this.value = '';
        this.isShown = false;
        this.betValueText.visible = false;
    }

    get value(): string
    {
        return this.betValueText.text;
    }

    set value(formattedValue: string)
    {
        this.betValueText.text = formattedValue;
    }

    update(_dt:number)
    {

    }

    show()
    {
        if (this.isShown) return;
        this.betValueText.visible = true;
        this.isShown = true;
    }

    hide()
    {
        if (!this.isShown) return;
        this.isShown = false;
        this.betValueText.visible = false;
    }

    hidden()
    {
        this.isShown = false;
        this.betValueText.visible = false;
    }

    override destroy(_options?: object)
    {
        super.destroy(_options);
    }
}
