class Victory
{
    constructor( ui , map )
    {
        this.ui = ui;
        this.map = map;
        this.lbl_bg = this.ui.add( new Sparrow.UI.Label( "" , { position: "center" , verticalPosition: "center" , width: 500 , height: 220 , background: "background" , backgroundColor: "#d6e6ff" , borderWidth: 5 , borderColor: "#003844" } ) );
        this.lbl_bg.addChild( new Sparrow.UI.Label( "Victory" , { position: "center" , y: 10 , textAlign: "center" , font: "monospace" , textSize: 30 } ) );

        this.lbl_bg.addChild( new Sparrow.UI.Label( "You successfully escaped the planet." , { position: "center" , width: 480 , y: 70 , textAlign: "center" , font: "monospace" } ) );

        this.btn_continue = this.lbl_bg.addChild( new Sparrow.UI.Button( "Keep Playing [Endless Mode]" , { position: "center" , width: 400 , y: 120 , font: "monospace" } ) );
        this.btn_continue.onclick = () => {
            this.lbl_bg.b_visible = false;
            this.map.b_endless = true;
            this.map.start();
            this.map.ui.lbl_impact.setStr( "Endless Mode" );
        };

        this.btn_continue = this.lbl_bg.addChild( new Sparrow.UI.Button( "Restart" , { position: "center" , width: 200 , y: 170 , font: "monospace" } ) );
        this.btn_continue.onclick = () => {
            this.lbl_bg.b_visible = false;
            this.map.restart();
        };

        this.lbl_bg.b_visible = false;
    }

    show()
    {
        this.lbl_bg.b_visible = true;
    }

    hide()
    {
        this.lbl_bg.b_visible = false;
    }
}