qs_phaser3_plugins
Version:
Collection of Phaser 3 plugins by Quinn & Sherry
44 lines (43 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var SelectGroup = /** @class */ (function () {
function SelectGroup(gameObjects, options) {
var _this = this;
this._gameObject = gameObjects;
this._options = options;
this._selected = null;
this._gameObject.forEach(function (obj) {
obj.setInteractive().on('pointerup', function () {
if (obj == _this._selected) {
_this.setUnselect(obj);
_this._selected = null;
}
else {
if (_this._selected != null) {
_this.setUnselect(_this._selected);
}
_this.setSelected(obj);
_this._selected = obj;
//this.emit('selected', this._selected);
}
});
});
}
SelectGroup.prototype.setSelected = function (gameObject) { };
SelectGroup.prototype.setUnselect = function (gameObject) { };
SelectGroup.prototype.setSelectAction = function (handler) {
this.setSelected = handler;
};
SelectGroup.prototype.setUnSelectAction = function (handler) {
this.setUnselect = handler;
};
Object.defineProperty(SelectGroup.prototype, "selected", {
get: function () {
return this._selected;
},
enumerable: true,
configurable: true
});
return SelectGroup;
}());
exports.default = SelectGroup;