import ComponentBase from "../components/ComponentBase";
import Loading from "../loading/Loading";
import IScene from "../components/IScene";

export default class SkinScene extends ComponentBase {
    public set onLoaded(v: () => void) {
        if (this.loadedOnConstruct) {
            v();
        } else {
            this._onLoaded = v;
        }
    }
    public get onLoaded() {
        return this._onLoaded;
    }
    private _onLoaded: () => void = null;
    public loadedOnConstruct = false;

    constructor() {
        super();
        if (this.skin) {
            this.loadedOnConstruct = true;
        } else {
            this.addEventListener(eui.UIEvent.COMPLETE, () => {
                this.onLoaded && this.onLoaded();
            }, this);
        }
    }
}