import '../../globals.js';
import Utils from '../../dot/js/Utils.js';
import optionize, { combineOptions } from '../../phet-core/js/optionize.js';
import StarNode from '../../scenery-phet/js/StarNode.js';
import StatusBar from '../../scenery-phet/js/StatusBar.js';
import { HBox, Text } from '../../scenery/js/imports.js';
import vegas from './vegas.js';
export default class ScoreDisplayNumberAndStar extends HBox {
    constructor(scoreProperty, providedOptions) {
        const options = optionize()({
            // SelfOptions
            font: StatusBar.DEFAULT_FONT,
            textFill: 'black',
            scoreDecimalPlaces: 0,
            starNodeOptions: {
                starShapeOptions: {
                    outerRadius: 10,
                    innerRadius: 5
                },
                filledLineWidth: 1.5,
                emptyLineWidth: 1.5
            },
            // HBoxOptions
            spacing: 5
        }, providedOptions);
        super(options);
        // Update number displayed based on score.
        const scorePropertyListener = (score) => {
            const children = [];
            if (score === 0) {
                children.push(new StarNode(combineOptions({ value: 0 }, options.starNodeOptions)));
            }
            else {
                children.push(new Text(Utils.toFixed(score, options.scoreDecimalPlaces), {
                    font: options.font,
                    fill: options.textFill
                }));
                children.push(new StarNode(combineOptions({ value: 1 }, options.starNodeOptions)));
            }
            this.children = children;
        };
        scoreProperty.link(scorePropertyListener);
        this.disposeScoreDisplayNumberAndStar = function () {
            scoreProperty.unlink(scorePropertyListener);
        };
    }
    dispose() {
        this.disposeScoreDisplayNumberAndStar();
        super.dispose();
    }
}
vegas.register('ScoreDisplayNumberAndStar', ScoreDisplayNumberAndStar);
//# sourceMappingURL=ScoreDisplayNumberAndStar.js.map