Commit 8f20e2d8 authored by rockyl's avatar rockyl

版本锁定分支前提交

parent c495d003
......@@ -61,6 +61,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s._pd = false;
s._bpd = false;
s.type = type;
delete s.data;
};
Event.RESIZE = "onResize";
Event.ON_SCROLL_TO_HEAD = "onScrollToHead";
......@@ -73,6 +74,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Event.ENTER_FRAME = "onEnterFrame";
Event.END_FRAME = "onEndFrame";
Event.CALL_FRAME = "onCallFrame";
Event.VISIBLE = "visible";
Event.HIDDEN = "hidden";
Event.COMPLETE = "onComplete";
Event.PROGRESS = "onProgress";
Event.FOCUS = "focus";
......@@ -1130,7 +1133,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_this.tempDisplayObjectParent = null;
_this.transform = new Transform();
_this._alpha = 1;
_this.visible = true;
_this._visible = true;
_this.renderable = true;
_this.parent = null;
_this.worldAlpha = 1;
......@@ -1140,8 +1143,25 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_this._lastBoundsID = -1;
_this._mask = null;
_this.destroyed = false;
_this.addEventListener(Event.ADDED_TO_STAGE, _this.attachVisibility, _this);
_this.addEventListener(Event.REMOVED_FROM_STAGE, _this.attachVisibility, _this);
return _this;
}
Object.defineProperty(DisplayObject.prototype, "visible", {
get: function () {
return this._visible;
},
set: function (value) {
if (this._visible !== value) {
this._visible = value;
this.attachVisibility();
}
},
enumerable: true,
configurable: true
});
DisplayObject.prototype.attachVisibility = function () {
};
Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", {
get: function () {
if (this.tempDisplayObjectParent === null) {
......@@ -1422,6 +1442,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
});
Object.defineProperty(DisplayObject.prototype, "worldVisible", {
get: function () {
if (!this.stage) {
return false;
}
var item = this;
do {
if (!item.visible) {
......@@ -1705,6 +1728,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var ESCAPE_REG_EXP = /\$\{[\u4e00-\u9fa5_a-zA-Z0-9\|]+\}/g;
var linkedFlag = '$_linked_$';
var nodeScheme = 'node://';
var linkScheme = 'link://';
function arrayFind(arr, predicate) {
if (!arr) {
return;
......@@ -1923,6 +1947,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
for (var key in source) {
propertyParse(key, target, source);
}
return target;
}
var rotateLeft = function (lValue, iShiftBits) {
......@@ -2413,7 +2438,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
var log = getLogSwitch(exports.Logs.PROCESS);
var linkScheme = 'link://';
var Process = (function () {
function Process(id) {
this.id = id;
......@@ -2533,7 +2557,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
if (!func) return [3, 2];
globalContext = this._vm.globalContext;
globalContext.dataCenter = globalContext.gameStage.dataCenter;
globalContext.gameStage = engine.gameStage;
globalContext.dataCenter = engine.gameStage.dataCenter;
globalContext.env = engine.env;
return [4, func(payload, this._config.props, this._target, globalContext, this._vm)];
case 1:
result = _a.sent();
......@@ -2802,6 +2828,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_a[MouseEvent.MOUSE_DOWN] = 'touchstart',
_a[MouseEvent.MOUSE_MOVE] = 'touchmove',
_a[MouseEvent.MOUSE_UP] = 'touchend',
_a[MouseEvent.VISIBLE] = 'visible',
_a[MouseEvent.HIDDEN] = 'hidden',
_a);
var globalEvent = new EventDispatcher();
var DATA_CENTER_EVENT = 'DATA_CENTER_EVENT';
......@@ -2891,6 +2919,13 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
Container.prototype.onChildrenChange = function (index) {
};
Container.prototype.attachVisibility = function () {
this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN);
for (var i = 0, li = this.children.length; i < li; i++) {
var child = this.children[i];
child.attachVisibility();
}
};
Container.prototype.addChild = function (child) {
this.addChildAt(child, this.children.length);
return child;
......@@ -7397,7 +7432,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_this.isPreventDefaultEvent = true;
_this.rootDiv = HTMLElement;
_this.renderObj = null;
_this.renderType = 0;
_this.renderType = exports.RENDERER_TYPE.UNKNOWN;
_this.viewRect = new Rectangle();
_this.autoSteering = false;
_this.autoResize = false;
......@@ -10541,8 +10576,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function httpRequest(url, method, params, type, headers) {
if (method === void 0) { method = 'get'; }
if (type === void 0) { type = 'text'; }
var openUrl = url.indexOf('blob') === 0 ? url : urlJoin(url, '__ts__=' + Date.now());
var mParams = injectProperties({}, params);
if (type === "jsonp") {
return jsonp(url, params);
return jsonp(openUrl, mParams);
}
else {
return new Promise(function (resolve, reject) {
......@@ -10550,7 +10587,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
'Content-Type': 'application/x-www-form-urlencoded',
};
injectProperties(mHeaders, headers);
var request = { url: url, method: method, params: params, type: type, headers: mHeaders };
var request = { url: url, method: method, params: mParams, type: type, headers: mHeaders };
var mock = window['mock'];
var mockRule;
if (mock) {
......@@ -10562,6 +10599,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}, resolve, reject);
}
else {
request.url = openUrl;
doRequest(request, resolve, reject);
}
});
......@@ -10584,7 +10622,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var queryStr = obj2query(params);
var openUrl = url;
if (isGet) {
openUrl = urlJoin(url, queryStr);
openUrl = urlJoin(openUrl, queryStr);
}
xhr.open(method, openUrl, true);
if (!isGet) {
......@@ -12820,15 +12858,21 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var failedList = [];
return Promise.all(config.map(function (assetConfig) {
assetsConfig.push(assetConfig);
var loadFunc = loaderMapping[assetConfig.ext];
var url = assetConfig.url, ext = assetConfig.ext, uuid = assetConfig.uuid;
var loadFunc = loaderMapping[ext];
if (loadFunc) {
if (url.indexOf(linkScheme) === 0) {
loaded++;
onProgress && onProgress(loaded, total);
return Promise.resolve();
}
var method = globalLoader['load' + loadFunc];
return method.call(globalLoader, assetConfig.url, assetConfig.uuid).then(function (data) {
return method.call(globalLoader, url, uuid).then(function (data) {
parse(assetConfig, data);
loaded++;
onProgress && onProgress(loaded, total);
}, function (error) {
failedList.push(assetConfig.url);
failedList.push(url);
});
}
else {
......@@ -12856,7 +12900,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
else {
for (var _i = 0, assetsConfig_1 = assetsConfig; _i < assetsConfig_1.length; _i++) {
var assetConfig = assetsConfig_1[_i];
var res = engine.globalLoader.get(assetConfig.url);
var res = globalLoader.get(assetConfig.url);
if (res && res.frames) {
for (var key in res.frames) {
var frame = res.frames[key];
......@@ -15161,6 +15205,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return _this;
}
Label.prototype._setText = function (value) {
if (typeof value !== 'string') {
value = value + '';
}
if (value !== this._text) {
var matchResult = value.match(ESCAPE_REG_EXP);
if (matchResult) {
......@@ -15474,45 +15521,60 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var BitmapText = (function (_super) {
tslib_1.__extends(BitmapText, _super);
function BitmapText() {
var _this = _super.call(this) || this;
_this._dirty = true;
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._charCache = [];
_this.text = '';
_this.verticalAlign = exports.VERTICAL_ALIGN.DOWN;
_this.letterSpacing = 0;
_this.addEventListener(Event.ENTER_FRAME, _this.onEnterFrame, _this);
return _this;
}
BitmapText.prototype.onModify = function (value, key) {
switch (key) {
case 'text':
this._dirty = true;
case 'letterSpacing':
case 'verticalAlign':
this.render();
break;
case 'font':
this._fontConfig = getFont(value);
this._dirty = true;
break;
case 'letterSpacing':
this._dirty = true;
break;
}
};
BitmapText.prototype.onEnterFrame = function (e) {
if (this._dirty) {
this._dirty = false;
if (!this._fontConfig) {
return;
}
var x = 0, li = this.text.length;
for (var i = 0; i < li; i++) {
var char = this.text[i];
var sp = this.addChar(char, i);
sp.x = x;
x += sp.width + this.letterSpacing;
BitmapText.prototype.render = function () {
if (!this._fontConfig || !this.text) {
return;
}
var text = this.text + '';
var x = 0, li = text.length, maxHeight = 0;
for (var i = 0; i < li; i++) {
var char = text[i];
var sp = this.addChar(char, i);
sp.x = x;
x += sp.width + this.letterSpacing;
if (sp.height > maxHeight) {
maxHeight = sp.height;
}
for (var i = li; i < this.children.length; i++) {
this._charCache.push(this.removeChildAt(li));
}
if (this._height) {
maxHeight = this._height;
}
for (var i = 0, li_1 = this.children.length; i < li_1; i++) {
var child = this.children[i];
switch (this.verticalAlign) {
case exports.VERTICAL_ALIGN.DOWN:
child.y = maxHeight - child.height;
break;
case exports.VERTICAL_ALIGN.MIDDLE:
child.y = (maxHeight - child.height) / 2;
break;
case exports.VERTICAL_ALIGN.UP:
child.y = 0;
break;
}
}
for (var i = li; i < this.children.length; i++) {
this._charCache.push(this.removeChildAt(li));
}
};
BitmapText.prototype.addChar = function (char, index) {
var sp = this.getChildAt(index);
......@@ -15540,6 +15602,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
tslib_1.__decorate([
dirtyFieldTrigger
], BitmapText.prototype, "font", void 0);
tslib_1.__decorate([
dirtyFieldTrigger
], BitmapText.prototype, "verticalAlign", void 0);
tslib_1.__decorate([
dirtyFieldTrigger
], BitmapText.prototype, "letterSpacing", void 0);
......@@ -15803,6 +15868,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var _a = this._config, _b = _a.options, entrySceneView = _b.entrySceneView, env = _b.env, dataMapping = _a.dataMapping, processes = _a.processes, builtinProcesses = _a.builtinProcesses, scripts = _a.scripts, customs = _a.customs;
Stage.addUpdateObj(Tween);
injectEnv(env);
registerCustomModuleAssets(customs);
if (dataMapping) {
this.dataCenter.registerDataMapping(dataMapping);
}
......@@ -15858,8 +15924,16 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}(Container));
var customMap = {};
function registerCustomModuleAssets(customs) {
for (var _i = 0, customs_1 = customs; _i < customs_1.length; _i++) {
var custom = customs_1[_i];
customMap[custom.id].assets = custom.assets;
}
}
function registerCustomModule(id, def) {
customMap[id] = def;
customMap[id] = {
def: def,
};
}
function registerCustomCodeModule(config) {
var id = config.id, code = config.code;
......@@ -15874,7 +15948,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
function addCustomModule(id, container, options) {
var creator = customMap[id];
var creator = customMap[id].def;
if (creator) {
var instance = creator(options);
if (instance) {
......@@ -15883,6 +15957,22 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
}
function resolveCustomAsset(id, uuid) {
var module = customMap[id];
if (module) {
var config = arrayFind(module.assets, function (item) { return item.uuid === uuid; });
if (config) {
if (config.url.indexOf(linkScheme) === 0) {
var linkUUID = config.url.replace(linkScheme, '');
var linkConfig = getAssetByUUID(linkUUID);
if (linkConfig) {
config = linkConfig;
}
}
}
return config;
}
}
var howler = createCommonjsModule(function (module, exports) {
/*!
......@@ -19141,13 +19231,21 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
var queryParams = {};
for (var _i = 0, _a$1 = location.search.replace('?', '').split('&'); _i < _a$1.length; _i++) {
for (var _i = 0, _a$1 = top.location.search.replace('?', '').split('&'); _i < _a$1.length; _i++) {
var item = _a$1[_i];
var arr = item.split('=');
queryParams[arr[0]] = arr.length === 1 ? true : arr[1];
}
var emojiRegex = function () {
// https://mths.be/emoji
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
};
var emojiRegexp = emojiRegex();
exports.BaseTexture = BaseTexture;
exports.BitmapText = BitmapText;
exports.Button = Button;
exports.Circle = Circle$1;
exports.Color = color;
......@@ -19211,6 +19309,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.devicePixelRatio = devicePixelRatio;
exports.dirtyFieldDetector = dirtyFieldDetector;
exports.dirtyFieldTrigger = dirtyFieldTrigger;
exports.emojiRegexp = emojiRegexp;
exports.env = env;
exports.executeBehavior = executeBehavior;
exports.fieldChanged = fieldChanged;
......@@ -19238,6 +19337,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.launchWithConfig = launchWithConfig;
exports.launchWithLocalStorage = launchWithLocalStorage;
exports.launchWithWindowVariable = launchWithWindowVariable;
exports.linkScheme = linkScheme;
exports.linkedFlag = linkedFlag;
exports.loadAssets = loadAssets;
exports.md5 = md5;
......@@ -19251,11 +19351,13 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.queryParams = queryParams;
exports.registerCustomCodeModule = registerCustomCodeModule;
exports.registerCustomModule = registerCustomModule;
exports.registerCustomModuleAssets = registerCustomModuleAssets;
exports.registerCustomModuleFromConfig = registerCustomModuleFromConfig;
exports.registerNodeType = registerNodeType;
exports.registerScriptDef = registerScriptDef;
exports.registerScripts = registerScripts;
exports.requestAnimationFrame = requestAnimationFrame;
exports.resolveCustomAsset = resolveCustomAsset;
exports.setGlobalContext = setGlobalContext;
exports.setProcessMetaLibs = setProcessMetaLibs;
exports.setScriptMap = setScriptMap;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,6 +6,7 @@
"types": "index.d.ts",
"dependencies": {
"color": "^3.1.2",
"emoji-regex": "^8.0.0",
"howler": "^2.1.2"
},
"devDependencies": {
......
......@@ -41,14 +41,6 @@ glob('types/src/**/*.d.ts', function (err, files) {
;
const content = `
declare const args: any;
declare const props: any;
declare const target: engine.Container;
declare const global: any;
declare const vm: engine.VM;
declare function next(type: string, payload?: any);
declare module engine{
${allExports}
}
......
......@@ -35,7 +35,7 @@ export default class Container extends DisplayObject {
*/
mouseChildren: boolean = true;
/**
* 子们
* 子们
* @member {DisplayObject[]}
* @readonly
*/
......@@ -68,6 +68,15 @@ export default class Container extends DisplayObject {
//子类需要时重写
}
attachVisibility() {
return;
this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN);
for (let i = 0, li = this.children.length; i < li; i++) {
const child = <Container>this.children[i];
child.attachVisibility();
}
}
/**
* 添加child
* @param {DisplayObject} child
......
import { EventDispatcher } from '../events/EventDispatcher';
import {EventDispatcher} from '../events/EventDispatcher';
import Transform from '../math/Transform';
import { Rectangle } from '../math/Rectangle';
import { Point } from "../math/Point";
import { Event } from "../events/Event";
import {Rectangle} from '../math/Rectangle';
import {Point} from "../math/Point";
import {Event} from "../events/Event";
import Graphics from '../graphics/Graphics';
import { DEG_TO_RAD, RAD_TO_DEG } from '../const';
import {DEG_TO_RAD, RAD_TO_DEG} from '../const';
import {Stage} from "./Stage";
/**
......@@ -13,608 +13,635 @@ import {Stage} from "./Stage";
* @extends EventDispatcher
*/
export class DisplayObject extends EventDispatcher {
/**
* 基础信息
*/
transform: Transform;
/**
* 是否可见
*/
visible: boolean;
/**
* 是否可绘制
* 自身不绘制,但是参与updateTransform
* 在有些时候的遮罩处理
*/
renderable: boolean;
/**
* 父级
* @member {Container}
* @readonly
*/
parent: any;
/**
* 舞台
*/
stage: Stage;
/**
* 名字,预留
*/
name: string;
/**
* 全局透明度
*/
worldAlpha: number;
/**
* 用于只管局部自己,不包括子级,用于各继承修改自身,hitTest检测自己用
*/
protected _localBoundsSelf: Rectangle;
/**
* 用于计算世界bounds,包括自身和子级,一般只在获取宽高时使用,变形后的
*/
protected _bounds: Rectangle;
protected _boundsID: number;
protected _lastBoundsID: number;
/**
* 遮罩
* @member {Graphics}
* @private
*/
private _mask: Graphics;
/**
* 透明度
* 0到1
*/
private _alpha: number;
/**
* 是否已销毁
* @member {boolean}
* @readonly
*/
destroyed: boolean;
/**
* 是否可响应鼠标事件
*/
mouseEnabled: boolean = true;
/**
* 临时父级,特殊用处
*/
tempDisplayObjectParent: DisplayObject;
/**
* 特殊用处
* 缓存的DisplayObject的updateTransform
*/
displayObjectUpdateTransform;
/**
* 特殊用处
* 缓存的DisplayObject的hitTestPoint
*/
displayObjectHitTestPoint;
protected _width: number;
protected _height: number;
constructor() {
super();
this._instanceType = "DisplayObject";
this.tempDisplayObjectParent = null;
this.transform = new Transform();
this._alpha = 1;
this.visible = true;
this.renderable = true;
this.parent = null;
this.worldAlpha = 1;
this._localBoundsSelf = new Rectangle();
this._bounds = new Rectangle();
this._boundsID = 0;
this._lastBoundsID = -1;
this._mask = null;
this.destroyed = false;
}
/**
* @private
* @member {DisplayObject}
*/
private get _tempDisplayObjectParent() {
if (this.tempDisplayObjectParent === null) {
this.tempDisplayObjectParent = new DisplayObject();
}
return this.tempDisplayObjectParent;
}
/**
* 更新矩阵
*/
updateTransform() {
this.transform.updateWorldMatrix(this.parent.transform);
//更新透明度
this.worldAlpha = this.alpha * this.parent.worldAlpha;
}
//为了hitTestPoint,localToGlobal,globalToLocal等方法不复新不重复生成新的点对象而节约内存
public static _bp: Point = new Point();
public static _p1: Point = new Point();
public static _p2: Point = new Point();
public static _p3: Point = new Point();
public static _p4: Point = new Point();
//bounds缓存
public static temBounds = new Rectangle();
/**
* 点击碰撞测试,就是舞台上的一个point是否在显示对象内,在则返回该对象,不在则返回null
* 对于那些不是继承container,而直接继承displayObject的不用重写,如Bitmap
* @method hitTestPoint
* @public
* @since 1.0.0
* @param {Point} point 需要碰到的坐标点
* @param {boolean} isMouseEvent 是否是鼠标事件调用此方法,一般都为true
* @return {DisplayObject}
*/
public hitTestPoint(point: Point, isMouseEvent: boolean = false): DisplayObject {
let s = this;
if (!s.visible) return null;
if (isMouseEvent && !s.mouseEnabled) return null;
if (!isMouseEvent) {
//如果不是系统调用则不考虑这个点是从全局来的,只认为这个点就是当前要碰撞测试同级别下的坐标点
if (s._localBoundsSelf.isPointIn(point)) {
return s;
}
} else {
if (s._localBoundsSelf.isPointIn(s.globalToLocal(point, DisplayObject._bp))) {
return s;
}
}
return null;
}
/**
* 递归更新矩阵方法
*/
private _recursivePostUpdateTransform() {
if (this.parent) {
this.parent._recursivePostUpdateTransform();
this.transform.updateWorldMatrix(this.parent.transform);
}
else {
this.transform.updateWorldMatrix(this._tempDisplayObjectParent.transform);
}
}
/**
* 获取全局的bounds,变形后的
* @param {boolean} skipUpdate - setting to true will stop the transforms of the scene graph from
* being updated. This means the calculation returned MAY be out of date BUT will give you a
* nice performance boost
* @param {Rectangle} rect - Optional rectangle to store the result of the bounds calculation
* @return {Rectangle} the rectangular bounding area
*/
getBounds(skipUpdate: boolean = false, rect: Rectangle = DisplayObject.temBounds): Rectangle {
//先把父级的都变换
if (!skipUpdate) {
if (!this.parent) {
this.parent = this._tempDisplayObjectParent;
this.updateTransform();
this.parent = null;
}
else {
this._recursivePostUpdateTransform();
this.updateTransform();
}
}
//里面计算了_bounds
this.calculateBounds();
return rect.copy(this._bounds);
}
/**
* 以父级为世界坐标系的本地包围盒
* @param {Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation
* @return {Rectangle} the rectangular bounding area
*/
getLocalBounds(rect: Rectangle = DisplayObject.temBounds): Rectangle {
const transformRef = this.transform;
const parentRef = this.parent;
this.parent = null;
this.transform = this._tempDisplayObjectParent.transform;
const bounds = this.getBounds(false, rect);
this.parent = parentRef;
this.transform = transformRef;
return bounds;
}
calculateBounds() {
//重写
if (this._lastBoundsID == this._boundsID) return
this._lastBoundsID = this._boundsID
}
/**
*将全局坐标转换到本地坐标值
* @method globalToLocal
* @since 1.0.0
* @public
* @param {Point} point
* @param bp
* @return {Point}
*/
public globalToLocal(point: Point, bp: Point = null): Point {
return this.worldMatrix.transformPointInverse(point.x, point.y, bp || DisplayObject._bp);
}
/**
*将本地坐标转换到全局坐标值
* @method localToGlobal
* @public
* @since 1.0.0
* @param {Point} point
* @param bp
* @return {Point}
*/
public localToGlobal(point: Point, bp: Point = null): Point {
return this.worldMatrix.transformPoint(point.x, point.y, bp || DisplayObject._bp);
}
/**
* 调用些方法会冒泡的将事件向显示列表下方传递,主要用于移除舞台,和添加进舞台事件,修改stage
* @method _onDispatchBubbledEvent
* @public
* @since 1.0.0
* @param {string} type
* @return {void}
*/
public _onDispatchBubbledEvent(type: string): void {
let s: any = this;
if (type == Event.REMOVED_FROM_STAGE && !s.stage) return;
if (type == Event.REMOVED_FROM_STAGE) {
s.dispatchEvent(type);
//以防REMOVED_FROM_STAGE事件里用到了stage
s.stage = null;
} else if (type == Event.ADDED_TO_STAGE) {
s.stage = s.parent.stage;
s.dispatchEvent(type);
}
}
/**
* webgl渲染
* @param {WebGLRenderer} renderer - The renderer
*/
renderWebGL(renderer: any) {
//子类重写
}
/**
* canvas渲染
* @param {CanvasRenderer} renderer - The renderer
*/
renderCanvas(renderer: any) {
//子类重写
}
/**
* 设置父级
* @param {Container} container - The Container to add this DisplayObject to
* @return {Container} The Container that this DisplayObject was added to
*/
setParent(container: any): any {
if (!container || !container.addChild) {
throw new Error('setParent: Argument must be a Container');
}
container.addChild(this);
return container;
}
/**
*根据常规属性 设置矩阵属性,弧度制
* @param {number} [x=0] - The X position
* @param {number} [y=0] - The Y position
* @param {number} [scaleX=1] - The X scale value
* @param {number} [scaleY=1] - The Y scale value
* @param {number} [rotation=0] - The rotation
* @param {number} [skewX=0] - The X skew value
* @param {number} [skewY=0] - The Y skew value
* @param {number} [anchorX=0] - The X anchor value
* @param {number} [anchorY=0] - The Y anchor value
* @return {DisplayObject} The DisplayObject instance
*/
setTransform(
x: number = 0,
y: number = 0,
scaleX: number = 1,
scaleY: number = 1,
rotation: number = 0,
skewX: number = 0,
skewY: number = 0,
anchorX: number = 0,
anchorY: number = 0
): DisplayObject {
this.position.x = x;
this.position.y = y;
this.scale.x = !scaleX ? 1 : scaleX;
this.scale.y = !scaleY ? 1 : scaleY;
this.rotation = rotation;
this.skew.x = skewX;
this.skew.y = skewY;
this.anchor.x = anchorX;
this.anchor.y = anchorY;
return this;
}
/**
* 基本销毁方法
*/
destroy() {
//移除所有监听
this.removeAllEventListener();
//如果有父级,从中移除自己
if (this.parent) {
this.parent.removeChild(this);
}
//矩阵销毁
this.transform.destroy();
//对应属性都置null
this.transform = null;
this._localBoundsSelf = null;
this._bounds = null;
this.tempDisplayObjectParent = null;
this._mask = null;
this.mouseEnabled = false;
//标记为已销毁
this.destroyed = true;
}
get alpha(): number {
return this._alpha
}
set alpha(value: number) {
if (this._alpha != value) {
this._alpha = value
//是否有必要设置worldAlpha是否需要更新,一个乘法基本不耗性能
}
}
get x(): number {
return this.position.x;
}
set x(value: number) {
this.transform.position.x = value;
}
get y(): number {
return this.position.y;
}
set y(value: number) {
this.transform.position.y = value;
}
/**
* 获取世界矩阵
* 手动修改时,this.transform._worldID++,保证子级的worldMatrix会修改,尽量别那么做
* @member {Matrix}
* @readonly
*/
get worldMatrix() {
return this.transform.worldMatrix;
}
/**
* 获取本地矩阵
* 手动修改时this.transform._parentID=-1;保证其worldMatrix会更新
* @member {Matrix}
* @readonly
*/
get localMatrix() {
return this.transform.localMatrix;
}
/**
* 获取位置对象
* @member {Point|ObservablePoint}
*/
get position() {
return this.transform.position;
}
/**
* 设置位置对象
*/
set position(value) {
this.transform.position.copy(value);
}
/**
* 获取缩放对象
* @member {Point|ObservablePoint}
*/
get scale() {
return this.transform.scale;
}
/**
* 设置缩放对象
*/
set scale(value) {
this.transform.scale.copy(value);
}
get scaleX() {
return this.transform.scale.x;
}
set scaleX(value) {
this.transform.scale.x = value;
}
get scaleY() {
return this.transform.scale.y;
}
set scaleY(value) {
this.transform.scale.y = value;
}
/**
* 获取锚点对象
* @member {Point|ObservablePoint}
*/
get anchor() {
return this.transform.anchor;
}
set anchor(value) {
this.transform.anchor.copy(value);
}
get anchorX() {
return this.transform.anchor.x;
}
set anchorX(value) {
this.transform.anchor.x = value;
}
get anchorY() {
return this.transform.anchor.y;
}
set anchorY(value) {
this.transform.anchor.y = value;
}
/**
* 获取斜切对象
* @member {ObservablePoint}
*/
get skew() {
return this.transform.skew;
}
set skew(value) {
this.transform.skew.copy(value);
}
/**
* 获取旋转值,顺时针,角度制
* @member {number}
*/
get rotation(): number {
return this.transform.rotation * RAD_TO_DEG;
}
/**
* 角度制
*/
set rotation(value: number) {
this.transform.rotation = value * DEG_TO_RAD;
}
/**
* 自身是否可见,检测所有父级的visible
* @member {boolean}
* @readonly
*/
get worldVisible() {
let item = this;
do {
if (!item.visible) {
return false;
}
item = item.parent;
} while (item);
return true;
}
/**
* 获取遮罩
* @member {Graphics}
*/
get mask(): Graphics {
return this._mask;
}
set mask(value) {
if (this._mask) {
//原先有的遮罩,重置属性
this._mask.renderable = true;
this._mask.isUsedToMask = false;
if (this._mask.parent) {
this._mask.parent.removeChild(this._mask)
//是否销毁
}
}
this._mask = value;
if (this._mask) {
this._mask.renderable = false;
this._mask.isUsedToMask = true;
//保证更新包围盒
this._boundsID++;
//手动添加吧
// this.parent.addChild(this._mask)
}
}
/**
* 子类必重写,
*/
get width() {
return this._width
}
/**
* 子类必重写,如果设置过宽高_width有值且不为0,子类在更新texture时需设置scale
*/
set width(value) {
this._width = value;
}
get height() {
return this._height;
}
set height(value) {
this._height = value;
}
/**
* 更新方法,帧循环的监听事件放在这
*/
public update(deltaTime: number) {
//监听的
if (this.hasEventListener(Event.ENTER_FRAME)) {
this.dispatchEvent(Event.ENTER_FRAME, deltaTime);
}
}
/**
* 基础信息
*/
transform: Transform;
/**
* 是否可见
*/
_visible: boolean;
/**
* 是否可绘制
* 自身不绘制,但是参与updateTransform
* 在有些时候的遮罩处理
*/
renderable: boolean;
/**
* 父级
* @member {Container}
* @readonly
*/
parent: any;
/**
* 舞台
*/
stage: Stage;
/**
* 名字,预留
*/
name: string;
/**
* 全局透明度
*/
worldAlpha: number;
/**
* 用于只管局部自己,不包括子级,用于各继承修改自身,hitTest检测自己用
*/
protected _localBoundsSelf: Rectangle;
/**
* 用于计算世界bounds,包括自身和子级,一般只在获取宽高时使用,变形后的
*/
protected _bounds: Rectangle;
protected _boundsID: number;
protected _lastBoundsID: number;
/**
* 遮罩
* @member {Graphics}
* @private
*/
private _mask: Graphics;
/**
* 透明度
* 0到1
*/
private _alpha: number;
/**
* 是否已销毁
* @member {boolean}
* @readonly
*/
destroyed: boolean;
/**
* 是否可响应鼠标事件
*/
mouseEnabled: boolean = true;
/**
* 临时父级,特殊用处
*/
tempDisplayObjectParent: DisplayObject;
/**
* 特殊用处
* 缓存的DisplayObject的updateTransform
*/
displayObjectUpdateTransform;
/**
* 特殊用处
* 缓存的DisplayObject的hitTestPoint
*/
displayObjectHitTestPoint;
protected _width: number;
protected _height: number;
constructor() {
super();
this._instanceType = "DisplayObject";
this.tempDisplayObjectParent = null;
this.transform = new Transform();
this._alpha = 1;
this._visible = true;
this.renderable = true;
this.parent = null;
this.worldAlpha = 1;
this._localBoundsSelf = new Rectangle();
this._bounds = new Rectangle();
this._boundsID = 0;
this._lastBoundsID = -1;
this._mask = null;
this.destroyed = false;
this.addEventListener(Event.ADDED_TO_STAGE, this.attachVisibility, this);
this.addEventListener(Event.REMOVED_FROM_STAGE, this.attachVisibility, this);
}
get visible() {
return this._visible;
}
set visible(value) {
if (this._visible !== value) {
this._visible = value;
this.attachVisibility();
}
}
attachVisibility() {
}
/**
* @private
*/
private get _tempDisplayObjectParent() {
if (this.tempDisplayObjectParent === null) {
this.tempDisplayObjectParent = new DisplayObject();
}
return this.tempDisplayObjectParent;
}
/**
* 更新矩阵
*/
updateTransform() {
this.transform.updateWorldMatrix(this.parent.transform);
//更新透明度
this.worldAlpha = this.alpha * this.parent.worldAlpha;
}
//为了hitTestPoint,localToGlobal,globalToLocal等方法不复新不重复生成新的点对象而节约内存
public static _bp: Point = new Point();
public static _p1: Point = new Point();
public static _p2: Point = new Point();
public static _p3: Point = new Point();
public static _p4: Point = new Point();
//bounds缓存
public static temBounds = new Rectangle();
/**
* 点击碰撞测试,就是舞台上的一个point是否在显示对象内,在则返回该对象,不在则返回null
* 对于那些不是继承container,而直接继承displayObject的不用重写,如Bitmap
* @method hitTestPoint
* @public
* @since 1.0.0
* @param {Point} point 需要碰到的坐标点
* @param {boolean} isMouseEvent 是否是鼠标事件调用此方法,一般都为true
* @return {DisplayObject}
*/
public hitTestPoint(point: Point, isMouseEvent: boolean = false): DisplayObject {
let s = this;
if (!s.visible) return null;
if (isMouseEvent && !s.mouseEnabled) return null;
if (!isMouseEvent) {
//如果不是系统调用则不考虑这个点是从全局来的,只认为这个点就是当前要碰撞测试同级别下的坐标点
if (s._localBoundsSelf.isPointIn(point)) {
return s;
}
} else {
if (s._localBoundsSelf.isPointIn(s.globalToLocal(point, DisplayObject._bp))) {
return s;
}
}
return null;
}
/**
* 递归更新矩阵方法
*/
private _recursivePostUpdateTransform() {
if (this.parent) {
this.parent._recursivePostUpdateTransform();
this.transform.updateWorldMatrix(this.parent.transform);
} else {
this.transform.updateWorldMatrix(this._tempDisplayObjectParent.transform);
}
}
/**
* 获取全局的bounds,变形后的
* @param {boolean} skipUpdate - setting to true will stop the transforms of the scene graph from
* being updated. This means the calculation returned MAY be out of date BUT will give you a
* nice performance boost
* @param {Rectangle} rect - Optional rectangle to store the result of the bounds calculation
* @return {Rectangle} the rectangular bounding area
*/
getBounds(skipUpdate: boolean = false, rect: Rectangle = DisplayObject.temBounds): Rectangle {
//先把父级的都变换
if (!skipUpdate) {
if (!this.parent) {
this.parent = this._tempDisplayObjectParent;
this.updateTransform();
this.parent = null;
} else {
this._recursivePostUpdateTransform();
this.updateTransform();
}
}
//里面计算了_bounds
this.calculateBounds();
return rect.copy(this._bounds);
}
/**
* 以父级为世界坐标系的本地包围盒
* @param {Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation
* @return {Rectangle} the rectangular bounding area
*/
getLocalBounds(rect: Rectangle = DisplayObject.temBounds): Rectangle {
const transformRef = this.transform;
const parentRef = this.parent;
this.parent = null;
this.transform = this._tempDisplayObjectParent.transform;
const bounds = this.getBounds(false, rect);
this.parent = parentRef;
this.transform = transformRef;
return bounds;
}
calculateBounds() {
//重写
if (this._lastBoundsID == this._boundsID) return
this._lastBoundsID = this._boundsID
}
/**
*将全局坐标转换到本地坐标值
* @method globalToLocal
* @since 1.0.0
* @public
* @param {Point} point
* @param bp
* @return {Point}
*/
public globalToLocal(point: Point, bp: Point = null): Point {
return this.worldMatrix.transformPointInverse(point.x, point.y, bp || DisplayObject._bp);
}
/**
*将本地坐标转换到全局坐标值
* @method localToGlobal
* @public
* @since 1.0.0
* @param {Point} point
* @param bp
* @return {Point}
*/
public localToGlobal(point: Point, bp: Point = null): Point {
return this.worldMatrix.transformPoint(point.x, point.y, bp || DisplayObject._bp);
}
/**
* 调用些方法会冒泡的将事件向显示列表下方传递,主要用于移除舞台,和添加进舞台事件,修改stage
* @method _onDispatchBubbledEvent
* @public
* @since 1.0.0
* @param {string} type
* @return {void}
*/
public _onDispatchBubbledEvent(type: string): void {
let s: any = this;
if (type == Event.REMOVED_FROM_STAGE && !s.stage) return;
if (type == Event.REMOVED_FROM_STAGE) {
s.dispatchEvent(type);
//以防REMOVED_FROM_STAGE事件里用到了stage
s.stage = null;
} else if (type == Event.ADDED_TO_STAGE) {
s.stage = s.parent.stage;
s.dispatchEvent(type);
}
}
/**
* webgl渲染
* @param {WebGLRenderer} renderer - The renderer
*/
renderWebGL(renderer: any) {
//子类重写
}
/**
* canvas渲染
* @param {CanvasRenderer} renderer - The renderer
*/
renderCanvas(renderer: any) {
//子类重写
}
/**
* 设置父级
* @param {Container} container - The Container to add this DisplayObject to
* @return {Container} The Container that this DisplayObject was added to
*/
setParent(container: any): any {
if (!container || !container.addChild) {
throw new Error('setParent: Argument must be a Container');
}
container.addChild(this);
return container;
}
/**
*根据常规属性 设置矩阵属性,弧度制
* @param {number} [x=0] - The X position
* @param {number} [y=0] - The Y position
* @param {number} [scaleX=1] - The X scale value
* @param {number} [scaleY=1] - The Y scale value
* @param {number} [rotation=0] - The rotation
* @param {number} [skewX=0] - The X skew value
* @param {number} [skewY=0] - The Y skew value
* @param {number} [anchorX=0] - The X anchor value
* @param {number} [anchorY=0] - The Y anchor value
* @return {DisplayObject} The DisplayObject instance
*/
setTransform(
x: number = 0,
y: number = 0,
scaleX: number = 1,
scaleY: number = 1,
rotation: number = 0,
skewX: number = 0,
skewY: number = 0,
anchorX: number = 0,
anchorY: number = 0
): DisplayObject {
this.position.x = x;
this.position.y = y;
this.scale.x = !scaleX ? 1 : scaleX;
this.scale.y = !scaleY ? 1 : scaleY;
this.rotation = rotation;
this.skew.x = skewX;
this.skew.y = skewY;
this.anchor.x = anchorX;
this.anchor.y = anchorY;
return this;
}
/**
* 基本销毁方法
*/
destroy() {
//移除所有监听
this.removeAllEventListener();
//如果有父级,从中移除自己
if (this.parent) {
this.parent.removeChild(this);
}
//矩阵销毁
this.transform.destroy();
//对应属性都置null
this.transform = null;
this._localBoundsSelf = null;
this._bounds = null;
this.tempDisplayObjectParent = null;
this._mask = null;
this.mouseEnabled = false;
//标记为已销毁
this.destroyed = true;
}
get alpha(): number {
return this._alpha
}
set alpha(value: number) {
if (this._alpha != value) {
this._alpha = value
//是否有必要设置worldAlpha是否需要更新,一个乘法基本不耗性能
}
}
get x(): number {
return this.position.x;
}
set x(value: number) {
this.transform.position.x = value;
}
get y(): number {
return this.position.y;
}
set y(value: number) {
this.transform.position.y = value;
}
/**
* 获取世界矩阵
* 手动修改时,this.transform._worldID++,保证子级的worldMatrix会修改,尽量别那么做
* @member {Matrix}
* @readonly
*/
get worldMatrix() {
return this.transform.worldMatrix;
}
/**
* 获取本地矩阵
* 手动修改时this.transform._parentID=-1;保证其worldMatrix会更新
* @member {Matrix}
* @readonly
*/
get localMatrix() {
return this.transform.localMatrix;
}
/**
* 获取位置对象
* @member {Point|ObservablePoint}
*/
get position() {
return this.transform.position;
}
/**
* 设置位置对象
*/
set position(value) {
this.transform.position.copy(value);
}
/**
* 获取缩放对象
* @member {Point|ObservablePoint}
*/
get scale() {
return this.transform.scale;
}
/**
* 设置缩放对象
*/
set scale(value) {
this.transform.scale.copy(value);
}
get scaleX() {
return this.transform.scale.x;
}
set scaleX(value) {
this.transform.scale.x = value;
}
get scaleY() {
return this.transform.scale.y;
}
set scaleY(value) {
this.transform.scale.y = value;
}
/**
* 获取锚点对象
* @member {Point|ObservablePoint}
*/
get anchor() {
return this.transform.anchor;
}
set anchor(value) {
this.transform.anchor.copy(value);
}
get anchorX() {
return this.transform.anchor.x;
}
set anchorX(value) {
this.transform.anchor.x = value;
}
get anchorY() {
return this.transform.anchor.y;
}
set anchorY(value) {
this.transform.anchor.y = value;
}
/**
* 获取斜切对象
* @member {ObservablePoint}
*/
get skew() {
return this.transform.skew;
}
set skew(value) {
this.transform.skew.copy(value);
}
/**
* 获取旋转值,顺时针,角度制
* @member {number}
*/
get rotation(): number {
return this.transform.rotation * RAD_TO_DEG;
}
/**
* 角度制
*/
set rotation(value: number) {
this.transform.rotation = value * DEG_TO_RAD;
}
/**
* 自身是否可见,检测所有父级的visible
* @member {boolean}
* @readonly
*/
get worldVisible() {
if (!this.stage) {
return false;
}
let item = this;
do {
if (!item.visible) {
return false;
}
item = item.parent;
} while (item);
return true;
}
/**
* 获取遮罩
* @member {Graphics}
*/
get mask(): Graphics {
return this._mask;
}
set mask(value) {
if (this._mask) {
//原先有的遮罩,重置属性
this._mask.renderable = true;
this._mask.isUsedToMask = false;
if (this._mask.parent) {
this._mask.parent.removeChild(this._mask)
//是否销毁
}
}
this._mask = value;
if (this._mask) {
this._mask.renderable = false;
this._mask.isUsedToMask = true;
//保证更新包围盒
this._boundsID++;
//手动添加吧
// this.parent.addChild(this._mask)
}
}
/**
* 子类必重写,
*/
get width() {
return this._width
}
/**
* 子类必重写,如果设置过宽高_width有值且不为0,子类在更新texture时需设置scale
*/
set width(value) {
this._width = value;
}
get height() {
return this._height;
}
set height(value) {
this._height = value;
}
/**
* 更新方法,帧循环的监听事件放在这
*/
public update(deltaTime: number) {
//监听的
if (this.hasEventListener(Event.ENTER_FRAME)) {
this.dispatchEvent(Event.ENTER_FRAME, deltaTime);
}
}
}
/**
* 比用call性能好
* 不会被子集覆盖,部分地方使用
......
import Container from "./Container";
import { devicePixelRatio, osType, RENDERER_TYPE, StageScaleMode } from "../const"
import {devicePixelRatio, osType, RENDERER_TYPE, StageScaleMode} from "../const"
import SystemRenderer from "../renderers/SystemRenderer";
import { Point, Rectangle } from "../math";
import { EventDispatcher } from "../events/EventDispatcher";
import { Event } from "../events/Event";
import { FloatDisplay } from "./FloatDisplay";
import { DisplayObject } from "./DisplayObject";
import { MouseEvent } from "../events/MouseEvent";
import { WebglRenderer } from "../renderers/WebglRenderer";
import { GDispatcher } from "../events/GDispatcher";
import {Point, Rectangle} from "../math";
import {EventDispatcher} from "../events/EventDispatcher";
import {Event} from "../events/Event";
import {FloatDisplay} from "./FloatDisplay";
import {DisplayObject} from "./DisplayObject";
import {MouseEvent} from "../events/MouseEvent";
import {WebglRenderer} from "../renderers/WebglRenderer";
import {GDispatcher} from "../events/GDispatcher";
import CanvasRenderer from "../renderers/CanvasRenderer";
import { GlobalPro, isWebGLSupported } from "../utils";
import {GlobalPro, isWebGLSupported} from "../utils";
//如果以后还出现帧率问题,使用ticker;
//兼容requestAnimationFrame
......@@ -94,7 +94,7 @@ export class Stage extends Container {
* @default 0
* @readonly
*/
public renderType: number = 0;
public renderType: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN;
/**
* 直接获取stage的引用,避免总是从Event.ADD_TO_STAGE 事件中去获取stage引用
......@@ -356,7 +356,7 @@ export class Stage extends Container {
desH: number = 1206,
frameRate: number = 60,
scaleMode: string = StageScaleMode.FIXED_WIDTH,
renderType: number = RENDERER_TYPE.WEBGL,
renderType: RENDERER_TYPE = RENDERER_TYPE.WEBGL,
transparent: boolean = true,
bgColor: number = 0x000000
) {
......
......@@ -113,6 +113,26 @@ export class Event extends HashObject {
* @since 1.0.0
*/
public static CALL_FRAME: string = "onCallFrame";
/**
* 可见事件
* @Event
* @property VISIBLE
* @type {string}
* @static
* @public
* @since 1.0.0
*/
public static VISIBLE: string = "visible";
/**
* 隐藏事件
* @Event
* @property HIDDEN
* @type {string}
* @static
* @public
* @since 1.0.0
*/
public static HIDDEN: string = "hidden";
/**
* 完成事件
* @Event
......@@ -312,5 +332,6 @@ export class Event extends HashObject {
s._pd = false;
s._bpd = false;
s.type = type;
delete s.data;
}
}
......@@ -13,8 +13,10 @@ import {injectProperties, obj2query} from "../zeroing/utils";
* @param headers
*/
export function httpRequest(url: string, method: string = 'get', params?: any, type: 'text' | 'json' | 'jsonp' = 'text', headers?) {
let openUrl = url.indexOf('blob') === 0 ? url : urlJoin(url, '__ts__=' + Date.now());
let mParams = injectProperties({}, params);
if (type === "jsonp") {
return jsonp(url, params);
return jsonp(openUrl, mParams);
} else {
return new Promise((resolve, reject) => {
let mHeaders = {
......@@ -22,18 +24,19 @@ export function httpRequest(url: string, method: string = 'get', params?: any, t
};
injectProperties(mHeaders, headers);
let request = {url, method, params, type, headers: mHeaders};
let request = {url, method, params: mParams, type, headers: mHeaders};
const mock = window['mock'];
let mockRule;
if (mock) {
mock(request, (rule)=>{
mock(request, (rule) => {
mockRule = rule;
if(!mockRule){
if (!mockRule) {
doRequest(request, resolve, reject);
}
}, resolve, reject);
}else{
} else {
request.url = openUrl;
doRequest(request, resolve, reject);
}
});
......@@ -54,11 +57,11 @@ function doRequest({url, method, params, type, headers}, resolve, reject) {
const queryStr = obj2query(params);
let openUrl = url;
if (isGet) {
openUrl = urlJoin(url, queryStr);
openUrl = urlJoin(openUrl, queryStr);
}
xhr.open(method, openUrl, true);
if (!isGet) {
for(let key in headers){
for (let key in headers) {
xhr.setRequestHeader(key, headers[key]);
}
}
......@@ -72,7 +75,7 @@ function doRequest({url, method, params, type, headers}, resolve, reject) {
reject(reason)
};
xhr.onloadend = (): void => {
if(xhr.status == 404){
if (xhr.status == 404) {
reject(url + ' 404 (Not Found)')
}
};
......
......@@ -26,7 +26,7 @@ export default class SystemRenderer extends EventDispatcher {
* @default RENDERER_TYPE.UNKNOWN
* @see RENDERER_TYPE
*/
type: number;
type: RENDERER_TYPE;
/**
* canvas对象
*/
......
......@@ -13,7 +13,7 @@ const padding = 10;
* 继承Sprite,暂时发现,只需要切换bitmap和Sprite,TextField永远都是最新的,到时替换
* 动态文本类,有时需要在canvas里有一个动态文本,能根据我们的显示内容来改变
* @class TextFieldCon
* @extends DisplayObject
* @extends Sprite
* @since 1.0.0
* @public
*/
......@@ -36,7 +36,7 @@ export class TextField extends Sprite {
canvas.height = 3;
const texture = Texture.fromCanvas(canvas, SCALE_MODES.LINEAR, 'textCanvas');
texture.orig = new Rectangle();
this.texture = texture
this.texture = texture;
//baseTexture已自动缓存,把texture也缓存,key textCanvas+num 和baseTexture的一致
Texture.addToCache(this._texture, this._texture.baseTexture.textureCacheIds[0]);
......
......@@ -4,13 +4,12 @@
* 过程
*/
import {VM} from "./VM";
import {getDataByPath, linkedFlag, nodeScheme, objClone} from "../utils";
import {getDataByPath, linkedFlag, linkScheme, nodeScheme, objClone} from "../utils";
import {dataCenter} from "../game-warpper/data-center";
import {env} from "../game-warpper/enviroment";
import {getLogSwitch, Logs} from "../log-switch";
const log = getLogSwitch(Logs.PROCESS);
const linkScheme = 'link://';
export class Process {
private readonly id;
......@@ -109,7 +108,9 @@ export class Process {
}
if (func) {
let globalContext = this._vm.globalContext;
globalContext.dataCenter = globalContext.gameStage.dataCenter;
globalContext.gameStage = engine.gameStage;
globalContext.dataCenter = engine.gameStage.dataCenter;
globalContext.env = engine.env;
result = await func(payload, this._config.props, this._target, globalContext, this._vm);
if (log){
console.log(`[${this._vm.id}:${this.id}] output: <${result.type}>`, result.payload);
......
......@@ -15,6 +15,8 @@ const eventsMapping = {
[MouseEvent.MOUSE_DOWN]: 'touchstart',
[MouseEvent.MOUSE_MOVE]: 'touchmove',
[MouseEvent.MOUSE_UP]: 'touchend',
[MouseEvent.VISIBLE]: 'visible',
[MouseEvent.HIDDEN]: 'hidden',
};
export const globalEvent = new EventDispatcher();
......@@ -52,7 +54,7 @@ class EventsProxy extends HashObject {
start(eventsConfig) {
this._eventsConfig = eventsConfig;
for(let name in eventsConfig){
for (let name in eventsConfig) {
globalEvent.addEventListener(name, this.onCustomEvent, this);
}
......@@ -63,8 +65,8 @@ class EventsProxy extends HashObject {
if (this._eventsConfig) {
const eventConfig = this._eventsConfig[name];
if (eventConfig) {
for(let behavior of eventConfig.behaviors){
if(behavior.disabled){
for (let behavior of eventConfig.behaviors) {
if (behavior.disabled) {
continue;
}
executeBehavior({
......
......@@ -13,7 +13,7 @@ import {Rect} from "./nodes";
import {injectEnv} from "./enviroment";
import {Toast} from "./Toast";
import {arrayFind} from "../utils";
import {registerScripts} from "..";
import {registerCustomModuleAssets, registerScripts} from "..";
import {registerCustomModuleFromConfig} from "./custom-module";
/**
......@@ -149,6 +149,9 @@ export class GameStage extends Container {
//registerScripts(scripts);
//registerCustomModuleFromConfig(customs);
registerCustomModuleAssets(customs);
if(dataMapping){
this.dataCenter.registerDataMapping(dataMapping);
}
......
......@@ -3,7 +3,7 @@
*/
import {globalLoader} from "../../2d/loader/Loader";
import {arrayFind} from "../utils";
import {arrayFind, linkScheme} from "../utils";
import {parse} from "./bmp-text-manager";
let assetsConfig = [];
......@@ -32,10 +32,16 @@ export function loadAssets(config, onProgress?, onComplete?) {
return Promise.all(
config.map(assetConfig => {
assetsConfig.push(assetConfig);
const loadFunc = loaderMapping[assetConfig.ext];
const {url, ext, uuid} = assetConfig;
const loadFunc = loaderMapping[ext];
if (loadFunc) {
if(url.indexOf(linkScheme) === 0){
loaded++;
onProgress && onProgress(loaded, total);
return Promise.resolve();
}
let method = globalLoader['load' + loadFunc];
return method.call(globalLoader, assetConfig.url, assetConfig.uuid).then(
return method.call(globalLoader, url, uuid).then(
(data) => {
parse(assetConfig, data);
......@@ -43,7 +49,7 @@ export function loadAssets(config, onProgress?, onComplete?) {
onProgress && onProgress(loaded, total);
},
(error) => {
failedList.push(assetConfig.url);
failedList.push(url);
}
);
} else {
......@@ -81,7 +87,7 @@ export function getAssetByName(name): any {
return result;
} else {
for (let assetConfig of assetsConfig) {
let res = engine.globalLoader.get(assetConfig.url);
let res = globalLoader.get(assetConfig.url);
if (res && res.frames) {
for (let key in res.frames) {
const frame = res.frames[key];
......
/**
* Created by rockyl on 2019-11-22.
*/
import {importCJSCode} from "../utils";
import {arrayFind, importCJSCode, linkScheme} from "../utils";
import {Container} from "../../2d/display";
import {getAssetByUUID} from "./assets-manager";
const customMap = {};
/**
* 注册自定义模块素材映射
* @param customs
*/
export function registerCustomModuleAssets(customs) {
for (let custom of customs) {
customMap[custom.id].assets = custom.assets;
}
}
/**
* 注册自定义模块
* @param id
* @param def
*/
export function registerCustomModule(id, def) {
customMap[id] = def;
customMap[id] = {
def,
};
}
/**
* 注册自定义模块代码段
* @param config
*/
export function registerCustomCodeModule(config) {
const {id, code} = config;
registerCustomModule(id, importCJSCode(code, true));
}
/**
* 通过配置注册自定义模块
* @param config
*/
export function registerCustomModuleFromConfig(config) {
if(config){
if (config) {
for (let item of config) {
registerCustomCodeModule(item);
}
}
}
/**
* 增加自定义模块
* @param id
* @param container
* @param options
*/
export function addCustomModule(id, container: Container, options?) {
let creator = customMap[id];
let creator = customMap[id].def;
if (creator) {
let instance = creator(options);
if (instance) {
......@@ -33,3 +65,25 @@ export function addCustomModule(id, container: Container, options?) {
}
}
}
/**
* 处理自定义模块资源
* @param id
* @param uuid
*/
export function resolveCustomAsset(id, uuid) {
let module = customMap[id];
if (module) {
let config = arrayFind(module.assets, item => item.uuid === uuid);
if (config) {
if (config.url.indexOf(linkScheme) === 0) {
let linkUUID = config.url.replace(linkScheme, '');
let linkConfig = getAssetByUUID(linkUUID);
if (linkConfig) {
config = linkConfig;
}
}
}
return config;
}
}
......@@ -3,14 +3,13 @@
*/
import Container from "../../../2d/display/Container";
import {Event} from "../../../2d/events";
import Sprite from "../../../2d/display/Sprite";
import Texture from "../../../2d/texture/Texture";
import {getFont} from "../bmp-text-manager";
import {dirtyFieldTrigger} from "../../decorators";
import {VERTICAL_ALIGN} from "../../..";
export class BitmapText extends Container {
private _dirty: boolean = true;
private _charCache = [];
private _fontConfig;
......@@ -19,47 +18,60 @@ export class BitmapText extends Container {
@dirtyFieldTrigger
public font: string;
@dirtyFieldTrigger
public verticalAlign: VERTICAL_ALIGN = VERTICAL_ALIGN.DOWN;
@dirtyFieldTrigger
public letterSpacing: number = 0;
constructor() {
super();
this.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, this);
}
onModify(value, key) {
switch (key) {
case 'text':
this._dirty = true;
case 'letterSpacing':
case 'verticalAlign':
this.render();
break;
case 'font':
this._fontConfig = getFont(value);
this._dirty = true;
break;
case 'letterSpacing':
this._dirty = true;
break;
}
}
onEnterFrame(e) {
if (this._dirty) {
this._dirty = false;
if (!this._fontConfig) {
return;
}
protected render() {
if (!this._fontConfig || !this.text) {
return;
}
let text = this.text + '';
let x = 0, li = this.text.length;
for (let i = 0; i < li; i++) {
const char = this.text[i];
let sp = this.addChar(char, i);
sp.x = x;
x += sp.width + this.letterSpacing;
let x = 0, li = text.length, maxHeight = 0;
for (let i = 0; i < li; i++) {
const char = text[i];
let sp = this.addChar(char, i);
sp.x = x;
x += sp.width + this.letterSpacing;
if (sp.height > maxHeight) {
maxHeight = sp.height;
}
for (let i = li; i < this.children.length; i++) {
this._charCache.push(this.removeChildAt(li));
}
if (this._height) {
maxHeight = this._height;
}
for (let i = 0, li = this.children.length; i < li; i++) {
const child = this.children[i];
switch (this.verticalAlign) {
case VERTICAL_ALIGN.DOWN:
child.y = maxHeight - child.height;
break;
case VERTICAL_ALIGN.MIDDLE:
child.y = (maxHeight - child.height) / 2;
break;
case VERTICAL_ALIGN.UP:
child.y = 0;
break;
}
}
for (let i = li; i < this.children.length; i++) {
this._charCache.push(this.removeChildAt(li));
}
}
private addChar(char, index) {
......@@ -75,7 +87,7 @@ export class BitmapText extends Container {
this.addChild(sp);
}
let uuid = this._fontConfig[char];
if(!uuid){
if (!uuid) {
console.log(`font asset not found: [${char}] in`, this.font);
}
sp.texture = uuid ? Texture.fromImage(uuid) : null;
......
......@@ -21,6 +21,9 @@ export class Label extends TextField {
* @private
*/
protected _setText(value) {
if (typeof value !== 'string') {
value = value + '';
}
if (value !== this._text) {
let matchResult = value.match(ESCAPE_REG_EXP);
......
......@@ -36,7 +36,7 @@ export class ScrollList extends ScrollListBase {
}
}
private onNextFrame(event) {
protected onNextFrame(event) {
this.firstItem = <Container>this.removeChildAt(0);
this._updateViewRect();
}
......
......@@ -8,3 +8,4 @@ export * from './Label'
export * from './TextInput'
export * from './ScrollView'
export * from './ScrollList'
export * from './BitmapText'
......@@ -3,9 +3,8 @@
*/
import {Container} from "../../2d/display";
import {Rect, Image, Label, Circle, ScrollView, TextInput, ScrollList} from "./nodes";
import {injectProperties, instantiateScript, propertyParse} from "../utils";
import {BitmapText} from "./nodes/BitmapText";
import {Rect, Image, Label, Circle, ScrollView, TextInput, ScrollList, BitmapText} from "./nodes";
import {injectProperties, instantiateScript,} from "../utils";
const nodeTypeMapping = {
node: Container,
......
......@@ -14,8 +14,12 @@ export * from './log-switch'
import {instantiate, registerNodeType} from './game-warpper/view-interpreter'
export {Howl, Howler} from 'howler';
import emojiRegex from 'emoji-regex';
const emojiRegexp = emojiRegex();
export {
instantiate,
registerNodeType,
emojiRegexp,
}
......@@ -7,10 +7,11 @@ import {registerScriptDef} from "..";
export const ESCAPE_REG_EXP = /\$\{[\u4e00-\u9fa5_a-zA-Z0-9\|]+\}/g;
export const linkedFlag = '$_linked_$';
export const nodeScheme = 'node://';
export const linkScheme = 'link://';
export function arrayFind(arr, predicate) {
if(!arr){
return ;
if (!arr) {
return;
}
for (let i = 0, li = arr.length; i < li; i++) {
const item = arr[i];
......@@ -134,7 +135,7 @@ export function obj2query(obj: any): string {
return arr.join('&');
}
function requireForCJS(id){
function requireForCJS(id) {
return window[id];
}
......@@ -227,29 +228,30 @@ export function htmlToPureText(htmlText) {
}
const zhReg = /[\u4e00-\u9fa5]/;
export function strLen(str){
export function strLen(str) {
let len = 0;
for(let char of str){
for (let char of str) {
len += char.match(zhReg) ? 2 : 1;
}
return len;
}
export function strShort(str, limit, replace = '…'){
export function strShort(str, limit, replace = '…') {
let result = '';
if(strLen(str) > limit){
if (strLen(str) > limit) {
let len = 0;
for (let i = 0, li = str.length; i < li; i++) {
const char = str[i];
len += char.match(zhReg) ? 2 : 1;
if(len > limit){
if (len > limit) {
result += replace;
break;
}else{
} else {
result += char;
}
}
}else{
} else {
result = str;
}
return result;
......@@ -264,4 +266,6 @@ export function injectProperties(target, source) {
for (let key in source) {
propertyParse(key, target, source);
}
return target;
}
......@@ -3,7 +3,7 @@
*/
export let queryParams:any = {};
for(let item of location.search.replace('?', '').split('&')){
for(let item of top.location.search.replace('?', '').split('&')){
let arr = item.split('=');
queryParams[arr[0]] = arr.length === 1 ? true : arr[1];
}
export default class TouchZoom {
static id: string;
host: any;
zoomTo: number;
mounted(): void;
private _onMouseDown;
private _onMouseUp;
}
export default class Wave {
static id: string;
host: any;
duration: any;
mounted(): void;
destroy(): void;
update(t: any): void;
awake(): void;
sleep(): void;
}
export declare abstract class HashObject {
protected _instanceId: number;
protected _instanceType: string;
protected static _object_id: number;
constructor();
readonly instanceId: number;
readonly instanceType: string;
abstract destroy(): void;
}
export declare const VERSION = "1.0";
export declare const devicePixelRatio: number;
export declare let StageScaleMode: {
EXACT_FIT: string;
NO_BORDER: string;
NO_SCALE: string;
SHOW_ALL: string;
FIXED_WIDTH: string;
FIXED_HEIGHT: string;
};
export declare const osType: string;
export declare function cos(angle: number): number;
export declare function sin(angle: number): number;
export declare const PI_2: number;
export declare const RAD_TO_DEG: number;
export declare const DEG_TO_RAD: number;
export declare enum RENDERER_TYPE {
UNKNOWN = 0,
WEBGL = 1,
CANVAS = 2
}
export declare enum SHAPES {
POLY = 0,
RECT = 1,
CIRC = 2,
ELIP = 3,
RREC = 4
}
export declare enum PRECISION {
LOW = "lowp",
MEDIUM = "mediump",
HIGH = "highp"
}
export declare enum TEXT_GRADIENT {
LINEAR_VERTICAL = 0,
LINEAR_HORIZONTAL = 1
}
export declare enum TEXT_ALIGN {
CENTER = "center",
LEFT = "left",
RIGHT = "right"
}
export declare enum VERTICAL_ALIGN {
MIDDLE = "middle",
UP = "up",
DOWN = "down"
}
export declare enum TEXT_lINETYPE {
SINGLE = "single",
MULTI = "multi"
}
export declare enum LINE_ALIGNMENT {
middle = 0.5,
outter = 1,
inner = 0
}
export declare enum LINE_CAP {
BUTT = "butt",
ROUND = "round",
SQUARE = "square"
}
export declare enum LINE_JOIN {
MITER = "miter",
ROUND = "round",
BEVEL = "bevel"
}
export declare enum BLEND_MODES {
NORMAL = 0,
ADD = 1,
MULTIPLY = 2,
SCREEN = 3,
OVERLAY = 4,
DARKEN = 5,
LIGHTEN = 6,
COLOR_DODGE = 7,
COLOR_BURN = 8,
HARD_LIGHT = 9,
SOFT_LIGHT = 10,
DIFFERENCE = 11,
EXCLUSION = 12,
HUE = 13,
SATURATION = 14,
COLOR = 15,
LUMINOSITY = 16,
NORMAL_NPM = 17,
ADD_NPM = 18,
SCREEN_NPM = 19
}
export declare enum DRAW_MODES {
POINTS = 0,
LINES = 1,
LINE_LOOP = 2,
LINE_STRIP = 3,
TRIANGLES = 4,
TRIANGLE_STRIP = 5,
TRIANGLE_FAN = 6
}
export declare enum SCALE_MODES {
LINEAR = 0,
NEAREST = 1
}
export declare enum WRAP_MODES {
CLAMP = 33071,
REPEAT = 10497,
MIRRORED_REPEAT = 33648
}
export declare enum GC_MODES {
AUTO = 0,
MANUAL = 1
}
export declare const URL_FILE_EXTENSION: any;
export declare const DATA_URI: any;
export declare enum SCROLL_DIRECTION {
HORIZONTAL = "horizontal",
VERTICAL = "vertical"
}
import { DisplayObject } from './DisplayObject';
import { Point } from '../math';
import CanvasRenderer from '../renderers/CanvasRenderer';
import { WebglRenderer } from '../renderers/WebglRenderer';
export default class Container extends DisplayObject {
percentWidth: number;
percentHeight: number;
left: number;
top: number;
right: number;
bottom: number;
horizonCenter: number;
verticalCenter: number;
mouseChildren: boolean;
children: any[];
containerUpdateTransform: any;
constructor();
afterConstructor(): void;
onChildrenChange(index: any): void;
addChild(child: DisplayObject): DisplayObject;
addChildAt(child: DisplayObject, index: number): DisplayObject;
swapChildren(child1: DisplayObject, child2: DisplayObject): boolean;
getChildIndex(child: DisplayObject): number;
setChildIndex(child: DisplayObject, index: number): void;
getChildAt(index: number): DisplayObject;
getChildByName(name: string | RegExp, isOnlyOne?: boolean, isRecursive?: boolean): any;
removeChild(child: DisplayObject): DisplayObject;
removeChildAt(index: number): DisplayObject;
removeChildren(beginIndex?: number, endIndex?: number): DisplayObject[];
updateTransform(): void;
calculateBounds(): void;
protected _calculateBounds(): void;
hitTestPoint(globalPoint: Point, isMouseEvent?: boolean): any;
renderWebGL(renderer: WebglRenderer): void;
private renderAdvancedWebGL;
protected _renderWebGL(renderer: WebglRenderer): void;
renderCanvas(renderer: CanvasRenderer): void;
protected _renderCanvas(renderer: CanvasRenderer): void;
update(deltaTime: number): void;
_onDispatchBubbledEvent(type: string): void;
destroy(): void;
width: number;
height: number;
private static _getElementsByName;
}
import { EventDispatcher } from '../events/EventDispatcher';
import Transform from '../math/Transform';
import { Rectangle } from '../math/Rectangle';
import { Point } from "../math/Point";
import Graphics from '../graphics/Graphics';
export declare class DisplayObject extends EventDispatcher {
transform: Transform;
visible: boolean;
renderable: boolean;
parent: any;
stage: any;
name: string;
worldAlpha: number;
protected _localBoundsSelf: Rectangle;
protected _bounds: Rectangle;
protected _boundsID: number;
protected _lastBoundsID: number;
private _mask;
private _alpha;
destroyed: boolean;
mouseEnabled: boolean;
tempDisplayObjectParent: DisplayObject;
displayObjectUpdateTransform: any;
displayObjectHitTestPoint: any;
protected _width: number;
protected _height: number;
constructor();
private readonly _tempDisplayObjectParent;
updateTransform(): void;
static _bp: Point;
static _p1: Point;
static _p2: Point;
static _p3: Point;
static _p4: Point;
static temBounds: Rectangle;
hitTestPoint(point: Point, isMouseEvent?: boolean): DisplayObject;
private _recursivePostUpdateTransform;
getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;
getLocalBounds(rect?: Rectangle): Rectangle;
calculateBounds(): void;
globalToLocal(point: Point, bp?: Point): Point;
localToGlobal(point: Point, bp?: Point): Point;
_onDispatchBubbledEvent(type: string): void;
renderWebGL(renderer: any): void;
renderCanvas(renderer: any): void;
setParent(container: any): any;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, anchorX?: number, anchorY?: number): DisplayObject;
destroy(): void;
alpha: number;
x: number;
y: number;
readonly worldMatrix: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/Matrix").Matrix;
readonly localMatrix: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/Matrix").Matrix;
position: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
scale: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
scaleX: number;
scaleY: number;
anchor: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
anchorX: number;
anchorY: number;
skew: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
rotation: number;
readonly worldVisible: boolean;
mask: Graphics;
width: number;
height: number;
update(deltaTime: number): void;
}
import { DisplayObject } from "./DisplayObject";
export declare class FloatDisplay extends DisplayObject {
htmlElement: any;
private _isAdded;
private _transformID;
constructor();
init(htmlElement: any): void;
private getStyle;
updateStyle(): void;
destroy(): void;
}
import { Point, Rectangle } from '../math';
import Texture from '../texture/Texture';
import Container from './Container';
import CanvasRenderer from '../renderers/CanvasRenderer';
import { WebglRenderer } from '../renderers/WebglRenderer';
export default class Sprite extends Container {
private _anchorTexture;
_texture: Texture;
_width: number;
_height: number;
_transformID: number;
_textureID: number;
_transformTrimmedID: number;
_textureTrimmedID: number;
pluginName: string;
indices: Uint16Array;
start: number;
uvs: Float32Array;
vertexData: Float32Array;
vertexTrimmedData: Float32Array;
constructor(texture?: Texture);
_onTextureUpdate(): void;
_onAnchorUpdate(): void;
calculateVertices(): void;
calculateTrimmedVertices(): void;
_renderWebGL(renderer: WebglRenderer): void;
_renderCanvas(renderer: CanvasRenderer): void;
_calculateBounds(): void;
getLocalBounds(rect?: Rectangle): Rectangle;
hitTestPoint(globalPoint: Point, isMouseEvent?: boolean): any;
destroy(): void;
anchorTexture: any;
texture: Texture;
static from(source: any): Sprite;
static fromFrame(frameId: string): Sprite;
static fromImage(imageId: string, crossorigin?: boolean, scaleMode?: number): Sprite;
}
import Container from "./Container";
import SystemRenderer from "../renderers/SystemRenderer";
import { Rectangle } from "../math";
import { DisplayObject } from "./DisplayObject";
export declare class Stage extends Container {
iosTouchendPreventDefault: boolean;
isPreventDefaultEvent: boolean;
rootDiv: any;
renderObj: SystemRenderer;
renderType: number;
static getStage(stageName?: string): Stage;
private static _stageList;
static pause: boolean;
private static _pause;
viewRect: Rectangle;
autoSteering: boolean;
autoResize: boolean;
desWidth: number;
desHeight: number;
divHeight: number;
divWidth: number;
private _bgColor;
bgColor: number;
scaleMode: string;
private _scaleMode;
private _flush;
private _currentFlush;
static _dragDisplay: DisplayObject;
private static _isLoadedVConsole;
private _lastDpList;
private _rid;
private _floatDisplayList;
constructor(rootDivId?: string, desW?: number, desH?: number, frameRate?: number, scaleMode?: string, renderType?: number, transparent?: boolean, bgColor?: number);
render(): void;
private _ml;
private _mp;
private _initMouseEvent;
private _mouseDownPoint;
flush(): void;
setFrameRate(fps: number): void;
getFrameRate(): number;
getRootDivWH(div: HTMLDivElement): {
w: number;
h: number;
};
kill(): void;
private _mouseEventTypes;
private onMouseEvent;
private setAlign;
resize(): void;
getBounds(): Rectangle;
private static allUpdateObjList;
static flushAll(): void;
static addUpdateObj(target: any): void;
static removeUpdateObj(target: any): void;
destroy(): void;
}
export { default as Container } from './Container';
export { DisplayObject } from './DisplayObject';
export { FloatDisplay } from "./FloatDisplay";
export { default as Sprite } from "./Sprite";
export { Stage } from "./Stage";
import { HashObject } from "../HashObject";
export declare class Event extends HashObject {
static RESIZE: string;
static ON_SCROLL_TO_HEAD: string;
static ON_SCROLL_STOP: string;
static ON_SCROLL_START: string;
static ON_SCROLL_TO_END: string;
static ON_INIT_STAGE: string;
static ADDED_TO_STAGE: string;
static REMOVED_FROM_STAGE: string;
static ENTER_FRAME: string;
static END_FRAME: string;
static CALL_FRAME: string;
static COMPLETE: string;
static PROGRESS: string;
static ERROR: string;
static ABORT: string;
static START: string;
static TIMER: string;
static TIMER_COMPLETE: string;
type: string;
target: any;
data: any;
constructor(type: string);
stopImmediatePropagation(): void;
stopPropagation(): void;
private _bpd;
private _pd;
destroy(): void;
reset(type: string, target: any): void;
}
import { HashObject } from "../HashObject";
export declare class EventDispatcher extends HashObject {
protected eventTypes: any;
protected eventTypes1: any;
constructor();
private static _MECO;
static _totalMEC: number;
static getMouseEventCount(type?: string): number;
addEventListener(type: string, listener: Function, context?: any, useCapture?: boolean): void;
once(type: string, listener: Function, context?: any, useCapture?: boolean): void;
private _changeMouseCount;
private _defaultEvent;
dispatchEvent(event: any, data?: any, useCapture?: boolean): boolean;
hasEventListener(type: string, useCapture?: boolean): boolean;
removeEventListener(type: string, listener: Function, context?: any, useCapture?: boolean): void;
removeAllEventListener(): void;
destroy(): void;
}
export declare class GDispatcher {
private static callbackPool;
private static thisObjPool;
static addEvent(name: string, callback: any, thisObj: any): void;
static removeEvent(name: string, callback: any, thisObj?: any): void;
static dispatchEvent(name: string, ...args: any[]): void;
}
import { Event } from "./Event";
import { DisplayObject } from "../display/DisplayObject";
export declare class MouseEvent extends Event {
static MOUSE_DOWN: string;
static MOUSE_UP: string;
static CLICK: string;
static MOUSE_MOVE: string;
static MOUSE_OVER: string;
static MOUSE_OUT: string;
clientX: number;
clientY: number;
stageX: number;
stageY: number;
localX: number;
localY: number;
currentTarget: DisplayObject;
identifier: any;
constructor(type: string);
updateAfterEvent(): void;
destroy(): void;
}
export * from './Event';
export * from './EventDispatcher';
export * from './GDispatcher';
export * from './MouseEvent';
import GraphicsData from './GraphicsData';
import { Matrix, Point } from '../math';
import { Polygon } from "./shapes";
import { DisplayObject } from '../display/DisplayObject';
import Texture from '../texture/Texture';
import CanvasRenderer from '../renderers/CanvasRenderer';
import { WebglRenderer } from '../renderers/WebglRenderer';
import FillStyle from './styles/FillStyle';
import LineStyle from './styles/LineStyle';
import Container from '../display/Container';
export default class Graphics extends Container {
private _fillStyle;
private _lineStyle;
readonly fill: FillStyle;
readonly line: LineStyle;
private _tint;
tint: number;
private batchTint;
private _matrix;
matrix: Matrix;
hitTestByPixel: boolean;
private _holeMode;
private _currentPath;
graphicsData: GraphicsData[];
isUsedToMask: boolean;
boundsPadding: number;
private dirty;
private boundsDirty;
cacheAsBitmap: boolean;
private cacheDirty;
private _canvasBuffer;
_texture: Texture;
offsetX: number;
offsetY: number;
verts: any;
indices: any;
private batches;
private geoBatches;
private batchDirty;
private uvs;
private vertexData;
private shapeIndex;
private _transformID;
constructor();
clone(): Graphics;
lineStyle(lineWidth?: number, color?: number, alpha?: number, alignment?: number, native?: boolean): Graphics;
lineTextureStyle(width?: number, texture?: Texture, color?: number, alpha?: number, matrix?: any, alignment?: number, native?: boolean): this;
private startPoly;
private finishPoly;
moveTo(x: number, y: number): Graphics;
lineTo(x: number, y: number): Graphics;
private _initCurve;
quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): Graphics;
bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): Graphics;
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics;
arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): Graphics;
beginFill(color?: number | string, alpha?: number): Graphics;
beginTextureFill(texture?: Texture, color?: number, alpha?: number, matrix?: Matrix): this;
endFill(): Graphics;
closePath(): Graphics;
beginHole(): this;
endHole(): this;
drawRect(x: number, y: number, width: number, height: number): Graphics;
drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): Graphics;
drawCircle(x: number, y: number, radius: number): Graphics;
drawEllipse(x: number, y: number, width: number, height: number): Graphics;
drawPolygon(path: number[] | Point[] | Polygon): Graphics;
drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation?: number): Graphics;
private drawShape;
clear(): Graphics;
isFastRect(): boolean;
_renderWebGL(renderer: WebglRenderer): void;
private updateBatch;
private calculateTints;
private calculateVertices;
private transformPoints;
_renderCanvas(renderer: CanvasRenderer): void;
_calculateBounds(): void;
hitTestPoint(point: Point, isMouseEvent?: boolean): DisplayObject;
private hitTestPointAccuratly;
updateLocalBoundsSelf(): void;
private generateCanvasTexture;
destroy(): void;
private proccessHoles;
private addUvs;
private adjustUvs;
}
import Circle from "./shapes/Circle";
import { Matrix, Rectangle } from "../math";
import Ellipse from "./shapes/Ellipse";
import Polygon from "./shapes/Polygon";
import RoundedRectangle from "./shapes/RoundedRectangle";
import { HashObject } from "../HashObject";
import LineStyle from "./styles/LineStyle";
import FillStyle from "./styles/FillStyle";
export default class GraphicsData extends HashObject {
fillStyle: FillStyle;
lineStyle: LineStyle;
matrix: Matrix;
holes: any[];
shape: any;
type: number;
points: number[];
constructor(shape: Circle | Rectangle | Ellipse | Polygon | RoundedRectangle, fillStyle?: FillStyle, lineStyle?: LineStyle, matrix?: Matrix);
clone(): GraphicsData;
destroy(): void;
}
import { LINE_CAP, LINE_JOIN } from "../const";
import { Point } from "../math";
import { DisplayObject } from "../display/DisplayObject";
import Sprite from "../display/Sprite";
export declare class Shape extends Sprite {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
dirty: boolean;
offsetX: number;
offsetY: number;
constructor();
private _command;
private _isBitmapStroke;
private _isBitmapFill;
hitTestByPixel: boolean;
drawRoundRect(x: number, y: number, w: number, h: number, rTL?: number, rTR?: number, rBL?: number, rBR?: number): void;
moveTo(x: number, y: number): void;
lineTo(x: number, y: number): void;
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
quadraticCurveTo(cpX: number, cpY: number, x: number, y: number): void;
bezierCurveTo(cp1X: number, cp1Y: number, cp2X: number, cp2Y: number, x: number, y: number): void;
closePath(): void;
drawRect(x: number, y: number, w: number, h: number): void;
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
drawCircle(x: number, y: number, radius: number, counterclockwise?: boolean): void;
drawEllipse(x: number, y: number, w: number, h: number): void;
clear(): void;
beginFill(color: number, alpha?: number): void;
beginLinearGradientFill(points: any, colors: any): void;
beginRadialGradientFill: (points: any, colors: any) => void;
beginBitmapFill(image: any, matrix: Array<number>): void;
private _fill;
beginStroke(color: number, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number, alpha?: number): void;
beginLinearGradientStroke(points: Array<number>, colors: any, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number): void;
beginRadialGradientStroke(points: Array<number>, colors: any, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number): void;
beginBitmapStroke(image: any, matrix: Array<number>, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number): void;
private _stroke;
endFill(): void;
endStroke(): void;
updateShape(): void;
private _drawShape;
hitTestPoint(globalPoint: Point, isMouseEvent?: boolean): DisplayObject;
changeColor(infoObj: any): void;
updateTexture(): void;
_renderCanvas(renderer: any): void;
_renderWebGL(renderer: any): void;
destroy(): void;
}
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: any, graphicsGeometry: Graphics): void;
};
export default _default;
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
export default function (graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
import Graphics from "../Graphics";
import GraphicsData from "../GraphicsData";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
};
export default _default;
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphics: Graphics): void;
};
export default _default;
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
};
export default _default;
export declare function earcut(data: any, holeIndices: any, dim: any): any[];
import { Point, Rectangle } from '../../math';
export default class Circle {
x: number;
y: number;
radius: number;
type: number;
constructor(x?: number, y?: number, radius?: number);
clone(): Circle;
isPointIn(point: Point): boolean;
getBounds(): Rectangle;
}
import { Point, Rectangle } from '../../math';
export default class Ellipse {
x: number;
y: number;
width: number;
height: number;
type: number;
constructor(x?: number, y?: number, width?: number, height?: number);
clone(): Ellipse;
isPointIn(point: Point): boolean;
getBounds(): Rectangle;
}
import { Point } from '../../math/Point';
export default class Polygon {
closed: boolean;
points: number[];
type: number;
constructor(...points: any[]);
clone(): Polygon;
close(): void;
isPointIn(point: Point): boolean;
}
import { Point } from '../../math';
export default class RoundedRectangle {
x: number;
y: number;
width: number;
height: number;
radius: number;
type: number;
constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
clone(): RoundedRectangle;
isPointIn(point: Point): boolean;
}
export { default as Circle } from './Circle';
export { default as Ellipse } from './Ellipse';
export { default as Polygon } from './Polygon';
export { default as RoundedRectangle } from './RoundedRectangle';
import Texture from "../../texture/Texture";
import { Matrix } from "../../math";
export default class FillStyle {
color: number;
alpha: number;
texture: Texture;
matrix: Matrix;
visible: boolean;
alphaBlock: boolean;
constructor();
clone(): FillStyle;
reset(): void;
destroy(): void;
}
import FillStyle from './FillStyle';
import { LINE_ALIGNMENT } from '../../const';
export default class LineStyle extends FillStyle {
native: boolean;
width: number;
alignment: LINE_ALIGNMENT;
clone(): LineStyle;
reset(): void;
}
export declare function bezierCurveControlPoint(points: any): {
A: any[];
B: any[];
};
export default function bezierCurveTo(fromX: number, fromY: number, cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number, n: number, path?: number[]): number[];
export { default as bezierCurveTo } from './bezierCurveTo';
export { bezierCurveControlPoint } from "./bezierCurveControlPoint";
export declare const GRAPHICS_CURVES: {
adaptive: boolean;
maxLength: number;
minSegments: number;
maxSegments: number;
segmentsCount: Function;
};
export declare function quadraticCurveLength(fromX: number, fromY: number, cpX: number, cpY: number, toX: number, toY: number): number;
export declare function bezierCurveLength(fromX: number, fromY: number, cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): number;
import { EventDispatcher } from "../events/EventDispatcher";
import { Texture } from "../texture";
export declare class Loader extends EventDispatcher {
caches: {};
crossOrigin: boolean;
constructor();
loadSheet(url: string): Promise<void>;
loadRaw(url: string, uuid?: string, type?: 'text' | 'json'): Promise<any>;
loadJson(url: string, uuid?: string): Promise<any>;
loadText(url: string, uuid?: string): Promise<any>;
loadImage(url: string, uuid?: string): Promise<{}>;
loadTexture(url: string, uuid?: string): Promise<Texture>;
cache(name: string, data: any): void;
}
export declare const globalLoader: Loader;
declare const GroupD8: {
E: number;
SE: number;
S: number;
SW: number;
W: number;
NW: number;
N: number;
NE: number;
MIRROR_VERTICAL: number;
MIRROR_HORIZONTAL: number;
uX: (ind: any) => number;
uY: (ind: any) => number;
vX: (ind: any) => number;
vY: (ind: any) => number;
inv: (rotation: any) => number;
add: (rotationSecond: any, rotationFirst: any) => any;
sub: (rotationSecond: any, rotationFirst: any) => any;
rotate180: (rotation: any) => number;
isVertical: (rotation: any) => boolean;
byDirection: (dx: any, dy: any) => number;
matrixAppendRotationInv: (matrix: any, rotation: any, tx?: number, ty?: number) => void;
};
export default GroupD8;
import { Point } from "././Point";
import { HashObject } from "../HashObject";
export declare class Matrix extends HashObject {
a: number;
b: number;
c: number;
d: number;
tx: number;
ty: number;
array: any;
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
clone(): Matrix;
copy(matrix: Matrix | any): this;
transformPoint(x: number, y: number, bp?: Point): Point;
transformPointInverse(x: number, y: number, bp?: Point): Point;
setFrom(mtx: Matrix): void;
identity(): void;
invert(): Matrix;
createBox(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, ax: number, ay: number): void;
prepend: (mtx: Matrix) => void;
append(matrix: Matrix): void;
static isEqual(m1: Matrix, m2: Matrix): boolean;
concat(mtx: Matrix): void;
rotate(angle: number): void;
scale(sx: number, sy: number): void;
translate(dx: number, dy: number): void;
set(a: any, b: any, c: any, d: any, tx: any, ty: any): this;
getRotation(): number;
toArray(transpose?: boolean, out?: any): any;
static readonly IDENTITY: Matrix;
static readonly TEMP_MATRIX: Matrix;
destroy(): void;
}
import { Point } from "../math/Point";
import { HashObject } from "../HashObject";
export declare class ObservablePoint extends HashObject {
_x: number;
_y: number;
cb: any;
scope: any;
constructor(cb: Function, scope: any, x?: number, y?: number);
set(x?: number, y?: number): void;
copy(point: Point | ObservablePoint): void;
x: number;
y: number;
destroy(): void;
}
import { HashObject } from "../HashObject";
export declare class Point extends HashObject {
destroy(): void;
constructor(x?: number, y?: number);
x: number;
y: number;
static distance(...args: any[]): number;
set(x: number, y: number): void;
}
import { HashObject } from "../HashObject";
import { Point } from "./Point";
export declare class Rectangle extends HashObject {
type: number;
constructor(x?: number, y?: number, width?: number, height?: number);
clear(): void;
copy(rect: Rectangle): this;
clone(): Rectangle;
x: number;
y: number;
width: number;
height: number;
readonly left: number;
readonly right: number;
readonly top: number;
readonly bottom: number;
isPointIn(point: Point): boolean;
fit(rectangle: Rectangle): void;
static createFromRects(...arg: Rectangle[]): Rectangle;
static createFromPoints(rect: Rectangle, ...arg: Point[]): Rectangle;
static createFromVertexData(rect: Rectangle, vertexData: Float32Array): Rectangle;
static createRectfrom2Point(rect: Rectangle, p1: Point, p2: Point): Rectangle;
static testRectCross(ra: Rectangle, rb: Rectangle): boolean;
destroy(): void;
}
import { ObservablePoint } from './ObservablePoint';
import { Matrix } from "./Matrix";
import { HashObject } from '../HashObject';
export default class Transform extends HashObject {
worldMatrix: Matrix;
localMatrix: Matrix;
_worldID: number;
_parentID: number;
position: ObservablePoint;
scale: ObservablePoint;
anchor: ObservablePoint;
skew: ObservablePoint;
_rotation: number;
_cx: number;
_sx: number;
_cy: number;
_sy: number;
_localID: number;
_currentLocalID: number;
constructor();
onChange(): void;
updateSkew(): void;
updateLocalMatrix(): void;
updateWorldMatrix(parentTransform: Transform): void;
rotation: number;
destroy(): void;
}
export { Matrix } from './Matrix';
export { Point } from './Point';
export { ObservablePoint } from './ObservablePoint';
export { Rectangle } from './Rectangle';
export { default as Transform } from './Transform';
export { default as GroupD8 } from './GroupD8';
export declare function httpRequest(url: string, method?: string, params?: any, type?: 'text' | 'json' | 'jsonp'): Promise<{}>;
export declare function jsonp(url: any, params: any): Promise<{}>;
export declare function urlJoin(url: any, query: any): any;
import SystemRenderer from './SystemRenderer';
import CanvasMaskManager from './managers/CanvasMaskManager';
import { RendererOptions } from './RendererOptions';
import { Matrix } from '../math';
import { DisplayObject } from '../display/DisplayObject';
import CanvasSpriteRenderer from './plugins/CanvasSpriteRenderer';
import { CanvasGraphicsRenderer } from './plugins/CanvasGraphicsRenderer';
export default class CanvasRenderer extends SystemRenderer {
rootContext: CanvasRenderingContext2D;
context: CanvasRenderingContext2D;
maskManager: CanvasMaskManager;
smoothProperty: string;
plugins: {
sprite: CanvasSpriteRenderer;
graphics: CanvasGraphicsRenderer;
};
renderingToScreen: boolean;
constructor(options: RendererOptions);
render(displayObject: DisplayObject, renderTexture?: any, transform?: Matrix): void;
clear(clearColor: string): void;
destroy(): void;
resize(screenWidth: number, screenHeight: number): void;
destroyPlugins(): void;
}
export interface RendererOptions {
htmlElement?: HTMLCanvasElement;
transparent?: boolean;
antialias?: boolean;
preserveDrawingBuffer?: boolean;
backgroundColor?: number;
roundPixels?: boolean;
}
import Container from '../display/Container';
import { EventDispatcher } from '../events/EventDispatcher';
import { DisplayObject } from "../display/DisplayObject";
import { RendererOptions } from "./RendererOptions";
export default class SystemRenderer extends EventDispatcher {
options: RendererOptions;
type: number;
htmlElement: HTMLCanvasElement;
transparent: boolean;
preserveDrawingBuffer: boolean;
_backgroundColor: number;
_backgroundColorRgba: number[];
_backgroundColorString: string;
_tempDisplayObjectParent: Container;
_lastObjectRendered: DisplayObject;
constructor(options: RendererOptions);
resize(width: number, height: number): void;
render(displayObject: any, renderTexture?: any, transform?: any): void;
destroy(): void;
backgroundColor: number;
}
import SystemRenderer from "./SystemRenderer";
import { RendererOptions } from "./RendererOptions";
import { GLShader, VertexArrayObject } from "../../glCore";
import RenderTarget from "./renderTarget/RenderTarget";
import TextureManager from "./managers/TextureManager";
import TextureGarbageCollector from "./managers/TextureGarbageCollector";
import { Matrix } from "../math";
import WebGLState from "./webgl/WebGLState";
import BatchManager from "./managers/BatchManager";
import MaskManager from "./managers/MaskManager";
import StencilManager from "./managers/StencilManager";
import { DisplayObject } from "../display/DisplayObject";
export declare class WebglRenderer extends SystemRenderer {
plugins: {};
gl: WebGLRenderingContext;
CONTEXT_UID: number;
maskManager: MaskManager;
stencilManager: StencilManager;
batchManager: BatchManager;
textureManager: TextureManager;
textureGC: TextureGarbageCollector;
state: WebGLState;
renderingToScreen: boolean;
_activeShader: GLShader;
_activeVao: VertexArrayObject;
_activeRenderTarget: RenderTarget;
rootRenderTarget: RenderTarget;
constructor(options: RendererOptions);
_initContext(): void;
render(displayObject: DisplayObject, renderTexture?: any, transform?: any): void;
clear(clearColor: number[]): void;
setTransform(matrix: Matrix): void;
clearRenderTexture(renderTexture: any, clearColor: any): this;
bindShader(shader: GLShader, autoProject?: boolean): WebglRenderer;
createVao(): VertexArrayObject;
bindVao(vao: VertexArrayObject): WebglRenderer;
reset(): WebglRenderer;
bindRenderTexture(renderTexture: any, transform?: Matrix): WebglRenderer;
bindRenderTarget(renderTarget: RenderTarget): WebglRenderer;
resize(screenWidth: any, screenHeight: any): void;
destroy(): void;
handleContextRestored(): void;
handleContextLost(event: WebGLContextEvent): void;
initPlugins(staticMap: any): void;
destroyPlugins(): void;
static __plugins: any;
static registerPlugin(pluginName: string, ctor: Function): void;
}
import ObjectRenderer from '../webgl/ObjectRenderer';
import { WebglRenderer } from '../WebglRenderer';
export default class BatchManager {
renderer: WebglRenderer;
emptyRenderer: ObjectRenderer;
currentRenderer: ObjectRenderer;
constructor(renderer: WebglRenderer);
setObjectRenderer(objectRenderer: ObjectRenderer): void;
flush(): void;
reset(): void;
}
import { HashObject } from '../../HashObject';
import CanvasRenderer from '../CanvasRenderer';
import Graphics from '../../graphics/Graphics';
export default class CanvasMaskManager extends HashObject {
renderer: any;
constructor(renderer: CanvasRenderer);
pushMask(maskData: Graphics): void;
renderGraphicsShape(graphics: Graphics): void;
popMask(renderer: CanvasRenderer): void;
destroy(): void;
}
import Graphics from '../../graphics/Graphics';
import { WebglRenderer } from '../WebglRenderer';
import RenderTarget from '../renderTarget/RenderTarget';
export default class MaskManager {
renderer: WebglRenderer;
scissor: boolean;
scissorData: any;
scissorRenderTarget: RenderTarget;
enableScissor: boolean;
alphaMaskPool: any[];
alphaMaskIndex: number;
constructor(renderer: WebglRenderer);
pushMask(target: any, maskData: any): void;
popMask(target: any, maskData: any): void;
pushStencilMask(maskData: Graphics): void;
popStencilMask(): void;
pushScissorMask(target: any, maskData: Graphics): void;
popScissorMask(): void;
destroy(): void;
}
import { WebglRenderer } from '../WebglRenderer';
import Graphics from '../../graphics/Graphics';
export default class StencilManager {
renderer: WebglRenderer;
stencilMaskStack: Graphics[];
constructor(renderer: WebglRenderer);
setMaskStack(stencilMaskStack: Graphics[]): void;
pushStencil(graphics: Graphics): void;
popStencil(): void;
_useCurrent(): void;
_getBitwiseMask(): number;
destroy(): void;
}
import { WebglRenderer } from '../WebglRenderer';
export default class TextureGarbageCollector {
renderer: WebglRenderer;
count: number;
checkCount: number;
maxIdle: number;
checkCountMax: number;
mode: number;
constructor(renderer: WebglRenderer);
update(): void;
run(): void;
unload(displayObject: any): void;
}
import { GLTexture } from '../../../glCore';
import { WebglRenderer } from '../WebglRenderer';
export default class TextureManager {
boundTextures: any;
renderer: WebglRenderer;
emptyTextures: any;
_nextTextureLocation: number;
currentLocation: number;
gl: WebGLRenderingContext;
_managedTextures: Array<any>;
constructor(renderer: WebglRenderer);
onContextChange(): void;
bindTexture(texture: any, location?: number, forceLocation?: boolean): number;
getTexture(): void;
updateTexture(texture: any, location?: number): GLTexture;
unbindTexture(texture: any): void;
destroyTexture(texture: any, skipRemove: any): void;
removeAll(): void;
destroy(): void;
}
import BatchDrawCall from '../webgl/BatchDrawCall';
import ObjectRenderer from '../webgl/ObjectRenderer';
import { WebglRenderer } from '../WebglRenderer';
import { GLBuffer, GLShader, VertexArrayObject } from '../../../glCore';
export default class BatchRenderer extends ObjectRenderer {
vertSize: number;
vertByteSize: number;
size: number;
currentSize: number;
currentIndexSize: number;
aBuffers: {};
iBuffers: {};
shader: GLShader;
currentIndex: number;
groups: BatchDrawCall[];
elements: any[];
vaos: VertexArrayObject[];
vaoMax: number;
vertexCount: number;
MAX_TEXTURES: number;
vertexBuffers: GLBuffer[];
indexBuffers: GLBuffer[];
constructor(renderer: WebglRenderer);
onContextChange(): void;
onPreRender(): void;
render(element: any): void;
getIndexBuffer(size: any): any;
getAttributeBuffer(size: number): any;
flush(): void;
packGeometry(element: any, float32View: any, uint32View: any, indexBuffer: any, index: any, indexCount: any): void;
start(): void;
stop(): void;
destroy(): void;
}
import CanvasRenderer from '../CanvasRenderer';
import Graphics from '../../graphics/Graphics';
import GraphicsData from '../../graphics/GraphicsData';
export declare class CanvasGraphicsRenderer {
renderer: CanvasRenderer;
constructor(renderer: CanvasRenderer);
render(graphics: Graphics): void;
destroy(): void;
}
export declare function holePath(graphicsData: GraphicsData, context: CanvasRenderingContext2D, ccw?: boolean): void;
export declare function judgeCcw(points: number[]): boolean;
import CanvasRenderer from '../CanvasRenderer';
export default class CanvasSpriteRenderer {
renderer: CanvasRenderer;
constructor(renderer: CanvasRenderer);
render(sprite: any): void;
destroy(): void;
}
export default class CanvasRenderTarget {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
constructor(width: number, height: number);
clear(): void;
resize(width: number, height: number): void;
destroy(): void;
width: number;
height: number;
}
import { Matrix, Rectangle } from '../../math';
import { GLBuffer, GLFramebuffer, GLTexture } from '../../../glCore';
import Graphics from '../../graphics/Graphics';
export default class RenderTarget {
gl: WebGLRenderingContext;
frameBuffer: GLFramebuffer;
texture: GLTexture;
clearColor: number[];
size: Rectangle;
projectionMatrix: Matrix;
transform: Matrix;
frame: Rectangle;
defaultFrame: Rectangle;
destinationFrame: any;
sourceFrame: any;
stencilBuffer: GLBuffer;
stencilMaskStack: Graphics[];
scaleMode: number;
root: boolean;
constructor(gl: WebGLRenderingContext, width?: number, height?: number, scaleMode?: number, root?: boolean);
clear(clearColor?: number[]): void;
attachStencilBuffer(): void;
setFrame(destinationFrame?: Rectangle, sourceFrame?: Rectangle): void;
activate(): void;
calculateProjection(destinationFrame: Rectangle, sourceFrame?: Rectangle): void;
resize(width: number, height: number): void;
destroy(): void;
}
export declare class BatchBuffer {
vertices: ArrayBuffer;
float32View: Float32Array;
uint32View: Uint32Array;
positions: any;
uvs: any;
colors: any;
constructor(size: number);
destroy(): void;
}
import BaseTexture from "../../texture/BaseTexture";
export default class BatchDrawCall {
textures: BaseTexture[];
textureCount: number;
start: number;
size: number;
type: number;
constructor();
}
import { DisplayObject } from "../../display/DisplayObject";
import { WebglRenderer } from "../WebglRenderer";
export default class ObjectRenderer {
renderer: WebglRenderer;
constructor(renderer: WebglRenderer);
onContextChange(): void;
start(): void;
stop(): void;
flush(): void;
render(object: DisplayObject): void;
destroy(): void;
}
export default class WebGLState {
blendModes: any;
activeState: Uint8Array;
defaultState: Uint8Array;
gl: any;
maxAttribs: any;
attribState: {
tempAttribState: any[];
attribState: any[];
};
nativeVaoExtension: any;
constructor(gl: WebGLRenderingContext);
setState(state: any): void;
setBlend(value: any): void;
setBlendMode(value: any): void;
setDepthTest(value: any): void;
setCullFace(value: any): void;
setFrontFace(value: any): void;
resetAttributes(): void;
resetToDefault(): void;
resetTo3D(): void;
}
export declare function createIndicesForQuads(size: number): Uint16Array;
import { GLShader } from '../../../glCore';
export declare function generateMultiTextureShader(gl: any, maxTextures: any): GLShader;
import Container from "../display/Container";
import { VideoEntity } from "./VideoEntity";
export declare class MovieClip extends Container {
lockStep: boolean;
readonly currentFrame: number;
private _curFrame;
readonly isPlaying: boolean;
private _isPlaying;
readonly isFront: boolean;
private _isFront;
totalFrames: number;
loops: number;
private textures;
private timeInterval;
private deltaFrame;
private frameCount;
constructor(mv?: VideoEntity);
init(mv: VideoEntity): void;
private initChildren;
private resetTransform;
resetTransformAll(frameIndex: number): void;
setImage(imagekey: any, imageUrl: string): void;
stop(): void;
nextFrame(): void;
prevFrame(): void;
gotoAndStop(frameIndex: number): void;
play(isFront?: boolean): void;
private _lastFrame;
readonly isInTimeFrame: boolean;
gotoAndPlay(frameIndex: number, isFront?: boolean): void;
startAniRange(beginFrame?: number, endFrame?: number, loops?: number, callback?: Function): void;
private startTime;
private startFrame;
private lastDeltaFrame;
private _endMark;
commonDeltaTime: number;
updateFrame(): void;
private getCurFrameWhenLockStep;
update(deltaTime: number): void;
destroy(): void;
}
import { SpriteEntity } from './spriteEntity';
import { HashObject } from '../HashObject';
export declare class VideoEntity extends HashObject {
version: string;
videoSize: {
width: number;
height: number;
};
FPS: number;
frames: number;
images: {};
hasBeenCached: boolean;
sprites: SpriteEntity[];
audios: any[];
constructor(spec: any, images: any);
resetSprites(spec: any): void;
destroy(): void;
}
export declare class BezierPath {
_d: any;
_transform: any;
_styles: any;
_shape: any;
constructor(d?: any, transform?: any, styles?: any);
}
import { BezierPath } from './bezierPath';
export declare class EllipsePath extends BezierPath {
_x: any;
_y: any;
_radiusX: any;
_radiusY: any;
_transform: any;
_styles: any;
constructor(x: any, y: any, radiusX: any, radiusY: any, transform: any, styles: any);
}
export declare class FrameEntity {
alpha: number;
transform: {
a: number;
b: number;
c: number;
d: number;
tx: number;
ty: number;
};
layout: {
x: number;
y: number;
width: number;
height: number;
};
nx: number;
ny: number;
maskPath: any;
shapes: any[];
constructor(spec: any);
static lastShapes: any;
}
export { VideoEntity } from "./VideoEntity";
export { MovieClip } from "./MovieClip";
declare const _default: (data: any, cb: any, failure: any) => void;
export default _default;
declare function inflate(input: any, options: any): any;
declare const _default: {
inflate: typeof inflate;
};
export default _default;
declare function assign(obj: any, objO: any): any;
declare function shrinkBuf(buf: any, size: any): any;
export declare const utils: {
assign: typeof assign;
shrinkBuf: typeof shrinkBuf;
Buf8: any;
Buf16: any;
Buf32: any;
arraySet: any;
flattenChunks: any;
};
export {};
declare function string2buf(str: any): any;
declare function buf2binstring(buf: any, len?: any): any;
declare function binstring2buf(str: any): any;
declare function buf2string(buf: any, max: any): any;
declare function utf8border(buf: any, max: any): any;
export declare const strings: {
utf8border: typeof utf8border;
buf2string: typeof buf2string;
binstring2buf: typeof binstring2buf;
buf2binstring: typeof buf2binstring;
string2buf: typeof string2buf;
};
export {};
declare function adler32(adler: any, buf: any, len: any, pos: any): number;
export default adler32;
declare const _default: {
Z_NO_FLUSH: number;
Z_PARTIAL_FLUSH: number;
Z_SYNC_FLUSH: number;
Z_FULL_FLUSH: number;
Z_FINISH: number;
Z_BLOCK: number;
Z_TREES: number;
Z_OK: number;
Z_STREAM_END: number;
Z_NEED_DICT: number;
Z_ERRNO: number;
Z_STREAM_ERROR: number;
Z_DATA_ERROR: number;
Z_BUF_ERROR: number;
Z_NO_COMPRESSION: number;
Z_BEST_SPEED: number;
Z_BEST_COMPRESSION: number;
Z_DEFAULT_COMPRESSION: number;
Z_FILTERED: number;
Z_HUFFMAN_ONLY: number;
Z_RLE: number;
Z_FIXED: number;
Z_DEFAULT_STRATEGY: number;
Z_BINARY: number;
Z_TEXT: number;
Z_UNKNOWN: number;
Z_DEFLATED: number;
};
export default _default;
declare function crc32(crc: any, buf: any, len: any, pos: any): number;
export default crc32;
declare function deflateResetKeep(strm: any): any;
declare function deflateReset(strm: any): any;
declare function deflateSetHeader(strm: any, head: any): number;
declare function deflateInit2(strm: any, level: any, method: any, windowBits: any, memLevel: any, strategy: any): any;
declare function deflateInit(strm: any, level: any): any;
declare function deflate(strm: any, flush: any): any;
declare function deflateEnd(strm: any): any;
declare function deflateSetDictionary(strm: any, dictionary: any): number;
declare const _default: {
deflateInit: typeof deflateInit;
deflateInit2: typeof deflateInit2;
deflateReset: typeof deflateReset;
deflateResetKeep: typeof deflateResetKeep;
deflateSetHeader: typeof deflateSetHeader;
deflate: typeof deflate;
deflateEnd: typeof deflateEnd;
deflateSetDictionary: typeof deflateSetDictionary;
deflateInfo: string;
};
export default _default;
declare function GZheader(): void;
export default GZheader;
export default function inflate_fast(strm: any, start: any): void;
declare function inflateResetKeep(strm: any): number;
declare function inflateReset(strm: any): number;
declare function inflateReset2(strm: any, windowBits: any): number;
declare function inflateInit2(strm: any, windowBits: any): any;
declare function inflateInit(strm: any): any;
declare function inflate(strm: any, flush: any): any;
declare function inflateEnd(strm: any): number;
declare function inflateGetHeader(strm: any, head: any): number;
declare function inflateSetDictionary(strm: any, dictionary: any): number;
declare const _default: {
inflateReset: typeof inflateReset;
inflateReset2: typeof inflateReset2;
inflateResetKeep: typeof inflateResetKeep;
inflateInit: typeof inflateInit;
inflateInit2: typeof inflateInit2;
inflate: typeof inflate;
inflateEnd: typeof inflateEnd;
inflateGetHeader: typeof inflateGetHeader;
inflateSetDictionary: typeof inflateSetDictionary;
inflateInfo: string;
};
export default _default;
export default function inflate_table(type: any, lens: any, lens_index: any, codes: any, table: any, table_index: any, work: any, opts: any): 0 | 1 | -1;
declare const _default: {
2: string;
1: string;
0: string;
'-1': string;
'-2': string;
'-3': string;
'-4': string;
'-5': string;
'-6': string;
};
export default _default;
declare function _tr_init(s: any): void;
declare function _tr_stored_block(s: any, buf: any, stored_len: any, last: any): void;
declare function _tr_align(s: any): void;
declare function _tr_flush_block(s: any, buf: any, stored_len: any, last: any): void;
declare function _tr_tally(s: any, dist: any, lc: any): boolean;
declare const _default: {
_tr_init: typeof _tr_init;
_tr_stored_block: typeof _tr_stored_block;
_tr_flush_block: typeof _tr_flush_block;
_tr_tally: typeof _tr_tally;
_tr_align: typeof _tr_align;
};
export default _default;
declare function ZStream(): void;
export default ZStream;
export declare class Parser {
load(url: any, success: any, failure: any): void;
loadViaWorker(url: any, success: any, failure: any): void;
}
import * as protobuf from "protobufjs/light";
export declare const proto: protobuf.Root;
export declare const ProtoMovieEntity: protobuf.Type;
import { BezierPath } from './bezierPath';
export declare class RectPath extends BezierPath {
_x: any;
_y: any;
_width: any;
_height: any;
_cornerRadius: any;
_transform: any;
_styles: any;
constructor(x: any, y: any, width: any, height: any, cornerRadius: any, transform: any, styles: any);
}
export declare class SpriteEntity {
matteKey: any;
imageKey: any;
frames: any[];
constructor(spec: any);
}
import { TextField } from "./TextField";
export declare class EditableText extends TextField {
htmlElement: any;
private _prompt;
prompt: string;
private _promptColor;
promptColor: string;
private _textColor;
textColor: string;
constructor();
}
import { FloatDisplay } from "../display/FloatDisplay";
import { TextField } from "./TextField";
export declare class InputText extends FloatDisplay {
private _view;
inputType: number;
isAutoDownKeyBoard: boolean;
private static _inputTypeList;
constructor(inputType?: number);
init(htmlElement: any): void;
initInfo(text: string, color: string, align: string, size: number, font: string, showBorder: boolean, lineSpacing: number, textWidth: number): void;
lineSpacing: number;
bold: boolean;
italic: boolean;
textHeight: number;
textWidth: number;
color: string;
border: boolean;
text: string;
maxCharacters: number;
convertToTextField(textField?: TextField): TextField;
}
import { TEXT_ALIGN, TEXT_lINETYPE, VERTICAL_ALIGN } from "../const";
import Sprite from "../display/Sprite";
export declare class TextField extends Sprite {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
dirty: boolean;
offsetX: number;
offsetY: number;
constructor();
textAlpha: number;
private _textAlpha;
textAlign: TEXT_ALIGN;
private _textAlign;
verticalAlign: VERTICAL_ALIGN;
private _verticalAlign;
width: number;
height: number;
lineSpacing: number;
private _lineSpacing;
lineType: TEXT_lINETYPE;
private _lineType;
text: string;
protected _setText(value: any): void;
protected _text: string;
font: string;
private _font;
size: number;
private _size;
fillColor: any;
private _fillColor;
strokeColor: string;
private _strokeColor;
stroke: number;
private _stroke;
italic: boolean;
private _italic;
bold: boolean;
_bold: boolean;
border: boolean;
private _border;
private _prepContext;
getTextWidth(lineIndex?: number): number;
readonly lines: number;
private _getMeasuredWidth;
private realLines;
updateText(): void;
updateTexture(): void;
_renderCanvas(renderer: any): void;
_renderWebGL(renderer: any): void;
destroy(): void;
}
export { TextField } from "./TextField";
export { InputText } from "./InputText";
export { EditableText } from "./EditableText";
import BaseTexture from './BaseTexture';
export default class BaseRenderTexture extends BaseTexture {
_glRenderTargets: {};
_canvasRenderTarget: any;
valid: boolean;
constructor(width?: number, height?: number, scaleMode?: number);
resize(width: number, height: number): void;
destroy(): void;
}
import { EventDispatcher } from '../events/EventDispatcher';
export default class BaseTexture extends EventDispatcher {
touched: number;
width: number;
height: number;
scaleMode: number;
hasLoaded: boolean;
isLoading: boolean;
source: HTMLImageElement | HTMLCanvasElement;
imageType: string;
premultipliedAlpha: boolean;
imageUrl: string;
isPowerOfTwo: boolean;
mipmap: boolean;
wrapMode: number;
_glTextures: {};
_enabled: number;
_destroyed: boolean;
textureCacheIds: string[];
constructor(source?: HTMLImageElement | HTMLCanvasElement, scaleMode?: number);
update(): void;
loadSource(source: any): void;
private _updateImageType;
private _sourceLoaded;
destroy(): void;
dispose(): void;
updateSourceImage(newSrc: string): void;
static fromImage(imageUrl: string, crossorigin?: any, scaleMode?: number): BaseTexture;
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: number, origin?: string): BaseTexture;
static from(source: any, scaleMode?: number): BaseTexture;
static addToCache(baseTexture: BaseTexture, id: string): void;
static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null;
}
import BaseRenderTexture from './BaseRenderTexture';
import Texture from './Texture';
import { Rectangle } from '../math';
export default class RenderTexture extends Texture {
constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle);
resize(width: number, height: number, doNotResizeBaseTexture?: boolean): void;
static create(width: number, height: number, scaleMode?: number): RenderTexture;
}
import BaseTexture from './BaseTexture';
import TextureUvs from './TextureUvs';
import { EventDispatcher } from '../events/EventDispatcher';
import { Event } from "../events/Event";
import { Point, Rectangle } from '../math';
export default class Texture extends EventDispatcher {
noFrame: boolean;
baseTexture: BaseTexture;
_frame: Rectangle;
trim: Rectangle;
valid: boolean;
_uvs: TextureUvs;
orig: Rectangle;
_rotate: number;
defaultAnchor: Point;
_updateID: number;
transform: any;
textureCacheIds: string[];
static EMPTY: Texture;
static WHITE: Texture;
constructor(baseTexture: BaseTexture | Texture, frame?: Rectangle, orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: Point);
update(): void;
onBaseTextureLoaded(e: Event): void;
onBaseTextureUpdated(e: Event): void;
destroy(): void;
clone(): Texture;
_updateUvs(): void;
frame: Rectangle;
rotate: number;
readonly width: number;
readonly height: number;
static fromImage(imageUrl: string, crossorigin?: boolean, scaleMode?: number): Texture;
static fromFrame(frameId: string): Texture;
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: number, origin?: string): Texture;
static from(source: any): Texture;
static addToCache(texture: Texture, id: string): void;
static removeFromCache(texture: any): Texture;
}
import Texture from "./Texture";
import BaseTexture from './BaseTexture';
export default class TextureSheet {
baseTexture: any;
textures: {};
animations: {};
data: any;
_frames: any;
_frameKeys: string[];
_callback: Function;
constructor(baseTexture: BaseTexture | Texture, data: any);
parse(callback: Function): void;
_processFrames(initialFrameIndex: number): void;
_processAnimations(): void;
_parseComplete(): void;
destroy(destroyBase?: boolean): void;
}
import { Rectangle } from "../math";
import BaseTexture from "./BaseTexture";
export default class TextureUvs {
x0: number;
y0: number;
x1: number;
y1: number;
x2: number;
y2: number;
x3: number;
y3: number;
uvsUint32: Uint32Array;
uvsFloat32: Float32Array;
constructor();
set(frame: Rectangle, baseFrame: Rectangle | BaseTexture, rotate: number): void;
}
export { default as Texture } from "./Texture";
export { default as BaseTexture } from "./BaseTexture";
export { default as TextureSheet } from "./TextureSheet";
export declare function getTexture(str: string): any;
export declare class Ease {
constructor();
static get(amount: number): (t: number) => number;
static getPowIn(pow: number): (t: number) => number;
static getPowOut(pow: number): (t: number) => number;
static getPowInOut(pow: number): (t: number) => number;
static quadIn: (t: number) => number;
static quadOut: (t: number) => number;
static quadInOut: (t: number) => number;
static cubicIn: (t: number) => number;
static cubicOut: (t: number) => number;
static cubicInOut: (t: number) => number;
static quartIn: (t: number) => number;
static quartOut: (t: number) => number;
static quartInOut: (t: number) => number;
static quintIn: (t: number) => number;
static quintOut: (t: number) => number;
static quintInOut: (t: number) => number;
static sineIn(t: number): number;
static sineOut(t: number): number;
static sineInOut(t: number): number;
static getBackIn(amount: number): (t: number) => number;
static backIn: (t: number) => number;
static getBackOut(amount: number): (t: any) => number;
static backOut: (t: any) => number;
static getBackInOut(amount: number): (t: number) => number;
static backInOut: (t: number) => number;
static circIn(t: number): number;
static circOut(t: number): number;
static circInOut(t: number): number;
static bounceIn(t: number): number;
static bounceOut(t: number): number;
static bounceInOut(t: number): number;
static getElasticIn(amplitude: number, period: number): (t: number) => number;
static elasticIn: (t: number) => number;
static getElasticOut(amplitude: number, period: number): (t: number) => number;
static elasticOut: (t: number) => number;
static getElasticInOut(amplitude: number, period: number): (t: number) => number;
static elasticInOut: (t: number) => number;
}
export declare class Tween {
private static NONE;
private static LOOP;
private static REVERSE;
private static _tweens;
private static IGNORE;
private static _plugins;
private static _inited;
private _target;
private _useTicks;
private ignoreGlobalPause;
private loop;
private pluginData;
private _curQueueProps;
private _initQueueProps;
private _steps;
private paused;
private duration;
private _prevPos;
private position;
private _prevPosition;
private _stepPosition;
private passive;
static get(target: any, props?: {
loop?: boolean;
onChange?: Function;
onChangeObj?: any;
}, pluginData?: any, override?: boolean): Tween;
static removeTweens(target: any): void;
static pauseTweens(target: any): void;
static resumeTweens(target: any): void;
private static tick;
static flush(): void;
private static _lastTime;
private static _register;
static removeAllTweens(): void;
constructor(target: any, props: any, pluginData: any);
onChange: Function;
private initialize;
setPosition(value: number, actionsMode?: number): boolean;
private _runAction;
private _updateTargetProps;
setPaused(value: boolean): Tween;
private _cloneProps;
private _addStep;
private _appendQueueProps;
private _addAction;
private _set;
wait(duration: number, passive?: boolean): Tween;
to(props: any, duration?: number, ease?: Function): Tween;
call(callback: Function, thisObj?: any, params?: any[]): Tween;
set(props: any, target?: any): Tween;
play(tween?: Tween): Tween;
pause(tween?: Tween): Tween;
$tick(delta: number): void;
}
export * from './Tween';
export * from './Ease';
import Texture from "../texture/Texture";
import Sprite from "../display/Sprite";
export declare class BitmapNumber extends Sprite {
resName: string;
private textures;
private _num;
num: number;
constructor(textures: Texture[]);
reset(textures: Texture[]): void;
}
import Container from "../display/Container";
import { TEXT_ALIGN } from "../const";
import Texture from "../texture/Texture";
export declare class BitmapNumbers extends Container {
textures: Texture[];
align: TEXT_ALIGN;
singleWidth: number;
private _num;
num: number;
constructor(textures: Texture[]);
adaptate(): void;
}
import Sprite from "../display/Sprite";
import Texture from "../texture/Texture";
export declare class Button extends Sprite {
textureUp: any;
textureDown: any;
textureDisable: any;
constructor(tUp: Texture, tDown?: Texture, tDisable?: Texture);
private _mouseEvent;
initButton(): void;
clicked: boolean;
private _clicked;
textureStatusEnable: boolean;
destroy(): void;
}
import Texture from "../texture/Texture";
import Sprite from "../display/Sprite";
export declare class FrameAni extends Sprite {
texturesAll: Texture[];
currentFrame: number;
totalFrames: number;
isPlay: boolean;
startTime: number;
allTime: number;
callback: Function;
_frameRate: number;
frameRate: number;
constructor(texturesAll: Texture[]);
private count;
onEnterFrame(): void;
play(callback: any): void;
reset(): void;
private changeTexture;
}
import Container from "../display/Container";
import { SCROLL_DIRECTION } from "../const";
export declare class ScrollContainer extends Container {
private _direction;
protected distance: number;
private minDis;
private maskObj;
viewPort: Container;
private lastValue;
protected speed: number;
private addSpeed;
isStop: boolean;
maxSpeed: number;
fSpeed: number;
protected paramXY: string;
protected paramSize: string;
private stopTimes;
private isMouseDownState;
private autoScroll;
isSpringBack: boolean;
constructor(maxDistance?: number, isFull?: boolean);
readonly maxDistance: any;
direction: SCROLL_DIRECTION;
protected updateDirection(): void;
updateViewRect(): void;
cancelScroll(): void;
private onMouseEvent;
scrollTo(dis: number, time?: number): void;
destroy(): void;
}
import { ScrollContainer } from "./ScrollContainer";
import { DisplayObject } from "../display/DisplayObject";
export interface IScrollListItem extends DisplayObject {
initData(id: number, data: any): void;
id: number;
data: number;
}
export declare class ScrollList extends ScrollContainer {
private _items;
private _itemW;
private _itemH;
private _itemRow;
private _itemCol;
private _itemCount;
private _itemClass;
private _isInit;
data: Array<any>;
private downL;
private _cols;
private _disParam;
private _lastFirstId;
readonly loadingView: DisplayObject;
constructor(itemClassName: any, itemWidth: number, itemHeight: number, cols?: number);
updateData(data: Array<any>, isReset?: boolean): void;
private flushData;
updateViewRect(): void;
private _updateViewRect;
setLoading(downLoading: DisplayObject): void;
destroy(): void;
}
import { TextField } from "../text/TextField";
export declare class ShowWord extends TextField {
playWords(text: string, deltaTime?: number, callback?: Function): void;
}
export { ScrollList } from "./ScrollList";
export { ScrollContainer } from "./ScrollContainer";
export { Button } from "./Button";
export declare function DrawAllToCanvas(images: any, callback: any): void;
export default function determineCrossOrigin(url: string, loc?: any): string;
import { RENDERER_TYPE } from "../const";
export * from './twiddle';
export { default as toDisplayDataURL } from "./toDisplayDataURL";
export { default as determineCrossOrigin } from './determineCrossOrigin';
export declare function uid(): number;
export declare const backupCanvas: HTMLCanvasElement;
export declare function getGradientColor(points: any, colors: any): any;
export declare function getCanvasBitmapStyle(image: any): any;
export declare function hex2rgb(hex: number, out?: number[] | Float32Array): number[] | Float32Array;
export declare function hex2string(hex: any): string;
export declare function string2hex(string: string): number;
export declare function rgb2hex(rgb: number[]): number;
export declare function getRGBA(color: string, alpha: number): string;
export declare function inputFeildIosEnable(): void;
export declare function decomposeDataUri(dataUri: any): {
mediaType: any;
subType: any;
charset: any;
encoding: any;
data: any;
};
export declare function getUrlFileExtension(url: any): any;
export declare function sign(n: number): number;
export declare function premultiplyTint(tint: number, alpha: number): number;
export declare const TextureCache: any;
export declare const BaseTextureCache: any;
export declare const TextureSheetCache: any;
export declare function destroyTextureCache(): void;
export declare function clearTextureCache(): void;
export declare const GlobalPro: {
stageRenderType: RENDERER_TYPE;
dpi: number;
padding: number;
startTime: number;
};
export declare function isWebGLSupported(): boolean;
export declare function removeItems(arr: Array<any>, startIdx: number, removeCount: number): void;
export declare function mapWebGLBlendModesToPixi(gl: any, array?: any[]): any[];
import { Rectangle } from "../math";
import { DisplayObject } from "../display/DisplayObject";
export default function toDisplayDataURL(obj: DisplayObject, rect?: Rectangle, typeInfo?: any, bgColor?: number): string;
export declare const INT_BITS1 = 32;
export declare const INT_MAX = 2147483647;
export declare const INT_MIN: number;
export declare function abs(v: any): number;
export declare function min(x: any, y: any): number;
export declare function max(x: any, y: any): number;
export declare function isPow2(v: any): boolean;
export declare function log2(v: any): number;
export declare function log10(v: any): 1 | 4 | 3 | 2 | 9 | 8 | 7 | 6 | 5 | 0;
export declare function popCount(v: any): number;
export declare function countTrailingZeros(v: any): number;
export declare function nextPow2(v: any): any;
export declare function prevPow2(v: any): number;
export declare function parity(v: any): number;
export declare function reverse(v: any): number;
export declare function interleave2(x: any, y: any): number;
export declare function deinterleave2(v: any, n: any): number;
export declare function interleave3(x: any, y: any, z: any): number;
export declare function deinterleave3(v: any, n: any): number;
export declare function nextCombination(v: any): number;
export declare class GLBuffer {
gl: any;
buffer: any;
type: any;
drawType: any;
data: any;
_updateID: number;
constructor(gl: any, type?: any, data?: any, drawType?: any);
upload(data: any, offset?: number, dontBind?: boolean): void;
bind(): void;
destroy: () => void;
static createVertexBuffer(gl: any, data?: any, drawType?: any): GLBuffer;
static createIndexBuffer(gl: any, data?: any, drawType?: any): GLBuffer;
static create(gl: any, type: any, data: any, drawType: any): GLBuffer;
}
export declare class GLFramebuffer {
gl: any;
framebuffer: any;
stencil: any;
texture: any;
width: any;
height: any;
constructor(gl: any, width: any, height: any);
enableTexture(texture: any): void;
enableStencil(): void;
clear(r: any, g: any, b: any, a: any): void;
bind(): void;
unbind(): void;
resize(width: any, height: any): void;
destroy(): void;
static createRGBA(gl: any, width: any, height: any, data?: any): GLFramebuffer;
static createFloat32(gl: any, width: any, height: any, data: any): GLFramebuffer;
}
export declare class GLShader {
gl: WebGLRenderingContext;
program: WebGLProgram;
attributes: any;
uniformData: any;
uniforms: any;
constructor(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string, precision?: string, attributeLocations?: any);
bind(): this;
destroy(): void;
}
export declare class GLTexture {
gl: WebGLRenderingContext;
texture: WebGLTexture;
mipmap: boolean;
premultiplyAlpha: any;
width: number;
height: number;
format: any;
type: any;
constructor(gl: WebGLRenderingContext, width?: number, height?: number, format?: any, type?: any);
upload(source: any): void;
uploadData: (data: any, width: any, height: any) => void;
bind(location?: number): void;
unbind(): void;
minFilter(linear: boolean): void;
magFilter(linear: boolean): void;
enableMipmap(): void;
enableLinearScaling(): void;
enableNearestScaling(): void;
enableWrapClamp(): void;
enableWrapRepeat(): void;
enableWrapMirrorRepeat(): void;
destroy(): void;
static fromSource(gl: WebGLRenderingContext, source: HTMLImageElement | ImageData, premultiplyAlpha?: boolean): GLTexture;
static fromData(gl: any, data: any, width: any, height: any): GLTexture;
}
export declare class VertexArrayObject {
nativeVaoExtension: any;
nativeState: any;
nativeVao: any;
gl: WebGLRenderingContext;
attributes: any[];
indexBuffer: any;
dirty: boolean;
constructor(gl: WebGLRenderingContext, state: any);
bind(): this;
unbind(): this;
activate(): this;
addAttribute(buffer: any, attribute: any, type?: any, normalized?: any, stride?: any, start?: any): this;
addIndex(buffer: any): this;
clear(): this;
draw(type: any, size?: any, start?: any): this;
destroy(): void;
getSize(): number;
static FORCE_NATIVE: boolean;
}
export declare function checkMaxIfStatementsInShader(maxIfs: number, gl: WebGLRenderingContext): number;
export declare function createContext(canvas: HTMLCanvasElement, options?: any): WebGLRenderingContext;
export { GLTexture } from './GLTexture';
export { GLBuffer } from './GLBuffer';
export { VertexArrayObject } from './VertexArrayObject';
export { GLFramebuffer } from "./GLFramebuffer";
export { GLShader } from "./GLShader";
export { createContext } from "./createContext";
export { checkMaxIfStatementsInShader } from "./checkMaxIfStatementsInShader";
export declare function setVertexAttribArrays(gl: any, attribs: any, state?: any): void;
export declare function compileProgram(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string, attributeLocations?: any): WebGLProgram;
export declare function defaultValue(type: string, size: number): false | any[] | 0 | Float32Array;
export declare function extractAttributes(gl: WebGLRenderingContext, program: WebGLProgram): {};
export declare function extractUniforms(gl: WebGLRenderingContext, program: WebGLProgram): {};
export declare function generateUniformAccessObject(gl: WebGLRenderingContext, uniformData: any): {
data: {};
};
export { compileProgram } from './compileProgram';
export { defaultValue } from './defaultValue';
export { extractAttributes } from './extractAttributes';
export { extractUniforms } from './extractUniforms';
export { generateUniformAccessObject } from './generateUniformAccessObject';
export { setPrecision } from './setPrecision';
export { mapSize } from './mapSize';
export { mapType } from './mapType';
export declare function mapSize(type: string): number;
export declare function mapType(gl: any, type: any): any;
export declare function setPrecision(src: string, precision: string): string;
export * from "./2d/display";
export * from "./2d/events";
export { default as Graphics } from "./2d/graphics/Graphics";
export { Shape } from "./2d/graphics/Shape";
export { Loader, globalLoader } from "./2d/loader/Loader";
export { Matrix } from "./2d/math/Matrix";
export { Point } from "./2d/math/Point";
export { Rectangle } from "./2d/math/Rectangle";
export * from "./2d/text";
export * from "./2d/texture";
export * from "./2d/ui";
export * from './2d/tween';
export * from './2d/net';
export { default as toDisplayDataURL } from "./2d/utils/toDisplayDataURL";
export { inputFeildIosEnable } from "./2d/utils/index";
export * from './2d/const';
export * from './zeroing';
export declare class Process {
private _config;
private _parent;
private _vm;
private _sequence;
private _meta;
private _target;
private _originProps;
constructor();
readonly processConfig: any;
readonly parent: Process;
readonly sequence: any;
init(context: any): void;
execute(args: any): Promise<any>;
_executeMetaScript(type: any, payload: any, meta: any): Promise<{
type: any;
payload: any;
}>;
_executeSubProcess(type: any, payload: any): Promise<{
type: any;
payload: any;
}>;
_executeNextProcess(type: any, payload: any): Promise<{
type: any;
payload: any;
}>;
getProcessMeta(id: any): any;
getProps(key?: any): any;
updateProps(props: any, args: any, originProps: any, propsConfig: any): void;
resolveLinkedProp(data: any, key: any): any;
}
export declare class VM {
_processMetaLibs: any;
_globalContext: any;
_target: any;
_id: any;
_scriptMap: any;
setup(context: any): void;
executeProcess(sequence: any, id: any, parentProcess: any, args: any): Promise<any>;
getMeta(id: any): any;
getScript(hash: any): any;
readonly globalContext: any;
readonly id: any;
}
export declare function setProcessMetaLibs(...metaContexts: any[]): void;
export declare function setGlobalContext(context: any): void;
export declare function setScriptMap(_scriptMap: any): void;
export declare function executeBehavior(sequence: any, subEntry: string, target: any, args?: any): void;
export declare function fieldChanged(onModify: any): (target: any, key: string) => void;
export declare const dirtyFieldDetector: (target: any, key: string) => void;
export declare const deepDirtyFieldDetector: (target: any, key: string) => void;
export declare const dirtyFieldTrigger: (target: any, key: string) => void;
export declare const deepDirtyFieldTrigger: (target: any, key: string) => void;
export declare function afterConstructor(ctor: Function): void;
export declare function applyAutoAdjust(ctor: Function): void;
import { EventDispatcher } from "../../2d/events";
export declare const globalEvent: EventDispatcher;
export declare const DATA_CENTER_EVENT: string;
export declare function applyEvents(ctor: Function): void;
import { Container } from "../../2d/display";
export declare function applyScript(ctor: Function): void;
export declare class ScriptBase {
private _host;
private _disabled;
readonly host: Container;
disabled: boolean;
mounted(): void;
destroy(): void;
update(t: number): void;
awake(): void;
sleep(): void;
}
export declare function registerScriptDef(id: any, def: any): void;
export declare function registerScripts(scripts: any): void;
import { Container, Stage } from "../../2d/display";
import { StackContainer } from "./StackContainer";
import { DataCenter } from "./data-center";
import { Toast } from "./Toast";
export declare class GameStage extends Container {
private _sceneContainer;
private _popupContainer;
private _toast;
private _blackLayer;
private _stage;
private _dataCenter;
private _config;
private _viewCache;
constructor(stage: Stage);
readonly sceneContainer: StackContainer;
readonly popupContainer: StackContainer;
readonly toast: Toast;
readonly dataCenter: DataCenter;
launch(config: any, onAssetsProgress?: any, onAssetsComplete?: any): Promise<void>;
start(): void;
instantiateView(name: any, cache?: boolean): any;
getViewConfigByName(name: any): any;
setBlackLayerVisible(visible: any): void;
onPopupContainerChange(e: any): void;
}
import { Container, DisplayObject } from "../../2d/display";
export declare class StackContainer extends Container {
private _mutex;
private _stack;
constructor(mutex?: boolean);
push(view: DisplayObject, options?: any, dispatch?: boolean): void;
replace(view: DisplayObject, options?: any): void;
pop(dispatch?: boolean): boolean;
popAll(view?: DisplayObject, options?: any): void;
}
import { Container } from "../../2d/display";
import { GameStage } from "./GameStage";
export declare class Toast extends Container {
private _contentSample;
private _content;
private _gameStage;
constructor(gameStage: GameStage);
show(props?: any): void;
hide(animation?: boolean, hideDuration?: number): void;
private removeContentView;
private getContent;
}
export declare function loadAssets(config: any, onProgress?: any, onComplete?: any): Promise<never>;
export declare function getAssetByUUID(uuid: any): any;
export declare function getAssetByName(name: any): any;
import { Container } from "../../2d/display";
export declare function registerCustomModule(id: any, def: any): void;
export declare function registerCustomCodeModule(config: any): void;
export declare function registerCustomModuleFromConfig(config: any): void;
export declare function addCustomModule(id: any, container: Container, options?: any): any;
import { EventDispatcher } from "../../2d/events";
export declare class DataCenter extends EventDispatcher {
store: {};
watchers: any[];
constructor();
registerGroup(name: any, origin?: any): void;
unregisterGroup(name: any): void;
getGroup(name: any): any;
getDataByPath(path: any, groupName?: any, throwException?: any): any;
getDataByName(name: any, throwException?: any): any;
formatString(str: any, escapes: any): any;
increase(groupName: any, step?: any, path?: any, dispatch?: boolean): void;
mutate(groupName: any, data?: any, path?: any, dispatch?: boolean): void;
watch(name: any, path: any): void;
getWatcher(name: any): any;
registerDataMapping(dataMapping: any): void;
}
export declare const dataCenter: DataCenter;
export declare let env: {};
export declare function injectEnv(data: any): void;
export * from './GameStage';
export * from './enviroment';
export * from './custom-module';
export * from './nodes';
export declare function showLoadingView(): void;
export declare function hideLoadingView(): void;
export declare function setLoadingViewProgress(current: any, total: any): void;
import { Sprite } from "../../../2d/display";
export declare class Image extends Sprite {
private _originText;
private _escapes;
private _registeredEvents;
private _source;
source: string;
private updateSource;
private _setSourceDirect;
private _setSource;
private unregisterEvents;
private onDataMutated;
}
import { TextField } from "../../../2d/text";
export declare class Label extends TextField {
private _originText;
private _escapes;
private _registeredEvents;
private _htmlText;
protected _setText(value: any): void;
private dealEscape;
htmlText: any;
private unregisterEvents;
private onTextMutated;
private onHtmlMutated;
}
import { ScrollContainer } from "../../../2d/ui";
export declare class ScrollView extends ScrollContainer {
constructor();
}
export * from './shapes';
export * from './Image';
export * from './Label';
export * from './ScrollView';
import { Shape } from "../../../";
declare class ShapeBase extends Shape {
protected __fieldDirty: boolean;
fillColor: any;
strokeColor: any;
strokeWidth: number;
constructor();
private onResize;
private onEnterFrame;
protected redraw(): void;
}
export declare class Rect extends ShapeBase {
borderRadius: number;
protected redraw(): void;
}
export declare class Circle extends ShapeBase {
protected redraw(): void;
}
export {};
import BaseTexture from "../../2d/texture/BaseTexture";
export declare function createTextureSheet(baseTexture: BaseTexture, altaData: any): void;
export declare function instantiate(config: any): any;
export * from './launcher';
export * from './decorators/scripts';
export * from './decorators/events';
export * from './utils';
export * from './decorators';
export * from './game-warpper';
export * from './behavior-runtime';
import { instantiate } from './game-warpper/view-interpreter';
export { instantiate };
import { GameStage } from "./game-warpper";
export declare let gameStage: GameStage;
export declare function launch(url: any, onAssetsProgress: any, onAssetsComplete: any): Promise<{}>;
export declare function launchWithLocalStorage(id: any, onAssetsProgress: any, onAssetsComplete: any): Promise<{}>;
export declare function launchWithConfig(config: any, onAssetsProgress: any, onAssetsComplete: any): Promise<{}>;
export declare function findNodeByUUID(node: any, uuid: any): any;
export * from './utils';
export * from './md5';
export declare function md5(string: any): string;
export declare const ESCAPE_REG_EXP: RegExp;
export declare const linkedFlag = "$_linked_$";
export declare const nodeScheme = "node://";
export declare function arrayFind(arr: any, predicate: any): any;
export declare function objClone(obj: any): any;
export declare function propertyParse(key: any, node: any, properties: any): void;
export declare function getDataByPath(scope: any, path: any, throwException?: any): any;
export declare function injectProp(target: any, data?: any, callback?: Function, ignoreMethod?: boolean, ignoreNull?: boolean): boolean;
export declare function copyProp(target: any, data: any, config?: any): void;
export declare function obj2query(obj: any): string;
export declare function importCJSCode(code: any, node?: any): any;
export declare function importUMDCode(code: any): any;
export declare function trimChar(str: string, char: string): string;
export declare function joinPath(...segments: string[]): string;
export declare function findVariable(name: string, ...contexts: any[]): any;
export declare function htmlToPureText(htmlText: any): any;
......@@ -167,6 +167,11 @@ dts-bundle@^0.7.3:
glob "^6.0.4"
mkdirp "^0.5.0"
emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.npm.taobao.org/emoji-regex/download/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=
escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
......
......@@ -2,7 +2,9 @@
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/dist" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
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