Commit 6fd2ea06 authored by rockyl's avatar rockyl

提交一波

parent 5753aeeb
......@@ -30,6 +30,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
HashObject._object_id = 0;
return HashObject;
}());
//# sourceMappingURL=HashObject.js.map
var Event = (function (_super) {
tslib_1.__extends(Event, _super);
......@@ -90,6 +91,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Event.UPDATE_DATA = "UPDATE_DATA";
return Event;
}(HashObject));
//# sourceMappingURL=Event.js.map
var EventDispatcher = (function (_super) {
tslib_1.__extends(EventDispatcher, _super);
......@@ -293,6 +295,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return EE;
}());
//# sourceMappingURL=EventDispatcher.js.map
var ObservablePoint = (function (_super) {
tslib_1.__extends(ObservablePoint, _super);
......@@ -356,6 +359,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return ObservablePoint;
}(HashObject));
//# sourceMappingURL=ObservablePoint.js.map
var Point = (function (_super) {
tslib_1.__extends(Point, _super);
......@@ -392,6 +396,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Point;
}(HashObject));
//# sourceMappingURL=Point.js.map
var VERSION = "1.0";
var devicePixelRatio = window.devicePixelRatio ? window.devicePixelRatio : 1;
......@@ -554,6 +559,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
SCROLL_DIRECTION["HORIZONTAL"] = "horizontal";
SCROLL_DIRECTION["VERTICAL"] = "vertical";
})(exports.SCROLL_DIRECTION || (exports.SCROLL_DIRECTION = {}));
//# sourceMappingURL=const.js.map
var Matrix = (function (_super) {
tslib_1.__extends(Matrix, _super);
......@@ -824,6 +830,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Matrix;
}(HashObject));
//# sourceMappingURL=Matrix.js.map
var Transform = (function (_super) {
tslib_1.__extends(Transform, _super);
......@@ -931,6 +938,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Transform;
}(HashObject));
//# sourceMappingURL=Transform.js.map
var Rectangle = (function (_super) {
tslib_1.__extends(Rectangle, _super);
......@@ -1132,6 +1140,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Rectangle;
}(HashObject));
//# sourceMappingURL=Rectangle.js.map
var DisplayObject = (function (_super) {
tslib_1.__extends(DisplayObject, _super);
......@@ -1261,6 +1270,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var bounds = this.getBounds(false, rect);
this.parent = parentRef;
this.transform = transformRef;
if (this.parent && this.stage) {
this.updateTransform();
}
return bounds;
};
DisplayObject.prototype.calculateBounds = function () {
......@@ -1551,6 +1563,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}(EventDispatcher));
DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;
DisplayObject.prototype.displayObjectHitTestPoint = DisplayObject.prototype.hitTestPoint;
//# sourceMappingURL=DisplayObject.js.map
var GDispatcher = (function () {
function GDispatcher() {
......@@ -1598,6 +1611,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
GDispatcher.thisObjPool = {};
return GDispatcher;
}());
//# sourceMappingURL=GDispatcher.js.map
var MouseEvent = (function (_super) {
tslib_1.__extends(MouseEvent, _super);
......@@ -1630,6 +1644,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
MouseEvent.MOUSE_OUT = "onMouseOut";
return MouseEvent;
}(Event));
//# sourceMappingURL=MouseEvent.js.map
function applyAutoAdjust(ctor) {
ctor.prototype.applyAutoAdjust = function () {
......@@ -1759,6 +1774,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function t(v) {
return !isNaN(v) && v !== null && v !== undefined;
}
//# sourceMappingURL=auto-adjust.js.map
var ESCAPE_REG_EXP = /\$\{[\u4e00-\u9fa5_a-zA-Z0-9\|]+\}/g;
var linkedFlag = '$_linked_$';
......@@ -1776,7 +1792,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
function objClone(obj) {
return JSON.parse(JSON.stringify(obj));
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
}
var percentKeys = ['width', 'height'];
function propertyParse(key, node, properties) {
......@@ -2013,6 +2029,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
}
//# sourceMappingURL=utils.js.map
function transPoint(str, sep) {
if (sep === void 0) { sep = ','; }
......@@ -2024,6 +2041,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
}
}
//# sourceMappingURL=math.js.map
var rotateLeft = function (lValue, iShiftBits) {
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
......@@ -2215,6 +2233,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
return tempValue.toLowerCase();
}
//# sourceMappingURL=md5.js.map
var ObjectPool = (function () {
function ObjectPool() {
......@@ -2278,6 +2297,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
ObjectPool.pools = {};
return ObjectPool;
}());
//# sourceMappingURL=ObjectPool.js.map
var scriptDefs = {};
function applyScript(ctor) {
......@@ -2420,6 +2440,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return ScriptsProxy;
}());
//# sourceMappingURL=scripts.js.map
var DataCenter = (function (_super) {
tslib_1.__extends(DataCenter, _super);
......@@ -2548,6 +2569,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return DataCenter;
}(EventDispatcher));
var dataCenter = new DataCenter();
//# sourceMappingURL=data-center.js.map
var env = {};
function injectEnv(data) {
......@@ -2558,6 +2580,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
}
//# sourceMappingURL=enviroment.js.map
var storeKey = 'zlog-switch';
(function (Logs) {
......@@ -2575,6 +2598,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function getLogSwitch(id) {
return typeof store === 'object' ? store[id] : !!store;
}
//# sourceMappingURL=log-switch.js.map
var logConfig = getLogSwitch(exports.Logs.PROCESS);
function logProcess(meta, vm, process) {
......@@ -2641,10 +2665,11 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
Process.prototype.execute = function (args) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var metaConfig, meta, result, p, i, li, key, scriptResult, subProcessResult;
var payload, metaConfig, meta, result, p, i, li, key, scriptResult, subProcessResult;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
payload = objClone(args);
metaConfig = this._config.meta;
if (metaConfig) {
this._meta = meta = this.getProcessMeta(metaConfig);
......@@ -2661,7 +2686,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
case 1:
if (!(i < li)) return [3, 5];
key = meta.output[i];
p = this._executeNextProcess(key, args);
p = this._executeNextProcess(key, payload);
if (!(i === li - 1)) return [3, 3];
return [4, p];
case 2:
......@@ -2676,7 +2701,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
i++;
return [3, 1];
case 5: return [3, 12];
case 6: return [4, this._executeMetaScript('', args, metaConfig)];
case 6: return [4, this._executeMetaScript('', payload, metaConfig)];
case 7:
scriptResult = _a.sent();
subProcessResult = void 0;
......@@ -2871,6 +2896,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function warpAsyncScript(source) {
return "return new Promise(function(resolve, reject){\n\t" + source + "\n\t\n\tfunction next(type, payload){resolve({type: type, payload: payload})}\n\t});";
}
//# sourceMappingURL=Process.js.map
var ID_INK = 0;
var VM = (function () {
......@@ -2933,6 +2959,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
});
return VM;
}());
//# sourceMappingURL=VM.js.map
var log = getLogSwitch(exports.Logs.PROCESS);
var processMetaLibs = [];
......@@ -2972,11 +2999,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
.then(function (result) {
return result;
}, function (e) {
if (log) {
console.log("[" + vm.id + "] terminate:", e);
}
console.log("[" + vm.id + "] terminate:", e);
});
}
//# sourceMappingURL=index.js.map
var _a;
var eventsMapping = (_a = {},
......@@ -3075,6 +3101,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return EventsProxy;
}(HashObject));
//# sourceMappingURL=events.js.map
function afterConstructor(ctor) {
ctor.prototype.afterConstructor = function () {
......@@ -3083,6 +3110,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this.applyEvents();
};
}
//# sourceMappingURL=after-constructor.js.map
var Container = (function (_super) {
tslib_1.__extends(Container, _super);
......@@ -3375,24 +3403,27 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Rectangle.createFromRects(this._bounds, child._bounds);
}
}
};
Container.prototype._calculateBounds = function () {
var widthSetted = !!this._width && this._width !== 0;
var heightSetted = !!this._height && this._height !== 0;
if (widthSetted) {
this._bounds.width = this._width;
if (widthSetted || heightSetted) {
var rect = this._localBoundsSelf;
var matrix = this.transform.worldMatrix;
matrix.transformPoint(rect.x, rect.y, DisplayObject._p1);
matrix.transformPoint(rect.x + rect.width, rect.y, DisplayObject._p2);
matrix.transformPoint(rect.x + rect.width, rect.y + rect.height, DisplayObject._p3);
matrix.transformPoint(rect.x, rect.y + rect.height, DisplayObject._p4);
Rectangle.createFromPoints(this._bounds, DisplayObject._p1, DisplayObject._p2, DisplayObject._p3, DisplayObject._p4);
}
if (heightSetted) {
this._bounds.height = this._height;
}
};
Container.prototype._calculateBounds = function () {
};
Container.prototype.hitTestPoint = function (globalPoint, isMouseEvent) {
if (isMouseEvent === void 0) { isMouseEvent = false; }
if (!this.visible)
return null;
var result = this.hitTestSelf(globalPoint);
if (isMouseEvent && !this.mouseChildren)
return result;
if (isMouseEvent && !this.mouseChildren) {
return this.hitTestSelf(globalPoint);
}
var children = this.children;
var length = children.length;
var child, hitDisplayObject;
......@@ -3406,7 +3437,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (hitDisplayObject)
return hitDisplayObject;
}
return this.hitTestSelf(globalPoint);
return this.displayObjectHitTestPoint(globalPoint, isMouseEvent);
};
Container.prototype.hitTestSelf = function (globalPoint) {
if (this.mouseEnabled) {
......@@ -3415,8 +3446,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return null;
};
Container.prototype.hitTestSelfBounds = function (globalPoint) {
if (this.width && this.height) {
var _a = this.getBounds(), tx = _a.x, ty = _a.y;
if (this._width && this._height) {
var _a = this.worldMatrix, tx = _a.tx, ty = _a.ty;
var x = globalPoint.x, y = globalPoint.y;
if (x > tx &&
x < tx + this.width &&
......@@ -3507,6 +3538,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
set: function (value) {
if (this._width !== value) {
this._width = value;
this._localBoundsSelf.width = value;
this.dispatchEvent(Event.RESIZE);
}
},
......@@ -3520,6 +3552,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
set: function (value) {
if (this._height !== value) {
this._height = value;
this._localBoundsSelf.height = value;
this.dispatchEvent(Event.RESIZE);
}
},
......@@ -3605,6 +3638,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return Container;
}(DisplayObject));
Container.prototype.containerUpdateTransform = Container.prototype.updateTransform;
//# sourceMappingURL=Container.js.map
var container;
var el$1;
......@@ -3772,6 +3806,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return FloatDisplay;
}(DisplayObject));
//# sourceMappingURL=FloatDisplay.js.map
var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];
var uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];
......@@ -3870,6 +3905,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
matrix.append(mat);
},
};
//# sourceMappingURL=GroupD8.js.map
var INT_BITS = 32;
var INT_BITS1 = 32;
......@@ -4025,6 +4061,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var t = v | (v - 1);
return (t + 1) | (((~t & -~t) - 1) >>> (countTrailingZeros(v) + 1));
}
//# sourceMappingURL=twiddle.js.map
var tempMatrix = new Matrix();
var SystemRenderer = (function (_super) {
......@@ -4080,6 +4117,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
});
return SystemRenderer;
}(EventDispatcher));
//# sourceMappingURL=SystemRenderer.js.map
var CanvasGraphicsRenderer = (function () {
function CanvasGraphicsRenderer(renderer) {
......@@ -4313,6 +4351,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
sum = sum + vector[vector.length - 2] * vector[1] - vector[vector.length - 1] * vector[0];
return !(sum > 0);
}
//# sourceMappingURL=CanvasGraphicsRenderer.js.map
var CanvasMaskManager = (function (_super) {
tslib_1.__extends(CanvasMaskManager, _super);
......@@ -4411,6 +4450,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return CanvasMaskManager;
}(HashObject));
//# sourceMappingURL=CanvasMaskManager.js.map
var CanvasRenderTarget = (function () {
function CanvasRenderTarget(width, height) {
......@@ -4452,6 +4492,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
});
return CanvasRenderTarget;
}());
//# sourceMappingURL=CanvasRenderTarget.js.map
var canvasRenderWorldTransform = new Matrix();
var CanvasSpriteRenderer = (function () {
......@@ -4507,6 +4548,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return CanvasSpriteRenderer;
}());
//# sourceMappingURL=CanvasSpriteRenderer.js.map
var CanvasRenderer = (function (_super) {
tslib_1.__extends(CanvasRenderer, _super);
......@@ -4624,6 +4666,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return CanvasRenderer;
}(SystemRenderer));
//# sourceMappingURL=CanvasRenderer.js.map
var _dRender = null;
var tempMatrix$1 = new Matrix();
......@@ -4664,6 +4707,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_dRender.render(obj, null, tempMatrix$1);
return _dRender.htmlElement.toDataURL("image/" + typeInfo.type, typeInfo.quality);
}
//# sourceMappingURL=toDisplayDataURL.js.map
function determineCrossOrigin(url, loc) {
if (loc === void 0) { loc = window.location; }
......@@ -4672,6 +4716,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return 'anonymous';
}
//# sourceMappingURL=determineCrossOrigin.js.map
var BaseTexture = (function (_super) {
tslib_1.__extends(BaseTexture, _super);
......@@ -4892,6 +4937,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return BaseTexture;
}(EventDispatcher));
//# sourceMappingURL=BaseTexture.js.map
var TextureUvs = (function () {
function TextureUvs() {
......@@ -4952,6 +4998,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return TextureUvs;
}());
//# sourceMappingURL=TextureUvs.js.map
var Texture = (function (_super) {
tslib_1.__extends(Texture, _super);
......@@ -5195,6 +5242,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Texture.WHITE = createWhiteTexture();
removeAllHandlers(Texture.WHITE);
removeAllHandlers(Texture.WHITE.baseTexture);
//# sourceMappingURL=Texture.js.map
var padding = 2;
function DrawAllToCanvas(images, callback) {
......@@ -5335,6 +5383,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return imageInfo;
}());
//# sourceMappingURL=DrawAllToCanvas.js.map
var nextUid = 0;
function uid() {
......@@ -5493,7 +5542,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
startTime: 0
};
function isWebGLSupported() {
var contextOptions = { stencil: true, failIfMajorPerformanceCaveat: true };
var contextOptions = { stencil: true };
try {
if (!window["WebGLRenderingContext"]) {
return false;
......@@ -5550,6 +5599,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
array[exports.BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_COLOR];
return array;
}
//# sourceMappingURL=index.js.map
var indices = new Uint16Array([0, 1, 2, 0, 2, 3]);
var Sprite = (function (_super) {
......@@ -5819,6 +5869,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Sprite;
}(Container));
//# sourceMappingURL=Sprite.js.map
var BatchDrawCall = (function () {
function BatchDrawCall() {
......@@ -5830,6 +5881,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return BatchDrawCall;
}());
//# sourceMappingURL=BatchDrawCall.js.map
var ObjectRenderer = (function () {
function ObjectRenderer(renderer) {
......@@ -5854,6 +5906,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return ObjectRenderer;
}());
//# sourceMappingURL=ObjectRenderer.js.map
function createContext(canvas, options) {
var gl = canvas.getContext('webgl', options) ||
......@@ -5863,6 +5916,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return gl;
}
//# sourceMappingURL=createContext.js.map
var fragTemplate = [
'precision mediump float;',
......@@ -5914,6 +5968,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return src;
}
//# sourceMappingURL=checkMaxIfStatementsInShader.js.map
var BatchBuffer = (function () {
function BatchBuffer(size) {
......@@ -5929,6 +5984,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return BatchBuffer;
}());
//# sourceMappingURL=BatchBuffer.js.map
var GLTexture = (function () {
function GLTexture(gl, width, height, format, type) {
......@@ -6060,6 +6116,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return GLTexture;
}());
var FLOATING_POINT_AVAILABLE = false;
//# sourceMappingURL=GLTexture.js.map
var EMPTY_ARRAY_BUFFER = new ArrayBuffer(0);
var GLBuffer = (function () {
......@@ -6106,6 +6163,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return GLBuffer;
}());
//# sourceMappingURL=GLBuffer.js.map
function setVertexAttribArrays(gl, attribs, state) {
var i;
......@@ -6136,6 +6194,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
}
//# sourceMappingURL=setVertexAttribArrays.js.map
var VertexArrayObject = (function () {
function VertexArrayObject(gl, state) {
......@@ -6253,6 +6312,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
VertexArrayObject.FORCE_NATIVE = false;
return VertexArrayObject;
}());
//# sourceMappingURL=VertexArrayObject.js.map
var GLFramebuffer = (function () {
function GLFramebuffer(gl, width, height) {
......@@ -6335,6 +6395,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return GLFramebuffer;
}());
//# sourceMappingURL=GLFramebuffer.js.map
function compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations) {
var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);
......@@ -6372,6 +6433,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return shader;
};
//# sourceMappingURL=compileProgram.js.map
function mapType(gl, type) {
if (!GL_TABLE) {
......@@ -6403,6 +6465,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
'FLOAT_MAT4': 'mat4',
'SAMPLER_2D': 'sampler2D'
};
//# sourceMappingURL=mapType.js.map
function mapSize(type) {
return GLSL_TO_SIZE[type];
......@@ -6425,6 +6488,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
'mat4': 16,
'sampler2D': 1
};
//# sourceMappingURL=mapSize.js.map
function extractAttributes(gl, program) {
var attributes = {};
......@@ -6447,6 +6511,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return attributes;
}
//# sourceMappingURL=extractAttributes.js.map
function defaultValue(type, size) {
switch (type) {
......@@ -6496,6 +6561,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return array;
};
//# sourceMappingURL=defaultValue.js.map
function extractUniforms(gl, program) {
var uniforms = {};
......@@ -6513,6 +6579,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return uniforms;
}
//# sourceMappingURL=extractUniforms.js.map
function setPrecision(src, precision) {
if (src.substring(0, 9) !== 'precision') {
......@@ -6520,6 +6587,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return src;
}
//# sourceMappingURL=setPrecision.js.map
function generateUniformAccessObject(gl, uniformData) {
var uniforms = { data: {} };
......@@ -6657,6 +6725,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return cur;
}
//# sourceMappingURL=generateUniformAccessObject.js.map
var GLShader = (function () {
function GLShader(gl, vertexSrc, fragmentSrc, precision, attributeLocations) {
......@@ -6683,6 +6752,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return GLShader;
}());
//# sourceMappingURL=GLShader.js.map
var VSHADER_SOURCE = "precision highp float;" +
"attribute vec2 aVertexPosition;" +
......@@ -6744,6 +6814,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
src += '\n';
return src;
}
//# sourceMappingURL=generateMultiTextureShader.js.map
var TICK = 0;
var BatchRenderer = (function (_super) {
......@@ -6967,6 +7038,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return BatchRenderer;
}(ObjectRenderer));
//# sourceMappingURL=BatchRenderer.js.map
var RenderTarget = (function () {
function RenderTarget(gl, width, height, scaleMode, root) {
......@@ -7073,6 +7145,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return RenderTarget;
}());
//# sourceMappingURL=RenderTarget.js.map
var TextureManager = (function () {
function TextureManager(renderer) {
......@@ -7274,6 +7347,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return TextureManager;
}());
//# sourceMappingURL=TextureManager.js.map
var TextureGarbageCollector = (function () {
function TextureGarbageCollector(renderer) {
......@@ -7328,6 +7402,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return TextureGarbageCollector;
}());
//# sourceMappingURL=TextureGarbageCollector.js.map
var BLEND = 0;
var DEPTH_TEST = 1;
......@@ -7430,6 +7505,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return WebGLState;
}());
//# sourceMappingURL=WebGLState.js.map
var BatchManager = (function () {
function BatchManager(renderer) {
......@@ -7453,6 +7529,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return BatchManager;
}());
//# sourceMappingURL=BatchManager.js.map
var MaskManager = (function () {
function MaskManager(renderer) {
......@@ -7501,6 +7578,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return MaskManager;
}());
//# sourceMappingURL=MaskManager.js.map
var StencilManager = (function () {
function StencilManager(renderer) {
......@@ -7573,6 +7651,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return StencilManager;
}());
//# sourceMappingURL=StencilManager.js.map
var CONTEXT_UID = 0;
var WebglRenderer = (function (_super) {
......@@ -7785,6 +7864,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return WebglRenderer;
}(SystemRenderer));
WebglRenderer.registerPlugin('batch', BatchRenderer);
//# sourceMappingURL=WebglRenderer.js.map
var requestAnimationFrame = (function () {
var lastTime = 0;
......@@ -8387,6 +8467,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Stage.allUpdateObjList = [];
return Stage;
}(Container));
//# sourceMappingURL=Stage.js.map
var GraphicsData = (function (_super) {
tslib_1.__extends(GraphicsData, _super);
......@@ -8419,6 +8500,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return GraphicsData;
}(HashObject));
//# sourceMappingURL=GraphicsData.js.map
var BaseRenderTexture = (function (_super) {
tslib_1.__extends(BaseRenderTexture, _super);
......@@ -8455,6 +8537,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return BaseRenderTexture;
}(BaseTexture));
//# sourceMappingURL=BaseRenderTexture.js.map
var RenderTexture = (function (_super) {
tslib_1.__extends(RenderTexture, _super);
......@@ -8482,6 +8565,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return RenderTexture;
}(Texture));
//# sourceMappingURL=RenderTexture.js.map
var Circle = (function () {
function Circle(x, y, radius) {
......@@ -8512,6 +8596,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Circle;
}());
//# sourceMappingURL=Circle.js.map
var Ellipse = (function () {
function Ellipse(x, y, width, height) {
......@@ -8543,6 +8628,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Ellipse;
}());
//# sourceMappingURL=Ellipse.js.map
var Polygon = (function () {
function Polygon() {
......@@ -8592,6 +8678,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Polygon;
}());
//# sourceMappingURL=Polygon.js.map
var RoundedRectangle = (function () {
function RoundedRectangle(x, y, width, height, radius) {
......@@ -8649,6 +8736,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return RoundedRectangle;
}());
//# sourceMappingURL=RoundedRectangle.js.map
function earcut(data, holeIndices, dim) {
dim = dim || 2;
......@@ -9110,6 +9198,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return result;
};
//# sourceMappingURL=earcut.js.map
var buildPoly = {
build: function (graphicsData) {
......@@ -9143,6 +9232,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
},
};
//# sourceMappingURL=buildPoly.js.map
var buildCircle = {
build: function (graphicsData) {
......@@ -9186,6 +9276,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
},
};
//# sourceMappingURL=buildCircle.js.map
var buildRectangle = {
build: function (graphicsData) {
......@@ -9206,6 +9297,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
graphics.indices.push(vertPos, vertPos + 1, vertPos + 2, vertPos + 1, vertPos + 2, vertPos + 3);
},
};
//# sourceMappingURL=buildRectangle.js.map
var buildRoundedRectangle = {
build: function (graphicsData) {
......@@ -9265,6 +9357,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return points;
}
//# sourceMappingURL=buildRoundedRectangle.js.map
function buildLine (graphicsData, graphicsGeometry) {
buildLine$1(graphicsData, graphicsGeometry);
......@@ -9393,6 +9486,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
indexStart++;
}
}
//# sourceMappingURL=buildLine.js.map
var FillStyle = (function () {
function FillStyle() {
......@@ -9422,6 +9516,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return FillStyle;
}());
//# sourceMappingURL=FillStyle.js.map
var LineStyle = (function (_super) {
tslib_1.__extends(LineStyle, _super);
......@@ -9449,6 +9544,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return LineStyle;
}(FillStyle));
//# sourceMappingURL=LineStyle.js.map
function bezierCurveTo(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY, n, path) {
if (path === void 0) { path = []; }
......@@ -9469,6 +9565,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return path;
}
//# sourceMappingURL=bezierCurveTo.js.map
var GRAPHICS_CURVES = {
adaptive: false,
......@@ -9540,6 +9637,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return result;
}
//# sourceMappingURL=index.js.map
var canvasRenderer;
var tempMatrix$2 = new Matrix();
......@@ -10427,6 +10525,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return geoBatchPart;
}());
//# sourceMappingURL=Graphics.js.map
var Shape = (function (_super) {
tslib_1.__extends(Shape, _super);
......@@ -10900,6 +10999,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Shape;
}(Sprite));
//# sourceMappingURL=Shape.js.map
var TextureSheet = (function () {
function TextureSheet(baseTexture, data) {
......@@ -10975,10 +11075,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return TextureSheet;
}());
//# sourceMappingURL=TextureSheet.js.map
function getTexture(str) {
return TextureCache[str] || null;
}
//# sourceMappingURL=index.js.map
var queryParams = {};
var search = window.location.search;
......@@ -10992,28 +11094,25 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var arr = item.split('=');
queryParams[arr[0]] = arr.length === 1 ? true : arr[1];
}
if (queryParams.appID) {
env.appID = queryParams.appID;
}
if (queryParams.channelType) {
env.channelType = queryParams.channelType;
}
if (queryParams.projectID) {
env.projectID = queryParams.projectID;
}
else if (window.location.pathname.match(new RegExp("/projectx/(\\S+)/index(\\S+)", "g"))) {
env.projectID = window.location.pathname.replace(new RegExp("/projectx/(\\S+)/index(\\S+)", "g"), "$1");
}
exports.newUser = true;
var key = 'nu_' + env.appID + '_' + env.projectID;
var v = localStorage.getItem(key);
if (v) {
exports.newUser = false;
}
else {
localStorage.setItem(key, '1');
function appendScript(script, parent) {
if (parent === void 0) { parent = document.body; }
if (!script) {
return;
}
var scriptContent;
if (script.indexOf('<script') === 0) {
var temp = document.createElement('div');
temp.innerHTML = script;
scriptContent = temp.children[0].innerHTML;
}
else {
scriptContent = script;
}
var scriptEl = document.createElement('script');
scriptEl.innerHTML = scriptContent;
parent.appendChild(scriptEl);
}
console.log(exports.newUser);
//# sourceMappingURL=web.js.map
function httpRequest(url, method, params, type, headers) {
if (method === void 0) { method = 'get'; }
......@@ -11182,6 +11281,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}, false);
}
//# sourceMappingURL=net.js.map
function createTextureSheet(baseTexture, altaData) {
var frames = altaData;
......@@ -11207,6 +11307,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
frameIndex++;
}
}
//# sourceMappingURL=texture-sheet.js.map
var prefix = 'font-';
var fonts = {};
......@@ -11242,6 +11343,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function getFont(name) {
return fonts[name];
}
//# sourceMappingURL=bmp-text-manager.js.map
var assetsConfig = [];
var loaderMapping = {
......@@ -11257,7 +11359,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
'.mp3': 'Sound',
'': 'Raw',
};
function loadAssetGroup(config, onProgress, onComplete) {
function loadAssets(config, onProgress, onComplete) {
var total = config.length;
var loaded = 0;
var failedList = [];
......@@ -11333,6 +11435,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
}
//# sourceMappingURL=assets-manager.js.map
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
......@@ -14548,6 +14651,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
keep: true,
};
}
//# sourceMappingURL=sound.js.map
var Loader = (function (_super) {
tslib_1.__extends(Loader, _super);
......@@ -14634,8 +14738,15 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return Loader;
}(EventDispatcher));
var globalLoader = new Loader();
//# sourceMappingURL=Loader.js.map
var padding$1 = 10;
var styleFields = {
color: 'fillStyle',
stroke: 'lineWidth',
strokeColor: 'strokeStyle',
font: 'font',
};
var TextField = (function (_super) {
tslib_1.__extends(TextField, _super);
function TextField() {
......@@ -14643,10 +14754,11 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_this._textAlpha = 1;
_this._textAlign = exports.TEXT_ALIGN.LEFT;
_this._verticalAlign = exports.VERTICAL_ALIGN.UP;
_this._lineSpacing = 14;
_this._lineSpacing = 0;
_this._lineType = exports.TEXT_lINETYPE.SINGLE;
_this._text = "";
_this._pureText = '';
_this._styleCache = [];
_this._font = "Arial";
_this._size = 12;
_this._fillColor = "#000";
......@@ -14792,6 +14904,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
set: function (value) {
this._textFlow = value;
this.dirty = true;
this._styleCache.splice(0);
var text = '';
for (var _i = 0, _a = this._textFlow; _i < _a.length; _i++) {
var item = _a[_i];
......@@ -14820,6 +14933,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (!this.textFlow) {
return null;
}
if (this._styleCache[index]) {
return this._styleCache[index];
}
var targetItem;
var count = 0;
for (var _i = 0, _a = this._textFlow; _i < _a.length; _i++) {
......@@ -14830,6 +14946,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
break;
}
}
if (targetItem && targetItem.style) {
this._styleCache[index] = targetItem.style;
}
return targetItem.style;
};
Object.defineProperty(TextField.prototype, "font", {
......@@ -14936,20 +15055,23 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
enumerable: true,
configurable: true
});
TextField.prototype._setupFont = function (font, size, bold, italic) {
var fontStyle = size;
fontStyle += "px ";
fontStyle += font;
if (bold) {
fontStyle = "bold " + fontStyle;
}
if (italic) {
fontStyle = "italic " + fontStyle;
}
return fontStyle;
};
TextField.prototype._prepContext = function (ctx) {
var s = this;
var font = s.size || 12;
font += "px ";
font += s.font;
if (s._bold) {
font = "bold " + font;
}
if (s._italic) {
font = "italic " + font;
}
ctx.font = font;
ctx.textAlign = s._textAlign || exports.TEXT_ALIGN.LEFT;
ctx.textBaseline = "top";
ctx.font = this._setupFont(s._font, s._size, s._bold, s._italic);
ctx.textAlign = s.isPureText ? (s._textAlign || exports.TEXT_ALIGN.LEFT) : exports.TEXT_ALIGN.LEFT;
ctx.textBaseline = s.isPureText ? 'top' : 'bottom';
if (typeof (s._fillColor) == "number")
s._fillColor = hex2string(s._fillColor);
ctx.fillStyle = s._textAlpha === 1 ? s._fillColor : getRGBA(s._fillColor, s._textAlpha);
......@@ -14969,18 +15091,30 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
enumerable: true,
configurable: true
});
TextField.prototype._getMeasuredWidth = function (text) {
TextField.prototype._getMeasuredWidth = function (text, style) {
var ctx = this.context;
ctx.save();
if (style && style.font) {
ctx.font = style.font;
}
var w = ctx.measureText(text).width;
ctx.restore();
return w;
};
TextField.prototype._getFontSize = function (style) {
if (style && style.font) {
return parseInt(style.font);
}
};
TextField.prototype.updateText = function () {
var s = this;
var text = s.pureText;
if (!text) {
s.canvas.width = 0;
s.canvas.height = 0;
s._localBoundsSelf.clear();
if (!this._width && !this._height) {
s._localBoundsSelf.clear();
}
this.anchorTexture = { x: 0, y: 0 };
this.updateTexture();
return;
......@@ -14989,15 +15123,18 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (!s.dirty)
return;
s.dirty = false;
var isPureText = s.isPureText;
text += "";
var can = s.canvas;
var ctx = s.context;
var hardLines = text.toString().split(/(?:\r\n|\r|\n)/);
var realLines = [];
var lineWidths = [];
var lineHeights = [];
s.realLines = realLines;
s._prepContext(ctx);
var textWidth = s._width;
if (text.indexOf("\n") < 0 && s.lineType == exports.TEXT_lINETYPE.SINGLE) {
if (isPureText && text.indexOf("\n") < 0 && s.lineType == exports.TEXT_lINETYPE.SINGLE) {
realLines[realLines.length] = hardLines[0];
var str = hardLines[0];
var lineW = s._getMeasuredWidth(str);
......@@ -15022,6 +15159,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
else {
var shouldMeasureTextWidth = !textWidth;
var index_1 = 0;
for (var i = 0, l = hardLines.length; i < l; i++) {
var str = hardLines[i];
if (!str)
......@@ -15029,49 +15167,71 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var lineWidth = 0;
for (var _i = 0, str_1 = str; _i < str_1.length; _i++) {
var char = str_1[_i];
var charWidth = measureChar(char);
var charWidth = measureChar(char, index_1);
lineWidth += charWidth;
index_1++;
}
if (shouldMeasureTextWidth) {
textWidth = Math.max(lineWidth, textWidth);
}
}
index_1 = 0;
for (var i = 0, l = hardLines.length; i < l; i++) {
var str = hardLines[i];
if (!str)
continue;
var w = measureCache[str[0]];
var w = measureChar(str[0], index_1++);
var lineStr = str[0];
var wordW = 0;
var strLen = str.length;
var lineHeight = 0;
for (var j = 1; j < strLen; j++) {
wordW = measureCache[str[j]];
wordW = measureChar(str[j], index_1);
w += wordW;
if (w > textWidth) {
realLines[realLines.length] = lineStr;
lineWidths.push(w - wordW);
lineHeights.push(lineHeight || s.size);
lineStr = str[j];
w = wordW;
lineHeight = 0;
}
else {
lineStr += str[j];
}
var style = this.getStyle(index_1);
var size = this._getFontSize(style);
if (size) {
if (size > lineHeight) {
lineHeight = size;
}
}
index_1++;
}
realLines[realLines.length] = lineStr;
lineWidths.push(w);
lineHeights.push(lineHeight || s.size);
}
}
var trueHeight = s.size * realLines.length + s._lineSpacing * (realLines.length - 1);
var maxH = s._height || trueHeight;
var maxW = textWidth;
var tx = 0;
if (s._textAlign == exports.TEXT_ALIGN.CENTER) {
tx = maxW * 0.5;
var maxH, trueHeight;
if (isPureText) {
trueHeight = s.size * realLines.length + s._lineSpacing * (realLines.length - 1);
}
else if (s._textAlign == exports.TEXT_ALIGN.RIGHT) {
tx = maxW;
else {
trueHeight = lineHeights.reduce(function (a, b) {
return a + b;
}, 0) + s._lineSpacing * (realLines.length - 1);
}
if (s._height) {
maxH = s._height;
}
else {
maxH = trueHeight;
}
var maxW = textWidth;
can.width = maxW + padding$1 * 2;
can.height = maxH + padding$1 * 2;
ctx.clearRect(0, 0, can.width, can.width);
ctx.clearRect(0, 0, can.width, can.height);
if (s.border) {
ctx.beginPath();
ctx.strokeStyle = "#000";
......@@ -15079,6 +15239,15 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
ctx.strokeRect(padding$1 + 0.5, padding$1 + 0.5, maxW, maxH);
ctx.closePath();
}
var tx = 0;
if (isPureText) {
if (s._textAlign == exports.TEXT_ALIGN.CENTER) {
tx = maxW * 0.5;
}
else if (s._textAlign == exports.TEXT_ALIGN.RIGHT) {
tx = maxW;
}
}
ctx.setTransform(1, 0, 0, 1, tx + padding$1, padding$1);
s._prepContext(ctx);
var lineH = s._lineSpacing + s.size;
......@@ -15092,9 +15261,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
var index = 0;
var lineY = upY;
for (var i = 0; i < realLines.length; i++) {
var line = realLines[i];
if (s.isPureText) {
if (isPureText) {
var y = upY + i * lineH;
if (s.stroke) {
ctx.strokeStyle = s.strokeColor;
......@@ -15104,38 +15274,37 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
ctx.fillText(line, 0, y, maxW);
}
else {
var lineWidth = 0;
for (var _a = 0, line_1 = line; _a < line_1.length; _a++) {
var char = line_1[_a];
var charWidth = measureChar(char);
lineWidth += charWidth;
var lineWidth = lineWidths[i];
var lineHeight = lineHeights[i];
lineY += s._lineSpacing + lineHeight;
var x = 0;
if (s._textAlign == exports.TEXT_ALIGN.CENTER) {
x = (maxW - lineWidth) * 0.5;
}
else if (s._textAlign == exports.TEXT_ALIGN.RIGHT) {
x = maxW - lineWidth;
}
var x = -lineWidth / 2;
for (var j = 0, lj = line.length; j < lj; j++) {
var char = line[j];
var style = s.getStyle(index);
if (style) {
if (style.hasOwnProperty('color')) {
ctx.fillStyle = style.color;
}
if (style.hasOwnProperty('stroke')) {
ctx.lineWidth = style.stroke * 2;
}
if (style.hasOwnProperty('strokeColor')) {
ctx.strokeStyle = style.strokeColor;
ctx.save();
for (var field in styleFields) {
if (style.hasOwnProperty(field)) {
ctx[styleFields[field]] = style[field];
}
}
}
else {
ctx.fillStyle = s.fillColor;
ctx.lineWidth = s.stroke;
if (s.stroke) {
ctx.strokeStyle = s.strokeColor;
ctx.lineWidth = s.stroke * 2;
ctx.strokeText(char, x, lineY);
}
var y = upY + i * lineH;
if (ctx.lineWidth > 0) {
ctx.strokeText(char, x, y);
ctx.fillText(char, x, lineY);
if (style) {
ctx.restore();
}
ctx.fillText(char, x, y);
x += measureChar(char);
x += measureChar(char, index);
index++;
}
}
......@@ -15146,10 +15315,18 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s._localBoundsSelf.width = maxW;
s._localBoundsSelf.height = maxH;
s.updateTexture();
function measureChar(char) {
var w = measureCache[char];
function measureChar(char, index) {
var key = char + ':';
var style;
if (!isPureText && index !== undefined) {
style = s.getStyle(index);
if (style && style.font) {
key += style.font;
}
}
var w = measureCache[key];
if (w === undefined) {
w = measureCache[char] = s._getMeasuredWidth(char);
w = measureCache[char] = s._getMeasuredWidth(char, style);
}
return w;
}
......@@ -15181,6 +15358,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return TextField;
}(Sprite));
//# sourceMappingURL=TextField.js.map
var InputText = (function (_super) {
tslib_1.__extends(InputText, _super);
......@@ -15378,6 +15556,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
InputText._inputTypeList = ["input", "password", "textarea"];
return InputText;
}(FloatDisplay));
//# sourceMappingURL=InputText.js.map
var EditableText = (function (_super) {
tslib_1.__extends(EditableText, _super);
......@@ -15479,6 +15658,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
});
return EditableText;
}(TextField));
//# sourceMappingURL=EditableText.js.map
var ScrollViewBase = (function (_super) {
tslib_1.__extends(ScrollViewBase, _super);
......@@ -15604,7 +15784,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
configurable: true
});
ScrollViewBase.prototype.calMaxDistance = function () {
return this.viewPort[this.paramSize];
return this.viewPort[this.paramSize] + this.viewPort.getLocalBounds()[this.paramXY];
};
Object.defineProperty(ScrollViewBase.prototype, "direction", {
get: function () {
......@@ -15735,6 +15915,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return ScrollViewBase;
}(Container));
//# sourceMappingURL=ScrollViewBase.js.map
function fieldChanged(onModify) {
return function (target, key) {
......@@ -15777,6 +15958,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
});
//# sourceMappingURL=decorators.js.map
var ScrollListItemBase = (function (_super) {
tslib_1.__extends(ScrollListItemBase, _super);
......@@ -15975,6 +16157,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
], ScrollListBase.prototype, "itemClass", void 0);
return ScrollListBase;
}(ScrollViewBase));
//# sourceMappingURL=ScrollListBase.js.map
var Tween = (function () {
function Tween(target, props, pluginData) {
......@@ -16380,6 +16563,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Tween._lastTime = 0;
return Tween;
}());
//# sourceMappingURL=Tween.js.map
var Ease = (function () {
function Ease() {
......@@ -16526,6 +16710,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Ease.elasticInOut = Ease.getElasticInOut(1, 0.3 * 1.5);
return Ease;
}());
//# sourceMappingURL=Ease.js.map
var Node$1 = (function (_super) {
tslib_1.__extends(Node, _super);
......@@ -16536,6 +16721,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return Node;
}(Container));
//# sourceMappingURL=Node.js.map
var StackContainer = (function (_super) {
tslib_1.__extends(StackContainer, _super);
......@@ -16568,7 +16754,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
StackContainer.prototype.pop = function (dispatch) {
if (dispatch === void 0) { dispatch = true; }
var len = this.children.length;
if (len <= 1) {
if (len <= 0) {
return false;
}
this.removeChildAt(len - 1);
......@@ -16592,6 +16778,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return StackContainer;
}(Node$1));
//# sourceMappingURL=StackContainer.js.map
var colorName = {
"aliceblue": [240, 248, 255],
......@@ -18786,6 +18973,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Circle;
}(ShapeBase));
//# sourceMappingURL=shapes.js.map
var assetScheme = 'asset://';
var Image$1 = (function (_super) {
......@@ -18793,6 +18981,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function Image() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.isUI = true;
_this.crossOrigin = true;
_this._escapes = [];
_this._registeredEvents = [];
return _this;
......@@ -18823,7 +19012,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
url = assetConfig.uuid;
}
}
this.texture = Texture.fromImage(url);
this.texture = Texture.fromImage(url, this.crossOrigin);
}
else {
this.texture = null;
......@@ -18874,6 +19063,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Image;
}(Sprite));
//# sourceMappingURL=Image.js.map
var Label = (function (_super) {
tslib_1.__extends(Label, _super);
......@@ -18950,6 +19140,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Label;
}(TextField));
//# sourceMappingURL=Label.js.map
var timer;
function delayScrollTop() {
......@@ -19141,7 +19332,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
TextInput.prototype.onClickStatic = function () {
this.setFocus();
this.stage.once(MouseEvent.CLICK, this.onClickStage, this);
this.stage.once(MouseEvent.MOUSE_DOWN, this.onClickStage, this);
};
TextInput.prototype.onResize = function () {
var pl = this._placeholderLabel;
......@@ -19186,6 +19377,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
], TextInput.prototype, "charRegStr", void 0);
return TextInput;
}(Label));
//# sourceMappingURL=TextInput.js.map
var proxyMethods = [
'onChildrenChange',
......@@ -19213,6 +19405,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return ScrollView;
}(ScrollViewBase));
//# sourceMappingURL=ScrollView.js.map
var ScrollListItem = (function (_super) {
tslib_1.__extends(ScrollListItem, _super);
......@@ -19255,6 +19448,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return ScrollList;
}(ScrollListBase));
//# sourceMappingURL=ScrollList.js.map
var BitmapText = (function (_super) {
tslib_1.__extends(BitmapText, _super);
......@@ -19351,6 +19545,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
], BitmapText.prototype, "letterSpacing", void 0);
return BitmapText;
}(Container));
//# sourceMappingURL=BitmapText.js.map
var HtmlView = (function (_super) {
tslib_1.__extends(HtmlView, _super);
......@@ -19362,6 +19557,27 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
HtmlView.prototype.afterConstructor = function () {
};
Object.defineProperty(HtmlView.prototype, "$store", {
get: function () {
var p = this;
do {
if (p['$isViewRoot']) {
break;
}
p = p.parent;
} while (p.parent);
if (p) {
return p['$_store'];
}
},
enumerable: true,
configurable: true
});
HtmlView.prototype.findChildByUUID = function (uuid) {
if (this['uuid'] === uuid) {
return this;
}
};
HtmlView = tslib_1.__decorate([
afterConstructor,
applyAutoAdjust,
......@@ -19370,10 +19586,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
], HtmlView);
return HtmlView;
}(FloatDisplay));
//# sourceMappingURL=HtmlView.js.map
function isUI(obj) {
return obj.isUI;
}
//# sourceMappingURL=IUIComponent.js.map
var nodeTypeMapping = {
node: Node$1,
......@@ -19426,6 +19644,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return node;
}
//# sourceMappingURL=view-interpreter.js.map
var Toast = (function (_super) {
tslib_1.__extends(Toast, _super);
......@@ -19519,6 +19738,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Toast;
}(Node$1));
//# sourceMappingURL=Toast.js.map
function createEvalFunc(exp) {
var func;
......@@ -19549,6 +19769,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function runExp(exp, scope) {
createRunFunc(exp)(scope);
}
//# sourceMappingURL=Utils.js.map
var Watcher = (function () {
function Watcher(entity, target, exp, scope, callback) {
......@@ -19637,6 +19858,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Watcher._uid = 0;
return Watcher;
}());
//# sourceMappingURL=Watcher.js.map
var Dep = (function () {
function Dep() {
......@@ -19655,6 +19877,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Dep;
}());
//# sourceMappingURL=Dep.js.map
var Mutator = (function () {
function Mutator() {
......@@ -19768,6 +19991,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
];
return Mutator;
}());
//# sourceMappingURL=Mutator.js.map
var commands = {
set: function (context) {
......@@ -19782,6 +20006,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return context.target;
}
};
//# sourceMappingURL=Commands.js.map
var defaultCmdRegExp = /^(data\-)?z[\-_](\w+)([:\$](.+))?$/;
var Zri = (function () {
......@@ -19848,6 +20073,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return Zri;
}());
//# sourceMappingURL=Zri.js.map
var commands$1 = {
prop: function (context) {
......@@ -20031,6 +20257,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return context.target;
}
};
//# sourceMappingURL=ZriCommands.js.map
var interruptCmds = ['for', 'if'];
var ZriCompiler = (function () {
......@@ -20100,6 +20327,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return ZriCompiler;
}());
//# sourceMappingURL=ZriCompiler.js.map
function bind(store, view, options) {
var compiler = new ZriCompiler(view);
......@@ -20120,6 +20348,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return store;
}
//# sourceMappingURL=index.js.map
var customMap = {};
function registerCustomModules(customs) {
......@@ -20182,6 +20411,87 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function getProps(id) {
return customMap[id].props || {};
}
//# sourceMappingURL=custom-module.js.map
function dealPxEnv() {
if (queryParams.appID) {
env.appID = queryParams.appID;
}
if (queryParams.channelType) {
env.channelType = queryParams.channelType;
}
if (queryParams.projectID) {
env.projectID = queryParams.projectID;
}
else {
var result = window.location.pathname.match(/\/projectx\/(.*?)\/.*?/);
if (result) {
env.projectID = result[1];
}
}
if (queryParams.is_from_share) {
env.fromShare = true;
}
var newUser = true;
var key = 'nu_' + env.appID + '_' + env.projectID;
var v = localStorage.getItem(key);
if (v) {
newUser = false;
}
else {
localStorage.setItem(key, '1');
}
env.newUser = newUser;
if (window['isSharePage']) {
accessLog(506);
}
}
function cleanNewUser() {
var key = 'nu_' + env.appID + '_' + env.projectID;
localStorage.removeItem(key);
}
function dealPageRemainTime() {
var startTimer = new Date().getTime();
var endTimer;
var visibilityChange;
if (typeof document.hidden !== 'undefined') {
visibilityChange = 'visibilitychange';
}
else if (typeof document['msHidden'] !== 'undefined') {
visibilityChange = 'msvisibilitychange';
}
else if (typeof document['webkitHidden'] !== 'undefined') {
visibilityChange = 'webkitvisibilitychange';
}
var handleVisibilityChange = function (e) {
if (document.visibilityState == "visible") {
startTimer = new Date().getTime();
}
if (document.visibilityState == "hidden") {
endTimer = new Date().getTime();
sendData();
}
};
var sendData = function () {
var t0 = endTimer - startTimer;
accessLog(156, {
remain: t0,
});
};
document.addEventListener(visibilityChange, handleVisibilityChange, false);
document.body['onbeforeunload'] = function () {
endTimer = new Date().getTime();
return sendData();
};
}
function accessLog(pagebizid, params) {
var p = {
pagebizid: pagebizid,
};
injectProp(p, params);
return httpRequest('buriedPoint', 'get', p);
}
//# sourceMappingURL=px-logics.js.map
var GameStage = (function (_super) {
tslib_1.__extends(GameStage, _super);
......@@ -20240,7 +20550,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
enumerable: true,
configurable: true
});
GameStage.prototype.launch = function (config, onPreloadAssetsProgress, onPreloadAssetsComplete, onStart) {
GameStage.prototype.launch = function (config, onAssetsProgress, onAssetsComplete, onStart) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
function p() {
loaded++;
......@@ -20265,7 +20575,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
}
return [4, loadAssetGroup(assets, p).catch(function (e) {
return [4, loadAssets(assets, p).catch(function (e) {
console.log(e);
})];
case 1:
......@@ -20277,7 +20587,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (!(_a < customs_2.length)) return [3, 5];
custom = customs_2[_a];
if (!custom.assets) return [3, 4];
return [4, loadAssetGroup(custom.assets, p).catch(function (e) {
return [4, loadAssets(custom.assets, p).catch(function (e) {
console.log(e);
})];
case 3:
......@@ -20288,6 +20598,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return [3, 2];
case 5:
this.start();
dealPxEnv();
dealPageRemainTime();
onStart && onStart();
return [2];
}
......@@ -20363,6 +20675,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return GameStage;
}(Node$1));
//# sourceMappingURL=GameStage.js.map
var template = "\n<div class=\"zeroing-loading-wrapper\">\n\t<div class=\"zeroing-loading-content\">\n\t</div>\n</div>\n";
var style = "\n.zeroing-loading-wrapper{\n\tposition: absolute;\n\ttop:0;\n\tleft: 0;\n\tright: 0;\n\tbottom: 0;\n\tdisplay: flex;\n\tdisplay: -webkit-flex;\n\tjustify-content: center;\n\t-webkit-justify-content: center;\n\talign-items: center;\n\t-webkit-align-items: center;\n}\n@keyframes part-body\n{\n\t0%,40% {transform: scale(1);}\n\t20% {transform: scale(1.5);}\n}\n.zeroing-loading-part {\n\ttransform-origin: 2px 12px;\n\tposition: absolute;\n}\n.zeroing-loading-part-body{\n\tbackground-color: dimgray;\n\twidth: 4px;\n\theight: 6px;\n\tborder-radius: 2px;\n\ttransform-origin: 2px 6px;\n\tanimation: part-body 1500ms linear infinite;\n}\n";
......@@ -20402,6 +20715,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
},
};
//# sourceMappingURL=LoadingView.js.map
var _stage;
function initAutoLayout(stage) {
......@@ -20447,7 +20761,44 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
}
//# sourceMappingURL=auto-layout.js.map
var EditorStage = (function (_super) {
tslib_1.__extends(EditorStage, _super);
function EditorStage(stage) {
var _this = _super.call(this) || this;
_this.name = 'editor-stage';
_this.addEventListener('modify-props', _this.onModifyProps, _this);
return _this;
}
EditorStage.prototype.launch = function (onStart) {
onStart();
};
EditorStage.prototype.showView = function (viewConfig) {
if (this._view) {
this.removeChild(this._view);
}
var view = this._view = instantiate(viewConfig);
this.addChild(view);
};
EditorStage.prototype.getNodeProps = function (nodePath) {
return this._view.getChildByIndexPath(nodePath);
};
EditorStage.prototype.onModifyProps = function (e) {
console.log(e.data);
var _a = e.data, nodePath = _a.nodePath, props = _a.props;
var node = this._view.getChildByIndexPath(nodePath);
if (node) {
injectProperties(node, props);
}
else {
console.warn('node not found:', nodePath);
}
};
return EditorStage;
}(Node$1));
exports.editorMode = false;
function launch(url, loadingDelegate, onStart) {
if (queryParams.__proxy_mode__) {
return Promise.resolve('cancel launch');
......@@ -20483,30 +20834,39 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
case 1:
_a.sent();
return [4, new Promise(function (resolve) {
var _a = config.options, containerId = _a.containerId, designWidth = _a.designWidth, designHeight = _a.designHeight, frameRate = _a.frameRate, scaleMode = _a.scaleMode, rendererType = _a.rendererType;
var _a = config.options, containerId = _a.containerId, designWidth = _a.designWidth, designHeight = _a.designHeight, frameRate = _a.frameRate, scaleMode = _a.scaleMode, rendererType = _a.rendererType, _editorMode = _a.editorMode;
exports.editorMode = _editorMode;
var stage = window['stage'] = new Stage(containerId || "game-container", designWidth || 750, designHeight || 1334, frameRate || 60, scaleMode || StageScaleMode.FIXED_WIDTH, rendererType || exports.RENDERER_TYPE.WEBGL);
initAutoLayout(stage);
Stage.flushAll();
stage.addEventListener(Event.ON_INIT_STAGE, function () {
exports.gameStage = new GameStage(stage);
setGlobalContext({
gameStage: exports.gameStage
});
stage.addChild(exports.gameStage);
var delegate = loadingDelegate || builtinLoadingView;
exports.gameStage.launch(config, function (done, total) {
delegate.onProgress && delegate.onProgress(done, total);
}, function () {
delegate.onComplete && delegate.onComplete();
}, onStart);
if (exports.editorMode) {
exports.editorStage = new EditorStage(stage);
stage.addChild(exports.editorStage);
exports.editorStage.launch(onStart);
}
else {
exports.gameStage = new GameStage(stage);
setGlobalContext({
gameStage: exports.gameStage
});
stage.addChild(exports.gameStage);
var delegate_1 = loadingDelegate || builtinLoadingView;
exports.gameStage.launch(config, function (done, total) {
delegate_1.onProgress && delegate_1.onProgress(done, total);
}, function () {
delegate_1.onComplete && delegate_1.onComplete();
}, onStart);
}
});
resolve(exports.gameStage);
resolve();
})];
case 2: return [2, _a.sent()];
}
});
});
}
//# sourceMappingURL=launcher.js.map
var emojiRegex = function () {
// https://mths.be/emoji
......@@ -20605,8 +20965,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return value;
}
//# sourceMappingURL=index.es.js.map
var emojiRegexp = emojiRegex();
//# sourceMappingURL=index.js.map
exports.BaseTexture = BaseTexture;
exports.BaseTextureCache = BaseTextureCache;
......@@ -20670,11 +21032,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.URL_FILE_EXTENSION = URL_FILE_EXTENSION;
exports.VERSION = VERSION;
exports.abs = abs;
exports.accessLog = accessLog;
exports.addCustomModule = addCustomModule;
exports.appendScript = appendScript;
exports.applyEvents = applyEvents;
exports.applyScript = applyScript;
exports.arrayFind = arrayFind;
exports.backupCanvas = backupCanvas;
exports.cleanNewUser = cleanNewUser;
exports.clearTextureCache = clearTextureCache;
exports.cmdOldPrefix = cmdOldPrefix;
exports.cmdPrefix = cmdPrefix;
......@@ -20737,7 +21102,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.launchWithWindowVariable = launchWithWindowVariable;
exports.linkScheme = linkScheme;
exports.linkedFlag = linkedFlag;
exports.loadAssetGroup = loadAssetGroup;
exports.loadAssets = loadAssets;
exports.log10 = log10;
exports.log2 = log2;
exports.mapWebGLBlendModesToPixi = mapWebGLBlendModesToPixi;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -61,9 +61,7 @@ export function executeBehavior(sequence, subEntry = 'main', target, args?) {
return result;
},
e => {
if(log){
console.log(`[${vm.id}] terminate:`, e);
}
console.log(`[${vm.id}] terminate:`, e);
}
);
}
/**
* Created by rockyl on 2019-11-05.
*/
import {Stage} from "../../2d/display/index";
import {Node} from "./nodes/Node";
import {instantiate} from "./view-interpreter";
import {injectProperties} from "../utils/utils";
/**
* 编辑器舞台
*/
export class EditorStage extends Node {
private _view: Node;
constructor(stage: Stage) {
super();
this.name = 'editor-stage';
this.addEventListener('modify-props', this.onModifyProps, this);
}
launch(onStart) {
onStart();
}
showView(viewConfig) {
if (this._view) {
this.removeChild(this._view);
}
let view = this._view = instantiate(viewConfig);
this.addChild(view);
}
getNodeProps(nodePath) {
return this._view.getChildByIndexPath(nodePath);
}
private onModifyProps(e) {
console.log(e.data);
const {nodePath, props} = e.data;
let node = this._view.getChildByIndexPath(nodePath);
if (node) {
injectProperties(node, props);
} else {
console.warn('node not found:', nodePath);
}
}
}
......@@ -100,6 +100,7 @@ export class GameStage extends Node {
* @param config
* @param onAssetsProgress
* @param onAssetsComplete
* @param onStart
*/
async launch(config, onAssetsProgress?, onAssetsComplete?, onStart?) {
this._config = config;
......
......@@ -2,7 +2,7 @@
* Created by rockyl on 2019-11-08.
*/
import {Stage} from "../2d/display";
import {Stage} from "../2d/display/index";
import {registerCustomModuleFromConfig, registerScripts, RENDERER_TYPE, setProcessMetaLibs, StageScaleMode} from "..";
import {GameStage} from "./game-warpper/index";
import {setGlobalContext} from "./behavior-runtime";
......@@ -11,8 +11,12 @@ import {Event} from "../2d/events/Event";
import builtinLoadingView from "./game-warpper/LoadingView";
import {queryParams} from "./web";
import {initAutoLayout} from "./game-warpper/auto-layout";
import {EditorStage} from "./game-warpper/EditorStage";
export let gameStage: GameStage;
export let editorStage: EditorStage;
export let editorMode = false;
export function launch(url, loadingDelegate?, onStart?) {
if (queryParams.__proxy_mode__) {
......@@ -51,7 +55,9 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
setTimeout(resolve, 300);
});
return await new Promise(resolve => {
const {containerId, designWidth, designHeight, frameRate, scaleMode, rendererType,} = config.options;
const {containerId, designWidth, designHeight, frameRate, scaleMode, rendererType, editorMode: _editorMode,} = config.options;
editorMode = _editorMode;
let stage = window['stage'] = new Stage(
containerId || "game-container",
designWidth || 750,
......@@ -64,21 +70,27 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
Stage.flushAll();
stage.addEventListener(Event.ON_INIT_STAGE, () => {
gameStage = new GameStage(stage);
setGlobalContext({
gameStage
});
stage.addChild(gameStage);
let delegate = loadingDelegate || builtinLoadingView;
gameStage.launch(config, function (done, total) {
delegate.onProgress && delegate.onProgress(done, total)
}, function () {
delegate.onComplete && delegate.onComplete();
}, onStart);
if (editorMode) {
editorStage = new EditorStage(stage);
stage.addChild(editorStage);
editorStage.launch(onStart)
} else {
gameStage = new GameStage(stage);
setGlobalContext({
gameStage
});
stage.addChild(gameStage);
let delegate = loadingDelegate || builtinLoadingView;
gameStage.launch(config, function (done, total) {
delegate.onProgress && delegate.onProgress(done, total)
}, function () {
delegate.onComplete && delegate.onComplete();
}, onStart);
}
});
resolve(gameStage);
resolve();
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment