{"size": 2200, "ext": "js", "max_stars_repo_path": "node_modules/phaser3-rex-plugins/templates/avg/stage/Stage.js", "max_stars_repo_name": "SamueleDelMoro/ACTAM.Project2122-TraningGame", "max_stars_repo_stars_event_min_datetime": "2018-03-29T05:11:21.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T14:02:58.000Z", "max_issues_repo_path": "node_modules/phaser3-rex-plugins/templates/avg/stage/Stage.js", "max_issues_repo_name": "SamueleDelMoro/ACTAM.Project2122-TraningGame", "max_issues_repo_issues_event_min_datetime": "2018-07-20T07:39:24.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T23:08:01.000Z", "max_forks_repo_path": "node_modules/phaser3-rex-plugins/templates/avg/stage/Stage.js", "max_forks_repo_name": "SamueleDelMoro/ACTAM.Project2122-TraningGame", "max_forks_repo_forks_event_min_datetime": "2018-05-17T06:45:48.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-24T11:48:52.000Z"}
{"max_stars_count": 888, "max_issues_count": 194, "max_forks_count": 262, "avg_line_length": 23.6559139785, "max_line_length": 94, "alphanum_fraction": 0.5927272727}
import ContainerLite from '../../../plugins/gameobjects/containerlite/ContainerLite.js';
import SetBackground from './SetBackground.js';
import SetCharacter from './SetCharacter.js';
import GetCharacter from './GetCharacter.js';
import GetElement from './GetElement.js';

const Container = ContainerLite;
const IsPlainObject = Phaser.Utils.Objects.IsPlainObject;
const GetValue = Phaser.Utils.Objects.GetValue;

class Stage extends Container {
    constructor(scene, x, y, config) {
        if (IsPlainObject(x)) {
            config = x;
            x = GetValue(config, 'x', 0);
            y = GetValue(config, 'y', 0);
        }
        super(scene, x, y, 2, 2);
        this.setName(GetValue(config, 'name', ''));

        this.characterDepth = GetValue(config, 'depth.characher', -2);
        this.backgroundDepth = GetValue(config, 'depth.background', this.characterDepth - 10);

        this.childrenMap = {};
        this.childrenMap.background;
        this.childrenMap.characters = {};
    }

    get left() {
        return this.x - (this.displayWidth * this.originX);
    }

    set left(value) {
        this.x += (value - this.left);
    }

    alignLeft(value) {
        this.left = value;
        return this;
    }

    get right() {
        return (this.x - (this.displayWidth * this.originX)) + this.displayWidth;
    }

    set right(value) {
        this.x += (value - this.right);
    }

    alignRight(value) {
        this.right = value;
        return this;
    }

    get top() {
        return this.y - (this.displayHeight * this.originY);
    }

    set top(value) {
        this.y += (value - this.top);
    }

    alignTop(value) {
        this.top = value;
        return this;
    }

    get bottom() {
        return (this.y - (this.displayHeight * this.originY)) + this.displayHeight;
    }

    set bottom(value) {
        this.y += (value - this.bottom);
    }

    alignBottom(value) {
        this.bottom = value;
        return this;
    }
}

var methods = {
    setBackground: SetBackground,
    setCharacter: SetCharacter,
    getCharacter: GetCharacter,
    getElement: GetElement,
}

Object.assign(
    Stage.prototype,
    methods
);
export default Stage;