@awayjs/scene
Version:
AwayJS scene classes
56 lines (55 loc) • 2.68 kB
JavaScript
import { __extends } from "tslib";
import { DefaultStageFactory } from '@awayjs/stage';
import { MethodMaterial } from '@awayjs/materials';
import { Timeline } from '../base/Timeline';
import { Billboard } from '../display/Billboard';
import { TextField } from '../display/TextField';
import { MovieClip } from '../display/MovieClip';
import { Sprite } from '../display/Sprite';
import { DisplayObjectContainer } from '../display/DisplayObjectContainer';
var DefaultSceneGraphFactory = /** @class */ (function (_super) {
__extends(DefaultSceneGraphFactory, _super);
function DefaultSceneGraphFactory() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.mapMatsForBitmaps = {};
_this.awaySymbols = {};
return _this;
}
DefaultSceneGraphFactory.prototype.createMovieClip = function (timeline, symbol) {
if (timeline === void 0) { timeline = null; }
if (symbol === void 0) { symbol = null; }
return new MovieClip(timeline || new Timeline(this));
};
DefaultSceneGraphFactory.prototype.createSprite = function (prefab, graphics, symbol) {
if (prefab === void 0) { prefab = null; }
if (graphics === void 0) { graphics = null; }
if (symbol === void 0) { symbol = null; }
if (prefab)
return prefab.getNewObject();
return new Sprite();
};
DefaultSceneGraphFactory.prototype.createDisplayObjectContainer = function (symbol) {
if (symbol === void 0) { symbol = null; }
return new DisplayObjectContainer();
};
DefaultSceneGraphFactory.prototype.createTextField = function (symbol) {
if (symbol === void 0) { symbol = null; }
return new TextField();
};
DefaultSceneGraphFactory.prototype.createBillboard = function (material, symbol) {
if (symbol === void 0) { symbol = null; }
return new Billboard(material);
};
DefaultSceneGraphFactory.prototype.createMaterial = function (imageColor, alpha, symbol) {
if (symbol === void 0) { symbol = null; }
return new MethodMaterial(imageColor, alpha);
};
DefaultSceneGraphFactory.prototype.createFrameScripts = function (scripts, frameIdx, objName, objID) {
throw ('[DefaultSceneGraphFactory] - createFrameScripts should be overwritten by AVM');
};
DefaultSceneGraphFactory.prototype.createChildInstanceForTimeline = function (timeline, symbolID, sessionID) {
throw ('[DefaultSceneGraphFactory] - createChildInstanceForTimeline should be overwritten by AVM');
};
return DefaultSceneGraphFactory;
}(DefaultStageFactory));
export { DefaultSceneGraphFactory };