diff --git a/.DS_Store b/.DS_Store
index 25b38d7..5008ddf 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/helloworld/.DS_Store b/helloworld/.DS_Store
deleted file mode 100644
index 25b38d7..0000000
Binary files a/helloworld/.DS_Store and /dev/null differ
diff --git a/helloworld/.wing/launch.json b/helloworld/.wing/launch.json
deleted file mode 100644
index 536bb0b..0000000
--- a/helloworld/.wing/launch.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "version": "0.2.0",
- "configurations": [
- {
- "name": "Launch Wing Player",
- "type": "chrome",
- "request": "launch",
- "file": "index.html",
- "runtimeExecutable": "${execPath}",
- "useBuildInServer": true,
- "sourceMaps": true,
- "webRoot": "${workspaceRoot}",
- "preLaunchTask":"build",
- "port":5317
- },
- {
- "name": "Launch Chrome",
- "type": "chrome",
- "request": "launch",
- "file": "index.html",
- "useBuildInServer": true,
- "sourceMaps": true,
- "webRoot": "${workspaceRoot}",
- "preLaunchTask":"build",
- "userDataDir":"${tmpdir}",
- "port":5317
- }
- ]
-}
\ No newline at end of file
diff --git a/helloworld/.wing/settings.json b/helloworld/.wing/settings.json
deleted file mode 100644
index 372e43c..0000000
--- a/helloworld/.wing/settings.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "search.exclude": {
- "**/bin-debug": true,
- "**/bin-release": true
- }
-}
\ No newline at end of file
diff --git a/helloworld/.wing/tasks.json b/helloworld/.wing/tasks.json
deleted file mode 100644
index 521f0c8..0000000
--- a/helloworld/.wing/tasks.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "version": "0.1.0",
- "command": "egret",
- "isShellCommand": true,
- "suppressTaskName": true,
- "tasks": [
- {
- "taskName": "build",
- "showOutput": "always",
- "args": [
- "build",
- "-sourcemap"
- ],
- "problemMatcher": "$tsc"
- },
- {
- "taskName": "clean",
- "showOutput": "always",
- "args": [
- "build",
- "-e"
- ],
- "problemMatcher": "$tsc"
- },
- {
- "taskName": "publish",
- "showOutput": "always",
- "args": [
- "publish"
- ],
- "problemMatcher": "$tsc"
- }
- ]
-}
\ No newline at end of file
diff --git a/helloworld/bin-debug/LoadingUI.js b/helloworld/bin-debug/LoadingUI.js
deleted file mode 100644
index 4a831d5..0000000
--- a/helloworld/bin-debug/LoadingUI.js
+++ /dev/null
@@ -1,60 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2014-present, Egret Technology.
-// All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// * Neither the name of the Egret nor the
-// names of its contributors may be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
-// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-var __reflect = (this && this.__reflect) || function (p, c, t) {
- p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
-};
-var __extends = this && this.__extends || function __extends(t, e) {
- function r() {
- this.constructor = t;
-}
-for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
-r.prototype = e.prototype, t.prototype = new r();
-};
-var LoadingUI = (function (_super) {
- __extends(LoadingUI, _super);
- function LoadingUI() {
- var _this = _super.call(this) || this;
- _this.createView();
- return _this;
- }
- LoadingUI.prototype.createView = function () {
- this.textField = new egret.TextField();
- this.addChild(this.textField);
- this.textField.y = 300;
- this.textField.width = 480;
- this.textField.height = 100;
- this.textField.textAlign = "center";
- };
- LoadingUI.prototype.onProgress = function (current, total) {
- this.textField.text = "Loading..." + current + "/" + total;
- };
- return LoadingUI;
-}(egret.Sprite));
-__reflect(LoadingUI.prototype, "LoadingUI", ["RES.PromiseTaskReporter"]);
-//# sourceMappingURL=LoadingUI.js.map
\ No newline at end of file
diff --git a/helloworld/bin-debug/LoadingUI.js.map b/helloworld/bin-debug/LoadingUI.js.map
deleted file mode 100644
index a6c222d..0000000
--- a/helloworld/bin-debug/LoadingUI.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"LoadingUI.js","sourceRoot":"","sources":["../src/LoadingUI.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,EAAE;AACF,iDAAiD;AACjD,wBAAwB;AACxB,sEAAsE;AACtE,+EAA+E;AAC/E,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,8CAA8C;AAC9C,6EAA6E;AAC7E,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,2EAA2E;AAC3E,gFAAgF;AAChF,gFAAgF;AAChF,8EAA8E;AAC9E,6EAA6E;AAC7E,wEAAwE;AACxE,gFAAgF;AAChF,sDAAsD;AACtD,EAAE;AACF,sFAAsF;;;;;;;;;;;AAEtF;IAAwB,6BAAY;IAEhC;QAAA,YACI,iBAAO,SAEV;QADG,KAAI,CAAC,UAAU,EAAE,CAAC;;IACtB,CAAC;IAIO,8BAAU,GAAlB;QACI,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,GAAG,CAAC;QAC3B,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG,CAAC;QAC5B,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,QAAQ,CAAC;IACxC,CAAC;IAEM,8BAAU,GAAjB,UAAkB,OAAe,EAAE,KAAa;QAC5C,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,eAAa,OAAO,SAAI,KAAO,CAAC;IAC1D,CAAC;IACL,gBAAC;AAAD,CAAC,AArBD,CAAwB,KAAK,CAAC,MAAM,GAqBnC;AArBK,UAAA,SAAS,qDAqBd,CAAA"}
\ No newline at end of file
diff --git a/helloworld/bin-debug/Main.js b/helloworld/bin-debug/Main.js
deleted file mode 100644
index 7e60da1..0000000
--- a/helloworld/bin-debug/Main.js
+++ /dev/null
@@ -1,275 +0,0 @@
-var __reflect = (this && this.__reflect) || function (p, c, t) {
- p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
-};
-var __extends = this && this.__extends || function __extends(t, e) {
- function r() {
- this.constructor = t;
-}
-for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
-r.prototype = e.prototype, t.prototype = new r();
-};
-var Main = (function (_super) {
- __extends(Main, _super);
- function Main() {
- var _this = _super.call(this) || this;
- //debug模式,使用图形绘制
- _this.isDebug = false;
- _this.worldBox = new egret.Sprite();
- // 滚动背景图
- _this.bgscrollView = new egret.ScrollView();
- // 当前物体的总高度
- _this.totalHeight = 0;
- // 掉下去了
- _this.isFail = false;
- // 上次碰撞的刚体ID
- _this.hitID = 0;
- // 地面距离舞台的初始高度
- _this.sh = 7;
- _this.addEventListener(egret.Event.ADDED_TO_STAGE, _this.onAddToStage, _this);
- return _this;
- }
- Main.prototype.onAddToStage = function (event) {
- // 设置加载进度界面
- this.loadingView = new LoadingUI();
- this.stage.addChild(this.loadingView);
- // 初始化Res资源加载库
- RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
- RES.loadConfig("resource/default.res.json", "resource/");
- };
- /**
- * 配置文件加载完成,开始预加载preload资源组
- */
- Main.prototype.onConfigComplete = function (event) {
- RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
- RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
- RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
- RES.loadGroup("preload");
- };
- /**
- * preload 资源组加载完成
- */
- Main.prototype.onResourceLoadComplete = function (event) {
- if (event.groupName == "preload") {
- this.stage.removeChild(this.loadingView);
- RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
- RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
- this.createGameScene();
- }
- };
- /**
- * preload资源组加载进度
- */
- Main.prototype.onResourceProgress = function (event) {
- if (event.groupName == "preload") {
- // this.loadingView.setProgress(event.itemsLoaded, event.itemsTotal);
- }
- };
- /**
- * 添加背景滚动视图
- */
- Main.prototype.addBgScrollView = function () {
- var content = this.createBitmapByName("bg_jpg");
- //创建ScrollView
- var myscrollView = this.bgscrollView;
- myscrollView.setContent(content);
- myscrollView.width = this.stage.stageWidth;
- myscrollView.height = this.stage.stageHeight;
- myscrollView.x = 0;
- myscrollView.y = 0;
- this.addChild(myscrollView);
- content.width = myscrollView.width;
- content.height = myscrollView.height * 2;
- myscrollView.scrollTop = this.stage.stageHeight;
- myscrollView.verticalScrollPolicy = "off";
- };
- // 漂浮动画
- Main.prototype.flowAnimation = function (display) {
- var rect = display;
- rect.y = 100;
- this.addChild(rect);
- var duration = 3000;
- egret.Tween.get(rect, { loop: true }).to({ x: this.stage.stageWidth + 100 }, duration).to({ x: -100 }, duration);
- };
- /**
- * 创建刚体
- */
- Main.prototype.createBody = function (boxWidth, boxHeight, factor, m) {
- if (m === void 0) { m = 1; }
- var display;
- //添加方形刚体
- var boxShape = new p2.Box({ width: boxWidth, height: boxHeight });
- var boxBody = new p2.Body({
- mass: m,
- angularVelocity: 0,
- gravityScale: 2,
- damping: 0.7
- });
- boxBody.addShape(boxShape);
- if (this.isDebug) {
- display = this.createBox(boxShape.width * factor, boxShape.height * factor);
- }
- else {
- display = this.createBitmapByName("rect_png");
- }
- display.width = boxShape.width * factor;
- display.height = boxShape.height * factor;
- display.anchorOffsetX = display.width / 2;
- display.anchorOffsetY = display.height / 2;
- boxBody.displays = [display];
- this.addChild(display);
- return [boxBody, display];
- };
- /**
- * 定时添加刚体
- */
- Main.prototype.addBoxByTimer = function (factor, boxWidth, boxHeight, world) {
- if (this.flowDisplay || this.isFail) {
- return;
- }
- var array = this.createBody(boxWidth, boxHeight, factor);
- var boxBody = array[0];
- var display = array[1];
- this.flowDisplay = display;
- this.flowAnimation(display);
- this.stage.addEventListener(egret.TouchEvent.TOUCH_TAP, addOneBox, this);
- var self = this;
- function addOneBox(e) {
- if (boxBody.displays[0] == self.flowDisplay) {
- self.flowDisplay = null;
- var positionX = display.x / factor;
- var positionY = Math.floor((egret.MainContext.instance.stage.stageHeight - display.y) / factor);
- boxBody.position = [positionX, positionY];
- // 添加到世界
- world.addBody(boxBody);
- // 停止动画
- egret.Tween.pauseTweens(display);
- // 延迟三秒后添加新的刚体
- egret.setTimeout(function () {
- self.addBoxByTimer(factor, boxWidth, boxHeight, world);
- }, 1, 3000);
- }
- }
- };
- /**
- * 碰撞
- */
- Main.prototype.hit = function () {
- var sound = RES.getRes("hit_mp3");
- sound.play(0, 1);
- var self = this;
- var count = this.world.bodies.length;
- egret.setTimeout(function () {
- var boxHieght = 3;
- for (var i = 0; i < count; i++) {
- var body = self.world.bodies[i];
- var positionY = body.position[1];
- positionY -= boxHieght;
- body.position = [body.position[0], positionY];
- }
- self.bgscrollView.scrollTop -= boxHieght * 50;
- }, 0, 2000);
- };
- Main.prototype.fail = function () {
- var sound = RES.getRes("break_mp3");
- sound.play(0, 1);
- };
- /**
- * 创建游戏场景
- * Create a game scene
- */
- Main.prototype.createGameScene = function () {
- // 添加背景
- this.addBgScrollView();
- //egret.Profiler.getInstance().run();
- var factor = 50;
- //创建world
- var world = new p2.World();
- world.sleepMode = p2.World.BODY_SLEEPING;
- world.defaultContactMaterial.restitution = 0;
- this.world = world;
- //创建一个地基
- var array = this.createBody(8, this.sh, 50, 0);
- var baseBody = array[0];
- baseBody.position = [this.stage.stageWidth / 100, this.sh * 0.5];
- world.addBody(baseBody);
- // 刚体在物理世界的宽和高
- var boxWidth = 6;
- var boxHeight = 3;
- egret.Ticker.getInstance().register(function (dt) {
- if (dt < 10) {
- return;
- }
- if (dt > 1000) {
- return;
- }
- world.step(dt / 1000);
- var stageHeight = egret.MainContext.instance.stage.stageHeight;
- var l = world.bodies.length;
- for (var i = 0; i < l; i++) {
- var lastBody = world.bodies[l - 1];
- var lastBox = lastBody.displays[0];
- if (lastBox && l != 1) {
- lastBox.y = Math.floor(stageHeight - lastBody.position[1] * factor);
- // let limitHeight = stageHeight - (l - 2) * boxHeight * factor;
- var limitHeight = Math.floor(stageHeight - lastBox.anchorOffsetY);
- if (lastBox.y > limitHeight + 20) {
- console.log("掉下去了!!!!!!!!!!!---->", l - 1, lastBox.y);
- if (this.isFail == false) {
- this.isFail = true;
- this.fail();
- }
- }
- else if (lastBox.y >= limitHeight - this.sh * factor - 20) {
- console.log("碰撞上了---->", l - 1);
- if (lastBody.id != this.hitID) {
- this.hitID = lastBody.id;
- this.hit();
- }
- }
- }
- var boxBody = world.bodies[i];
- var box = boxBody.displays[0];
- if (box) {
- box.x = boxBody.position[0] * factor;
- box.y = stageHeight - boxBody.position[1] * factor;
- box.rotation = 360 - (boxBody.angle + boxBody.shapes[0].angle) * 180 / Math.PI;
- if (boxBody.sleepState == p2.Body.SLEEPING) {
- box.alpha = 0.5;
- }
- else {
- box.alpha = 1;
- }
- }
- }
- }, this);
- this.addBoxByTimer(factor, boxWidth, boxHeight, world);
- };
- /**
- * 判断是否叠放成功
- */
- Main.prototype.testPlaceSafe = function (world) {
- };
- /**
- * 根据name关键字创建一个Bitmap对象。name属性请参考resources/resource.json配置文件的内容。
- * Create a Bitmap object according to name keyword.As for the property of name please refer to the configuration file of resources/resource.json.
- */
- Main.prototype.createBitmapByName = function (name) {
- var result = new egret.Bitmap();
- var texture = RES.getRes(name);
- result.texture = texture;
- return result;
- };
- /**
- * 创建一个方形
- */
- Main.prototype.createBox = function (width, height) {
- var shape = new egret.Shape();
- shape.graphics.beginFill(0xfff000);
- shape.graphics.drawRect(0, 0, width, height);
- shape.graphics.endFill();
- return shape;
- };
- return Main;
-}(egret.DisplayObjectContainer));
-__reflect(Main.prototype, "Main");
-//# sourceMappingURL=Main.js.map
\ No newline at end of file
diff --git a/helloworld/bin-debug/Main.js.map b/helloworld/bin-debug/Main.js.map
deleted file mode 100644
index 6d0ae71..0000000
--- a/helloworld/bin-debug/Main.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"Main.js","sourceRoot":"","sources":["../src/Main.ts"],"names":[],"mappings":";;;;;;;;;;AACA;IAAmB,wBAA4B;IAQ3C;QAAA,YACI,iBAAO,SAEV;QA4CD,gBAAgB;QACR,aAAO,GAAY,KAAK,CAAC;QAEzB,cAAQ,GAAiB,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAEpD,QAAQ;QACA,kBAAY,GAAqB,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;QAEhE,WAAW;QACH,iBAAW,GAAW,CAAC,CAAC;QAmIhC,OAAO;QACC,YAAM,GAAY,KAAK,CAAC;QAChC,YAAY;QACJ,WAAK,GAAG,CAAC,CAAC;QAKlB,cAAc;QACN,QAAE,GAAG,CAAC,CAAC;QAlMX,KAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,KAAI,CAAC,YAAY,EAAE,KAAI,CAAC,CAAC;;IAC/E,CAAC;IAEO,2BAAY,GAApB,UAAqB,KAAkB;QACnC,WAAW;QACX,IAAI,CAAC,WAAW,GAAG,IAAI,SAAS,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEtC,cAAc;QACd,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QACrF,GAAG,CAAC,UAAU,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED;;MAEE;IACM,+BAAgB,GAAxB,UAAyB,KAAwB;QAC7C,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QACxF,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;QAC1F,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;QACtF,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAED;;MAEE;IACM,qCAAsB,GAA9B,UAA+B,KAAwB;QACnD,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACzC,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;YAC7F,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;YACzF,IAAI,CAAC,eAAe,EAAE,CAAC;QAC3B,CAAC;IAEL,CAAC;IAED;;GAED;IACS,iCAAkB,GAA1B,UAA2B,KAAwB;QAC/C,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC;YAC/B,qEAAqE;QACzE,CAAC;IACL,CAAC;IAaD;;MAEE;IAEM,8BAAe,GAAvB;QACI,IAAI,OAAO,GAAiB,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAE9D,cAAc;QACd,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACrC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACjC,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAC3C,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAC7C,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC;QACnB,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAE5B,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;QACnC,OAAO,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;QACzC,YAAY,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAChD,YAAY,CAAC,oBAAoB,GAAG,KAAK,CAAC;IAC9C,CAAC;IAMD,OAAO;IACC,4BAAa,GAArB,UAAsB,OAA4B;QAC9C,IAAI,IAAI,GAAG,OAAO,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,QAAQ,GAAG,IAAI,CAAC;QACpB,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IACrH,CAAC;IAED;;MAEE;IACM,yBAAU,GAAlB,UAAmB,QAAgB,EAAE,SAAiB,EAAE,MAAc,EAAC,CAAY;QAAZ,kBAAA,EAAA,KAAY;QAC/E,IAAI,OAA4B,CAAC;QACjC,QAAQ;QACR,IAAI,QAAQ,GAAa,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;QAC5E,IAAI,OAAO,GAAY,IAAI,EAAE,CAAC,IAAI,CAAC;YAC/B,IAAI,EAAE,CAAC;YACP,eAAe,EAAE,CAAC;YAClB,YAAY,EAAE,CAAC;YACf,OAAO,EAAE,GAAG;SACf,CAAC,CAAC;QACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAE3B,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YACf,OAAO,GAAG,IAAI,CAAC,SAAS,CAAU,QAAS,CAAC,KAAK,GAAG,MAAM,EAAW,QAAS,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;QACpG,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,CAAC,KAAK,GAAY,QAAS,CAAC,KAAK,GAAG,MAAM,CAAC;QAClD,OAAO,CAAC,MAAM,GAAY,QAAS,CAAC,MAAM,GAAG,MAAM,CAAC;QAEpD,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;QAC1C,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3C,OAAO,CAAC,QAAQ,GAAG,CAAC,OAAO,CAAC,CAAC;QAC7B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvB,MAAM,CAAC,CAAC,OAAO,EAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;KAEC;IACO,4BAAa,GAArB,UAAsB,MAAc,EAAE,QAAgB,EAAE,SAAiB,EAAE,KAAe;QACtF,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAClC,MAAM,CAAC;QACX,CAAC;QACD,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAC,SAAS,EAAC,MAAM,CAAC,CAAC;QACvD,IAAI,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE5B,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QACzE,IAAI,IAAI,GAAG,IAAI,CAAC;QAEhB,mBAAmB,CAAmB;YAClC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;gBAC1C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,IAAI,SAAS,GAAW,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC;gBAC3C,IAAI,SAAS,GAAW,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;gBACxG,OAAO,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBAC1C,QAAQ;gBACR,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACvB,OAAO;gBACP,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAEjC,cAAc;gBACd,KAAK,CAAC,UAAU,CAAC;oBACb,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;gBAC1D,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YAChB,CAAC;QACL,CAAC;IACL,CAAC;IAID;;MAEE;IACM,kBAAG,GAAX;QAEI,IAAI,KAAK,GAAgB,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC/C,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACjB,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QACrC,KAAK,CAAC,UAAU,CAAC;YACb,IAAI,SAAS,GAAG,CAAC,CAAC;YAClB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7B,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAChC,IAAI,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACjC,SAAS,IAAI,SAAS,CAAC;gBACvB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;YACjD,CAAC;YACD,IAAI,CAAC,YAAY,CAAC,SAAS,IAAI,SAAS,GAAG,EAAE,CAAC;QAClD,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAEhB,CAAC;IAEO,mBAAI,GAAZ;QACI,IAAI,KAAK,GAAgB,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACjD,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrB,CAAC;IAaD;;;OAGG;IACK,8BAAe,GAAvB;QAEI,OAAO;QACP,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,qCAAqC;QACrC,IAAI,MAAM,GAAW,EAAE,CAAC;QAExB,SAAS;QACT,IAAI,KAAK,GAAa,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;QACrC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC;QACzC,KAAK,CAAC,sBAAsB,CAAC,WAAW,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,QAAQ;QACR,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,EAAC,IAAI,CAAC,EAAE,EAAC,EAAE,EAAC,CAAC,CAAC,CAAC;QAC5C,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,QAAQ,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,GAAG,EAAC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;QAChE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAExB,cAAc;QACd,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC5C,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;gBACV,MAAM,CAAC;YACX,CAAC;YACD,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;gBACZ,MAAM,CAAC;YACX,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;YAEtB,IAAI,WAAW,GAAW,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC;YACvE,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;YAC5B,GAAG,CAAC,CAAC,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjC,IAAI,QAAQ,GAAY,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC5C,IAAI,OAAO,GAAwB,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACxD,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBACpB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;oBACpE,gEAAgE;oBAChE,IAAI,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;oBAClE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC;wBAC/B,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;wBACtD,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC;4BACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;4BACnB,IAAI,CAAC,IAAI,EAAE,CAAC;wBAChB,CAAC;oBACL,CAAC;oBAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,WAAW,GAAG,IAAI,CAAC,EAAE,GAAG,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;wBAC1D,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;wBAChC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;4BAC5B,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC;4BACzB,IAAI,CAAC,GAAG,EAAE,CAAC;wBACf,CAAC;oBACL,CAAC;gBACL,CAAC;gBACD,IAAI,OAAO,GAAY,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACvC,IAAI,GAAG,GAAwB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACnD,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBACN,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;oBACrC,GAAG,CAAC,CAAC,GAAG,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;oBACnD,GAAG,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;oBAC/E,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;wBACzC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC;oBACpB,CAAC;oBACD,IAAI,CAAC,CAAC;wBACF,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;oBAClB,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;IAED;;MAEE;IACM,4BAAa,GAArB,UAAsB,KAAe;IAErC,CAAC;IAGD;;;OAGG;IACK,iCAAkB,GAA1B,UAA2B,IAAY;QACnC,IAAI,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAChC,IAAI,OAAO,GAAkB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9C,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,MAAM,CAAC,MAAM,CAAC;IAClB,CAAC;IAED;;OAEG;IACK,wBAAS,GAAjB,UAAkB,KAAa,EAAE,MAAc;QAC3C,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC9B,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACnC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC7C,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;IAEL,WAAC;AAAD,CAAC,AA3TD,CAAmB,KAAK,CAAC,sBAAsB,GA2T9C;AA3TK,UAAA,IAAI,mBA2TT,CAAA"}
\ No newline at end of file
diff --git a/helloworld/bin-debug/Platform.js b/helloworld/bin-debug/Platform.js
deleted file mode 100644
index ee68280..0000000
--- a/helloworld/bin-debug/Platform.js
+++ /dev/null
@@ -1,62 +0,0 @@
-var __reflect = (this && this.__reflect) || function (p, c, t) {
- p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
-};
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-var __generator = (this && this.__generator) || function (thisArg, body) {
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
- function verb(n) { return function (v) { return step([n, v]); }; }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_) try {
- if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
- if (y = 0, t) op = [0, t.value];
- switch (op[0]) {
- case 0: case 1: t = op; break;
- case 4: _.label++; return { value: op[1], done: false };
- case 5: _.label++; y = op[1]; op = [0]; continue;
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
- default:
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
- if (t[2]) _.ops.pop();
- _.trys.pop(); continue;
- }
- op = body.call(thisArg, _);
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
- }
-};
-var DebugPlatform = (function () {
- function DebugPlatform() {
- }
- DebugPlatform.prototype.getUserInfo = function () {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- return [2 /*return*/, { nickName: "username" }];
- });
- });
- };
- DebugPlatform.prototype.login = function () {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- return [2 /*return*/];
- });
- });
- };
- return DebugPlatform;
-}());
-__reflect(DebugPlatform.prototype, "DebugPlatform", ["Platform"]);
-if (!window.platform) {
- window.platform = new DebugPlatform();
-}
-//# sourceMappingURL=Platform.js.map
\ No newline at end of file
diff --git a/helloworld/bin-debug/Platform.js.map b/helloworld/bin-debug/Platform.js.map
deleted file mode 100644
index 8b95647..0000000
--- a/helloworld/bin-debug/Platform.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"Platform.js","sourceRoot":"","sources":["../src/Platform.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA;IAAA;IAOA,CAAC;IANS,mCAAW,GAAjB;;;gBACI,sBAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAA;;;KAClC;IACK,6BAAK,GAAX;;;;;;KAEC;IACL,oBAAC;AAAD,CAAC,AAPD,IAOC;AAPK,UAAA,aAAa,0CAOlB,CAAA;AAGD,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnB,MAAM,CAAC,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;AAC1C,CAAC"}
\ No newline at end of file
diff --git a/helloworld/egretProperties.json b/helloworld/egretProperties.json
deleted file mode 100644
index bee5679..0000000
--- a/helloworld/egretProperties.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "engineVersion": "5.2.5",
- "compilerVersion": "5.2.5",
- "template": {},
- "target": {
- "current": "web"
- },
- "modules": [
- {
- "name": "egret"
- },
- {
- "name": "game"
- },
- {
- "name": "tween"
- },
- {
- "name": "physics",
- "path":"../libsrc"
- },
- {
- "name": "assetsmanager"
- },
- {
- "name": "promise"
- }
- ],
- "targets": {
- "android": {
- "appname": "helloworld",
- "packagename": "com.companyname"
- }
- }
-}
diff --git a/helloworld/favicon.ico b/helloworld/favicon.ico
deleted file mode 100644
index e4ec42c..0000000
Binary files a/helloworld/favicon.ico and /dev/null differ
diff --git a/helloworld/index.html b/helloworld/index.html
deleted file mode 100644
index 63fb06f..0000000
--- a/helloworld/index.html
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
-
-
- Egret
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/helloworld/libs/modules/assetsmanager/assetsmanager.d.ts b/helloworld/libs/modules/assetsmanager/assetsmanager.d.ts
deleted file mode 100644
index 7904a14..0000000
--- a/helloworld/libs/modules/assetsmanager/assetsmanager.d.ts
+++ /dev/null
@@ -1,1064 +0,0 @@
-declare type ResourceRootSelector = () => T;
-declare type ResourceTypeSelector = (file: string) => string;
-declare type ResourceNameSelector = (file: string) => string;
-declare type ResourceMergerSelector = (file: string) => {
- path: string;
- alias: string;
-};
-declare module RES {
- var resourceTypeSelector: ResourceTypeSelector;
- var resourceNameSelector: ResourceNameSelector;
- var resourceMergerSelector: ResourceMergerSelector | null;
- function getResourceInfo(path: string): File | null;
- function setConfigURL(url: string, root: string): void;
- interface ResourceInfo {
- url: string;
- type: string;
- root: string;
- crc32?: string;
- size?: number;
- name: string;
- soundType?: string;
- scale9grid?: string;
- groupNames?: string[];
- promise?: Promise;
- }
- interface Data {
- resourceRoot: string;
- typeSelector: ResourceTypeSelector;
- mergeSelector: ResourceMergerSelector | null;
- fileSystem: FileSystem;
- groups: {
- [groupName: string]: string[];
- };
- alias: {
- [aliasName: string]: string;
- };
- }
- /**
- * @class RES.ResourceConfig
- * @classdesc
- * @private
- */
- class ResourceConfig {
- config: Data;
- constructor();
- init(): Promise;
- __temp__get__type__via__url(url_or_alias: string): string;
- getKeyByAlias(aliasName: string): string;
- /**
- * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
- * 可以监听ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成。
- * @method RES.ResourceConfig#createGroup
- * @param name {string} 要创建的加载资源组的组名
- * @param keys {egret.Array} 要包含的键名列表,key对应配置文件里的name属性或sbuKeys属性的一项或一个资源组名。
- * @param override {boolean} 是否覆盖已经存在的同名资源组,默认false。
- * @returns {boolean}
- */
- createGroup(name: string, keys: Array, override?: boolean): boolean;
- /**
- * 添加一个二级键名到配置列表。
- * @method RES.ResourceConfig#addSubkey
- * @param subkey {string} 要添加的二级键名
- * @param name {string} 二级键名所属的资源name属性
- */
- addSubkey(subkey: string, name: string): void;
- addAlias(alias: any, key: any): void;
- /**
- * 获取加载项类型。
- * @method RES.ResourceConfig#getType
- * @param key {string} 对应配置文件里的name属性或sbuKeys属性的一项。
- * @returns {string}
- */
- getType(key: string): string;
- addResourceData(data: {
- name: string;
- type?: string;
- url: string;
- root?: string;
- }): void;
- destory(): void;
- }
-}
-declare module RES {
- /**
- * @class RES.ResourceLoader
- * @classdesc
- * @private
- */
- class ResourceLoader {
- /**
- * 当前组加载的项总个数,key为groupName
- */
- private groupTotalDic;
- /**
- * 已经加载的项个数,key为groupName
- */
- private numLoadedDic;
- /**
- * 正在加载的组列表,key为groupName
- */
- private itemListDic;
- /**
- * 加载失败的组,key为groupName
- */
- private groupErrorDic;
- private retryTimesDic;
- maxRetryTimes: number;
- /**
- * 优先级队列,key为priority,value为groupName列表
- */
- private priorityQueue;
- private reporterDic;
- private dispatcherDic;
- private failedList;
- private loadItemErrorDic;
- private errorDic;
- load(list: ResourceInfo[], groupName: string, priority: number, reporter?: PromiseTaskReporter): Promise;
- private loadingCount;
- thread: number;
- private next();
- /**
- * 从优先级队列中移除指定的组名
- */
- private removeGroupName(groupName);
- private queueIndex;
- /**
- * 获取下一个待加载项
- */
- private getOneResourceInfo();
- loadResource(r: ResourceInfo, p?: RES.processor.Processor): Promise;
- unloadResource(r: ResourceInfo): Promise;
- }
-}
-declare module RES {
- /**
- * 整个资源加载系统的进程id,协助管理回调派发机制
- */
- var systemPid: number;
- let checkCancelation: MethodDecorator;
- function profile(): void;
- var host: ProcessHost;
- var config: ResourceConfig;
- var queue: ResourceLoader;
- interface ProcessHost {
- state: {
- [index: string]: number;
- };
- resourceConfig: ResourceConfig;
- load: (resource: ResourceInfo, processor?: string | processor.Processor) => Promise;
- unload: (resource: ResourceInfo) => Promise;
- save: (rexource: ResourceInfo, data: any) => void;
- get: (resource: ResourceInfo) => any;
- remove: (resource: ResourceInfo) => void;
- }
- class ResourceManagerError extends Error {
- static errorMessage: {
- 1001: string;
- 1002: string;
- 1005: string;
- 2001: string;
- 2002: string;
- 2003: string;
- 2004: string;
- 2005: string;
- 2006: string;
- };
- /**
- * why instanceof e != ResourceManagerError ???
- * see link : https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
- */
- private __resource_manager_error__;
- constructor(code: number, replacer?: Object, replacer2?: Object);
- }
-}
-declare namespace RES {
- /**
- * Promise的回调函数集合
- */
- interface PromiseTaskReporter {
- /**
- * 进度回调
- */
- onProgress?: (current: number, total: number) => void;
- /**
- * 取消回调
- */
- onCancel?: () => void;
- }
-}
-declare module RES {
- let checkNull: MethodDecorator;
- /**
- * 功能开关
- * LOADING_STATE:处理重复加载
- */
- let FEATURE_FLAG: {
- FIX_DUPLICATE_LOAD: number;
- };
- namespace upgrade {
- function setUpgradeGuideLevel(level: "warning" | "silent"): void;
- }
-}
-declare module RES.processor {
- interface Processor {
- onLoadStart(host: ProcessHost, resource: ResourceInfo): Promise;
- onRemoveStart(host: ProcessHost, resource: ResourceInfo): Promise;
- getData?(host: ProcessHost, resource: ResourceInfo, key: string, subkey: string): any;
- }
- function isSupport(resource: ResourceInfo): Processor;
- function map(type: string, processor: Processor): void;
- function getRelativePath(url: string, file: string): string;
- var ImageProcessor: Processor;
- var BinaryProcessor: Processor;
- var TextProcessor: Processor;
- var JsonProcessor: Processor;
- var XMLProcessor: Processor;
- var CommonJSProcessor: Processor;
- const SheetProcessor: Processor;
- var FontProcessor: Processor;
- var SoundProcessor: Processor;
- var MovieClipProcessor: Processor;
- const MergeJSONProcessor: Processor;
- const ResourceConfigProcessor: Processor;
- const LegacyResourceConfigProcessor: Processor;
- var PVRProcessor: Processor;
- const _map: {
- [index: string]: Processor;
- };
-}
-declare module RES {
- interface File {
- url: string;
- type: string;
- name: string;
- root: string;
- }
- interface Dictionary {
- [file: string]: File | Dictionary;
- }
- interface FileSystem {
- addFile(filename: string, type?: string, root?: string): any;
- getFile(filename: string): File | null;
- profile(): void;
- }
- class NewFileSystem {
- private data;
- constructor(data: Dictionary);
- profile(): void;
- addFile(filename: string, type?: string): void;
- getFile(filename: string): File | null;
- private reslove(dirpath);
- private mkdir(dirpath);
- private exists(dirpath);
- }
- var fileSystem: FileSystem;
-}
-declare module RES {
- /**
- * The events of resource loading.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 资源加载事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class ResourceEvent extends egret.Event {
- /**
- * Failure event for a load item.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 一个加载项加载失败事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ITEM_LOAD_ERROR: string;
- /**
- * Configure file to load and parse the completion event. Note: if a configuration file is loaded, it will not be thrown out, and if you want to handle the configuration loading failure, monitor the CONFIG_LOAD_ERROR event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 配置文件加载并解析完成事件。注意:若有配置文件加载失败,将不会抛出此事件,若要处理配置加载失败,请同时监听 CONFIG_LOAD_ERROR 事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static CONFIG_COMPLETE: string;
- /**
- * Configuration file failed to load.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 配置文件加载失败事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static CONFIG_LOAD_ERROR: string;
- /**
- * Delay load group resource loading progress event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 延迟加载组资源加载进度事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static GROUP_PROGRESS: string;
- /**
- * Delay load group resource to complete event. Note: if you have a resource item loading failure, the event will not be thrown, if you want to handle the group load failure, please listen to the GROUP_LOAD_ERROR event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 延迟加载组资源加载完成事件。注意:若组内有资源项加载失败,将不会抛出此事件,若要处理组加载失败,请同时监听 GROUP_LOAD_ERROR 事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static GROUP_COMPLETE: string;
- /**
- * Delayed load group resource failed event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 延迟加载组资源加载失败事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static GROUP_LOAD_ERROR: string;
- /**
- * Creates an Event object to pass as a parameter to event listeners.
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @version Egret 2.4
- * @platform Web,Native
- * @private
- * @language en_US
- */
- /**
- * 创建一个作为参数传递给事件侦听器的 Event 对象。
- * @param type 事件的类型,可以作为 Event.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @private
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean);
- /**
- * File number that has been loaded.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 已经加载的文件数。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- itemsLoaded: number;
- /**
- * Total file number to load.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 要加载的总文件数。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- itemsTotal: number;
- /**
- * Resource group name.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 资源组名。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- groupName: string;
- /**
- * An item of information that is finished by the end of a load.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 一次加载项加载结束的项信息对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- resItem: ResourceItem;
- }
-}
-declare module RES {
- /**
- * Resource term. One of the resources arrays in resource.json.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 资源项。对应 resource.json 中 resources 数组中的一项。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- namespace ResourceItem {
- /**
- * XML file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * XML 文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const TYPE_XML: string;
- /**
- * Picture file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 图片文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const TYPE_IMAGE: string;
- /**
- * Binary file.
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 二进制文件。
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- const TYPE_BIN: string;
- /**
- * Text file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文本文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const TYPE_TEXT: string;
- /**
- * JSON file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * JSON 文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const TYPE_JSON: string;
- /**
- * SpriteSheet file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * SpriteSheet 文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const TYPE_SHEET: string;
- /**
- * BitmapTextSpriteSheet file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * BitmapTextSpriteSheet 文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const TYPE_FONT: string;
- /**
- * Sound file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 声音文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const TYPE_SOUND: string;
- function convertToResItem(r: ResourceInfo): ResourceItem;
- }
- interface ResourceItem extends ResourceInfo {
- /**
- * Name of resource term.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 加载项名称。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- name: string;
- /**
- * URL of resource term.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 要加载的文件地址。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- url: string;
- /**
- * Type of resource term.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 加载项文件类型。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- type: string;
- /**
- * The raw data object to be referenced.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 被引用的原始数据对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- data: ResourceInfo;
- crc32?: string;
- size?: number;
- soundType?: string;
- }
-}
-declare namespace RES {
- namespace path {
- const normalize: (filename: string) => string;
- const basename: (filename: string) => string;
- const dirname: (path: string) => string;
- }
-}
-declare namespace RES {
-}
-declare module RES {
- type GetResAsyncCallback = (value?: any, key?: string) => any;
- let nameSelector: (url: any) => string;
- /**
- * Conduct mapping injection with class definition as the value.
- * @param type Injection type.
- * @param analyzerClass Injection type classes need to be resolved.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample extension/resource/Resource.ts
- * @language en_US
- */
- /**
- * 以类定义为值进行映射注入。
- * @param type 注入的类型。
- * @param analyzerClass 注入类型需要解析的类。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample extension/resource/Resource.ts
- * @language zh_CN
- */
- function registerAnalyzer(type: string, analyzerClass: any): void;
- /**
- * Load configuration file and parse.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 加载配置文件并解析。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function loadConfig(url: string, resourceRoot: string): Promise;
- /**
- * Load a set of resources according to the group name.
- * @param name Group name to load the resource group.
- * @param priority Load priority can be negative, the default value is 0.
- *
A low priority group must wait for the high priority group to complete the end of the load to start, and the same priority group will be loaded at the same time.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 根据组名加载一组资源。
- * @param name 要加载资源组的组名。
- * @param priority 加载优先级,可以为负数,默认值为 0。
- *
低优先级的组必须等待高优先级组完全加载结束才能开始,同一优先级的组会同时加载。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function loadGroup(name: string, priority?: number, reporter?: PromiseTaskReporter): Promise;
- /**
- * Check whether a resource group has been loaded.
- * @param name Group name。
- * @returns Is loading or not.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 检查某个资源组是否已经加载完成。
- * @param name 组名。
- * @returns 是否正在加载。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function isGroupLoaded(name: string): boolean;
- /**
- * A list of groups of loading is obtained according to the group name.
- * @param name Group name.
- * @returns The resource item array of group.
- * @see RES.ResourceItem
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 根据组名获取组加载项列表。
- * @param name 组名。
- * @returns 加载项列表。
- * @see RES.ResourceItem
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function getGroupByName(name: string): Array;
- /**
- * Create a custom load resource group, note that this method is valid only after the resource configuration file is loaded.
- *
You can monitor the ResourceEvent.CONFIG_COMPLETE event to verify that the configuration is complete.
- * @param name Group name to create the load resource group.
- * @param keys To be included in the list of key keys, the corresponding configuration file in the name or sbuKeys property one or a resource group name.
- * @param override Is the default false for the same name resource group already exists.
- * @returns Create success or fail.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
- *
可以监听 ResourceEvent.CONFIG_COMPLETE 事件来确认配置加载完成。
- * @param name 要创建的加载资源组的组名。
- * @param keys 要包含的键名列表,key 对应配置文件里的 name 属性或 sbuKeys 属性的一项或一个资源组名。
- * @param override 是否覆盖已经存在的同名资源组,默认 false。
- * @returns 是否创建成功。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function createGroup(name: string, keys: Array, override?: boolean): boolean;
- /**
- * Check whether the configuration file contains the specified resources.
- * @param key A sbuKeys attribute or name property in a configuration file.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 检查配置文件里是否含有指定的资源。
- * @param key 对应配置文件里的 name 属性或 sbuKeys 属性的一项。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function hasRes(key: string): boolean;
- /**
- * The synchronization method for obtaining the cache has been loaded with the success of the resource.
- *
The type of resource and the corresponding return value types are as follows:
- *
RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript primary object
- *
RES.ResourceItem.TYPE_IMAGE : img Html Object,or egret.BitmapData interface。
- *
RES.ResourceItem.TYPE_JSON : Object
- *
RES.ResourceItem.TYPE_SHEET : Object
- *
1. If the incoming parameter is the name of the entire SpriteSheet is returned is {image1: Texture, "image2": Texture}.
- *
2. If the incoming is "sheet.image1", the return is a single resource.
- *
3. If the incoming is the name of the "image1" single resource, the return is a single resource.
- * But if there are two SpriteSheet in a single picture of the same name, the return of the image after the load.
- *
RES.ResourceItem.TYPE_SOUND : HtmlSound Html Object
- *
RES.ResourceItem.TYPE_TEXT : string
- * @param key A subKeys attribute or name property in a configuration file.
- * @see RES.ResourceItem
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 同步方式获取缓存的已经加载成功的资源。
- *
资源类型和对应的返回值类型关系如下:
- *
RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript 原生对象
- *
RES.ResourceItem.TYPE_IMAGE : img Html 对象,或者 egret.BitmapData 接口。
- *
RES.ResourceItem.TYPE_JSON : Object
- *
RES.ResourceItem.TYPE_SHEET : Object
- *
1. 如果传入的参数是整个 SpriteSheet 的名称返回的是 {"image1":Texture,"image2":Texture} 这样的格式。
- *
2. 如果传入的是 "sheet.image1",返回的是单个资源。
- *
3. 如果传入的是 "image1" 单个资源的名称,返回的是单个资源。但是如果有两张 SpriteSheet 中有单个图片资源名称相同,返回的是后加载的那个图片资源。
- *
RES.ResourceItem.TYPE_SOUND : HtmlSound Html 对象
- *
RES.ResourceItem.TYPE_TEXT : string
- * @param key 对应配置文件里的 name 属性或 subKeys 属性的一项。
- * @see RES.ResourceItem
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function getRes(key: string): any;
- /**
- * Asynchronous mode to get the resources in the configuration. As long as the resources exist in the configuration file, you can get it in an asynchronous way.
- * @param key A sbuKeys attribute or name property in a configuration file.
- * @param compFunc Call back function. Example:compFunc(data,key):void.
- * @param thisObject This pointer of call back function.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 异步方式获取配置里的资源。只要是配置文件里存在的资源,都可以通过异步方式获取。
- * @param key 对应配置文件里的 name 属性或 sbuKeys 属性的一项。
- * @param compFunc 回调函数。示例:compFunc(data,key):void。
- * @param thisObject 回调函数的 this 引用。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function getResAsync(key: string): Promise;
- function getResAsync(key: string, compFunc: GetResAsyncCallback, thisObject: any): void;
- /**
- * Access to external resources through the full URL.
- * @param url The external path to load the file.
- * @param compFunc Call back function. Example:compFunc(data,url):void。
- * @param thisObject This pointer of call back function.
- * @param type File type (optional). Use the static constants defined in the ResourceItem class. If you do not set the file name extension.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample extension/resource/GetResByUrl.ts
- * @language en_US
- */
- /**
- * 通过完整URL方式获取外部资源。
- * @param url 要加载文件的外部路径。
- * @param compFunc 回调函数。示例:compFunc(data,url):void。
- * @param thisObject 回调函数的 this 引用。
- * @param type 文件类型(可选)。请使用 ResourceItem 类中定义的静态常量。若不设置将根据文件扩展名生成。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample extension/resource/GetResByUrl.ts
- * @language zh_CN
- */
- function getResByUrl(url: string, compFunc: Function, thisObject: any, type?: string): void;
- /**
- * Destroy a single resource file or a set of resources to the cache data, to return whether to delete success.
- * @param name Name attribute or resource group name of the load item in the configuration file.
- * @param force Destruction of a resource group when the other resources groups have the same resource situation whether the resources will be deleted, the default value true.
- * @returns Are successful destruction.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 销毁单个资源文件或一组资源的缓存数据,返回是否删除成功。
- * @param name 配置文件中加载项的name属性或资源组名。
- * @param force 销毁一个资源组时其他资源组有同样资源情况资源是否会被删除,默认值 true。
- * @see #setMaxRetryTimes
- * @returns 是否销毁成功。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function destroyRes(name: string, force?: boolean): Promise;
- /**
- * Sets the maximum number of concurrent load threads, the default value is 2.
- * @param thread The number of concurrent loads to be set.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 设置最大并发加载线程数量,默认值是 2。
- * @param thread 要设置的并发加载数。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function setMaxLoadingThread(thread: number): void;
- /**
- * Sets the number of retry times when the resource failed to load, and the default value is 3.
- * @param retry To set the retry count.
- * @includeExample extension/resource/Resource.ts
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 设置资源加载失败时的重试次数,默认值是 3。
- * @param retry 要设置的重试次数。
- * @includeExample extension/resource/Resource.ts
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function setMaxRetryTimes(retry: number): void;
- /**
- * Add event listeners, reference ResourceEvent defined constants.
- * @param type Event name。
- * @param listener Listener functions for handling events. This function must accept the Event object as its only parameter, and can't return any results,
- * As shown in the following example: function (evt:Event):void can have any name.
- * @param thisObject The this object that is bound to a function.
- * @param useCapture Determine the listener is running on the capture or running on the target and the bubbling phase. Set useCapture to true,
- * then the listener in the capture phase processing events, but not in the target or the bubbling phase processing events.
- * If useCapture is false, then the listener only in the target or the bubbling phase processing events.
- * To listen for events in all three stages, please call addEventListener two times: once the useCapture is set to true, once the useCapture is set to false.
- * @param priority Event listener priority. Priority is specified by a 32 - bit integer with a symbol. The higher the number, the higher the priority.
- * All listeners with a priority for n will be processed before the -1 n listener.
- * If two or more listeners share the same priority, they are processed in accordance with the order of their added. The default priority is 0.
- * @see RES.ResourceEvent
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 添加事件侦听器,参考 ResourceEvent 定义的常量。
- * @param type 事件的类型。
- * @param listener 处理事件的侦听器函数。此函数必须接受 Event 对象作为其唯一的参数,并且不能返回任何结果,
- * 如下面的示例所示: function(evt:Event):void 函数可以有任何名称。
- * @param thisObject 侦听函数绑定的 this 对象。
- * @param useCapture 确定侦听器是运行于捕获阶段还是运行于目标和冒泡阶段。如果将 useCapture 设置为 true,
- * 则侦听器只在捕获阶段处理事件,而不在目标或冒泡阶段处理事件。如果 useCapture 为 false,则侦听器只在目标或冒泡阶段处理事件。
- * 要在所有三个阶段都侦听事件,请调用 addEventListener 两次:一次将 useCapture 设置为 true,一次将 useCapture 设置为 false。
- * @param priority 事件侦听器的优先级。优先级由一个带符号的 32 位整数指定。数字越大,优先级越高。优先级为 n 的所有侦听器会在
- * 优先级为 n -1 的侦听器之前得到处理。如果两个或更多个侦听器共享相同的优先级,则按照它们的添加顺序进行处理。默认优先级为 0。
- * @see RES.ResourceEvent
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function addEventListener(type: string, listener: (event: egret.Event) => void, thisObject: any, useCapture?: boolean, priority?: number): void;
- /**
- * Remove event listeners, reference ResourceEvent defined constants.
- * @param type Event name。
- * @param listener Listening function。
- * @param thisObject The this object that is bound to a function.
- * @param useCapture Is used to capture, and this property is only valid in the display list.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 移除事件侦听器,参考ResourceEvent定义的常量。
- * @param type 事件名。
- * @param listener 侦听函数。
- * @param thisObject 侦听函数绑定的this对象。
- * @param useCapture 是否使用捕获,这个属性只在显示列表中生效。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function removeEventListener(type: string, listener: (event: egret.Event) => void, thisObject: any, useCapture?: boolean): void;
- /**
- * Adding a custom resource configuration.
- * @param data To add configuration.
- * @version Egret 3.1.6
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 自定义添加一项资源配置。
- * @param data 要添加的配置。
- * @version Egret 3.1.6
- * @platform Web,Native
- * @language zh_CN
- */
- function $addResourceData(data: {
- name: string;
- type: string;
- url: string;
- }): void;
- /**
- * @private
- */
- class Resource extends egret.EventDispatcher {
- /**
- * 开始加载配置
- * @method RES.loadConfig
- */
- loadConfig(): Promise;
- /**
- * 检查某个资源组是否已经加载完成
- * @method RES.isGroupLoaded
- * @param name {string}
- */
- isGroupLoaded(name: string): boolean;
- /**
- * 根据组名获取组加载项列表
- * @method RES.getGroupByName
- * @param name {string}
- */
- getGroupByName(name: string): Array;
- /**
- * 根据组名加载一组资源
- * @method RES.loadGroup
- * @param name {string}
- * @param priority {number}
- */
- loadGroup(name: string, priority?: number, reporter?: PromiseTaskReporter): Promise;
- private _loadGroup(name, priority?, reporter?);
- loadResources(keys: string[], reporter?: PromiseTaskReporter): Promise;
- /**
- * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
- * 可以监听ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成。
- * @method RES.ResourceConfig#createGroup
- * @param name {string} 要创建的加载资源组的组名
- * @param keys {egret.Array} 要包含的键名列表,key对应配置文件里的name属性或一个资源组名。
- * @param override {boolean} 是否覆盖已经存在的同名资源组,默认false。
- * @returns {boolean}
- */
- createGroup(name: string, keys: Array, override?: boolean): boolean;
- /**
- * 检查配置文件里是否含有指定的资源
- * @method RES.hasRes
- * @param key {string} 对应配置文件里的name属性或subKeys属性的一项。
- * @returns {boolean}
- */
- hasRes(key: string): boolean;
- /**
- * 通过key同步获取资源
- * @method RES.getRes
- * @param key {string}
- * @returns {any}
- */
- getRes(resKey: string): any;
- /**
- * 通过key异步获取资源
- * @method RES.getResAsync
- * @param key {string}
- * @param compFunc {Function} 回调函数。示例:compFunc(data,url):void。
- * @param thisObject {any}
- */
- getResAsync(key: string): Promise;
- getResAsync(key: string, compFunc: GetResAsyncCallback, thisObject: any): void;
- /**
- * 通过url获取资源
- * @method RES.getResByUrl
- * @param url {string}
- * @param compFunc {Function}
- * @param thisObject {any}
- * @param type {string}
- */
- getResByUrl(url: string, compFunc: Function, thisObject: any, type?: string): Promise | void;
- /**
- * 销毁单个资源文件或一组资源的缓存数据,返回是否删除成功。
- * @method RES.destroyRes
- * @param name {string} 配置文件中加载项的name属性或资源组名
- * @param force {boolean} 销毁一个资源组时其他资源组有同样资源情况资源是否会被删除,默认值true
- * @returns {boolean}
- */
- destroyRes(name: string, force?: boolean): Promise;
- /**
- * 设置最大并发加载线程数量,默认值是2.
- * @method RES.setMaxLoadingThread
- * @param thread {number} 要设置的并发加载数。
- */
- setMaxLoadingThread(thread: number): void;
- /**
- * 设置资源加载失败时的重试次数。
- * @param retry 要设置的重试次数。
- */
- setMaxRetryTimes(retry: number): void;
- addResourceData(data: {
- name: string;
- type: string;
- url: string;
- }): void;
- }
-}
diff --git a/helloworld/libs/modules/assetsmanager/assetsmanager.js b/helloworld/libs/modules/assetsmanager/assetsmanager.js
deleted file mode 100644
index b8d687c..0000000
--- a/helloworld/libs/modules/assetsmanager/assetsmanager.js
+++ /dev/null
@@ -1,2738 +0,0 @@
-var __reflect = (this && this.__reflect) || function (p, c, t) {
- p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
-};
-var __extends = this && this.__extends || function __extends(t, e) {
- function r() {
- this.constructor = t;
-}
-for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
-r.prototype = e.prototype, t.prototype = new r();
-};
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-var __generator = (this && this.__generator) || function (thisArg, body) {
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
- function verb(n) { return function (v) { return step([n, v]); }; }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_) try {
- if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
- if (y = 0, t) op = [0, t.value];
- switch (op[0]) {
- case 0: case 1: t = op; break;
- case 4: _.label++; return { value: op[1], done: false };
- case 5: _.label++; y = op[1]; op = [0]; continue;
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
- default:
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
- if (t[2]) _.ops.pop();
- _.trys.pop(); continue;
- }
- op = body.call(thisArg, _);
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
- }
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var RES;
-(function (RES) {
- RES.resourceNameSelector = function (p) { return p; };
- function getResourceInfo(path) {
- var result = RES.fileSystem.getFile(path);
- if (!result) {
- path = RES.resourceNameSelector(path);
- result = RES.fileSystem.getFile(path);
- }
- return result;
- }
- RES.getResourceInfo = getResourceInfo;
- var configItem;
- function setConfigURL(url, root) {
- var type;
- if (url.indexOf(".json") >= 0) {
- type = "legacyResourceConfig";
- }
- else {
- type = "resourceConfig";
- }
- configItem = { type: type, root: root, url: url, name: url };
- }
- RES.setConfigURL = setConfigURL;
- /**
- * @class RES.ResourceConfig
- * @classdesc
- * @private
- */
- var ResourceConfig = (function () {
- function ResourceConfig() {
- }
- ResourceConfig.prototype.init = function () {
- var _this = this;
- if (!this.config) {
- this.config = {
- alias: {}, groups: {}, resourceRoot: configItem.root,
- typeSelector: function () { return 'unknown'; }, mergeSelector: null,
- fileSystem: null
- };
- }
- return RES.queue.loadResource(configItem).then(function (data) {
- return _this.parseConfig(data);
- }).catch(function (e) {
- if (!e.__resource_manager_error__) {
- console.error(e.stack);
- e = new RES.ResourceManagerError(1002);
- }
- return Promise.reject(e);
- });
- };
- /**
- * @internal
- */
- ResourceConfig.prototype.getGroupByName = function (name, shouldNotBeNull) {
- var group = this.config.groups[name];
- var result = [];
- if (!group) {
- if (shouldNotBeNull) {
- throw new RES.ResourceManagerError(2005, name);
- }
- return null;
- }
- for (var _i = 0, group_1 = group; _i < group_1.length; _i++) {
- var paramKey = group_1[_i];
- var _a = RES.config.getResourceWithSubkey(paramKey, true), key = _a.key, subkey = _a.subkey;
- var r = RES.config.getResource(key, true);
- if (result.indexOf(r) == -1) {
- result.push(r);
- }
- }
- return result;
- };
- ResourceConfig.prototype.__temp__get__type__via__url = function (url_or_alias) {
- var url = this.config.alias[url_or_alias];
- if (!url) {
- url = url_or_alias;
- }
- if (RES.resourceTypeSelector) {
- var type = RES.resourceTypeSelector(url);
- if (!type) {
- throw new RES.ResourceManagerError(2004, url);
- }
- return type;
- }
- else {
- console.warn("RES.mapConfig 并未设置 typeSelector");
- return "unknown";
- }
- };
- ResourceConfig.prototype.getResourceWithSubkey = function (key, shouldNotBeNull) {
- key = this.getKeyByAlias(key);
- var index = key.indexOf("#");
- var subkey = "";
- if (index >= 0) {
- subkey = key.substr(index + 1);
- key = key.substr(0, index);
- }
- var r = this.getResource(key);
- if (!r) {
- if (shouldNotBeNull) {
- var msg = subkey ? key + "#" + subkey : key;
- throw new RES.ResourceManagerError(2006, msg);
- }
- else {
- return null;
- }
- }
- else {
- return {
- r: r, key: key, subkey: subkey
- };
- }
- };
- ResourceConfig.prototype.getKeyByAlias = function (aliasName) {
- if (this.config.alias[aliasName]) {
- return this.config.alias[aliasName];
- }
- else {
- return aliasName;
- }
- };
- ResourceConfig.prototype.getResource = function (path_or_alias, shouldNotBeNull) {
- var path = this.config.alias[path_or_alias];
- if (!path) {
- path = path_or_alias;
- }
- var r = getResourceInfo(path);
- if (!r) {
- if (shouldNotBeNull) {
- throw new RES.ResourceManagerError(2006, path_or_alias);
- }
- return null;
- }
- return r;
- };
- /**
- * 根据组名获取原始的组加载项列表
- * @method RES.ResourceConfig#getRawGroupByName
- * @param name {string} 组名
- * @returns {Array}
- * @internal
- */
- ResourceConfig.prototype.getGroup = function (name) {
- return this.getGroupByName(name);
- };
- // public getResourceInfos(folderName: string) {
- // this.config.resources[]
- // }
- /**
- * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
- * 可以监听ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成。
- * @method RES.ResourceConfig#createGroup
- * @param name {string} 要创建的加载资源组的组名
- * @param keys {egret.Array} 要包含的键名列表,key对应配置文件里的name属性或sbuKeys属性的一项或一个资源组名。
- * @param override {boolean} 是否覆盖已经存在的同名资源组,默认false。
- * @returns {boolean}
- */
- ResourceConfig.prototype.createGroup = function (name, keys, override) {
- if (override === void 0) { override = false; }
- if ((!override && this.config.groups[name]) || !keys || keys.length == 0) {
- return false;
- }
- var group = [];
- for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
- var key = keys_1[_i];
- if (this.config.groups[key]) {
- var groupInfo = this.config.groups[key];
- group = group.concat(groupInfo);
- }
- else {
- group.push(key);
- }
- }
- this.config.groups[name] = group;
- return true;
- // var groupDic: any = this.groupDic;
- // var group: Array = [];
- // var length: number = keys.length;
- // for (var i: number = 0; i < length; i++) {
- // var key: string = keys[i];
- // var g: Array = groupDic[key];
- // if (g) {
- // var len: number = g.length;
- // for (var j: number = 0; j < len; j++) {
- // var item: any = g[j];
- // if (group.indexOf(item) == -1)
- // group.push(item);
- // }
- // }
- // else {
- // item = this.keyMap[key];
- // if (item) {
- // if (group.indexOf(item) == -1)
- // group.push(item);
- // }
- // else {
- // egret.$warn(3200, key);
- // }
- // }
- // }
- // if (group.length == 0)
- // return false;
- // this.groupDic[name] = group;
- // return true;
- };
- /**
- * 解析一个配置文件
- * @internal
- * @method RES.ResourceConfig#parseConfig
- * @param data {any} 配置文件数据
- * @param folder {string} 加载项的路径前缀。
- */
- ResourceConfig.prototype.parseConfig = function (data) {
- this.config = data;
- RES.fileSystem = data.fileSystem;
- // if (!data)
- // return;
- // var resources: Array = data["resources"];
- // if (resources) {
- // var length: number = resources.length;
- // for (var i: number = 0; i < length; i++) {
- // var item: any = resources[i];
- // var url: string = item.url;
- // if (url && url.indexOf("://") == -1)
- // item.url = folder + url;
- // this.addItemToKeyMap(item);
- // }
- // }
- // var groups: Array = data["groups"];
- // if (groups) {
- // length = groups.length;
- // for (i = 0; i < length; i++) {
- // var group: any = groups[i];
- // var list: Array = [];
- // var keys: Array = (group.keys).split(",");
- // var l: number = keys.length;
- // for (var j: number = 0; j < l; j++) {
- // var name: string = keys[j].trim();
- // item = this.keyMap[name];
- // if (item && list.indexOf(item) == -1) {
- // list.push(item);
- // }
- // }
- // this.groupDic[group.name] = list;
- // }
- // }
- };
- /**
- * 添加一个二级键名到配置列表。
- * @method RES.ResourceConfig#addSubkey
- * @param subkey {string} 要添加的二级键名
- * @param name {string} 二级键名所属的资源name属性
- */
- ResourceConfig.prototype.addSubkey = function (subkey, name) {
- this.addAlias(subkey, name + "#" + subkey);
- };
- ResourceConfig.prototype.addAlias = function (alias, key) {
- if (this.config.alias[key]) {
- key = this.config.alias[key];
- }
- this.config.alias[alias] = key;
- };
- /**
- * 获取加载项类型。
- * @method RES.ResourceConfig#getType
- * @param key {string} 对应配置文件里的name属性或sbuKeys属性的一项。
- * @returns {string}
- */
- ResourceConfig.prototype.getType = function (key) {
- return this.getResource(key, true).type;
- };
- ResourceConfig.prototype.addResourceData = function (data) {
- if (RES.hasRes(data.name)) {
- return;
- }
- if (!data.type) {
- data.type = this.__temp__get__type__via__url(data.url);
- }
- RES.fileSystem.addFile(data.url, data.type, data.root);
- if (data.name) {
- this.config.alias[data.name] = data.url;
- }
- };
- ResourceConfig.prototype.destory = function () {
- RES.systemPid++;
- var emptyFileSystem = {
- getFile: function () {
- return null;
- },
- addFile: function () {
- },
- profile: function () {
- }
- };
- this.config = { groups: {}, alias: {}, fileSystem: emptyFileSystem, typeSelector: function (p) { return p; }, resourceRoot: "resources", mergeSelector: null };
- };
- return ResourceConfig;
- }());
- RES.ResourceConfig = ResourceConfig;
- __reflect(ResourceConfig.prototype, "RES.ResourceConfig");
-})(RES || (RES = {}));
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2014-present, Egret Technology.
-// All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// * Neither the name of the Egret nor the
-// names of its contributors may be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
-// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-var RES;
-(function (RES) {
- /**
- * @class RES.ResourceLoader
- * @classdesc
- * @private
- */
- var ResourceLoader = (function () {
- function ResourceLoader() {
- /**
- * 当前组加载的项总个数,key为groupName
- */
- this.groupTotalDic = {};
- /**
- * 已经加载的项个数,key为groupName
- */
- this.numLoadedDic = {};
- /**
- * 正在加载的组列表,key为groupName
- */
- this.itemListDic = {};
- /**
- * 加载失败的组,key为groupName
- */
- this.groupErrorDic = {};
- this.retryTimesDic = {};
- this.maxRetryTimes = 3;
- /**
- * 优先级队列,key为priority,value为groupName列表
- */
- this.priorityQueue = {};
- this.reporterDic = {};
- this.dispatcherDic = {};
- this.failedList = new Array();
- this.loadItemErrorDic = {};
- this.errorDic = {};
- this.loadingCount = 0;
- this.thread = 4;
- this.queueIndex = 0;
- }
- ResourceLoader.prototype.load = function (list, groupName, priority, reporter) {
- var _this = this;
- if (this.itemListDic[groupName]) {
- if (!this.dispatcherDic[groupName]) {
- var dispatcher_1 = new egret.EventDispatcher();
- this.dispatcherDic[groupName] = dispatcher_1;
- }
- var promise_1 = new Promise(function (reslove, reject) {
- _this.dispatcherDic[groupName].addEventListener("complete", reslove, null);
- _this.dispatcherDic[groupName].addEventListener("error", function (e) {
- reject(e.data);
- }, null);
- });
- return promise_1;
- }
- var total = list.length;
- for (var i = 0; i < total; i++) {
- var resInfo = list[i];
- if (!resInfo.groupNames) {
- resInfo.groupNames = [];
- }
- resInfo.groupNames.push(groupName);
- }
- this.itemListDic[groupName] = list;
- this.groupTotalDic[groupName] = list.length;
- this.numLoadedDic[groupName] = 0;
- if (this.priorityQueue[priority])
- this.priorityQueue[priority].push(groupName);
- else
- this.priorityQueue[priority] = [groupName];
- this.reporterDic[groupName] = reporter;
- var dispatcher = new egret.EventDispatcher();
- this.dispatcherDic[groupName] = dispatcher;
- var promise = new Promise(function (reslove, reject) {
- dispatcher.addEventListener("complete", reslove, null);
- dispatcher.addEventListener("error", function (e) {
- reject(e.data);
- }, null);
- });
- this.next();
- return promise;
- };
- ResourceLoader.prototype.next = function () {
- var _this = this;
- var _loop_1 = function () {
- var r = this_1.getOneResourceInfo();
- if (!r)
- return "break";
- this_1.loadingCount++;
- this_1.loadResource(r)
- .then(function (response) {
- _this.loadingCount--;
- RES.host.save(r, response);
- var groupName = r.groupNames.shift();
- if (r.groupNames.length == 0) {
- r.groupNames = undefined;
- }
- var reporter = _this.reporterDic[groupName];
- _this.numLoadedDic[groupName]++;
- var current = _this.numLoadedDic[groupName];
- var total = _this.groupTotalDic[groupName];
- if (reporter && reporter.onProgress) {
- reporter.onProgress(current, total);
- }
- if (current == total) {
- var groupError = _this.groupErrorDic[groupName];
- _this.removeGroupName(groupName);
- delete _this.groupTotalDic[groupName];
- delete _this.numLoadedDic[groupName];
- delete _this.itemListDic[groupName];
- delete _this.groupErrorDic[groupName];
- var dispatcher = _this.dispatcherDic[groupName];
- if (groupError) {
- var itemList = _this.loadItemErrorDic[groupName];
- delete _this.loadItemErrorDic[groupName];
- var error = _this.errorDic[groupName];
- delete _this.errorDic[groupName];
- dispatcher.dispatchEventWith("error", false, { itemList: itemList, error: error });
- }
- else {
- dispatcher.dispatchEventWith("complete");
- }
- }
- _this.next();
- }).catch(function (error) {
- if (!error) {
- throw r.name + " load fail";
- }
- if (!error.__resource_manager_error__) {
- throw error;
- }
- _this.loadingCount--;
- delete RES.host.state[r.root + r.name];
- var times = _this.retryTimesDic[r.name] || 1;
- if (times > _this.maxRetryTimes) {
- delete _this.retryTimesDic[r.name];
- var groupName = r.groupNames.shift();
- if (r.groupNames.length == 0) {
- delete r.groupNames;
- }
- if (!_this.loadItemErrorDic[groupName]) {
- _this.loadItemErrorDic[groupName] = [];
- }
- if (_this.loadItemErrorDic[groupName].indexOf(r) == -1) {
- _this.loadItemErrorDic[groupName].push(r);
- }
- _this.groupErrorDic[groupName] = true;
- var reporter = _this.reporterDic[groupName];
- _this.numLoadedDic[groupName]++;
- var current = _this.numLoadedDic[groupName];
- var total = _this.groupTotalDic[groupName];
- if (reporter && reporter.onProgress) {
- reporter.onProgress(current, total);
- }
- if (current == total) {
- var groupError = _this.groupErrorDic[groupName];
- _this.removeGroupName(groupName);
- delete _this.groupTotalDic[groupName];
- delete _this.numLoadedDic[groupName];
- delete _this.itemListDic[groupName];
- delete _this.groupErrorDic[groupName];
- var itemList = _this.loadItemErrorDic[groupName];
- delete _this.loadItemErrorDic[groupName];
- var dispatcher = _this.dispatcherDic[groupName];
- dispatcher.dispatchEventWith("error", false, { itemList: itemList, error: error });
- }
- else {
- _this.errorDic[groupName] = error;
- }
- _this.next();
- }
- else {
- _this.retryTimesDic[r.name] = times + 1;
- _this.failedList.push(r);
- _this.next();
- return;
- }
- });
- };
- var this_1 = this;
- while (this.loadingCount < this.thread) {
- var state_1 = _loop_1();
- if (state_1 === "break")
- break;
- }
- };
- /**
- * 从优先级队列中移除指定的组名
- */
- ResourceLoader.prototype.removeGroupName = function (groupName) {
- for (var p in this.priorityQueue) {
- var queue_1 = this.priorityQueue[p];
- var index = 0;
- var found = false;
- var length_1 = queue_1.length;
- for (var i = 0; i < length_1; i++) {
- var name_1 = queue_1[i];
- if (name_1 == groupName) {
- queue_1.splice(index, 1);
- found = true;
- break;
- }
- index++;
- }
- if (found) {
- if (queue_1.length == 0) {
- delete this.priorityQueue[p];
- }
- break;
- }
- }
- };
- /**
- * 获取下一个待加载项
- */
- ResourceLoader.prototype.getOneResourceInfo = function () {
- if (this.failedList.length > 0)
- return this.failedList.shift();
- var maxPriority = Number.NEGATIVE_INFINITY;
- for (var p in this.priorityQueue) {
- maxPriority = Math.max(maxPriority, p);
- }
- var queue = this.priorityQueue[maxPriority];
- if (!queue || queue.length == 0) {
- return undefined;
- }
- var length = queue.length;
- var list = [];
- for (var i = 0; i < length; i++) {
- if (this.queueIndex >= length)
- this.queueIndex = 0;
- list = this.itemListDic[queue[this.queueIndex]];
- if (list.length > 0)
- break;
- this.queueIndex++;
- }
- if (list.length == 0)
- return undefined;
- return list.shift();
- };
- ResourceLoader.prototype.loadResource = function (r, p) {
- if (!p) {
- if (RES.FEATURE_FLAG.FIX_DUPLICATE_LOAD == 1) {
- var s = RES.host.state[r.root + r.name];
- if (s == 2) {
- return Promise.resolve(RES.host.get(r));
- }
- if (s == 1) {
- return r.promise;
- }
- }
- p = RES.processor.isSupport(r);
- }
- if (!p) {
- throw new RES.ResourceManagerError(2001, r.name, r.type);
- }
- RES.host.state[r.root + r.name] = 1;
- var promise = p.onLoadStart(RES.host, r);
- r.promise = promise;
- return promise;
- };
- ResourceLoader.prototype.unloadResource = function (r) {
- var data = RES.host.get(r);
- if (!data) {
- console.warn("尝试释放不存在的资源:", r.name);
- return Promise.resolve();
- }
- var p = RES.processor.isSupport(r);
- if (p) {
- RES.host.state[r.root + r.name] = 3;
- var promise = p.onRemoveStart(RES.host, r);
- RES.host.remove(r);
- return promise;
- }
- else {
- return Promise.resolve();
- }
- };
- return ResourceLoader;
- }());
- RES.ResourceLoader = ResourceLoader;
- __reflect(ResourceLoader.prototype, "RES.ResourceLoader");
-})(RES || (RES = {}));
-var RES;
-(function (RES) {
- var __tempCache = {};
- /**
- * 整个资源加载系统的进程id,协助管理回调派发机制
- */
- RES.systemPid = 0;
- RES.checkCancelation = function (target, propertyKey, descriptor) {
- var method = descriptor.value;
- descriptor.value = function () {
- var arg = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- arg[_i] = arguments[_i];
- }
- var currentPid = RES.systemPid;
- var result = method.apply(this, arg);
- return result.then(function (value) {
- if (RES.systemPid != currentPid) {
- throw new ResourceManagerError(1005, arg[0]);
- }
- else {
- return value;
- }
- });
- };
- };
- function profile() {
- RES.fileSystem.profile();
- console.log(__tempCache);
- //todo
- var totalImageSize = 0;
- for (var key in __tempCache) {
- var img = __tempCache[key];
- if (img instanceof egret.Texture) {
- totalImageSize += img.$bitmapWidth * img.$bitmapHeight * 4;
- }
- }
- console.log("gpu size : " + (totalImageSize / 1024).toFixed(3) + "kb");
- }
- RES.profile = profile;
- RES.host = {
- state: {},
- get resourceConfig() {
- return RES.config;
- },
- load: function (r, processorName) {
- var processor = typeof processorName == 'string' ? RES.processor._map[processorName] : processorName;
- return RES.queue.loadResource(r, processor);
- },
- unload: function (r) { return RES.queue.unloadResource(r); },
- save: function (resource, data) {
- RES.host.state[resource.root + resource.name] = 2;
- resource.promise = undefined;
- __tempCache[resource.url] = data;
- },
- get: function (resource) {
- return __tempCache[resource.url];
- },
- remove: function (resource) {
- RES.host.state[resource.root + resource.name] = 0;
- delete __tempCache[resource.url];
- }
- };
- RES.config = new RES.ResourceConfig();
- RES.queue = new RES.ResourceLoader();
- var ResourceManagerError = (function (_super) {
- __extends(ResourceManagerError, _super);
- function ResourceManagerError(code, replacer, replacer2) {
- var _this = _super.call(this) || this;
- /**
- * why instanceof e != ResourceManagerError ???
- * see link : https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
- */
- _this.__resource_manager_error__ = true;
- _this.name = code.toString();
- _this.message = ResourceManagerError.errorMessage[code].replace("{0}", replacer).replace("{1}", replacer2);
- return _this;
- }
- ResourceManagerError.errorMessage = {
- 1001: '文件加载失败:{0}',
- 1002: "ResourceManager 初始化失败:配置文件加载失败",
- 1005: 'ResourceManager 已被销毁,文件加载失败:{0}',
- 2001: "{0}解析失败,不支持指定解析类型:\'{1}\',请编写自定义 Processor ,更多内容请参见 https://github.com/egret-labs/resourcemanager/blob/master/docs/README.md#processor",
- 2002: "Analyzer 相关API 在 ResourceManager 中不再支持,请编写自定义 Processor ,更多内容请参见 https://github.com/egret-labs/resourcemanager/blob/master/docs/README.md#processor",
- 2003: "{0}解析失败,错误原因:{1}",
- 2004: "无法找到文件类型:{0}",
- 2005: "资源配置文件中无法找到特定的资源组:{0}",
- 2006: "资源配置文件中无法找到特定的资源:{0}"
- };
- return ResourceManagerError;
- }(Error));
- RES.ResourceManagerError = ResourceManagerError;
- __reflect(ResourceManagerError.prototype, "RES.ResourceManagerError");
-})(RES || (RES = {}));
-var RES;
-(function (RES) {
- RES.checkNull = function (target, propertyKey, descriptor) {
- var method = descriptor.value;
- descriptor.value = function () {
- var arg = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- arg[_i] = arguments[_i];
- }
- if (!arg[0]) {
- console.warn("\u65B9\u6CD5" + propertyKey + "\u7684\u53C2\u6570\u4E0D\u80FD\u4E3Anull");
- return null;
- }
- else {
- return method.apply(this, arg);
- }
- };
- };
- /**
- * 功能开关
- * LOADING_STATE:处理重复加载
- */
- RES.FEATURE_FLAG = {
- FIX_DUPLICATE_LOAD: 1
- };
- var upgrade;
- (function (upgrade) {
- var _level = "warning";
- function setUpgradeGuideLevel(level) {
- _level = level;
- }
- upgrade.setUpgradeGuideLevel = setUpgradeGuideLevel;
- })(upgrade = RES.upgrade || (RES.upgrade = {}));
-})(RES || (RES = {}));
-var RES;
-(function (RES) {
- var processor;
- (function (processor_1) {
- function isSupport(resource) {
- return processor_1._map[resource.type];
- }
- processor_1.isSupport = isSupport;
- function map(type, processor) {
- processor_1._map[type] = processor;
- }
- processor_1.map = map;
- function promisify(loader, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var _this = this;
- return __generator(this, function (_a) {
- return [2 /*return*/, new Promise(function (reslove, reject) {
- var onSuccess = function () {
- var texture = loader['data'] ? loader['data'] : loader['response'];
- reslove(texture);
- };
- var onError = function () {
- var e = new RES.ResourceManagerError(1001, resource.url);
- reject(e);
- };
- loader.addEventListener(egret.Event.COMPLETE, onSuccess, _this);
- loader.addEventListener(egret.IOErrorEvent.IO_ERROR, onError, _this);
- })];
- });
- });
- }
- function getURL(resource) {
- if (resource.url.indexOf("://") != -1) {
- return resource.url;
- }
- var prefix = resource.root;
- var url = prefix + resource.url;
- if (RES['getRealURL']) {
- return RES['getRealURL'](url);
- }
- else {
- return url;
- }
- }
- function getRelativePath(url, file) {
- if (file.indexOf("://") != -1) {
- return file;
- }
- url = url.split("\\").join("/");
- var params = url.match(/#.*|\?.*/);
- var paramUrl = "";
- if (params) {
- paramUrl = params[0];
- }
- var index = url.lastIndexOf("/");
- if (index != -1) {
- url = url.substring(0, index + 1) + file;
- }
- else {
- url = file;
- }
- return url + paramUrl;
- }
- processor_1.getRelativePath = getRelativePath;
- // var cache: {[index:string]:egret.Texture} = {};
- processor_1.ImageProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var loader, bitmapData, texture, r, list;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- loader = new egret.ImageLoader();
- loader.load(getURL(resource));
- return [4 /*yield*/, promisify(loader, resource)];
- case 1:
- bitmapData = _a.sent();
- texture = new egret.Texture();
- texture._setBitmapData(bitmapData);
- r = host.resourceConfig.getResource(resource.name);
- if (r && r.scale9grid) {
- list = r.scale9grid.split(",");
- texture["scale9Grid"] = new egret.Rectangle(parseInt(list[0]), parseInt(list[1]), parseInt(list[2]), parseInt(list[3]));
- }
- // var config: any = resItem.data;
- // if (config && config["scale9grid"]) {
- //
- // }
- return [2 /*return*/, texture];
- }
- });
- });
- },
- onRemoveStart: function (host, resource) {
- var texture = host.get(resource);
- texture.dispose();
- return Promise.resolve();
- }
- };
- processor_1.BinaryProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var request, arraybuffer;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- request = new egret.HttpRequest();
- request.responseType = egret.HttpResponseType.ARRAY_BUFFER;
- request.open(getURL(resource), "get");
- request.send();
- return [4 /*yield*/, promisify(request, resource)];
- case 1:
- arraybuffer = _a.sent();
- return [2 /*return*/, arraybuffer];
- }
- });
- });
- },
- onRemoveStart: function (host, resource) {
- return Promise.resolve();
- }
- };
- processor_1.TextProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var request, text;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- request = new egret.HttpRequest();
- request.responseType = egret.HttpResponseType.TEXT;
- request.open(getURL(resource), "get");
- request.send();
- return [4 /*yield*/, promisify(request, resource)];
- case 1:
- text = _a.sent();
- return [2 /*return*/, text];
- }
- });
- });
- },
- onRemoveStart: function (host, resource) {
- return Promise.resolve();
- }
- };
- processor_1.JsonProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var text, data;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0: return [4 /*yield*/, host.load(resource, 'text')];
- case 1:
- text = _a.sent();
- data = JSON.parse(text);
- return [2 /*return*/, data];
- }
- });
- });
- },
- onRemoveStart: function (host, request) {
- return Promise.resolve();
- }
- };
- processor_1.XMLProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var text, data;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0: return [4 /*yield*/, host.load(resource, 'text')];
- case 1:
- text = _a.sent();
- data = egret.XML.parse(text);
- return [2 /*return*/, data];
- }
- });
- });
- },
- onRemoveStart: function (host, resource) {
- return Promise.resolve();
- }
- };
- processor_1.CommonJSProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var text, f, require, exports;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0: return [4 /*yield*/, host.load(resource, 'text')];
- case 1:
- text = _a.sent();
- f = new Function('require', 'exports', text);
- require = function () { };
- exports = {};
- try {
- f(require, exports);
- }
- catch (e) {
- throw new RES.ResourceManagerError(2003, resource.name, e.message);
- }
- return [2 /*return*/, exports];
- }
- });
- });
- },
- onRemoveStart: function (host, resource) {
- return Promise.resolve();
- }
- };
- processor_1.SheetProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var data, r, imageName, texture, frames, spriteSheet, subkey, config, texture, str, list;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0: return [4 /*yield*/, host.load(resource, "json")];
- case 1:
- data = _a.sent();
- r = host.resourceConfig.getResource(RES.nameSelector(data.file));
- if (!r) {
- imageName = getRelativePath(resource.url, data.file);
- r = { name: imageName, url: imageName, type: 'image', root: resource.root };
- }
- return [4 /*yield*/, host.load(r)];
- case 2:
- texture = _a.sent();
- frames = data.frames;
- spriteSheet = new egret.SpriteSheet(texture);
- spriteSheet["$resourceInfo"] = r;
- for (subkey in frames) {
- config = frames[subkey];
- texture = spriteSheet.createTexture(subkey, config.x, config.y, config.w, config.h, config.offX, config.offY, config.sourceW, config.sourceH);
- if (config["scale9grid"]) {
- str = config["scale9grid"];
- list = str.split(",");
- texture["scale9Grid"] = new egret.Rectangle(parseInt(list[0]), parseInt(list[1]), parseInt(list[2]), parseInt(list[3]));
- }
- }
- host.save(r, texture);
- return [2 /*return*/, spriteSheet];
- }
- });
- });
- },
- getData: function (host, resource, key, subkey) {
- var data = host.get(resource);
- if (data) {
- return data.getTexture(subkey);
- }
- else {
- return null;
- }
- },
- onRemoveStart: function (host, resource) {
- var sheet = host.get(resource);
- var r = sheet["$resourceInfo"];
- sheet.dispose();
- host.unload(r);
- return Promise.resolve();
- }
- };
- var fontGetTexturePath = function (url, fntText) {
- var file = "";
- var lines = fntText.split("\n");
- var pngLine = lines[2];
- var index = pngLine.indexOf("file=\"");
- if (index != -1) {
- pngLine = pngLine.substring(index + 6);
- index = pngLine.indexOf("\"");
- file = pngLine.substring(0, index);
- }
- url = url.split("\\").join("/");
- var index = url.lastIndexOf("/");
- if (index != -1) {
- url = url.substring(0, index + 1) + file;
- }
- else {
- url = file;
- }
- return url;
- };
- processor_1.FontProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var data, config, imageName, r, texture, font;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0: return [4 /*yield*/, host.load(resource, 'text')];
- case 1:
- data = _a.sent();
- try {
- config = JSON.parse(data);
- }
- catch (e) {
- config = data;
- }
- if (typeof config === 'string') {
- imageName = fontGetTexturePath(resource.url, config);
- }
- else {
- imageName = getRelativePath(resource.url, config.file);
- }
- r = host.resourceConfig.getResource(RES.nameSelector(imageName));
- if (!r) {
- r = { name: imageName, url: imageName, type: 'image', root: resource.root };
- }
- return [4 /*yield*/, host.load(r)];
- case 2:
- texture = _a.sent();
- font = new egret.BitmapFont(texture, config);
- font["$resourceInfo"] = r;
- // todo refactor
- host.save(r, texture);
- return [2 /*return*/, font];
- }
- });
- });
- },
- onRemoveStart: function (host, resource) {
- var font = host.get(resource);
- var r = font["$resourceInfo"];
- host.unload(r);
- return Promise.resolve();
- }
- };
- processor_1.SoundProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var sound;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- sound = new egret.Sound();
- sound.load(getURL(resource));
- return [4 /*yield*/, promisify(sound, resource)];
- case 1:
- _a.sent();
- return [2 /*return*/, sound];
- }
- });
- });
- },
- onRemoveStart: function (host, resource) {
- return Promise.resolve();
- }
- };
- processor_1.MovieClipProcessor = {
- onLoadStart: function (host, resource) {
- var mcData;
- var imageResource;
- return host.load(resource, 'json')
- .then(function (value) {
- mcData = value;
- var jsonPath = resource.name;
- var imagePath = jsonPath.substring(0, jsonPath.lastIndexOf(".")) + ".png";
- imageResource = host.resourceConfig.getResource(imagePath, true);
- if (!imageResource) {
- throw new RES.ResourceManagerError(1001, imagePath);
- }
- return host.load(imageResource);
- }).then(function (value) {
- host.save(imageResource, value);
- var mcTexture = value;
- var mcDataFactory = new egret.MovieClipDataFactory(mcData, mcTexture);
- return mcDataFactory;
- });
- },
- onRemoveStart: function (host, resource) {
- var mcFactory = host.get(resource);
- mcFactory.clearCache();
- mcFactory.$spriteSheet.dispose();
- // refactor
- var jsonPath = resource.name;
- var imagePath = jsonPath.substring(0, jsonPath.lastIndexOf(".")) + ".png";
- var imageResource = host.resourceConfig.getResource(imagePath, true);
- return host.unload(imageResource);
- }
- };
- processor_1.MergeJSONProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var data, key;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0: return [4 /*yield*/, host.load(resource, 'json')];
- case 1:
- data = _a.sent();
- for (key in data) {
- RES.config.addSubkey(key, resource.name);
- }
- return [2 /*return*/, data];
- }
- });
- });
- },
- getData: function (host, resource, key, subkey) {
- var data = host.get(resource);
- if (data) {
- return data[subkey];
- }
- else {
- console.error("missing resource :" + resource.name);
- return null;
- }
- },
- onRemoveStart: function (host, resource) {
- return Promise.resolve();
- }
- };
- processor_1.ResourceConfigProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var data, fileSystem;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0: return [4 /*yield*/, host.load(resource, 'commonjs')];
- case 1:
- data = _a.sent();
- fileSystem = new RES.NewFileSystem(data.resources);
- data.fileSystem = fileSystem;
- delete data.resource;
- RES.resourceTypeSelector = data.typeSelector;
- RES.resourceNameSelector = data.nameSelector ? data.nameSelector : function (p) { return p; };
- return [2 /*return*/, data];
- }
- });
- });
- },
- onRemoveStart: function () {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- return [2 /*return*/];
- });
- });
- }
- };
- processor_1.LegacyResourceConfigProcessor = {
- onLoadStart: function (host, resource) {
- return host.load(resource, 'json').then(function (data) {
- var resConfigData = RES.config.config;
- var root = resource.root;
- var fileSystem = resConfigData.fileSystem;
- if (!fileSystem) {
- fileSystem = {
- fsData: {},
- getFile: function (filename) {
- return fsData[filename];
- },
- addFile: function (filename, type, root) {
- if (!type)
- type = "";
- if (root == undefined) {
- root = "";
- }
- fsData[filename] = { name: filename, type: type, url: filename, root: root };
- },
- profile: function () {
- console.log(fsData);
- }
- };
- resConfigData.fileSystem = fileSystem;
- }
- var groups = resConfigData.groups;
- for (var _i = 0, _a = data.groups; _i < _a.length; _i++) {
- var g = _a[_i];
- groups[g.name] = g.keys.split(",");
- }
- var alias = resConfigData.alias;
- var fsData = fileSystem['fsData'];
- var _loop_2 = function (resource_1) {
- fsData[resource_1.name] = resource_1;
- fsData[resource_1.name].root = root;
- if (resource_1.subkeys) {
- resource_1.subkeys.split(",").forEach(function (subkey) {
- alias[subkey] = resource_1.name + "#" + subkey;
- alias[resource_1.name + "." + subkey] = resource_1.name + "#" + subkey;
- });
- // ResourceConfig.
- }
- };
- for (var _b = 0, _c = data.resources; _b < _c.length; _b++) {
- var resource_1 = _c[_b];
- _loop_2(resource_1);
- }
- return resConfigData;
- });
- },
- onRemoveStart: function () {
- return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
- return [2 /*return*/];
- }); });
- }
- };
- var PVRParser = (function () {
- function PVRParser() {
- }
- PVRParser.parse = function (arrayBuffer, callback, errorCallback) {
- // the header length of int32
- var headerIntLength = 13;
- // get header part of arrayBuffer
- var header = new Uint32Array(arrayBuffer, 0, headerIntLength);
- // separate buffer and header
- var pvrDatas = {
- buffer: arrayBuffer,
- header: header
- };
- // PVR v3
- if (header[0] === 0x03525650) {
- PVRParser._parseV3(pvrDatas, callback, errorCallback);
- }
- else if (header[11] === 0x21525650) {
- PVRParser._parseV2(pvrDatas, callback, errorCallback);
- }
- else {
- errorCallback(pvrDatas, "pvr parse error!");
- }
- };
- PVRParser._parseV2 = function (pvrDatas, callback, errorCallback) {
- var header = pvrDatas.header;
- var headerLength = header[0], height = header[1], width = header[2], numMipmaps = header[3], flags = header[4], dataLength = header[5], bpp = header[6], bitmaskRed = header[7], bitmaskGreen = header[8], bitmaskBlue = header[9], bitmaskAlpha = header[10], pvrTag = header[11], numSurfs = header[12];
- var TYPE_MASK = 0xff;
- var PVRTC_2 = 24, PVRTC_4 = 25;
- var formatFlags = flags & TYPE_MASK;
- var bpp, format;
- var _hasAlpha = bitmaskAlpha > 0;
- if (formatFlags === PVRTC_4) {
- format = _hasAlpha ? PVRParser.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG : PVRParser.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
- bpp = 4;
- }
- else if (formatFlags === PVRTC_2) {
- format = _hasAlpha ? PVRParser.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG : PVRParser.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
- bpp = 2;
- }
- else {
- errorCallback(pvrDatas, "pvr v2 parse error");
- console.log("unknow format flags::" + formatFlags);
- }
- var dataOffset = headerLength;
- pvrDatas.pvrtcData = new Uint8Array(pvrDatas.buffer, dataOffset);
- pvrDatas.bpp = bpp;
- pvrDatas.format = format;
- pvrDatas.width = width;
- pvrDatas.height = height;
- pvrDatas.surfacesCount = numSurfs;
- pvrDatas.mipmapsCount = numMipmaps + 1;
- // guess cubemap type seems tricky in v2
- // it juste a pvr containing 6 surface (no explicit cubemap type)
- pvrDatas.isCubemap = (pvrDatas.surfacesCount === 6);
- callback(pvrDatas);
- };
- PVRParser._parseV3 = function (pvrDatas, callback, errorCallback) {
- var header = pvrDatas.header;
- var bpp, format;
- var pixelFormat = header[2];
- switch (pixelFormat) {
- case 0:// PVRTC 2bpp RGB
- bpp = 2;
- format = PVRParser.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
- break;
- case 1:// PVRTC 2bpp RGBA
- bpp = 2;
- format = PVRParser.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
- break;
- case 2:// PVRTC 4bpp RGB
- bpp = 4;
- format = PVRParser.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
- break;
- case 3:// PVRTC 4bpp RGBA
- bpp = 4;
- format = PVRParser.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
- break;
- default:
- errorCallback(pvrDatas, "pvr v3 parse error");
- console.log("unknow pixel format::" + pixelFormat);
- }
- var dataOffset = 52 + header[12];
- pvrDatas.pvrtcData = new Uint8Array(pvrDatas.buffer, dataOffset);
- pvrDatas.bpp = bpp;
- pvrDatas.format = format;
- pvrDatas.width = header[7];
- pvrDatas.height = header[6];
- pvrDatas.surfacesCount = header[10];
- pvrDatas.mipmapsCount = header[11];
- pvrDatas.isCubemap = (pvrDatas.surfacesCount === 6);
- callback(pvrDatas);
- };
- PVRParser.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
- PVRParser.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01;
- PVRParser.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
- PVRParser.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;
- return PVRParser;
- }());
- __reflect(PVRParser.prototype, "PVRParser");
- if (typeof egret != 'undefined' && egret && egret["web"] && egret["web"].WebGLRenderContext) {
- // Calcualates the size of a compressed texture level in bytes
- function textureLevelSize(format, width, height) {
- switch (format) {
- case PVRParser.COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
- case PVRParser.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
- return Math.floor((Math.max(width, 8) * Math.max(height, 8) * 4 + 7) / 8);
- case PVRParser.COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
- case PVRParser.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
- return Math.floor((Math.max(width, 16) * Math.max(height, 8) * 2 + 7) / 8);
- default:
- return 0;
- }
- }
- egret["web"].WebGLRenderContext.prototype.createTextureFromCompressedData = function (data, width, height, levels, internalFormat) {
- var gl = this.context;
- if (!this.pvrtcExt) {
- this.pvrtcExt = gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");
- }
- var texture = gl.createTexture();
- gl.bindTexture(gl.TEXTURE_2D, texture);
- var offset = 0;
- // Loop through each mip level of compressed texture data provided and upload it to the given texture.
- for (var i = 0; i < levels; ++i) {
- // Determine how big this level of compressed texture data is in bytes.
- var levelSize = textureLevelSize(internalFormat, width, height);
- // Get a view of the bytes for this level of DXT data.
- var dxtLevel = new Uint8Array(data.buffer, data.byteOffset + offset, levelSize);
- // Upload!
- gl.compressedTexImage2D(gl.TEXTURE_2D, i, internalFormat, width, height, 0, dxtLevel);
- // The next mip level will be half the height and width of this one.
- width = width >> 1;
- if (width < 1)
- width = 1;
- height = height >> 1;
- if (height < 1)
- height = 1;
- // Advance the offset into the compressed texture data past the current mip level's data.
- offset += levelSize;
- }
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
- return texture;
- };
- }
- processor_1.PVRProcessor = {
- onLoadStart: function (host, resource) {
- return __awaiter(this, void 0, void 0, function () {
- var arraybuffer, width, height, borderWidth, borderHeight, byteArray, list, pvrDataBuffer, i, buffer, dataLength, self, texture;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0: return [4 /*yield*/, host.load(resource, 'bin')];
- case 1:
- arraybuffer = _a.sent();
- width = 512;
- height = 512;
- borderWidth = 0;
- borderHeight = 0;
- byteArray = new egret.ByteArray(arraybuffer);
- byteArray.position = 7;
- list = ["body", "ext"];
- for (i = 0; i < list.length; i++) {
- buffer = void 0;
- switch (list[i]) {
- case "body":
- byteArray.position += 2;
- dataLength = byteArray.readUnsignedInt();
- pvrDataBuffer = byteArray.buffer.slice(byteArray.position, byteArray.position + dataLength);
- byteArray.position += dataLength;
- break;
- case "ext":
- byteArray.position += 6;
- width = byteArray.readUnsignedShort();
- height = byteArray.readUnsignedShort();
- borderWidth = byteArray.readUnsignedShort();
- borderHeight = byteArray.readUnsignedShort();
- break;
- }
- }
- self = this;
- PVRParser.parse(pvrDataBuffer, function (pvrData) {
- var bitmapData = new egret.BitmapData(pvrData);
- bitmapData.format = "pvr";
- texture = new egret.Texture();
- texture._setBitmapData(bitmapData);
- texture.$initData(borderWidth, borderHeight, width, height, 0, 0, width, height, bitmapData.width, bitmapData.height);
- }, function () {
- console.log("pvr error");
- });
- return [2 /*return*/, texture];
- }
- });
- });
- },
- onRemoveStart: function (host, resource) {
- return Promise.resolve();
- }
- };
- processor_1._map = {
- "image": processor_1.ImageProcessor,
- "json": processor_1.JsonProcessor,
- "text": processor_1.TextProcessor,
- "xml": processor_1.XMLProcessor,
- "sheet": processor_1.SheetProcessor,
- "font": processor_1.FontProcessor,
- "bin": processor_1.BinaryProcessor,
- "commonjs": processor_1.CommonJSProcessor,
- "sound": processor_1.SoundProcessor,
- "movieclip": processor_1.MovieClipProcessor,
- "pvr": processor_1.PVRProcessor,
- "mergeJson": processor_1.MergeJSONProcessor,
- "resourceConfig": processor_1.ResourceConfigProcessor,
- "legacyResourceConfig": processor_1.LegacyResourceConfigProcessor,
- };
- })(processor = RES.processor || (RES.processor = {}));
-})(RES || (RES = {}));
-var RES;
-(function (RES) {
- var NewFileSystem = (function () {
- function NewFileSystem(data) {
- this.data = data;
- }
- NewFileSystem.prototype.profile = function () {
- console.log(this.data);
- };
- NewFileSystem.prototype.addFile = function (filename, type) {
- if (!type)
- type = "";
- filename = RES.path.normalize(filename);
- var basefilename = RES.path.basename(filename);
- var folder = RES.path.dirname(filename);
- if (!this.exists(folder)) {
- this.mkdir(folder);
- }
- var d = this.reslove(folder);
- d[basefilename] = { url: filename, type: type };
- };
- NewFileSystem.prototype.getFile = function (filename) {
- var result = this.reslove(filename);
- if (result) {
- result.name = filename;
- }
- return result;
- };
- NewFileSystem.prototype.reslove = function (dirpath) {
- if (dirpath == "") {
- return this.data;
- }
- dirpath = RES.path.normalize(dirpath);
- var list = dirpath.split("/");
- var current = this.data;
- for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
- var f = list_1[_i];
- if (current) {
- current = current[f];
- }
- else {
- return current;
- }
- }
- return current;
- };
- NewFileSystem.prototype.mkdir = function (dirpath) {
- dirpath = RES.path.normalize(dirpath);
- var list = dirpath.split("/");
- var current = this.data;
- for (var _i = 0, list_2 = list; _i < list_2.length; _i++) {
- var f = list_2[_i];
- if (!current[f]) {
- current[f] = {};
- }
- current = current[f];
- }
- };
- NewFileSystem.prototype.exists = function (dirpath) {
- if (dirpath == "")
- return true;
- dirpath = RES.path.normalize(dirpath);
- var list = dirpath.split("/");
- var current = this.data;
- for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
- var f = list_3[_i];
- if (!current[f]) {
- return false;
- }
- current = current[f];
- }
- return true;
- };
- return NewFileSystem;
- }());
- RES.NewFileSystem = NewFileSystem;
- __reflect(NewFileSystem.prototype, "RES.NewFileSystem");
-})(RES || (RES = {}));
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2014-present, Egret Technology.
-// All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// * Neither the name of the Egret nor the
-// names of its contributors may be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
-// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-var RES;
-(function (RES) {
- /**
- * The events of resource loading.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 资源加载事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- var ResourceEvent = (function (_super) {
- __extends(ResourceEvent, _super);
- /**
- * Creates an Event object to pass as a parameter to event listeners.
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @version Egret 2.4
- * @platform Web,Native
- * @private
- * @language en_US
- */
- /**
- * 创建一个作为参数传递给事件侦听器的 Event 对象。
- * @param type 事件的类型,可以作为 Event.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @private
- * @language zh_CN
- */
- function ResourceEvent(type, bubbles, cancelable) {
- if (bubbles === void 0) { bubbles = false; }
- if (cancelable === void 0) { cancelable = false; }
- var _this = _super.call(this, type, bubbles, cancelable) || this;
- /**
- * File number that has been loaded.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 已经加载的文件数。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- _this.itemsLoaded = 0;
- /**
- * Total file number to load.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 要加载的总文件数。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- _this.itemsTotal = 0;
- /**
- * Resource group name.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 资源组名。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- _this.groupName = "";
- return _this;
- }
- /**
- * 使用指定的EventDispatcher对象来抛出事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
- * @method RES.ResourceEvent.dispatchResourceEvent
- * @param target {egret.IEventDispatcher}
- * @param type {string}
- * @param groupName {string}
- * @param resItem {egret.ResourceItem}
- * @param itemsLoaded {number}
- * @param itemsTotal {number}
- * @internal
- * @private
- */
- ResourceEvent.dispatchResourceEvent = function (target, type, groupName, resItem, itemsLoaded, itemsTotal) {
- if (groupName === void 0) { groupName = ""; }
- if (resItem === void 0) { resItem = undefined; }
- if (itemsLoaded === void 0) { itemsLoaded = 0; }
- if (itemsTotal === void 0) { itemsTotal = 0; }
- var event = egret.Event.create(ResourceEvent, type);
- event.groupName = groupName;
- if (resItem) {
- event.resItem = RES.ResourceItem.convertToResItem(resItem);
- }
- event.itemsLoaded = itemsLoaded;
- event.itemsTotal = itemsTotal;
- var result = target.dispatchEvent(event);
- egret.Event.release(event);
- return result;
- };
- /**
- * Failure event for a load item.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 一个加载项加载失败事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceEvent.ITEM_LOAD_ERROR = "itemLoadError";
- /**
- * Configure file to load and parse the completion event. Note: if a configuration file is loaded, it will not be thrown out, and if you want to handle the configuration loading failure, monitor the CONFIG_LOAD_ERROR event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 配置文件加载并解析完成事件。注意:若有配置文件加载失败,将不会抛出此事件,若要处理配置加载失败,请同时监听 CONFIG_LOAD_ERROR 事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceEvent.CONFIG_COMPLETE = "configComplete";
- /**
- * Configuration file failed to load.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 配置文件加载失败事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceEvent.CONFIG_LOAD_ERROR = "configLoadError";
- /**
- * Delay load group resource loading progress event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 延迟加载组资源加载进度事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceEvent.GROUP_PROGRESS = "groupProgress";
- /**
- * Delay load group resource to complete event. Note: if you have a resource item loading failure, the event will not be thrown, if you want to handle the group load failure, please listen to the GROUP_LOAD_ERROR event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 延迟加载组资源加载完成事件。注意:若组内有资源项加载失败,将不会抛出此事件,若要处理组加载失败,请同时监听 GROUP_LOAD_ERROR 事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceEvent.GROUP_COMPLETE = "groupComplete";
- /**
- * Delayed load group resource failed event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 延迟加载组资源加载失败事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceEvent.GROUP_LOAD_ERROR = "groupLoadError";
- return ResourceEvent;
- }(egret.Event));
- RES.ResourceEvent = ResourceEvent;
- __reflect(ResourceEvent.prototype, "RES.ResourceEvent");
-})(RES || (RES = {}));
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2014-present, Egret Technology.
-// All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// * Neither the name of the Egret nor the
-// names of its contributors may be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
-// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-var RES;
-(function (RES) {
- /**
- * Resource term. One of the resources arrays in resource.json.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 资源项。对应 resource.json 中 resources 数组中的一项。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- var ResourceItem;
- (function (ResourceItem) {
- /**
- * XML file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * XML 文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceItem.TYPE_XML = "xml";
- /**
- * Picture file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 图片文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceItem.TYPE_IMAGE = "image";
- /**
- * Binary file.
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 二进制文件。
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- ResourceItem.TYPE_BIN = "bin";
- /**
- * Text file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文本文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceItem.TYPE_TEXT = "text";
- /**
- * JSON file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * JSON 文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceItem.TYPE_JSON = "json";
- /**
- * SpriteSheet file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * SpriteSheet 文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceItem.TYPE_SHEET = "sheet";
- /**
- * BitmapTextSpriteSheet file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * BitmapTextSpriteSheet 文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceItem.TYPE_FONT = "font";
- /**
- * Sound file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 声音文件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ResourceItem.TYPE_SOUND = "sound";
- function convertToResItem(r) {
- var name = r.name;
- if (!RES.config.config) {
- name = r.url;
- }
- else {
- for (var aliasName in RES.config.config.alias) {
- if (RES.config.config.alias[aliasName] == r.url) {
- name = aliasName;
- }
- }
- }
- var result = {
- name: name,
- url: r.url,
- type: r.type,
- data: r,
- root: r.root
- };
- return result;
- }
- ResourceItem.convertToResItem = convertToResItem;
- })(ResourceItem = RES.ResourceItem || (RES.ResourceItem = {}));
-})(RES || (RES = {}));
-var RES;
-(function (RES) {
- var path;
- (function (path_1) {
- path_1.normalize = function (filename) {
- var arr = filename.split("/");
- return arr.filter(function (value, index) { return !!value || index == arr.length - 1; }).join("/");
- };
- path_1.basename = function (filename) {
- return filename.substr(filename.lastIndexOf("/") + 1);
- };
- path_1.dirname = function (path) {
- return path.substr(0, path.lastIndexOf("/"));
- };
- })(path = RES.path || (RES.path = {}));
-})(RES || (RES = {}));
-var RES;
-(function (RES) {
- var versionInfo;
- /**
- * @internal
- */
- function native_init() {
- if (egret.Capabilities.runtimeType == egret.RuntimeType.NATIVE) {
- versionInfo = getLocalData("all.manifest");
- }
- }
- RES.native_init = native_init;
- /**
- * @internal
- */
- function getRealURL(url) {
- if (versionInfo && versionInfo[url]) {
- return "resource/" + versionInfo[url].v.substring(0, 2) + "/" + versionInfo[url].v + "_" + versionInfo[url].s + "." + url.substring(url.lastIndexOf(".") + 1);
- }
- else {
- return url;
- }
- }
- RES.getRealURL = getRealURL;
- function getLocalData(filePath) {
- if (egret_native.readUpdateFileSync && egret_native.readResourceFileSync) {
- //先取更新目录
- var content = egret_native.readUpdateFileSync(filePath);
- if (content != null) {
- return JSON.parse(content);
- }
- //再取资源目录
- content = egret_native.readResourceFileSync(filePath);
- if (content != null) {
- return JSON.parse(content);
- }
- }
- return null;
- }
-})(RES || (RES = {}));
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2014-present, Egret Technology.
-// All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// * Neither the name of the Egret nor the
-// names of its contributors may be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
-// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-var RES;
-(function (RES) {
- RES.nameSelector = function (url) {
- return RES.path.basename(url).split(".").join("_");
- };
- /**
- * Conduct mapping injection with class definition as the value.
- * @param type Injection type.
- * @param analyzerClass Injection type classes need to be resolved.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample extension/resource/Resource.ts
- * @language en_US
- */
- /**
- * 以类定义为值进行映射注入。
- * @param type 注入的类型。
- * @param analyzerClass 注入类型需要解析的类。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample extension/resource/Resource.ts
- * @language zh_CN
- */
- function registerAnalyzer(type, analyzerClass) {
- throw new RES.ResourceManagerError(2002);
- }
- RES.registerAnalyzer = registerAnalyzer;
- /**
- * Load configuration file and parse.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 加载配置文件并解析。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function loadConfig(url, resourceRoot) {
- if (resourceRoot.indexOf('://') >= 0) {
- var temp = resourceRoot.split('://');
- resourceRoot = temp[0] + '://' + RES.path.normalize(temp[1] + '/');
- }
- else {
- resourceRoot = RES.path.normalize(resourceRoot + "/");
- url = url.replace(resourceRoot, '');
- }
- RES.setConfigURL(url, resourceRoot);
- if (!instance)
- instance = new Resource();
- return instance.loadConfig();
- }
- RES.loadConfig = loadConfig;
- /**
- * Load a set of resources according to the group name.
- * @param name Group name to load the resource group.
- * @param priority Load priority can be negative, the default value is 0.
- *
A low priority group must wait for the high priority group to complete the end of the load to start, and the same priority group will be loaded at the same time.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 根据组名加载一组资源。
- * @param name 要加载资源组的组名。
- * @param priority 加载优先级,可以为负数,默认值为 0。
- *
低优先级的组必须等待高优先级组完全加载结束才能开始,同一优先级的组会同时加载。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function loadGroup(name, priority, reporter) {
- if (priority === void 0) { priority = 0; }
- return instance.loadGroup(name, priority, reporter);
- }
- RES.loadGroup = loadGroup;
- /**
- * Check whether a resource group has been loaded.
- * @param name Group name。
- * @returns Is loading or not.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 检查某个资源组是否已经加载完成。
- * @param name 组名。
- * @returns 是否正在加载。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function isGroupLoaded(name) {
- return instance.isGroupLoaded(name);
- }
- RES.isGroupLoaded = isGroupLoaded;
- /**
- * A list of groups of loading is obtained according to the group name.
- * @param name Group name.
- * @returns The resource item array of group.
- * @see RES.ResourceItem
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 根据组名获取组加载项列表。
- * @param name 组名。
- * @returns 加载项列表。
- * @see RES.ResourceItem
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function getGroupByName(name) {
- return instance.getGroupByName(name).map(function (r) { return RES.ResourceItem.convertToResItem(r); });
- }
- RES.getGroupByName = getGroupByName;
- /**
- * Create a custom load resource group, note that this method is valid only after the resource configuration file is loaded.
- *
You can monitor the ResourceEvent.CONFIG_COMPLETE event to verify that the configuration is complete.
- * @param name Group name to create the load resource group.
- * @param keys To be included in the list of key keys, the corresponding configuration file in the name or sbuKeys property one or a resource group name.
- * @param override Is the default false for the same name resource group already exists.
- * @returns Create success or fail.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
- *
可以监听 ResourceEvent.CONFIG_COMPLETE 事件来确认配置加载完成。
- * @param name 要创建的加载资源组的组名。
- * @param keys 要包含的键名列表,key 对应配置文件里的 name 属性或 sbuKeys 属性的一项或一个资源组名。
- * @param override 是否覆盖已经存在的同名资源组,默认 false。
- * @returns 是否创建成功。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function createGroup(name, keys, override) {
- if (override === void 0) { override = false; }
- return instance.createGroup(name, keys, override);
- }
- RES.createGroup = createGroup;
- /**
- * Check whether the configuration file contains the specified resources.
- * @param key A sbuKeys attribute or name property in a configuration file.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 检查配置文件里是否含有指定的资源。
- * @param key 对应配置文件里的 name 属性或 sbuKeys 属性的一项。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function hasRes(key) {
- return instance.hasRes(key);
- }
- RES.hasRes = hasRes;
- /**
- * The synchronization method for obtaining the cache has been loaded with the success of the resource.
- *
The type of resource and the corresponding return value types are as follows:
- *
RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript primary object
- *
RES.ResourceItem.TYPE_IMAGE : img Html Object,or egret.BitmapData interface。
- *
RES.ResourceItem.TYPE_JSON : Object
- *
RES.ResourceItem.TYPE_SHEET : Object
- *
1. If the incoming parameter is the name of the entire SpriteSheet is returned is {image1: Texture, "image2": Texture}.
- *
2. If the incoming is "sheet.image1", the return is a single resource.
- *
3. If the incoming is the name of the "image1" single resource, the return is a single resource.
- * But if there are two SpriteSheet in a single picture of the same name, the return of the image after the load.
- *
RES.ResourceItem.TYPE_SOUND : HtmlSound Html Object
- *
RES.ResourceItem.TYPE_TEXT : string
- * @param key A subKeys attribute or name property in a configuration file.
- * @see RES.ResourceItem
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 同步方式获取缓存的已经加载成功的资源。
- *
资源类型和对应的返回值类型关系如下:
- *
RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript 原生对象
- *
RES.ResourceItem.TYPE_IMAGE : img Html 对象,或者 egret.BitmapData 接口。
- *
RES.ResourceItem.TYPE_JSON : Object
- *
RES.ResourceItem.TYPE_SHEET : Object
- *
1. 如果传入的参数是整个 SpriteSheet 的名称返回的是 {"image1":Texture,"image2":Texture} 这样的格式。
- *
2. 如果传入的是 "sheet.image1",返回的是单个资源。
- *
3. 如果传入的是 "image1" 单个资源的名称,返回的是单个资源。但是如果有两张 SpriteSheet 中有单个图片资源名称相同,返回的是后加载的那个图片资源。
- *
RES.ResourceItem.TYPE_SOUND : HtmlSound Html 对象
- *
RES.ResourceItem.TYPE_TEXT : string
- * @param key 对应配置文件里的 name 属性或 subKeys 属性的一项。
- * @see RES.ResourceItem
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function getRes(key) {
- return instance.getRes(key);
- }
- RES.getRes = getRes;
- function getResAsync(key, compFunc, thisObject) {
- return instance.getResAsync.apply(instance, arguments);
- }
- RES.getResAsync = getResAsync;
- /**
- * Access to external resources through the full URL.
- * @param url The external path to load the file.
- * @param compFunc Call back function. Example:compFunc(data,url):void。
- * @param thisObject This pointer of call back function.
- * @param type File type (optional). Use the static constants defined in the ResourceItem class. If you do not set the file name extension.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample extension/resource/GetResByUrl.ts
- * @language en_US
- */
- /**
- * 通过完整URL方式获取外部资源。
- * @param url 要加载文件的外部路径。
- * @param compFunc 回调函数。示例:compFunc(data,url):void。
- * @param thisObject 回调函数的 this 引用。
- * @param type 文件类型(可选)。请使用 ResourceItem 类中定义的静态常量。若不设置将根据文件扩展名生成。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample extension/resource/GetResByUrl.ts
- * @language zh_CN
- */
- function getResByUrl(url, compFunc, thisObject, type) {
- if (type === void 0) { type = ""; }
- instance.getResByUrl(url, compFunc, thisObject, type);
- }
- RES.getResByUrl = getResByUrl;
- /**
- * Destroy a single resource file or a set of resources to the cache data, to return whether to delete success.
- * @param name Name attribute or resource group name of the load item in the configuration file.
- * @param force Destruction of a resource group when the other resources groups have the same resource situation whether the resources will be deleted, the default value true.
- * @returns Are successful destruction.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 销毁单个资源文件或一组资源的缓存数据,返回是否删除成功。
- * @param name 配置文件中加载项的name属性或资源组名。
- * @param force 销毁一个资源组时其他资源组有同样资源情况资源是否会被删除,默认值 true。
- * @see #setMaxRetryTimes
- * @returns 是否销毁成功。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function destroyRes(name, force) {
- return instance.destroyRes(name, force);
- }
- RES.destroyRes = destroyRes;
- /**
- * Sets the maximum number of concurrent load threads, the default value is 2.
- * @param thread The number of concurrent loads to be set.
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 设置最大并发加载线程数量,默认值是 2。
- * @param thread 要设置的并发加载数。
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function setMaxLoadingThread(thread) {
- if (!instance)
- instance = new Resource();
- instance.setMaxLoadingThread(thread);
- }
- RES.setMaxLoadingThread = setMaxLoadingThread;
- /**
- * Sets the number of retry times when the resource failed to load, and the default value is 3.
- * @param retry To set the retry count.
- * @includeExample extension/resource/Resource.ts
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 设置资源加载失败时的重试次数,默认值是 3。
- * @param retry 要设置的重试次数。
- * @includeExample extension/resource/Resource.ts
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function setMaxRetryTimes(retry) {
- instance.setMaxRetryTimes(retry);
- }
- RES.setMaxRetryTimes = setMaxRetryTimes;
- /**
- * Add event listeners, reference ResourceEvent defined constants.
- * @param type Event name。
- * @param listener Listener functions for handling events. This function must accept the Event object as its only parameter, and can't return any results,
- * As shown in the following example: function (evt:Event):void can have any name.
- * @param thisObject The this object that is bound to a function.
- * @param useCapture Determine the listener is running on the capture or running on the target and the bubbling phase. Set useCapture to true,
- * then the listener in the capture phase processing events, but not in the target or the bubbling phase processing events.
- * If useCapture is false, then the listener only in the target or the bubbling phase processing events.
- * To listen for events in all three stages, please call addEventListener two times: once the useCapture is set to true, once the useCapture is set to false.
- * @param priority Event listener priority. Priority is specified by a 32 - bit integer with a symbol. The higher the number, the higher the priority.
- * All listeners with a priority for n will be processed before the -1 n listener.
- * If two or more listeners share the same priority, they are processed in accordance with the order of their added. The default priority is 0.
- * @see RES.ResourceEvent
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 添加事件侦听器,参考 ResourceEvent 定义的常量。
- * @param type 事件的类型。
- * @param listener 处理事件的侦听器函数。此函数必须接受 Event 对象作为其唯一的参数,并且不能返回任何结果,
- * 如下面的示例所示: function(evt:Event):void 函数可以有任何名称。
- * @param thisObject 侦听函数绑定的 this 对象。
- * @param useCapture 确定侦听器是运行于捕获阶段还是运行于目标和冒泡阶段。如果将 useCapture 设置为 true,
- * 则侦听器只在捕获阶段处理事件,而不在目标或冒泡阶段处理事件。如果 useCapture 为 false,则侦听器只在目标或冒泡阶段处理事件。
- * 要在所有三个阶段都侦听事件,请调用 addEventListener 两次:一次将 useCapture 设置为 true,一次将 useCapture 设置为 false。
- * @param priority 事件侦听器的优先级。优先级由一个带符号的 32 位整数指定。数字越大,优先级越高。优先级为 n 的所有侦听器会在
- * 优先级为 n -1 的侦听器之前得到处理。如果两个或更多个侦听器共享相同的优先级,则按照它们的添加顺序进行处理。默认优先级为 0。
- * @see RES.ResourceEvent
- * @see #setMaxRetryTimes
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function addEventListener(type, listener, thisObject, useCapture, priority) {
- if (useCapture === void 0) { useCapture = false; }
- if (priority === void 0) { priority = 0; }
- if (!instance)
- instance = new Resource();
- instance.addEventListener(type, listener, thisObject, useCapture, priority);
- }
- RES.addEventListener = addEventListener;
- /**
- * Remove event listeners, reference ResourceEvent defined constants.
- * @param type Event name。
- * @param listener Listening function。
- * @param thisObject The this object that is bound to a function.
- * @param useCapture Is used to capture, and this property is only valid in the display list.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 移除事件侦听器,参考ResourceEvent定义的常量。
- * @param type 事件名。
- * @param listener 侦听函数。
- * @param thisObject 侦听函数绑定的this对象。
- * @param useCapture 是否使用捕获,这个属性只在显示列表中生效。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function removeEventListener(type, listener, thisObject, useCapture) {
- if (useCapture === void 0) { useCapture = false; }
- instance.removeEventListener(type, listener, thisObject, useCapture);
- }
- RES.removeEventListener = removeEventListener;
- /**
- * Adding a custom resource configuration.
- * @param data To add configuration.
- * @version Egret 3.1.6
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 自定义添加一项资源配置。
- * @param data 要添加的配置。
- * @version Egret 3.1.6
- * @platform Web,Native
- * @language zh_CN
- */
- function $addResourceData(data) {
- //这里可能需要其他配置
- instance.addResourceData(data);
- }
- RES.$addResourceData = $addResourceData;
- /**
- * @private
- */
- var Resource = (function (_super) {
- __extends(Resource, _super);
- function Resource() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * 开始加载配置
- * @method RES.loadConfig
- */
- Resource.prototype.loadConfig = function () {
- var _this = this;
- RES.native_init();
- return RES.config.init().then(function (data) {
- RES.ResourceEvent.dispatchResourceEvent(_this, RES.ResourceEvent.CONFIG_COMPLETE);
- }, function (error) {
- RES.ResourceEvent.dispatchResourceEvent(_this, RES.ResourceEvent.CONFIG_LOAD_ERROR);
- return Promise.reject(error);
- });
- };
- /**
- * 检查某个资源组是否已经加载完成
- * @method RES.isGroupLoaded
- * @param name {string}
- */
- Resource.prototype.isGroupLoaded = function (name) {
- var resources = RES.config.getGroupByName(name, true);
- return resources.every(function (r) { return RES.host.get(r) != null; });
- };
- /**
- * 根据组名获取组加载项列表
- * @method RES.getGroupByName
- * @param name {string}
- */
- Resource.prototype.getGroupByName = function (name) {
- return RES.config.getGroupByName(name, true); //这里不应该传入 true,但是为了老版本的 TypeScriptCompiler 兼容性,暂时这样做
- };
- /**
- * 根据组名加载一组资源
- * @method RES.loadGroup
- * @param name {string}
- * @param priority {number}
- */
- Resource.prototype.loadGroup = function (name, priority, reporter) {
- var _this = this;
- if (priority === void 0) { priority = 0; }
- var reporterDelegate = {
- onProgress: function (current, total) {
- if (reporter && reporter.onProgress) {
- reporter.onProgress(current, total);
- }
- RES.ResourceEvent.dispatchResourceEvent(_this, RES.ResourceEvent.GROUP_PROGRESS, name, undefined, current, total);
- }
- };
- return this._loadGroup(name, priority, reporterDelegate).then(function (data) {
- RES.ResourceEvent.dispatchResourceEvent(_this, RES.ResourceEvent.GROUP_COMPLETE, name);
- }, function (error) {
- var itemList = error.itemList;
- var length = itemList.length;
- for (var i = 0; i < length; i++) {
- var item = itemList[i];
- delete item.promise;
- RES.ResourceEvent.dispatchResourceEvent(_this, RES.ResourceEvent.ITEM_LOAD_ERROR, name, item);
- }
- RES.ResourceEvent.dispatchResourceEvent(_this, RES.ResourceEvent.GROUP_LOAD_ERROR, name);
- return Promise.reject(error.error);
- });
- };
- Resource.prototype._loadGroup = function (name, priority, reporter) {
- if (priority === void 0) { priority = 0; }
- var resources = RES.config.getGroupByName(name, true);
- return RES.queue.load(resources, name, priority, reporter);
- };
- Resource.prototype.loadResources = function (keys, reporter) {
- var resources = keys.map(function (key) {
- var r = RES.config.getResourceWithSubkey(key, true);
- return r.r;
- });
- return RES.queue.load(resources, "name", 0, reporter);
- };
- /**
- * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
- * 可以监听ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成。
- * @method RES.ResourceConfig#createGroup
- * @param name {string} 要创建的加载资源组的组名
- * @param keys {egret.Array} 要包含的键名列表,key对应配置文件里的name属性或一个资源组名。
- * @param override {boolean} 是否覆盖已经存在的同名资源组,默认false。
- * @returns {boolean}
- */
- Resource.prototype.createGroup = function (name, keys, override) {
- if (override === void 0) { override = false; }
- return RES.config.createGroup(name, keys, override);
- };
- /**
- * 检查配置文件里是否含有指定的资源
- * @method RES.hasRes
- * @param key {string} 对应配置文件里的name属性或subKeys属性的一项。
- * @returns {boolean}
- */
- Resource.prototype.hasRes = function (key) {
- return RES.config.getResourceWithSubkey(key) != null;
- };
- /**
- * 通过key同步获取资源
- * @method RES.getRes
- * @param key {string}
- * @returns {any}
- */
- Resource.prototype.getRes = function (resKey) {
- var result = RES.config.getResourceWithSubkey(resKey);
- if (result) {
- var r = result.r;
- var key = result.key;
- var subkey = result.subkey;
- var p = RES.processor.isSupport(r);
- if (p && p.getData && subkey) {
- return p.getData(RES.host, r, key, subkey);
- }
- else {
- return RES.host.get(r);
- }
- }
- else {
- return null;
- }
- };
- Resource.prototype.getResAsync = function (key, compFunc, thisObject) {
- var _this = this;
- var paramKey = key;
- var _a = RES.config.getResourceWithSubkey(key, true), r = _a.r, subkey = _a.subkey;
- return RES.queue.loadResource(r).then(function (value) {
- RES.host.save(r, value);
- var p = RES.processor.isSupport(r);
- if (p && p.getData && subkey) {
- value = p.getData(RES.host, r, key, subkey);
- }
- if (compFunc) {
- compFunc.call(thisObject, value, paramKey);
- }
- return value;
- }, function (error) {
- RES.ResourceEvent.dispatchResourceEvent(_this, RES.ResourceEvent.ITEM_LOAD_ERROR, "", r);
- return Promise.reject(error);
- });
- };
- /**
- * 通过url获取资源
- * @method RES.getResByUrl
- * @param url {string}
- * @param compFunc {Function}
- * @param thisObject {any}
- * @param type {string}
- */
- Resource.prototype.getResByUrl = function (url, compFunc, thisObject, type) {
- var _this = this;
- if (type === void 0) { type = ""; }
- var r = RES.config.getResource(url);
- if (!r) {
- if (!type) {
- type = RES.config.__temp__get__type__via__url(url);
- }
- // manager.config.addResourceData({ name: url, url: url });
- r = { name: url, url: url, type: type, root: '' };
- RES.config.addResourceData(r);
- r = RES.config.getResource(url);
- if (!r) {
- throw 'never';
- }
- }
- return RES.queue.loadResource(r).then(function (value) {
- RES.host.save(r, value);
- if (compFunc && r) {
- compFunc.call(thisObject, value, r.url);
- }
- return value;
- }, function (error) {
- RES.ResourceEvent.dispatchResourceEvent(_this, RES.ResourceEvent.ITEM_LOAD_ERROR, "", r);
- return Promise.reject(error);
- });
- };
- /**
- * 销毁单个资源文件或一组资源的缓存数据,返回是否删除成功。
- * @method RES.destroyRes
- * @param name {string} 配置文件中加载项的name属性或资源组名
- * @param force {boolean} 销毁一个资源组时其他资源组有同样资源情况资源是否会被删除,默认值true
- * @returns {boolean}
- */
- Resource.prototype.destroyRes = function (name, force) {
- if (force === void 0) { force = true; }
- return __awaiter(this, void 0, void 0, function () {
- var group, remove, _i, group_2, item, item;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- group = RES.config.getGroup(name);
- remove = function (r) {
- return RES.queue.unloadResource(r);
- };
- if (!(group && group.length > 0)) return [3 /*break*/, 5];
- _i = 0, group_2 = group;
- _a.label = 1;
- case 1:
- if (!(_i < group_2.length)) return [3 /*break*/, 4];
- item = group_2[_i];
- return [4 /*yield*/, remove(item)];
- case 2:
- _a.sent();
- _a.label = 3;
- case 3:
- _i++;
- return [3 /*break*/, 1];
- case 4: return [2 /*return*/, true];
- case 5:
- item = RES.config.getResource(name);
- if (!item) return [3 /*break*/, 7];
- return [4 /*yield*/, remove(item)];
- case 6:
- _a.sent();
- return [2 /*return*/, true];
- case 7:
- console.warn("\u65E0\u6CD5\u5220\u9664\u6307\u5B9A\u7EC4:" + name);
- return [2 /*return*/, false];
- }
- });
- });
- };
- /**
- * 设置最大并发加载线程数量,默认值是2.
- * @method RES.setMaxLoadingThread
- * @param thread {number} 要设置的并发加载数。
- */
- Resource.prototype.setMaxLoadingThread = function (thread) {
- if (thread < 1) {
- thread = 1;
- }
- RES.queue.thread = thread;
- };
- /**
- * 设置资源加载失败时的重试次数。
- * @param retry 要设置的重试次数。
- */
- Resource.prototype.setMaxRetryTimes = function (retry) {
- retry = Math.max(retry, 0);
- RES.queue.maxRetryTimes = retry;
- };
- Resource.prototype.addResourceData = function (data) {
- RES.config.addResourceData(data);
- };
- __decorate([
- RES.checkCancelation
- ], Resource.prototype, "loadConfig", null);
- __decorate([
- RES.checkCancelation
- ], Resource.prototype, "_loadGroup", null);
- __decorate([
- RES.checkNull
- ], Resource.prototype, "hasRes", null);
- __decorate([
- RES.checkNull
- ], Resource.prototype, "getRes", null);
- __decorate([
- RES.checkNull,
- RES.checkCancelation
- ], Resource.prototype, "getResAsync", null);
- __decorate([
- RES.checkNull,
- RES.checkCancelation
- ], Resource.prototype, "getResByUrl", null);
- return Resource;
- }(egret.EventDispatcher));
- RES.Resource = Resource;
- __reflect(Resource.prototype, "RES.Resource");
- /**
- * Resource单例
- */
- var instance;
-})(RES || (RES = {}));
diff --git a/helloworld/libs/modules/assetsmanager/assetsmanager.min.js b/helloworld/libs/modules/assetsmanager/assetsmanager.min.js
deleted file mode 100644
index 1633e3f..0000000
--- a/helloworld/libs/modules/assetsmanager/assetsmanager.min.js
+++ /dev/null
@@ -1 +0,0 @@
-var __reflect=this&&this.__reflect||function(e,r,t){e.__class__=r,t?t.push(r):t=[r],e.__types__=e.__types__?t.concat(e.__types__):t},__extends=this&&this.__extends||function(e,r){function t(){this.constructor=e}for(var o in r)r.hasOwnProperty(o)&&(e[o]=r[o]);t.prototype=r.prototype,e.prototype=new t},__awaiter=this&&this.__awaiter||function(e,r,t,o){return new(t||(t=Promise))(function(n,i){function a(e){try{u(o.next(e))}catch(r){i(r)}}function s(e){try{u(o["throw"](e))}catch(r){i(r)}}function u(e){e.done?n(e.value):new t(function(r){r(e.value)}).then(a,s)}u((o=o.apply(e,r||[])).next())})},__generator=this&&this.__generator||function(e,r){function t(e){return function(r){return o([e,r])}}function o(t){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,i&&(a=i[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(i,t[1])).done)return a;switch(i=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return u.label++,{value:t[1],done:!1};case 5:u.label++,i=t[1],t=[0];continue;case 7:t=u.ops.pop(),u.trys.pop();continue;default:if(a=u.trys,!(a=a.length>0&&a[a.length-1])&&(6===t[0]||2===t[0])){u=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]i?r:null===o?o=Object.getOwnPropertyDescriptor(r,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,t,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(3>i?n(a):i>3?n(r,t,a):n(r,t))||a);return i>3&&a&&Object.defineProperty(r,t,a),a},RES;!function(e){function r(r){var t=e.fileSystem.getFile(r);return t||(r=e.resourceNameSelector(r),t=e.fileSystem.getFile(r)),t}function t(e,r){var t;t=e.indexOf(".json")>=0?"legacyResourceConfig":"resourceConfig",o={type:t,root:r,url:e,name:e}}e.resourceNameSelector=function(e){return e},e.getResourceInfo=r;var o;e.setConfigURL=t;var n=function(){function t(){}return t.prototype.init=function(){var r=this;return this.config||(this.config={alias:{},groups:{},resourceRoot:o.root,typeSelector:function(){return"unknown"},mergeSelector:null,fileSystem:null}),e.queue.loadResource(o).then(function(e){return r.parseConfig(e)})["catch"](function(r){return r.__resource_manager_error__||(console.error(r.stack),r=new e.ResourceManagerError(1002)),Promise.reject(r)})},t.prototype.getGroupByName=function(r,t){var o=this.config.groups[r],n=[];if(!o){if(t)throw new e.ResourceManagerError(2005,r);return null}for(var i=0,a=o;i=0&&(n=r.substr(o+1),r=r.substr(0,o));var i=this.getResource(r);if(i)return{r:i,key:r,subkey:n};if(t){var a=n?r+"#"+n:r;throw new e.ResourceManagerError(2006,a)}return null},t.prototype.getKeyByAlias=function(e){return this.config.alias[e]?this.config.alias[e]:e},t.prototype.getResource=function(t,o){var n=this.config.alias[t];n||(n=t);var i=r(n);if(!i){if(o)throw new e.ResourceManagerError(2006,t);return null}return i},t.prototype.getGroup=function(e){return this.getGroupByName(e)},t.prototype.createGroup=function(e,r,t){if(void 0===t&&(t=!1),!t&&this.config.groups[e]||!r||0==r.length)return!1;for(var o=[],n=0,i=r;nu;u++){var c=e[u];c.groupNames||(c.groupNames=[]),c.groupNames.push(r)}this.itemListDic[r]=e,this.groupTotalDic[r]=e.length,this.numLoadedDic[r]=0,this.priorityQueue[t]?this.priorityQueue[t].push(r):this.priorityQueue[t]=[r],this.reporterDic[r]=o;var f=new egret.EventDispatcher;this.dispatcherDic[r]=f;var l=new Promise(function(e,r){f.addEventListener("complete",e,null),f.addEventListener("error",function(e){r(e.data)},null)});return this.next(),l},r.prototype.next=function(){for(var r=this,t=function(){var t=o.getOneResourceInfo();return t?(o.loadingCount++,void o.loadResource(t).then(function(o){r.loadingCount--,e.host.save(t,o);var n=t.groupNames.shift();0==t.groupNames.length&&(t.groupNames=void 0);var i=r.reporterDic[n];r.numLoadedDic[n]++;var a=r.numLoadedDic[n],s=r.groupTotalDic[n];if(i&&i.onProgress&&i.onProgress(a,s),a==s){var u=r.groupErrorDic[n];r.removeGroupName(n),delete r.groupTotalDic[n],delete r.numLoadedDic[n],delete r.itemListDic[n],delete r.groupErrorDic[n];var c=r.dispatcherDic[n];if(u){var f=r.loadItemErrorDic[n];delete r.loadItemErrorDic[n];var l=r.errorDic[n];delete r.errorDic[n],c.dispatchEventWith("error",!1,{itemList:f,error:l})}else c.dispatchEventWith("complete")}r.next()})["catch"](function(o){if(!o)throw t.name+" load fail";if(!o.__resource_manager_error__)throw o;r.loadingCount--,delete e.host.state[t.root+t.name];var n=r.retryTimesDic[t.name]||1;if(!(n>r.maxRetryTimes))return r.retryTimesDic[t.name]=n+1,r.failedList.push(t),void r.next();delete r.retryTimesDic[t.name];var i=t.groupNames.shift();0==t.groupNames.length&&delete t.groupNames,r.loadItemErrorDic[i]||(r.loadItemErrorDic[i]=[]),-1==r.loadItemErrorDic[i].indexOf(t)&&r.loadItemErrorDic[i].push(t),r.groupErrorDic[i]=!0;var a=r.reporterDic[i];r.numLoadedDic[i]++;var s=r.numLoadedDic[i],u=r.groupTotalDic[i];if(a&&a.onProgress&&a.onProgress(s,u),s==u){r.groupErrorDic[i];r.removeGroupName(i),delete r.groupTotalDic[i],delete r.numLoadedDic[i],delete r.itemListDic[i],delete r.groupErrorDic[i];var c=r.loadItemErrorDic[i];delete r.loadItemErrorDic[i];var f=r.dispatcherDic[i];f.dispatchEventWith("error",!1,{itemList:c,error:o})}else r.errorDic[i]=o;r.next()})):"break"},o=this;this.loadingCounta;a++){var s=t[a];if(s==e){t.splice(o,1),n=!0;break}o++}if(n){0==t.length&&delete this.priorityQueue[r];break}}},r.prototype.getOneResourceInfo=function(){if(this.failedList.length>0)return this.failedList.shift();var e=Number.NEGATIVE_INFINITY;for(var r in this.priorityQueue)e=Math.max(e,r);var t=this.priorityQueue[e];if(t&&0!=t.length){for(var o=t.length,n=[],i=0;o>i&&(this.queueIndex>=o&&(this.queueIndex=0),n=this.itemListDic[t[this.queueIndex]],!(n.length>0));i++)this.queueIndex++;if(0!=n.length)return n.shift()}},r.prototype.loadResource=function(r,t){if(!t){if(1==e.FEATURE_FLAG.FIX_DUPLICATE_LOAD){var o=e.host.state[r.root+r.name];if(2==o)return Promise.resolve(e.host.get(r));if(1==o)return r.promise}t=e.processor.isSupport(r)}if(!t)throw new e.ResourceManagerError(2001,r.name,r.type);e.host.state[r.root+r.name]=1;var n=t.onLoadStart(e.host,r);return r.promise=n,n},r.prototype.unloadResource=function(r){var t=e.host.get(r);if(!t)return console.warn("尝试释放不存在的资源:",r.name),Promise.resolve();var o=e.processor.isSupport(r);if(o){e.host.state[r.root+r.name]=3;var n=o.onRemoveStart(e.host,r);return e.host.remove(r),n}return Promise.resolve()},r}();e.ResourceLoader=r,__reflect(r.prototype,"RES.ResourceLoader")}(RES||(RES={}));var RES;!function(e){function r(){e.fileSystem.profile(),console.log(t);var r=0;for(var o in t){var n=t[o];n instanceof egret.Texture&&(r+=n.$bitmapWidth*n.$bitmapHeight*4)}console.log("gpu size : "+(r/1024).toFixed(3)+"kb")}var t={};e.systemPid=0,e.checkCancelation=function(r,t,n){var i=n.value;n.value=function(){for(var r=[],t=0;t0;_===h?(i=R?e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,n=4):_===v?(i=R?e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,n=2):(o(r,"pvr v2 parse error"),console.log("unknow format flags::"+_));var m=s;r.pvrtcData=new Uint8Array(r.buffer,m),r.bpp=n,r.format=i,r.width=c,r.height=u,r.surfacesCount=d,r.mipmapsCount=f+1,r.isCubemap=6===r.surfacesCount,t(r)},e._parseV3=function(r,t,o){var n,i,a=r.header,s=a[2];switch(s){case 0:n=2,i=e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;break;case 1:n=2,i=e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;break;case 2:n=4,i=e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;break;case 3:n=4,i=e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;break;default:o(r,"pvr v3 parse error"),console.log("unknow pixel format::"+s)}var u=52+a[12];r.pvrtcData=new Uint8Array(r.buffer,u),r.bpp=n,r.format=i,r.width=a[7],r.height=a[6],r.surfacesCount=a[10],r.mipmapsCount=a[11],r.isCubemap=6===r.surfacesCount,t(r)},e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840,e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841,e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842,e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843,e}();__reflect(c.prototype,"PVRParser"),"undefined"!=typeof egret&&egret&&egret.web&&egret.web.WebGLRenderContext&&(egret.web.WebGLRenderContext.prototype.createTextureFromCompressedData=function(e,r,t,o,n){var i=this.context;this.pvrtcExt||(this.pvrtcExt=i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"));var a=i.createTexture();i.bindTexture(i.TEXTURE_2D,a);for(var u=0,c=0;o>c;++c){var f=s(n,r,t),l=new Uint8Array(e.buffer,e.byteOffset+u,f);i.compressedTexImage2D(i.TEXTURE_2D,c,n,r,t,0,l),r>>=1,1>r&&(r=1),t>>=1,1>t&&(t=1),u+=f}return i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),a}),r.PVRProcessor={onLoadStart:function(e,r){return __awaiter(this,void 0,void 0,function(){var t,o,n,i,a,s,u,f,l,p,d,g,v;return __generator(this,function(h){switch(h.label){case 0:return[4,e.load(r,"bin")];case 1:for(t=h.sent(),o=512,n=512,i=0,a=0,s=new egret.ByteArray(t),s.position=7,u=["body","ext"],l=0;l=0){var o=t.split("://");t=o[0]+"://"+e.path.normalize(o[1]+"/")}else t=e.path.normalize(t+"/"),r=r.replace(t,"");return e.setConfigURL(r,t),R||(R=new _),R.loadConfig()}function o(e,r,t){return void 0===r&&(r=0),R.loadGroup(e,r,t)}function n(e){return R.isGroupLoaded(e)}function i(r){return R.getGroupByName(r).map(function(r){return e.ResourceItem.convertToResItem(r)})}function a(e,r,t){return void 0===t&&(t=!1),R.createGroup(e,r,t)}function s(e){return R.hasRes(e)}function u(e){return R.getRes(e)}function c(e,r,t){return R.getResAsync.apply(R,arguments)}function f(e,r,t,o){void 0===o&&(o=""),R.getResByUrl(e,r,t,o)}function l(e,r){return R.destroyRes(e,r)}function p(e){R||(R=new _),R.setMaxLoadingThread(e)}function d(e){R.setMaxRetryTimes(e)}function g(e,r,t,o,n){void 0===o&&(o=!1),void 0===n&&(n=0),R||(R=new _),R.addEventListener(e,r,t,o,n)}function v(e,r,t,o){void 0===o&&(o=!1),R.removeEventListener(e,r,t,o)}function h(e){R.addResourceData(e)}e.nameSelector=function(r){return e.path.basename(r).split(".").join("_")},e.registerAnalyzer=r,e.loadConfig=t,e.loadGroup=o,e.isGroupLoaded=n,e.getGroupByName=i,e.createGroup=a,e.hasRes=s,e.getRes=u,e.getResAsync=c,e.getResByUrl=f,e.destroyRes=l,e.setMaxLoadingThread=p,e.setMaxRetryTimes=d,e.addEventListener=g,e.removeEventListener=v,e.$addResourceData=h;var _=function(r){function t(){return null!==r&&r.apply(this,arguments)||this}return __extends(t,r),t.prototype.loadConfig=function(){var r=this;return e.native_init(),e.config.init().then(function(t){e.ResourceEvent.dispatchResourceEvent(r,e.ResourceEvent.CONFIG_COMPLETE)},function(t){return e.ResourceEvent.dispatchResourceEvent(r,e.ResourceEvent.CONFIG_LOAD_ERROR),Promise.reject(t)})},t.prototype.isGroupLoaded=function(r){var t=e.config.getGroupByName(r,!0);return t.every(function(r){return null!=e.host.get(r)})},t.prototype.getGroupByName=function(r){return e.config.getGroupByName(r,!0)},t.prototype.loadGroup=function(r,t,o){var n=this;void 0===t&&(t=0);var i={onProgress:function(t,i){o&&o.onProgress&&o.onProgress(t,i),e.ResourceEvent.dispatchResourceEvent(n,e.ResourceEvent.GROUP_PROGRESS,r,void 0,t,i)}};return this._loadGroup(r,t,i).then(function(t){e.ResourceEvent.dispatchResourceEvent(n,e.ResourceEvent.GROUP_COMPLETE,r)},function(t){for(var o=t.itemList,i=o.length,a=0;i>a;a++){var s=o[a];delete s.promise,e.ResourceEvent.dispatchResourceEvent(n,e.ResourceEvent.ITEM_LOAD_ERROR,r,s)}return e.ResourceEvent.dispatchResourceEvent(n,e.ResourceEvent.GROUP_LOAD_ERROR,r),Promise.reject(t.error)})},t.prototype._loadGroup=function(r,t,o){void 0===t&&(t=0);var n=e.config.getGroupByName(r,!0);return e.queue.load(n,r,t,o)},t.prototype.loadResources=function(r,t){var o=r.map(function(r){var t=e.config.getResourceWithSubkey(r,!0);return t.r});return e.queue.load(o,"name",0,t)},t.prototype.createGroup=function(r,t,o){return void 0===o&&(o=!1),e.config.createGroup(r,t,o)},t.prototype.hasRes=function(r){return null!=e.config.getResourceWithSubkey(r)},t.prototype.getRes=function(r){var t=e.config.getResourceWithSubkey(r);if(t){var o=t.r,n=t.key,i=t.subkey,a=e.processor.isSupport(o);return a&&a.getData&&i?a.getData(e.host,o,n,i):e.host.get(o)}return null},t.prototype.getResAsync=function(r,t,o){var n=this,i=r,a=e.config.getResourceWithSubkey(r,!0),s=a.r,u=a.subkey;return e.queue.loadResource(s).then(function(n){e.host.save(s,n);var a=e.processor.isSupport(s);return a&&a.getData&&u&&(n=a.getData(e.host,s,r,u)),t&&t.call(o,n,i),n},function(r){return e.ResourceEvent.dispatchResourceEvent(n,e.ResourceEvent.ITEM_LOAD_ERROR,"",s),Promise.reject(r)})},t.prototype.getResByUrl=function(r,t,o,n){var i=this;void 0===n&&(n="");var a=e.config.getResource(r);if(!a&&(n||(n=e.config.__temp__get__type__via__url(r)),a={name:r,url:r,type:n,root:""},e.config.addResourceData(a),a=e.config.getResource(r),!a))throw"never";return e.queue.loadResource(a).then(function(r){return e.host.save(a,r),t&&a&&t.call(o,r,a.url),r},function(r){return e.ResourceEvent.dispatchResourceEvent(i,e.ResourceEvent.ITEM_LOAD_ERROR,"",a),Promise.reject(r)})},t.prototype.destroyRes=function(r,t){return void 0===t&&(t=!0),__awaiter(this,void 0,void 0,function(){var t,o,n,i,a,a;return __generator(this,function(s){switch(s.label){case 0:if(t=e.config.getGroup(r),o=function(r){return e.queue.unloadResource(r)},!(t&&t.length>0))return[3,5];n=0,i=t,s.label=1;case 1:return nr&&(r=1),e.queue.thread=r},t.prototype.setMaxRetryTimes=function(r){r=Math.max(r,0),e.queue.maxRetryTimes=r},t.prototype.addResourceData=function(r){e.config.addResourceData(r)},__decorate([e.checkCancelation],t.prototype,"loadConfig",null),__decorate([e.checkCancelation],t.prototype,"_loadGroup",null),__decorate([e.checkNull],t.prototype,"hasRes",null),__decorate([e.checkNull],t.prototype,"getRes",null),__decorate([e.checkNull,e.checkCancelation],t.prototype,"getResAsync",null),__decorate([e.checkNull,e.checkCancelation],t.prototype,"getResByUrl",null),t}(egret.EventDispatcher);e.Resource=_,__reflect(_.prototype,"RES.Resource");var R}(RES||(RES={}));var RES;!function(e){var r=function(r){function t(e,t,o){void 0===t&&(t=!1),void 0===o&&(o=!1);var n=r.call(this,e,t,o)||this;return n.itemsLoaded=0,n.itemsTotal=0,n.groupName="",n}return __extends(t,r),t.dispatchResourceEvent=function(r,o,n,i,a,s){void 0===n&&(n=""),void 0===i&&(i=void 0),void 0===a&&(a=0),void 0===s&&(s=0);var u=egret.Event.create(t,o);u.groupName=n,i&&(u.resItem=e.ResourceItem.convertToResItem(i)),u.itemsLoaded=a,u.itemsTotal=s;var c=r.dispatchEvent(u);return egret.Event.release(u),c},t.ITEM_LOAD_ERROR="itemLoadError",t.CONFIG_COMPLETE="configComplete",t.CONFIG_LOAD_ERROR="configLoadError",t.GROUP_PROGRESS="groupProgress",t.GROUP_COMPLETE="groupComplete",t.GROUP_LOAD_ERROR="groupLoadError",t}(egret.Event);e.ResourceEvent=r,__reflect(r.prototype,"RES.ResourceEvent")}(RES||(RES={}));var RES;!function(e){var r;!function(r){function t(r){var t=r.name;if(e.config.config)for(var o in e.config.config.alias)e.config.config.alias[o]==r.url&&(t=o);else t=r.url;var n={name:t,url:r.url,type:r.type,data:r,root:r.root};return n}r.TYPE_XML="xml",r.TYPE_IMAGE="image",r.TYPE_BIN="bin",r.TYPE_TEXT="text",r.TYPE_JSON="json",r.TYPE_SHEET="sheet",r.TYPE_FONT="font",r.TYPE_SOUND="sound",r.convertToResItem=t}(r=e.ResourceItem||(e.ResourceItem={}))}(RES||(RES={}));var RES;!function(e){var r;!function(e){e.normalize=function(e){var r=e.split("/");return r.filter(function(e,t){return!!e||t==r.length-1}).join("/")},e.basename=function(e){return e.substr(e.lastIndexOf("/")+1)},e.dirname=function(e){return e.substr(0,e.lastIndexOf("/"))}}(r=e.path||(e.path={}))}(RES||(RES={}));var RES;!function(e){function r(){egret.Capabilities.runtimeType==egret.RuntimeType.NATIVE&&(n=o("all.manifest"))}function t(e){return n&&n[e]?"resource/"+n[e].v.substring(0,2)+"/"+n[e].v+"_"+n[e].s+"."+e.substring(e.lastIndexOf(".")+1):e}function o(e){if(egret_native.readUpdateFileSync&&egret_native.readResourceFileSync){var r=egret_native.readUpdateFileSync(e);if(null!=r)return JSON.parse(r);if(r=egret_native.readResourceFileSync(e),null!=r)return JSON.parse(r)}return null}var n;e.native_init=r,e.getRealURL=t}(RES||(RES={}));var RES;!function(e){var r=function(){function r(e){this.data=e}return r.prototype.profile=function(){console.log(this.data)},r.prototype.addFile=function(r,t){t||(t=""),r=e.path.normalize(r);var o=e.path.basename(r),n=e.path.dirname(r);this.exists(n)||this.mkdir(n);var i=this.reslove(n);i[o]={url:r,type:t}},r.prototype.getFile=function(e){var r=this.reslove(e);return r&&(r.name=e),r},r.prototype.reslove=function(r){if(""==r)return this.data;r=e.path.normalize(r);for(var t=r.split("/"),o=this.data,n=0,i=t;n
- * the capture phase comprises the journey from the root to the last node before the event target's node, the target
- * phase comprises only the event target node, and the bubbling phase comprises any subsequent nodes encountered on
- * the return trip to the root of the display list. In general, the easiest way for a user-defined class to gain event
- * dispatching capabilities is to extend EventDispatcher. If this is impossible (that is, if the class is already extending
- * another class), you can instead implement the IEventDispatcher interface, create an EventDispatcher member, and write simple
- * hooks to route calls into the aggregated EventDispatcher.
- * @see egret.IEventDispatcher
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/EventDispatcher.ts
- * @language en_US
- */
- /**
- * EventDispatcher 是 Egret 的事件派发器类,负责进行事件的发送和侦听。
- * 事件目标是事件如何通过显示列表层次结构这一问题的焦点。当发生鼠标单击、触摸或按键等事件时,
- * 框架会将事件对象调度到从显示列表根开始的事件流中。然后该事件对象在显示列表中前进,直到到达事件目标,
- * 然后从这一点开始其在显示列表中的回程。在概念上,到事件目标的此往返行程被划分为三个阶段:
- * 捕获阶段包括从根到事件目标节点之前的最后一个节点的行程,目标阶段仅包括事件目标节点,冒泡阶段包括回程上遇到的任何后续节点到显示列表的根。
- * 通常,使用户定义的类能够调度事件的最简单方法是扩展 EventDispatcher。如果无法扩展(即,如果该类已经扩展了另一个类),则可以实现
- * IEventDispatcher 接口,创建 EventDispatcher 成员,并编写一些简单的映射,将调用连接到聚合的 EventDispatcher 中。
- * @see egret.IEventDispatcher
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/EventDispatcher.ts
- * @language zh_CN
- */
- class EventDispatcher extends HashObject implements IEventDispatcher {
- /**
- * create an instance of the EventDispatcher class.
- * @param target The target object for events dispatched to the EventDispatcher object. This parameter is used when
- * the EventDispatcher instance is aggregated by a class that implements IEventDispatcher; it is necessary so that the
- * containing object can be the target for events. Do not use this parameter in simple cases in which a class extends EventDispatcher.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 EventDispatcher 类的实例
- * @param target 此 EventDispatcher 所抛出事件对象的 target 指向。此参数主要用于一个实现了 IEventDispatcher 接口的自定义类,
- * 以便抛出的事件对象的 target 属性可以指向自定义类自身。请勿在直接继承 EventDispatcher 的情况下使用此参数。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(target?: IEventDispatcher);
- /**
- * @private
- */
- $EventDispatcher: Object;
- /**
- * @private
- *
- * @param useCapture
- */
- $getEventMap(useCapture?: boolean): any;
- /**
- * @inheritDoc
- * @version Egret 2.4
- * @platform Web,Native
- */
- addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void;
- /**
- * @inheritDoc
- * @version Egret 2.4
- * @platform Web,Native
- */
- once(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void;
- /**
- * @private
- */
- $addListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number, dispatchOnce?: boolean): void;
- $insertEventBin(list: any[], type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number, dispatchOnce?: boolean): boolean;
- /**
- * @inheritDoc
- * @version Egret 2.4
- * @platform Web,Native
- */
- removeEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean): void;
- $removeEventBin(list: any[], listener: Function, thisObject: any): boolean;
- /**
- * @inheritDoc
- * @version Egret 2.4
- * @platform Web,Native
- */
- hasEventListener(type: string): boolean;
- /**
- * @inheritDoc
- * @version Egret 2.4
- * @platform Web,Native
- */
- willTrigger(type: string): boolean;
- /**
- * @inheritDoc
- * @version Egret 2.4
- * @platform Web,Native
- */
- dispatchEvent(event: Event): boolean;
- /**
- * @private
- */
- $notifyListener(event: Event, capturePhase: boolean): boolean;
- /**
- * Distribute a specified event parameters.
- * @param type The type of the event. Event listeners can access this information through the inherited type property.
- * @param bubbles Determines whether the Event object bubbles. Event listeners can access this information through
- * the inherited bubbles property.
- * @param data {any} data
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 派发一个指定参数的事件。
- * @param type {string} 事件类型
- * @param bubbles {boolean} 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param data {any} 事件data
- * @param cancelable {boolean} 确定是否可以取消 Event 对象。默认值为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- dispatchEventWith(type: string, bubbles?: boolean, data?: any, cancelable?: boolean): boolean;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 事件信息对象
- */
- interface EventBin {
- type: string;
- /**
- * @private
- */
- listener: Function;
- /**
- * @private
- */
- thisObject: any;
- /**
- * @private
- */
- priority: number;
- /**
- * @private
- */
- target: IEventDispatcher;
- /**
- * @private
- */
- useCapture: boolean;
- /**
- * @private
- */
- dispatchOnce: boolean;
- }
-}
-declare namespace egret {
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- class Filter extends HashObject {
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- type: string;
- /**
- * @private
- */
- $id: number;
- /**
- * @private
- */
- $uniforms: any;
- /**
- * @private
- */
- protected paddingTop: number;
- /**
- * @private
- */
- protected paddingBottom: number;
- /**
- * @private
- */
- protected paddingLeft: number;
- /**
- * @private
- */
- protected paddingRight: number;
- /**
- * @private
- * @native Render
- */
- $obj: any;
- constructor();
- /**
- * @private
- */
- $toJson(): string;
- protected updatePadding(): void;
- onPropertyChange(): void;
- }
-}
-declare namespace egret {
- /**
- * @private
- */
- const enum RenderMode {
- NONE = 1,
- FILTER = 2,
- CLIP = 3,
- SCROLLRECT = 4,
- }
- /**
- * The DisplayObject class is the base class for all objects that can be placed on the display list. The display list
- * manages all objects displayed in the runtime. Use the DisplayObjectContainer class to arrange the display
- * objects in the display list. DisplayObjectContainer objects can have child display objects, while other display objects,
- * such as Shape and TextField objects, are "leaf" nodes that have only parents and siblings, no children.
- * The DisplayObject class supports basic functionality like the x and y position of an object, as well as more advanced
- * properties of the object such as its transformation matrix.
- * The DisplayObject class contains several broadcast events.Normally, the target of any particular event is a specific
- * DisplayObject instance. For example, the target of an added event is the specific DisplayObject instance that was added
- * to the display list. Having a single target restricts the placement of event listeners to that target and in some cases
- * the target's ancestors on the display list. With broadcast events, however, the target is not a specific DisplayObject
- * instance, but rather all DisplayObject instances, including those that are not on the display list. This means that you
- * can add a listener to any DisplayObject instance to listen for broadcast events.
- *
- * @event egret.Event.ADDED Dispatched when a display object is added to the display list.
- * @event egret.Event.ADDED_TO_STAGE Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained.
- * @event egret.Event.REMOVED Dispatched when a display object is about to be removed from the display list.
- * @event egret.Event.REMOVED_FROM_STAGE Dispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained.
- * @event egret.Event.ENTER_FRAME [broadcast event] Dispatched when the playhead is entering a new frame.
- * @event egret.Event.RENDER [broadcast event] Dispatched when the display list is about to be updated and rendered.
- * @event egret.TouchEvent.TOUCH_MOVE Dispatched when the user touches the device, and is continuously dispatched until the point of contact is removed.
- * @event egret.TouchEvent.TOUCH_BEGIN Dispatched when the user first contacts a touch-enabled device (such as touches a finger to a mobile phone or tablet with a touch screen).
- * @event egret.TouchEvent.TOUCH_END Dispatched when the user removes contact with a touch-enabled device (such as lifts a finger off a mobile phone or tablet with a touch screen).
- * @event egret.TouchEvent.TOUCH_TAP Dispatched when the user lifts the point of contact over the same DisplayObject instance on which the contact was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display object on a mobile phone or tablet with a touch screen).
- * @event egret.TouchEvent.TOUCH_RELEASE_OUTSIDE Dispatched when the user lifts the point of contact over the different DisplayObject instance on which the contact was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display object on a mobile phone or tablet with a touch screen).
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/DisplayObject.ts
- * @language en_US
- */
- /**
- * DisplayObject 类是可放在显示列表中的所有对象的基类。该显示列表管理运行时中显示的所有对象。使用 DisplayObjectContainer 类排列
- * 显示列表中的显示对象。DisplayObjectContainer 对象可以有子显示对象,而其他显示对象(如 Shape 和 TextField 对象)是“叶”节点,没有子项,只有父级和
- * 同级。DisplayObject 类有一些基本的属性(如确定坐标位置的 x 和 y 属性),也有一些高级的对象属性(如 Matrix 矩阵变换)。
- * DisplayObject 类包含若干广播事件。通常,任何特定事件的目标均为一个特定的 DisplayObject 实例。例如,added 事件的目标是已添加到显示列表
- * 的目标 DisplayObject 实例。若只有一个目标,则会将事件侦听器限制为只能监听在该目标上(在某些情况下,可监听在显示列表中该目标的祖代上)。
- * 但是对于广播事件,目标不是特定的 DisplayObject 实例,而是所有 DisplayObject 实例(包括那些不在显示列表中的实例)。这意味着您可以向任何
- * DisplayObject 实例添加侦听器来侦听广播事件。
- *
- * @event egret.Event.ADDED 将显示对象添加到显示列表中时调度。
- * @event egret.Event.ADDED_TO_STAGE 在将显示对象直接添加到舞台显示列表或将包含显示对象的子树添加至舞台显示列表中时调度。
- * @event egret.Event.REMOVED 将要从显示列表中删除显示对象时调度。
- * @event egret.Event.REMOVED_FROM_STAGE 在从显示列表中直接删除显示对象或删除包含显示对象的子树时调度。
- * @event egret.Event.ENTER_FRAME [广播事件] 播放头进入新帧时调度。
- * @event egret.Event.RENDER [广播事件] 将要更新和呈现显示列表时调度。
- * @event egret.TouchEvent.TOUCH_MOVE 当用户触碰设备时进行调度,而且会连续调度,直到接触点被删除。
- * @event egret.TouchEvent.TOUCH_BEGIN 当用户第一次触摸启用触摸的设备时(例如,用手指触摸手机屏幕)调度。
- * @event egret.TouchEvent.TOUCH_END 当用户移除与启用触摸的设备的接触时(例如,将手指从屏幕上抬起)调度。
- * @event egret.TouchEvent.TOUCH_TAP 当用户在启用触摸设备上的已启动接触的同一 DisplayObject 实例上抬起接触点时(例如,手机点击屏幕后抬起)调度。
- * @event egret.TouchEvent.TOUCH_RELEASE_OUTSIDE 当用户在启用触摸设备上的已启动接触的不同 DisplayObject 实例上抬起接触点时(例如,按住屏幕上的某个对象,然后从它上面挪开后再松开手指)调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/DisplayObject.ts
- * @language zh_CN
- */
- class DisplayObject extends EventDispatcher {
- /**
- * Initializes a DisplayObject object
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个显示对象
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor();
- $nativeDisplayObject: egret_native.NativeDisplayObject;
- protected createNativeDisplayObject(): void;
- /**
- * @private
- * 是否添加到舞台上,防止重复发送 removed_from_stage 消息
- */
- $hasAddToStage: boolean;
- /**
- * @private
- * 能够含有子项的类将子项列表存储在这个属性里。
- */
- $children: DisplayObject[];
- private $name;
- /**
- * Indicates the instance name of the DisplayObject. The object can be identified in the child list of its parent
- * display object container by calling the getChildByName() method of the display object container.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示 DisplayObject 的实例名称。
- * 通过调用父显示对象容器的 getChildByName() 方法,可以在父显示对象容器的子列表中标识该对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- name: string;
- /**
- * @private
- */
- $parent: DisplayObjectContainer;
- /**
- * Indicates the DisplayObjectContainer object that contains this display object. Use the parent property to specify
- * a relative path to display objects that are above the current display object in the display list hierarchy.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示包含此显示对象的 DisplayObjectContainer 对象。
- * 使用 parent 属性可以指定高于显示列表层次结构中当前显示对象的显示对象的相对路径。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly parent: DisplayObjectContainer;
- /**
- * @private
- * 设置父级显示对象
- */
- $setParent(parent: DisplayObjectContainer): void;
- /**
- * @private
- * 显示对象添加到舞台
- */
- $onAddToStage(stage: Stage, nestLevel: number): void;
- /**
- * @private
- * 显示对象从舞台移除
- */
- $onRemoveFromStage(): void;
- /**
- * @private
- */
- $stage: Stage;
- /**
- * @private
- * 这个对象在显示列表中的嵌套深度,舞台为1,它的子项为2,子项的子项为3,以此类推。当对象不在显示列表中时此属性值为0.
- */
- $nestLevel: number;
- $useTranslate: boolean;
- protected $updateUseTransform(): void;
- /**
- * The Stage of the display object. you can create and load multiple display objects into the display list, and
- * the stage property of each display object refers to the same Stage object.
- * If a display object is not added to the display list, its stage property is set to null.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 显示对象的舞台。
- * 例如,您可以创建多个显示对象并加载到显示列表中,每个显示对象的 stage 属性是指向相同的 Stage 对象。
- * 如果显示对象未添加到显示列表,则其 stage 属性会设置为 null。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly stage: Stage;
- /**
- * A Matrix object containing values that alter the scaling, rotation, and translation of the display object.
- * Note: to change the value of a display object's matrix, you must make a copy of the entire matrix object, then copy
- * the new object into the matrix property of the display object.
- * @example the following code increases the tx value of a display object's matrix
- *
- * let myMatrix:Matrix = myDisplayObject.matrix;
- * myMatrix.tx += 10;
- * myDisplayObject.matrix = myMatrix;
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 一个 Matrix 对象,其中包含更改显示对象的缩放、旋转和平移的值。
- * 注意:要改变一个显示对象矩阵的值,您必引用整个矩阵对象,然后将它重新赋值给显示对象的 matrix 属性。
- * @example 以下代码改变了显示对象矩阵的tx属性值:
- *
- * let myMatrix:Matrix = myDisplayObject.matrix;
- * myMatrix.tx += 10;
- * myDisplayObject.matrix = myMatrix;
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- matrix: Matrix;
- private $matrix;
- private $matrixDirty;
- /**
- * @private
- * 获取矩阵
- */
- $getMatrix(): Matrix;
- /**
- * @private
- * 设置矩阵
- */
- $setMatrix(matrix: Matrix, needUpdateProperties?: boolean): void;
- private $concatenatedMatrix;
- /**
- * @private
- * 获得这个显示对象以及它所有父级对象的连接矩阵。
- */
- $getConcatenatedMatrix(): Matrix;
- private $invertedConcatenatedMatrix;
- /**
- * @private
- * 获取链接矩阵
- */
- $getInvertedConcatenatedMatrix(): Matrix;
- $x: number;
- /**
- * Indicates the x coordinate of the DisplayObject instance relative to the local coordinates of the parent
- * DisplayObjectContainer.
- * If the object is inside a DisplayObjectContainer that has transformations, it is in
- * the local coordinate system of the enclosing DisplayObjectContainer. Thus, for a DisplayObjectContainer
- * rotated 90° counterclockwise, the DisplayObjectContainer's children inherit a coordinate system that is
- * rotated 90° counterclockwise. The object's coordinates refer to the registration point position.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示 DisplayObject 实例相对于父级 DisplayObjectContainer 本地坐标的 x 坐标。
- * 如果该对象位于具有变形的 DisplayObjectContainer 内,则它也位于包含 DisplayObjectContainer 的本地坐标系中。
- * 因此,对于逆时针旋转 90 度的 DisplayObjectContainer,该 DisplayObjectContainer 的子级将继承逆时针旋转 90 度的坐标系。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- x: number;
- /**
- * @private
- * 获取x坐标
- */
- $getX(): number;
- /**
- * @private
- * 设置x坐标
- */
- $setX(value: number): boolean;
- $y: number;
- /**
- * Indicates the y coordinate of the DisplayObject instance relative to the local coordinates of the parent
- * DisplayObjectContainer.
- * If the object is inside a DisplayObjectContainer that has transformations, it is in
- * the local coordinate system of the enclosing DisplayObjectContainer. Thus, for a DisplayObjectContainer rotated
- * 90° counterclockwise, the DisplayObjectContainer's children inherit a coordinate system that is rotated 90°
- * counterclockwise. The object's coordinates refer to the registration point position.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示 DisplayObject 实例相对于父级 DisplayObjectContainer 本地坐标的 y 坐标。
- * 如果该对象位于具有变形的 DisplayObjectContainer 内,则它也位于包含 DisplayObjectContainer 的本地坐标系中。
- * 因此,对于逆时针旋转 90 度的 DisplayObjectContainer,该 DisplayObjectContainer 的子级将继承逆时针旋转 90 度的坐标系。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- y: number;
- /**
- * @private
- * 获取y坐标
- */
- $getY(): number;
- /**
- * @private
- * 设置y坐标
- */
- $setY(value: number): boolean;
- private $scaleX;
- /**
- * Indicates the horizontal scale (percentage) of the object as applied from the registration point.
- * The default 1.0 equals 100% scale.
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示从注册点开始应用的对象的水平缩放比例(百分比)。
- * 1.0 等于 100% 缩放。
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- scaleX: number;
- /**
- * @private
- *
- * @returns
- */
- $getScaleX(): number;
- /**
- * @private
- * 设置水平缩放值
- */
- $setScaleX(value: number): void;
- private $scaleY;
- /**
- * Indicates the vertical scale (percentage) of an object as applied from the registration point of the object.
- * 1.0 is 100% scale.
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示从对象注册点开始应用的对象的垂直缩放比例(百分比)。1.0 是 100% 缩放。
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- scaleY: number;
- /**
- * @private
- *
- * @returns
- */
- $getScaleY(): number;
- /**
- * @private
- * 设置垂直缩放值
- */
- $setScaleY(value: number): void;
- private $rotation;
- /**
- * Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. Values from
- * 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside
- * this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement
- * myDisplayObject.rotation = 450 is the same as myDisplayObject.rotation = 90.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示 DisplayObject 实例距其原始方向的旋转程度,以度为单位。
- * 从 0 到 180 的值表示顺时针方向旋转;从 0 到 -180 的值表示逆时针方向旋转。对于此范围之外的值,可以通过加上或
- * 减去 360 获得该范围内的值。例如,myDisplayObject.rotation = 450语句与 myDisplayObject.rotation = 90 是相同的。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- rotation: number;
- /**
- * @private
- */
- $getRotation(): number;
- $setRotation(value: number): void;
- private $skewX;
- private $skewXdeg;
- /**
- * 表示DisplayObject的x方向斜切
- * @member {number} egret.DisplayObject#skewX
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- */
- skewX: number;
- /**
- * @private
- *
- * @param value
- */
- $setSkewX(value: number): void;
- private $skewY;
- private $skewYdeg;
- /**
- * 表示DisplayObject的y方向斜切
- * @member {number} egret.DisplayObject#skewY
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- */
- skewY: number;
- /**
- * @private
- *
- * @param value
- */
- $setSkewY(value: number): void;
- /**
- * Indicates the width of the display object, in pixels. The width is calculated based on the bounds of the content
- * of the display object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示显示对象的宽度,以像素为单位。宽度是根据显示对象内容的范围来计算的。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- width: number;
- /**
- * @private
- * 获取显示宽度
- */
- $getWidth(): number;
- $explicitWidth: number;
- /**
- * @private
- * 设置显示宽度
- */
- $setWidth(value: number): void;
- /**
- * Indicates the height of the display object, in pixels. The height is calculated based on the bounds of the
- * content of the display object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示显示对象的高度,以像素为单位。高度是根据显示对象内容的范围来计算的。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- height: number;
- $explicitHeight: number;
- /**
- * @private
- * 获取显示高度
- */
- $getHeight(): number;
- /**
- * @private
- * 设置显示高度
- */
- $setHeight(value: number): void;
- /**
- * 测量宽度
- * @returns {number}
- * @member {egret.Rectangle} egret.DisplayObject#measuredWidth
- * @version Egret 2.4
- * @platform Web,Native
- */
- readonly measuredWidth: number;
- /**
- * 测量高度
- * @returns {number}
- * @member {egret.Rectangle} egret.DisplayObject#measuredWidth
- * @version Egret 2.4
- * @platform Web,Native
- */
- readonly measuredHeight: number;
- $anchorOffsetX: number;
- /**
- * X represents the object of which is the anchor.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示从对象绝对锚点X。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- anchorOffsetX: number;
- /**
- * @private
- *
- * @param value
- * @returns
- */
- $setAnchorOffsetX(value: number): void;
- $anchorOffsetY: number;
- /**
- * Y represents the object of which is the anchor.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示从对象绝对锚点Y。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- anchorOffsetY: number;
- /**
- * @private
- *
- * @param value
- * @returns
- */
- $setAnchorOffsetY(value: number): void;
- /**
- * @private
- */
- $visible: boolean;
- /**
- * Whether or not the display object is visible. Display objects that are not visible are disabled. For example,
- * if visible=false for an DisplayObject instance, it cannot receive touch or other user input.
- * @default true
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 显示对象是否可见。不可见的显示对象将被禁用。例如,如果实例的 visible 为 false,则无法接受触摸或用户交互操作。
- * @default true
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- visible: boolean;
- $setVisible(value: boolean): void;
- /**
- * @private
- * cacheAsBitmap创建的缓存位图节点。
- */
- $displayList: egret.sys.DisplayList;
- private $cacheAsBitmap;
- /**
- * If set to true, Egret runtime caches an internal bitmap representation of the display object. This caching can
- * increase performance for display objects that contain complex vector content. After you set the cacheAsBitmap
- * property to true, the rendering does not change, however the display object performs pixel snapping automatically.
- * The execution speed can be significantly faster depending on the complexity of the content.The cacheAsBitmap
- * property is best used with display objects that have mostly static content and that do not scale and rotate frequently.
- * Note: The display object will not create the bitmap caching when the memory exceeds the upper limit,even if you set it to true.
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 如果设置为 true,则 Egret 运行时将缓存显示对象的内部位图表示形式。此缓存可以提高包含复杂矢量内容的显示对象的性能。
- * 将 cacheAsBitmap 属性设置为 true 后,呈现并不更改,但是,显示对象将自动执行像素贴紧。执行速度可能会大大加快,
- * 具体取决于显示对象内容的复杂性。最好将 cacheAsBitmap 属性与主要具有静态内容且不频繁缩放或旋转的显示对象一起使用。
- * 注意:在内存超过上限的情况下,即使将 cacheAsBitmap 属性设置为 true,显示对象也不使用位图缓存。
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- cacheAsBitmap: boolean;
- $setHasDisplayList(value: boolean): void;
- $cacheDirty: boolean;
- $cacheDirtyUp(): void;
- /**
- * @private
- */
- $alpha: number;
- /**
- * Indicates the alpha transparency value of the object specified. Valid values are 0 (fully transparent) to 1 (fully opaque).
- * The default value is 1. Display objects with alpha set to 0 are active, even though they are invisible.
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示指定对象的 Alpha 透明度值。
- * 有效值为 0(完全透明)到 1(完全不透明)。alpha 设置为 0 的显示对象是可触摸的,即使它们不可见。
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- alpha: number;
- /**
- * @private
- *
- * @param value
- */
- $setAlpha(value: number): void;
- /**
- * @private
- * The default touchEnabled property of DisplayObject
- * @default false
- * @version Egret 2.5
- * @platform Web,Native
- * @language en_US
- */
- /**
- * @private
- * 显示对象默认的 touchEnabled 属性
- * @default false
- * @version Egret 2.5
- * @platform Web,Native
- * @language zh_CN
- */
- static defaultTouchEnabled: boolean;
- $touchEnabled: boolean;
- /**
- * Specifies whether this object receives touch or other user input. The default value is false, which means that
- * by default any DisplayObject instance that is on the display list cannot receive touch events. If touchEnabled is
- * set to false, the instance does not receive any touch events (or other user input events). Any children of
- * this instance on the display list are not affected. To change the touchEnabled behavior for all children of
- * an object on the display list, use DisplayObjectContainer.touchChildren.
- * @see egret.DisplayObjectContainer#touchChildren
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 指定此对象是否接收触摸或其他用户输入。默认值为 false,这表示默认情况下,显示列表上的任何 DisplayObject 实例都不会接收触摸事件或
- * 其他用户输入事件。如果将 touchEnabled 设置为 false,则实例将不接收任何触摸事件(或其他用户输入事件)。显示列表上的该实例的任
- * 何子级都不会受到影响。要更改显示列表上对象的所有子级的 touchEnabled 行为,请使用 DisplayObjectContainer.touchChildren。
- * @see egret.DisplayObjectContainer#touchChildren
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- touchEnabled: boolean;
- /**
- * @private
- */
- $getTouchEnabled(): boolean;
- /**
- * @private
- */
- $setTouchEnabled(value: boolean): void;
- /**
- * @private
- */
- $scrollRect: Rectangle;
- /**
- * The scroll rectangle bounds of the display object. The display object is cropped to the size defined by the rectangle,
- * and it scrolls within the rectangle when you change the x and y properties of the scrollRect object. A scrolled display
- * object always scrolls in whole pixel increments.You can scroll an object left and right by setting the x property of
- * the scrollRect Rectangle object. You can scroll an object up and down by setting the y property of the scrollRect
- * Rectangle object. If the display object is rotated 90° and you scroll it left and right, the display object actually
- * scrolls up and down.
- *
- * Note: to change the value of a display object's scrollRect, you must make a copy of the entire scrollRect object, then copy
- * the new object into the scrollRect property of the display object.
- * @example the following code increases the x value of a display object's scrollRect
- *
- * let myRectangle:Rectangle = myDisplayObject.scrollRect;
- * myRectangle.x += 10;
- * myDisplayObject.scrollRect = myRectangle;
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 显示对象的滚动矩形范围。显示对象被裁切为矩形定义的大小,当您更改 scrollRect 对象的 x 和 y 属性时,它会在矩形内滚动。
- * 滚动的显示对象始终以整像素为增量进行滚动。您可以通过设置 scrollRect Rectangle 对象的 x 属性来左右滚动对象, 还可以通过设置
- * scrollRect 对象的 y 属性来上下滚动对象。如果显示对象旋转了 90 度,并且您左右滚动它,则实际上显示对象会上下滚动。
- *
- * 注意:要改变一个显示对象 scrollRect 属性的值,您必引用整个 scrollRect 对象,然后将它重新赋值给显示对象的 scrollRect 属性。
- * @example 以下代码改变了显示对象 scrollRect 的 x 属性值:
- *
- * let myRectangle:Rectangle = myDisplayObject.scrollRect;
- * myRectangle.x += 10;
- * myDisplayObject.scrollRect = myRectangle;//设置完scrollRect的x、y、width、height值之后,一定要对myDisplayObject重新赋值scrollRect,不然会出问题。
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- scrollRect: Rectangle;
- /**
- * @private
- *
- * @param value
- */
- private $setScrollRect(value);
- /**
- * @private
- */
- $blendMode: number;
- /**
- * A value from the BlendMode class that specifies which blend mode to use. Determine how a source image (new one)
- * is drawn on the target image (old one).
- * If you attempt to set this property to an invalid value, Egret runtime set the value to BlendMode.NORMAL.
- * @default egret.BlendMode.NORMAL
- * @see egret.BlendMode
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * BlendMode 枚举中的一个值,用于指定要使用的混合模式,确定如何将一个源(新的)图像绘制到目标(已有)的图像上
- * 如果尝试将此属性设置为无效值,则运行时会将此值设置为 BlendMode.NORMAL。
- * @default egret.BlendMode.NORMAL
- * @see egret.BlendMode
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- blendMode: string;
- /**
- * @private
- * 被遮罩的对象
- */
- $maskedObject: DisplayObject;
- /**
- * @private
- */
- $mask: DisplayObject;
- /**
- * @private
- */
- $maskRect: Rectangle;
- /**
- * The calling display object is masked by the specified mask object. To ensure that masking works when the Stage
- * is scaled, the mask display object must be in an active part of the display list. The mask object itself is not drawn.
- * Set mask to null to remove the mask. To be able to scale a mask object, it must be on the display list. To be
- * able to drag a mask object , it must be on the display list.
- * Note: A single mask object cannot be used to mask more than one calling display object. When the mask is assigned
- * to a second display object, it is removed as the mask of the first object, and that object's mask property becomes null.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 调用显示对象被指定的 mask 对象遮罩。要确保当舞台缩放时蒙版仍然有效,mask 显示对象必须处于显示列表的活动部分。
- * 但不绘制 mask 对象本身。将 mask 设置为 null 可删除蒙版。要能够缩放遮罩对象,它必须在显示列表中。要能够拖动蒙版
- * 对象,它必须在显示列表中。
- * 注意:单个 mask 对象不能用于遮罩多个执行调用的显示对象。在将 mask 分配给第二个显示对象时,会撤消其作为第一个对象的遮罩,
- * 该对象的 mask 属性将变为 null。
- *
- * 下面例子为 mask 为 Rectangle 类型对象,这种情况下,修改 mask 的值后,一定要对 myDisplayObject 重新赋值 mask,不然会出问题。
- * @example 以下代码改变了显示对象 mask 的 x 属性值:
- *
- * let myMask:Rectangle = myDisplayObject.mask;
- * myMask.x += 10;
- * myDisplayObject.mask = myMask;//设置完 mask 的x、y、width、height值之后,一定要对myDisplayObject重新赋值 mask,不然会出问题。
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- mask: DisplayObject | Rectangle;
- private $setMaskRect(value);
- $filters: Array;
- /**
- * An indexed array that contains each filter object currently associated with the display object.
- * @version Egret 3.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 包含当前与显示对象关联的每个滤镜对象的索引数组。
- * @version Egret 3.1.0
- * @platform Web
- * @language zh_CN
- */
- filters: Array;
- /**
- * Returns a rectangle that defines the area of the display object relative to the coordinate system of the targetCoordinateSpace object.
- * @param targetCoordinateSpace The display object that defines the coordinate system to use.
- * @param resultRect A reusable instance of Rectangle for saving the results. Passing this parameter can reduce the number of reallocate objects
- *, which allows you to get better code execution performance..
- * @returns The rectangle that defines the area of the display object relative to the targetCoordinateSpace object's coordinate system.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回一个矩形,该矩形定义相对于 targetCoordinateSpace 对象坐标系的显示对象区域。
- * @param targetCoordinateSpace 定义要使用的坐标系的显示对象。
- * @param resultRect 一个用于存储结果的可复用Rectangle实例,传入此参数能够减少内部创建对象的次数,从而获得更高的运行性能。
- * @returns 定义与 targetCoordinateSpace 对象坐标系统相关的显示对象面积的矩形。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- getTransformedBounds(targetCoordinateSpace: DisplayObject, resultRect?: Rectangle): Rectangle;
- /**
- * Obtain measurement boundary of display object
- * @param resultRect {Rectangle} Optional. It is used to import Rectangle object for saving results, preventing duplicate object creation.
- * @param calculateAnchor {boolean} Optional. It is used to determine whether to calculate anchor point.
- * @returns {Rectangle}
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取显示对象的测量边界
- * @param resultRect {Rectangle} 可选参数,传入用于保存结果的Rectangle对象,避免重复创建对象。
- * @param calculateAnchor {boolean} 可选参数,是否会计算锚点。
- * @returns {Rectangle}
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- getBounds(resultRect?: Rectangle, calculateAnchor?: boolean): egret.Rectangle;
- /**
- * @private
- */
- $getTransformedBounds(targetCoordinateSpace: DisplayObject, resultRect?: Rectangle): Rectangle;
- /**
- * Converts the point object from the Stage (global) coordinates to the display object's (local) coordinates.
- * @param stageX the x value in the global coordinates
- * @param stageY the y value in the global coordinates
- * @param resultPoint A reusable instance of Point for saving the results. Passing this parameter can reduce the
- * number of reallocate objects, which allows you to get better code execution performance.
- * @returns A Point object with coordinates relative to the display object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将从舞台(全局)坐标转换为显示对象的(本地)坐标。
- * @param stageX 舞台坐标x
- * @param stageY 舞台坐标y
- * @param resultPoint 一个用于存储结果的可复用 Point 实例,传入此参数能够减少内部创建对象的次数,从而获得更高的运行性能。
- * @returns 具有相对于显示对象的坐标的 Point 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- globalToLocal(stageX?: number, stageY?: number, resultPoint?: Point): Point;
- /**
- * Converts the point object from the display object's (local) coordinates to the Stage (global) coordinates.
- * @param localX the x value in the local coordinates
- * @param localY the x value in the local coordinates
- * @param resultPoint A reusable instance of Point for saving the results. Passing this parameter can reduce the
- * number of reallocate objects, which allows you to get better code execution performance.
- * @returns A Point object with coordinates relative to the Stage.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将显示对象的(本地)坐标转换为舞台(全局)坐标。
- * @param localX 本地坐标 x
- * @param localY 本地坐标 y
- * @param resultPoint 一个用于存储结果的可复用 Point 实例,传入此参数能够减少内部创建对象的次数,从而获得更高的运行性能。
- * @returns 一个具有相对于舞台坐标的 Point 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- localToGlobal(localX?: number, localY?: number, resultPoint?: Point): Point;
- /**
- * @private
- * 获取显示对象占用的矩形区域集合,通常包括自身绘制的测量区域,如果是容器,还包括所有子项占据的区域。
- */
- $getOriginalBounds(): Rectangle;
- /**
- * @private
- * 测量子项占用的矩形区域
- * @param bounds 测量结果存储在这个矩形对象内
- */
- $measureChildBounds(bounds: Rectangle): void;
- /**
- * @private
- */
- $getContentBounds(): Rectangle;
- /**
- * @private
- * 测量自身占用的矩形区域,注意:此测量结果并不包括子项占据的区域。
- * @param bounds 测量结果存储在这个矩形对象内
- */
- $measureContentBounds(bounds: Rectangle): void;
- /**
- * @private
- */
- $parentDisplayList: egret.sys.DisplayList;
- /**
- * @private
- * 渲染节点,不为空表示自身有绘制到屏幕的内容
- */
- $renderNode: sys.RenderNode;
- $renderDirty: boolean;
- /**
- * @private
- * 获取渲染节点
- */
- $getRenderNode(): sys.RenderNode;
- $updateRenderMode(): void;
- $renderMode: RenderMode;
- /**
- * @private
- */
- private $measureFiltersOffset(fromParent);
- /**
- * @private
- * 获取相对于指定根节点的连接矩阵。
- * @param root 根节点显示对象
- * @param matrix 目标显示对象相对于舞台的完整连接矩阵。
- */
- $getConcatenatedMatrixAt(root: DisplayObject, matrix: Matrix): void;
- /**
- * @private
- * 更新renderNode
- */
- $updateRenderNode(): void;
- /**
- * @private
- */
- $hitTest(stageX: number, stageY: number): DisplayObject;
- /**
- * Calculate the display object to determine whether it overlaps or crosses with the points specified by the x and y parameters. The x and y parameters specify the points in the coordinates of the stage, rather than the points in the display object container that contains display objects (except the situation where the display object container is a stage).
- * Note: Don't use accurate pixel collision detection on a large number of objects. Otherwise, this will cause serious performance deterioration.
- * @param x {number} x coordinate of the object to be tested.
- * @param y {number} y coordinate of the object to be tested.
- * @param shapeFlag {boolean} Whether to check the actual pixel of object (true) or check that of border (false).Write realized.
- * @returns {boolean} If display object overlaps or crosses with the specified point, it is true; otherwise, it is false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 计算显示对象,以确定它是否与 x 和 y 参数指定的点重叠或相交。x 和 y 参数指定舞台的坐标空间中的点,而不是包含显示对象的显示对象容器中的点(除非显示对象容器是舞台)。
- * 注意,不要在大量物体中使用精确碰撞像素检测,这回带来巨大的性能开销
- * @param x {number} 要测试的此对象的 x 坐标。
- * @param y {number} 要测试的此对象的 y 坐标。
- * @param shapeFlag {boolean} 是检查对象 (true) 的实际像素,还是检查边框 (false) 的实际像素。
- * @returns {boolean} 如果显示对象与指定的点重叠或相交,则为 true;否则为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- hitTestPoint(x: number, y: number, shapeFlag?: boolean): boolean;
- /**
- * @private
- */
- static $enterFrameCallBackList: DisplayObject[];
- /**
- * @private
- */
- static $renderCallBackList: DisplayObject[];
- /**
- * @private
- */
- $addListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number, dispatchOnce?: boolean): void;
- /**
- * @inheritDoc
- * @version Egret 2.4
- * @platform Web,Native
- */
- removeEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean): void;
- /**
- * @inheritDoc
- * @version Egret 2.4
- * @platform Web,Native
- */
- dispatchEvent(event: Event): boolean;
- /**
- * @private
- * 获取事件流列表。注意:Egret框架的事件流与Flash实现并不一致。
- *
- * 事件流有三个阶段:捕获,目标,冒泡。
- * Flash里默认的的事件监听若不开启useCapture将监听目标和冒泡阶段。若开始capture将只能监听捕获当不包括目标的事件。
- * 可以在Flash中写一个简单的测试:实例化一个非容器显示对象,例如TextField。分别监听useCapture为true和false时的鼠标事件。
- * 点击后将只有useCapture为false的回调函数输出信息。也就带来一个问题「Flash的捕获阶段不能监听到最内层对象本身,只在父级列表有效」。
- *
- * 而HTML里的事件流设置useCapture为true时是能监听到目标阶段的,也就是目标阶段会被触发两次,在捕获和冒泡过程各触发一次。这样可以避免
- * 前面提到的监听捕获无法监听目标本身的问题。
- *
- * Egret最终采用了HTML里目标节点触发两次的事件流方式。
- */
- $getPropagationList(target: DisplayObject): DisplayObject[];
- /**
- * @private
- */
- $dispatchPropagationEvent(event: Event, list: DisplayObject[], targetIndex: number): void;
- /**
- * @inheritDoc
- * @version Egret 2.4
- * @platform Web,Native
- */
- willTrigger(type: string): boolean;
- }
-}
-declare namespace egret {
- let $TextureScaleFactor: number;
- /**
- * The Texture class encapsulates different image resources on different platforms.
- * In HTML5, resource is an HTMLElement object
- * In OpenGL / WebGL, resource is a texture ID obtained after the GPU is submitted
- * The Texture class encapsulates the details implemented on the underlayer. Developers just need to focus on interfaces
- * @see http://edn.egret.com/cn/docs/page/135 The use of texture packs
- * @see http://edn.egret.com/cn/docs/page/123 Several ways of access to resources
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Texture.ts
- * @language en_US
- */
- /**
- * 纹理类是对不同平台不同的图片资源的封装
- * 在HTML5中,资源是一个HTMLElement对象
- * 在OpenGL / WebGL中,资源是一个提交GPU后获取的纹理id
- * Texture类封装了这些底层实现的细节,开发者只需要关心接口即可
- * @see http://edn.egret.com/cn/docs/page/135 纹理集的使用
- * @see http://edn.egret.com/cn/docs/page/123 获取资源的几种方式
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Texture.ts
- * @language zh_CN
- */
- class Texture extends HashObject {
- /**
- * Create an egret.Texture object
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 egret.Texture 对象
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor();
- /**
- * @private
- * 纹理id
- */
- $textureId: number;
- /**
- * Whether to destroy the corresponding BitmapData when the texture is destroyed
- * @version Egret 5.0.8
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 销毁纹理时是否销毁对应BitmapData
- * @version Egret 5.0.8
- * @platform Web,Native
- * @language zh_CN
- */
- disposeBitmapData: boolean;
- /**
- * @private
- * 表示这个纹理在 bitmapData 上的 x 起始位置
- */
- $bitmapX: number;
- /**
- * @private
- * 表示这个纹理在 bitmapData 上的 y 起始位置
- */
- $bitmapY: number;
- /**
- * @private
- * 表示这个纹理在 bitmapData 上的宽度
- */
- $bitmapWidth: number;
- /**
- * @private
- * 表示这个纹理在 bitmapData 上的高度
- */
- $bitmapHeight: number;
- /**
- * @private
- * 表示这个纹理显示了之后在 x 方向的渲染偏移量
- */
- $offsetX: number;
- /**
- * @private
- * 表示这个纹理显示了之后在 y 方向的渲染偏移量
- */
- $offsetY: number;
- /**
- * @private
- * 纹理宽度
- */
- private $textureWidth;
- /**
- * Texture width, read only
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 纹理宽度,只读属性,不可以设置
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly textureWidth: number;
- $getTextureWidth(): number;
- /**
- * @private
- * 纹理高度
- */
- private $textureHeight;
- /**
- * Texture height, read only
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 纹理高度,只读属性,不可以设置
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly textureHeight: number;
- $getTextureHeight(): number;
- $getScaleBitmapWidth(): number;
- $getScaleBitmapHeight(): number;
- /**
- * @private
- * 表示bitmapData.width
- */
- $sourceWidth: number;
- /**
- * @private
- * 表示bitmapData.height
- */
- $sourceHeight: number;
- /**
- * @private
- */
- $bitmapData: BitmapData;
- /**
- * @private
- */
- $rotated: boolean;
- /**
- * The BitmapData object being referenced.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 被引用的 BitmapData 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- bitmapData: BitmapData;
- /**
- * Set the BitmapData object.
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 设置 BitmapData 对象。
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language zh_CN
- */
- _setBitmapData(value: BitmapData): void;
- /**
- * @private
- * 设置Texture数据
- * @param bitmapX
- * @param bitmapY
- * @param bitmapWidth
- * @param bitmapHeight
- * @param offsetX
- * @param offsetY
- * @param textureWidth
- * @param textureHeight
- * @param sourceWidth
- * @param sourceHeight
- */
- $initData(bitmapX: number, bitmapY: number, bitmapWidth: number, bitmapHeight: number, offsetX: number, offsetY: number, textureWidth: number, textureHeight: number, sourceWidth: number, sourceHeight: number, rotated?: boolean): void;
- /**
- * @deprecated
- */
- getPixel32(x: number, y: number): number[];
- /**
- * Obtain the color value for the specified pixel region
- * @param x The x coordinate of the pixel region
- * @param y The y coordinate of the pixel region
- * @param width The width of the pixel region
- * @param height The height of the pixel region
- * @returns Specifies the color value for the pixel region
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取指定像素区域的颜色值
- * @param x 像素区域的X轴坐标
- * @param y 像素区域的Y轴坐标
- * @param width 像素点的Y轴坐标
- * @param height 像素点的Y轴坐标
- * @returns 指定像素区域的颜色值
- * @version Egret 3.2.1
- * @platform Web
- * @language zh_CN
- */
- getPixels(x: number, y: number, width?: number, height?: number): number[];
- /**
- * Convert base64 string, if the picture (or pictures included) cross-border or null
- * @param type Type conversions, such as "image / png"
- * @param rect The need to convert the area
- * @param smoothing Whether to convert data to the smoothing process
- * @returns {any} base64 string
- * @version Egret 2.4
- * @language en_US
- */
- /**
- * 转换成base64字符串,如果图片(或者包含的图片)跨域,则返回null
- * @param type 转换的类型,如 "image/png"
- * @param rect 需要转换的区域
- * @param {any} encoderOptions 编码用的参数
- * @returns {any} base64字符串
- * @version Egret 2.4
- * @language zh_CN
- */
- toDataURL(type: string, rect?: egret.Rectangle, encoderOptions?: any): string;
- /**
- * Crop designated area and save it as image.
- * native support only "image / png" and "image / jpeg"; Web browser because of the various implementations are not the same, it is recommended to use only these two kinds.
- * @param type Type conversions, such as "image / png"
- * @param filePath The path name of the image (the home directory for the game's private space, the path can not have "../",Web supports only pass names.)
- * @param rect The need to convert the area
- * @version Egret 2.4
- * @platform Native
- * @language en_US
- */
- /**
- * 裁剪指定区域并保存成图片。
- * native只支持 "image/png" 和 "image/jpeg";Web中由于各个浏览器的实现不一样,因此建议也只用这2种。
- * @param type 转换的类型,如 "image/png"
- * @param filePath 图片的名称的路径(主目录为游戏的私有空间,路径中不能有 "../",Web只支持传名称。)
- * @param rect 需要转换的区域
- * @version Egret 2.4
- * @platform Native
- * @language zh_CN
- */
- saveToFile(type: string, filePath: string, rect?: egret.Rectangle): void;
- /**
- * dispose texture
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 释放纹理
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- dispose(): void;
- }
-}
-declare namespace egret {
- /**
- * The Event class is used as the base class for the creation of Event objects, which are passed as parameters to event
- * listeners when an event occurs.The properties of the Event class carry basic information about an event, such as
- * the event's type or whether the event's default behavior can be canceled. For many events, such as the events represented
- * by the Event class constants, this basic information is sufficient. Other events, however, may require more detailed
- * information. Events associated with a touch tap, for example, need to include additional information about the
- * location of the touch event. You can pass such additional information to event listeners by extending the Event class,
- * which is what the TouchEvent class does. Egret API defines several Event subclasses for common events that require
- * additional information. Events associated with each of the Event subclasses are described in the documentation for
- * each class.The methods of the Event class can be used in event listener functions to affect the behavior of the event
- * object. Some events have an associated default behavior. Your event listener can cancel this behavior by calling the
- * preventDefault() method. You can also make the current event listener the last one to process an event by calling
- * the stopPropagation() or stopImmediatePropagation() method.
- * @see egret.EventDispatcher
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/Event.ts
- * @see http://edn.egret.com/cn/docs/page/798 取消触摸事件
- * @language en_US
- */
- /**
- * Event 类作为创建事件实例的基类,当发生事件时,Event 实例将作为参数传递给事件侦听器。Event 类的属性包含有关事件的基本信息,例如事件
- * 的类型或者是否可以取消事件的默认行为。对于许多事件(如由 Event 类常量表示的事件),此基本信息就足够了。但其他事件可能需要更详细的信息。
- * 例如,与触摸关联的事件需要包括有关触摸事件的位置信息。您可以通过扩展 Event 类(TouchEvent 类执行的操作)将此类其他信息传递给事件侦听器。
- * Egret API 为需要其他信息的常见事件定义多个 Event 子类。与每个 Event 子类关联的事件将在每个类的文档中加以介绍。Event 类的方法可以在
- * 事件侦听器函数中使用以影响事件对象的行为。某些事件有关联的默认行为,通过调用 preventDefault() 方法,您的事件侦听器可以取消此行为。
- * 可以通过调用 stopPropagation() 或 stopImmediatePropagation() 方法,将当前事件侦听器作为处理事件的最后一个事件侦听器。
- * @see egret.EventDispatcher
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/Event.ts
- * @see http://edn.egret.com/cn/docs/page/798 取消触摸事件
- * @language zh_CN
- */
- class Event extends HashObject {
- /**
- * Dispatched when a display object is added to the on stage display list, either directly or through the addition
- * of a sub tree in which the display object is contained.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在将显示对象直接添加到舞台显示列表或将包含显示对象的子树添加至舞台显示列表中时调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ADDED_TO_STAGE: string;
- /**
- * Dispatched when a display object is about to be removed from the display list, either directly or through the removal
- * of a sub tree in which the display object is contained.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在从显示列表中直接删除显示对象或删除包含显示对象的子树时调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static REMOVED_FROM_STAGE: string;
- /**
- * Dispatched when a display object is added to the display list.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将显示对象添加到显示列表中时调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ADDED: string;
- /**
- * Dispatched when a display object is about to be removed from the display list.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将要从显示列表中删除显示对象时调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static REMOVED: string;
- /**
- * [broadcast event] Dispatched when the playhead is entering a new frame.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * [广播事件] 进入新的一帧,监听此事件将会在下一帧开始时触发一次回调。这是一个广播事件,可以在任何一个显示对象上监听,无论它是否在显示列表中。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ENTER_FRAME: string;
- /**
- * Dispatched when the display list is about to be updated and rendered.
- * Note: Every time you want to receive a render event,you must call the stage.invalidate() method.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 渲染事件,监听此事件将会在本帧末即将开始渲染的前一刻触发回调,这是一个广播事件,可以在任何一个显示对象上监听,无论它是否在显示列表中。
- * 注意:每次您希望 Egret 发送 Event.RENDER 事件时,都必须调用 stage.invalidate() 方法,由于每帧只会触发一次屏幕刷新,
- * 若在 Event.RENDER 回调函数执行期间再次调用stage.invalidate(),将会被忽略。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static RENDER: string;
- /**
- * Dispatched when the size of stage or UIComponent is changed.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 舞台尺寸或UI组件尺寸发生改变
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static RESIZE: string;
- /**
- * Dispatched when the value or selection of a property is chaned.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 属性值或状态发生改变。通常是按钮的选中状态,或者列表的选中项索引改变。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static CHANGE: string;
- /**
- * Dispatched when the value or selection of a property is going to change.you can cancel this by calling the
- * preventDefault() method.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 属性值或状态即将发生改变,通常是按钮的选中状态,或者列表的选中项索引改变。可以通过调用 preventDefault() 方法阻止索引发生更改。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static CHANGING: string;
- /**
- * Dispatched when the net request is complete.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 网络请求加载完成
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static COMPLETE: string;
- /**
- * Dispatched when loop completed.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 循环完成。循环最后一次只派发 COMPLETE 事件,不派发 LOOP_COMPLETE 事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static LOOP_COMPLETE: string;
- /**
- * Dispatched when the TextInput instance gets focus.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * TextInput实例获得焦点
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static FOCUS_IN: string;
- /**
- * Dispatched when the TextInput instance loses focus.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * TextInput实例失去焦点
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static FOCUS_OUT: string;
- /**
- * Dispatched when the playback is ended.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 动画声音等播放完成
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ENDED: string;
- /**
- * 游戏激活
- * @version Egret 2.4
- * @platform Web,Native
- */
- static ACTIVATE: string;
- /**
- * 取消激活
- * @version Egret 2.4
- * @platform Web,Native
- */
- static DEACTIVATE: string;
- /**
- * Event.CLOSE 常量定义 close 事件对象的 type 属性的值。
- * @version Egret 2.4
- * @platform Web,Native
- */
- static CLOSE: string;
- /**
- * Event.CONNECT 常量定义 connect 事件对象的 type 属性的值。
- * @version Egret 2.4
- * @platform Web,Native
- */
- static CONNECT: string;
- /**
- * Event.LEAVE_STAGE 常量定义 leaveStage 事件对象的 type 属性的值。
- * @version Egret 2.4
- * @platform Web,Native
- */
- static LEAVE_STAGE: string;
- /**
- * Event.SOUND_COMPLETE 常量定义 在声音完成播放后调度。
- * @version Egret 2.4
- * @platform Web,Native
- */
- static SOUND_COMPLETE: string;
- /**
- * Creates an Event object to pass as a parameter to event listeners.
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @param data the optional data associated with this event
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个作为参数传递给事件侦听器的 Event 对象。
- * @param type 事件的类型,可以作为 Event.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @param data 与此事件对象关联的可选数据。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean, data?: any);
- /**
- * the optional data associated with this event
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 与此事件对象关联的可选数据。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- data: any;
- /**
- * @private
- */
- $type: string;
- /**
- * The type of event. The type is case-sensitive.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 事件的类型。类型区分大小写。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly type: string;
- /**
- * @private
- */
- $bubbles: boolean;
- /**
- * Indicates whether an event is a bubbling event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示事件是否为冒泡事件。如果事件可以冒泡,则此值为 true;否则为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly bubbles: boolean;
- /**
- * @private
- */
- $cancelable: boolean;
- /**
- * Indicates whether the behavior associated with the event can be prevented. If the behavior can be
- * canceled, this value is true; otherwise it is false.
- * @see #preventDefault()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示是否可以阻止与事件相关联的行为。如果可以取消该行为,则此值为 true;否则为 false。
- * @see #preventDefault()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly cancelable: boolean;
- /**
- * @private
- */
- $eventPhase: number;
- /**
- * The current phase in the event flow. This property can contain the following numeric values:
- * The capture phase (EventPhase.CAPTURING_PHASE).
- * The target phase (EventPhase.AT_TARGET)
- * The bubbling phase (EventPhase.BUBBLING_PHASE).
- * @see egret.EventPhase
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 事件流中的当前阶段。此属性可以包含以下数值:
- * 捕获阶段 (EventPhase.CAPTURING_PHASE)。
- * 目标阶段 (EventPhase.AT_TARGET)。
- * 冒泡阶段 (EventPhase.BUBBLING_PHASE)。
- * @see egret.EventPhase
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly eventPhase: number;
- /**
- * @private
- */
- $currentTarget: any;
- /**
- * The object that is actively processing the Event object with an event listener. For example, if a
- * user clicks an OK button, the current target could be the node containing that button or one of its ancestors
- * that has registered an event listener for that event.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当前正在使用某个事件侦听器处理 Event 对象的对象。例如,如果用户单击“确定”按钮,
- * 则当前目标可以是包含该按钮的节点,也可以是它的已为该事件注册了事件侦听器的始祖之一。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly currentTarget: any;
- /**
- * @private
- */
- $target: any;
- /**
- * The event target. This property contains the target node. For example, if a user clicks an OK button,
- * the target node is the display list node containing that button.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 事件目标。此属性包含目标节点。例如,如果用户单击“确定”按钮,则目标节点就是包含该按钮的显示列表节点。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly target: any;
- $setTarget(target: any): boolean;
- /**
- * @private
- */
- $isDefaultPrevented: boolean;
- /**
- * Checks whether the preventDefault() method has been called on the event. If the preventDefault() method has been
- * called, returns true; otherwise, returns false.
- * @returns If preventDefault() has been called, returns true; otherwise, returns false.
- * @see #preventDefault()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 检查是否已对事件调用 preventDefault() 方法。
- * @returns 如果已调用 preventDefault() 方法,则返回 true;否则返回 false。
- * @see #preventDefault()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- isDefaultPrevented(): boolean;
- /**
- * Cancels an event's default behavior if that behavior can be canceled.Many events have associated behaviors that
- * are carried out by default. For example, if a user types a character into a text input, the default behavior
- * is that the character is displayed in the text input. Because the TextEvent.TEXT_INPUT event's default behavior
- * can be canceled, you can use the preventDefault() method to prevent the character from appearing.
- * You can use the Event.cancelable property to check whether you can prevent the default behavior associated with
- * a particular event. If the value of Event.cancelable is true, then preventDefault() can be used to cancel the event;
- * otherwise, preventDefault() has no effect.
- * @see #cancelable
- * @see #isDefaultPrevented
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 如果可以取消事件的默认行为,则取消该行为。
- * 许多事件都有默认执行的关联行为。例如,如果用户在文本字段中键入一个字符,则默认行为就是在文本字段中显示该字符。
- * 由于可以取消 TextEvent.TEXT_INPUT 事件的默认行为,因此您可以使用 preventDefault() 方法来防止显示该字符。
- * 您可以使用 Event.cancelable 属性来检查是否可以防止与特定事件关联的默认行为。如果 Event.cancelable 的值为 true,
- * 则可以使用 preventDefault() 来取消事件;否则,preventDefault() 无效。
- * @see #cancelable
- * @see #isDefaultPrevented
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- preventDefault(): void;
- /**
- * @private
- */
- $isPropagationStopped: boolean;
- /**
- * Prevents processing of any event listeners in nodes subsequent to the current node in the event flow. This method
- * does not affect any event listeners in the current node (currentTarget). In contrast, the stopImmediatePropagation()
- * method prevents processing of event listeners in both the current node and subsequent nodes. Additional calls to this
- * method have no effect. This method can be called in any phase of the event flow.
- * Note: This method does not cancel the behavior associated with this event; see preventDefault() for that functionality.
- * @see #stopImmediatePropagation()
- * @see #preventDefault()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 防止对事件流中当前节点的后续节点中的所有事件侦听器进行处理。此方法不会影响当前节点 currentTarget 中的任何事件侦听器。
- * 相比之下,stopImmediatePropagation() 方法可以防止对当前节点中和后续节点中的事件侦听器进行处理。
- * 对此方法的其它调用没有任何效果。可以在事件流的任何阶段中调用此方法。
- * 注意:此方法不会取消与此事件相关联的行为;有关此功能的信息,请参阅 preventDefault()。
- * @see #stopImmediatePropagation()
- * @see #preventDefault()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- stopPropagation(): void;
- /**
- * @private
- */
- $isPropagationImmediateStopped: boolean;
- /**
- * Prevents processing of any event listeners in the current node and any subsequent nodes in the event flow.
- * This method takes effect immediately, and it affects event listeners in the current node. In contrast, the
- * stopPropagation() method doesn't take effect until all the event listeners in the current node finish processing.
- * Note: This method does not cancel the behavior associated with this event; see preventDefault() for that functionality.
- * @see #stopPropagation()
- * @see #preventDefault()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 防止对事件流中当前节点中和所有后续节点中的事件侦听器进行处理。此方法会立即生效,并且会影响当前节点中的事件侦听器。
- * 相比之下,在当前节点中的所有事件侦听器都完成处理之前,stopPropagation() 方法不会生效。
- * 注意:此方法不会取消与此事件相关联的行为;有关此功能的信息,请参阅 preventDefault()。
- * @see #stopPropagation()
- * @see #preventDefault()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- stopImmediatePropagation(): void;
- /**
- * This method will be called automatically when you pass the event object as the parameters to the Event.release() method.
- * If your custom event is designed for reusable,you should override this method to make sure all the references to external
- * objects are cleaned. if not,it may cause memory leaking.
- * @see egret.Event.create()
- * @see egret.Event.release()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当事件实例传递给Event.release()静态方法时,实例上的clean()方法将会被自动调用。
- * 若此自定义事件的实例设计为可以循环复用的,为了避免引起内存泄露,自定义事件需要覆盖此方法来确保实例被缓存前断开对外部对象的一切引用。
- * @see egret.Event.create()
- * @see egret.Event.release()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- protected clean(): void;
- /**
- * EventDispatcher object using the specified event object thrown Event. Objects thrown objects will be cached in the pool for the next round robin.
- * @param target the event target
- * @param type The type of the event. Event listeners can access this information through the inherited type property.
- * @param bubbles Determines whether the Event object bubbles. Event listeners can access this information through
- * the inherited bubbles property.
- * @param data {any} data
- * @method egret.Event.dispatchEvent
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用指定的 EventDispatcher 对象来抛出 Event 事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
- * @param target {egret.IEventDispatcher} 派发事件目标
- * @param type {string} 事件类型
- * @param bubbles {boolean} 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param data {any} 事件data
- * @method egret.Event.dispatchEvent
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static dispatchEvent(target: IEventDispatcher, type: string, bubbles?: boolean, data?: any): boolean;
- /**
- * @private
- *
- * @param EventClass
- * @returns
- */
- static _getPropertyData(EventClass: any): any;
- /**
- * Gets one event instance from the object pool or create a new one. We highly recommend using the Event.create()
- * and Event.release() methods to create and release an event object,it can reduce the number of reallocate objects,
- * which allows you to get better code execution performance.
- * Note: If you want to use this method to initialize your custom event object,you must make sure the constructor
- * of your custom event is the same as the constructor of egret.Event.
- * @param EventClass Event Class。
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @example
- *
- * let event = Event.create(Event,type, bubbles);
- * event.data = data; //optional,initializes custom data here
- * this.dispatchEvent(event);
- * Event.release(event);
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从对象池中取出或创建一个新的事件实例。我们建议您尽可能使用Event.create()和Event.release() 这一对方法来创建和释放事件对象,
- * 这一对方法会将事件实例在内部缓存下来供下次循环使用,减少对象的创建次数,从而获得更高的代码运行性能。
- * 注意:若使用此方法来创建自定义事件的实例,自定义的构造函数参数列表必须跟Event类一致。
- * @param EventClass Event类名。
- * @param type 事件的类型,可以作为 Event.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @example
- *
- * let event = Event.create(Event,type, bubbles);
- * event.data = data; //可选,若指定义事件上需要附加其他参数,可以在获取实例后在此处设置。
- * this.dispatchEvent(event);
- * Event.release(event);
- *
- * @see #clean()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static create(EventClass: {
- new (type: string, bubbles?: boolean, cancelable?: boolean): T;
- eventPool?: Event[];
- }, type: string, bubbles?: boolean, cancelable?: boolean): T;
- /**
- * Releases an event object and cache it into the object pool.We highly recommend using the Event.create()
- * and Event.release() methods to create and release an event object,it can reduce the number of reallocate objects,
- * which allows you to get better code execution performance.
- * Note: The parameters of this method only accepts an instance created by the Event.create() method.
- * if not,it may throw an error.
- * @example
- *
- * let event = Event.create(Event,type, bubbles);
- * event.data = data; //optional,initializes custom data here
- * this.dispatchEvent(event);
- * Event.release(event);
- *
- * @see #clean()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 释放一个事件对象,并缓存到对象池。我们建议您尽可能使用Event.create()和Event.release() 这一对方法来创建和释放事件对象,
- * 这一对方法会将事件实例在内部缓存下来供下次循环使用,减少对象的创建次数,从而获得更高的代码运行性能。
- * 注意:此方法只能传入由Event.create()创建的事件实例,传入非法对象实例可能会导致报错。
- * @example
- *
- * let event = Event.create(Event,type, bubbles);
- * event.data = data; //可选,若指定义事件上需要附加其他参数,可以在获取实例后在此处设置。
- * this.dispatchEvent(event);
- * Event.release(event);
- *
- * @see #clean()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static release(event: Event): void;
- }
-}
-/**
- * Is debug mode.
- * @version Egret 2.5
- * @platform Web,Native
- * @language en_US
- */
-/**
- * 是否为 debug 模式。
- * @version Egret 2.5
- * @platform Web,Native
- * @language zh_CN
- */
-declare let DEBUG: boolean;
-/**
- * Is release mode.
- * @version Egret 2.5
- * @platform Web,Native
- * @language en_US
- */
-/**
- * 是否为 release 模式。
- * @version Egret 2.5
- * @platform Web,Native
- * @language zh_CN
- */
-declare let RELEASE: boolean;
-declare namespace egret {
- /**
- * @private
- */
- function $error(code: number, ...params: any[]): void;
- /**
- * @private
- */
- function $warn(code: number, ...params: any[]): void;
- /**
- * @private
- */
- function getString(code: number, ...params: any[]): string;
- /**
- * @private
- */
- function $markCannotUse(instance: any, property: string, defaultVale: any): void;
-}
-declare namespace egret {
- /**
- * The Point object represents a location in a two-dimensional coordinate system, where x represents the horizontal
- * axis and y represents the vertical axis.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/geom/Point.ts
- * @language en_US
- */
- /**
- * Point 对象表示二维坐标系统中的某个位置,其中 x 表示水平轴,y 表示垂直轴。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/geom/Point.ts
- * @language zh_CN
- */
- class Point extends HashObject {
- /**
- * Releases a point instance to the object pool
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 释放一个Point实例到对象池
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static release(point: Point): void;
- /**
- * get a point instance from the object pool or create a new one.
- * @param x The horizontal coordinate.
- * @param y The vertical coordinate.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从对象池中取出或创建一个新的Point对象。
- * @param x 该对象的x属性值,默认为0
- * @param y 该对象的y属性值,默认为0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static create(x: number, y: number): Point;
- /**
- * Creates a new point. If you pass no parameters to this method, a point is created at (0,0).
- * @param x The horizontal coordinate.
- * @param y The vertical coordinate.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 egret.Point 对象.若不传入任何参数,将会创建一个位于(0,0)位置的点。
- * @param x 该对象的x属性值,默认为0
- * @param y 该对象的y属性值,默认为0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(x?: number, y?: number);
- /**
- * The horizontal coordinate.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 该点的水平坐标。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- x: number;
- /**
- * The vertical coordinate.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 该点的垂直坐标。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- y: number;
- /**
- * The length of the line segment from (0,0) to this point.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从 (0,0) 到此点的线段长度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly length: number;
- /**
- * Sets the members of Point to the specified values
- * @param x The horizontal coordinate.
- * @param y The vertical coordinate.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将 Point 的成员设置为指定值
- * @param x 该对象的x属性值
- * @param y 该对象的y属性值
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- setTo(x: number, y: number): Point;
- /**
- * Creates a copy of this Point object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 克隆点对象
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- clone(): Point;
- /**
- * Determines whether two points are equal. Two points are equal if they have the same x and y values.
- * @param toCompare The point to be compared.
- * @returns A value of true if the object is equal to this Point object; false if it is not equal.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定两个点是否相同。如果两个点具有相同的 x 和 y 值,则它们是相同的点。
- * @param toCompare 要比较的点。
- * @returns 如果该对象与此 Point 对象相同,则为 true 值,如果不相同,则为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- equals(toCompare: Point): boolean;
- /**
- * Returns the distance between pt1 and pt2.
- * @param p1 The first point.
- * @param p2 The second point.
- * @returns The distance between the first and second points.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回 pt1 和 pt2 之间的距离。
- * @param p1 第一个点
- * @param p2 第二个点
- * @returns 第一个点和第二个点之间的距离。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static distance(p1: Point, p2: Point): number;
- /**
- * Copies all of the point data from the source Point object into the calling Point object.
- * @param sourcePoint The Point object from which to copy the data.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将源 Point 对象中的所有点数据复制到调用方 Point 对象中。
- * @param sourcePoint 要从中复制数据的 Point 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- copyFrom(sourcePoint: Point): void;
- /**
- * Adds the coordinates of another point to the coordinates of this point to create a new point.
- * @param v The point to be added.
- * @returns The new point.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将另一个点的坐标添加到此点的坐标以创建一个新点。
- * @param v 要添加的点。
- * @returns 新点。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- add(v: Point): Point;
- /**
- * Determines a point between two specified points.
- * The parameter f determines where the new interpolated point is located relative to the two end points specified by parameters pt1 and pt2. The closer the value of the parameter f is to 1.0, the closer the interpolated point is to the first point (parameter pt1). The closer the value of the parameter f is to 0, the closer the interpolated point is to the second point (parameter pt2).
- * @param pt1 The first point.
- * @param pt2 The second point.
- * @param f The level of interpolation between the two points. Indicates where the new point will be, along the line between pt1 and pt2. If f=1, pt1 is returned; if f=0, pt2 is returned.
- * @returns The new interpolated point.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定两个指定点之间的点。
- * 参数 f 确定新的内插点相对于参数 pt1 和 pt2 指定的两个端点所处的位置。参数 f 的值越接近 1.0,则内插点就越接近第一个点(参数 pt1)。参数 f 的值越接近 0,则内插点就越接近第二个点(参数 pt2)。
- * @param pt1 第一个点。
- * @param pt2 第二个点。
- * @param f 两个点之间的内插级别。表示新点将位于 pt1 和 pt2 连成的直线上的什么位置。如果 f=1,则返回 pt1;如果 f=0,则返回 pt2。
- * @returns 新的内插点。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static interpolate(pt1: Point, pt2: Point, f: number): Point;
- /**
- * Scales the line segment between (0,0) and the current point to a set length.
- * @param thickness The scaling value. For example, if the current point is (0,5), and you normalize it to 1, the point returned is at (0,1).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将 (0,0) 和当前点之间的线段缩放为设定的长度。
- * @param thickness 缩放值。例如,如果当前点为 (0,5) 并且您将它规范化为 1,则返回的点位于 (0,1) 处。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- normalize(thickness: number): void;
- /**
- * Offsets the Point object by the specified amount. The value of dx is added to the original value of x to create the new x value. The value of dy is added to the original value of y to create the new y value.
- * @param dx The amount by which to offset the horizontal coordinate, x.
- * @param dy The amount by which to offset the vertical coordinate, y.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 按指定量偏移 Point 对象。dx 的值将添加到 x 的原始值中以创建新的 x 值。dy 的值将添加到 y 的原始值中以创建新的 y 值。
- * @param dx 水平坐标 x 的偏移量。
- * @param dy 水平坐标 y 的偏移量。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- offset(dx: number, dy: number): void;
- /**
- * Converts a pair of polar coordinates to a Cartesian point coordinate.
- * @param len The length coordinate of the polar pair.
- * @param angle The angle, in radians, of the polar pair.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将一对极坐标转换为笛卡尔点坐标。
- * @param len 极坐标对的长度。
- * @param angle 极坐标对的角度(以弧度表示)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static polar(len: number, angle: number): Point;
- /**
- * Subtracts the coordinates of another point from the coordinates of this point to create a new point.
- * @param v The point to be subtracted.
- * @returns The new point.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从此点的坐标中减去另一个点的坐标以创建一个新点。
- * @param v 要减去的点。
- * @returns 新点。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- subtract(v: Point): Point;
- /**
- * Returns a string that contains the values of the x and y coordinates. The string has the form "(x=x, y=y)", so calling the toString() method for a point at 23,17 would return "(x=23, y=17)".
- * @returns The string representation of the coordinates.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回包含 x 和 y 坐标的值的字符串。该字符串的格式为 "(x=x, y=y)",因此为点 23,17 调用 toString() 方法将返回 "(x=23, y=17)"。
- * @returns 坐标的字符串表示形式。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- toString(): string;
- }
- /**
- * @private
- * 仅供框架内复用,要防止暴露引用到外部。
- */
- let $TempPoint: Point;
-}
-declare namespace egret {
- /**
- * The DisplayObjectContainer class is a basic display list building block: a display list node that can contain children.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/DisplayObjectContainer.ts
- * @language en_US
- */
- /**
- * DisplayObjectContainer 类是基本显示列表构造块:一个可包含子项的显示列表节点。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/DisplayObjectContainer.ts
- * @language zh_CN
- */
- class DisplayObjectContainer extends DisplayObject {
- /**
- * @private
- */
- static $EVENT_ADD_TO_STAGE_LIST: DisplayObject[];
- /**
- * @private
- */
- static $EVENT_REMOVE_FROM_STAGE_LIST: DisplayObject[];
- /**
- * Creates a new DisplayObjectContainer instance.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 实例化一个容器
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor();
- /**
- * Returns the number of children of this object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回此对象的子项数目。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly numChildren: number;
- /**
- * Adds a child DisplayObject instance to this DisplayObjectContainer instance. The child is added to the front
- * (top) of all other children in this DisplayObjectContainer instance. (To add a child to a specific index position,
- * use the addChildAt() method.)If you add a child object that already has a different display object container
- * as a parent, the object is removed from the child list of the other display object container.
- * @param child The DisplayObject instance to add as a child of this DisplayObjectContainer instance.
- * @returns 在 child The DisplayObject instance that you pass in the child parameter.
- * @see #addChildAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将一个 DisplayObject 子实例添加到该 DisplayObjectContainer 实例中。子项将被添加到该 DisplayObjectContainer 实例中其他
- * 所有子项的前(上)面。(要将某子项添加到特定索引位置,请使用 addChildAt() 方法。)
- * @param child 要作为该 DisplayObjectContainer 实例的子项添加的 DisplayObject 实例。
- * @returns 在 child 参数中传递的 DisplayObject 实例。
- * @see #addChildAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- addChild(child: DisplayObject): DisplayObject;
- /**
- * Adds a child DisplayObject instance to this DisplayObjectContainer instance. The child is added at the index position
- * specified. An index of 0 represents the back (bottom) of the display list for this DisplayObjectContainer object.
- * If you add a child object that already has a different display object container as a parent, the object is removed
- * from the child list of the other display object container.
- * @param child The DisplayObject instance to add as a child of this DisplayObjectContainer instance.
- * @param index The index position to which the child is added. If you specify a currently occupied index position,
- * the child object that exists at that position and all higher positions are moved up one position in the child list.
- * @returns The DisplayObject instance that you pass in the child parameter.
- * @see #addChild()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将一个 DisplayObject 子实例添加到该 DisplayObjectContainer 实例中。该子项将被添加到指定的索引位置。索引为 0 表示该
- * DisplayObjectContainer 对象的显示列表的后(底)部。如果添加一个已将其它显示对象容器作为父项的子对象,则会从其它显示对象容器的子列表中删除该对象。
- * @param child 要作为该 DisplayObjectContainer 实例的子项添加的 DisplayObject 实例。
- * @param index 添加该子项的索引位置。 如果指定当前占用的索引位置,则该位置以及所有更高位置上的子对象会在子级列表中上移一个位置。
- * @returns 在 child 参数中传递的 DisplayObject 实例。
- * @see #addChild()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- addChildAt(child: DisplayObject, index: number): DisplayObject;
- /**
- * @private
- */
- $doAddChild(child: DisplayObject, index: number, notifyListeners?: boolean): DisplayObject;
- /**
- * Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance
- * itself. The search includes the entire display list including this DisplayObjectContainer instance. Grandchildren,
- * great-grandchildren, and so on each return true.
- * @param child The child object to test.
- * @returns true if the child object is a child of the DisplayObjectContainer or the container itself; otherwise false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定指定显示对象是 DisplayObjectContainer 实例的子项或该实例本身。搜索包括整个显示列表(其中包括此 DisplayObjectContainer 实例)。
- * 孙项、曾孙项等,每项都返回 true。
- * @param child 要测试的子对象。
- * @returns 如果 child 对象是 DisplayObjectContainer 的子项或容器本身,则为 true;否则为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- contains(child: DisplayObject): boolean;
- /**
- * Returns the child display object instance that exists at the specified index.
- * @param index The index position of the child object.
- * @returns The child display object at the specified index position.
- * @see #getChildByName()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回位于指定索引处的子显示对象实例。
- * @param index 子对象的索引位置。
- * @returns 位于指定索引位置处的子显示对象。
- * @see #getChildByName()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- getChildAt(index: number): DisplayObject;
- /**
- * Returns the index position of a child DisplayObject instance.
- * @param child The DisplayObject instance to identify.
- * @returns The index position of the child display object to identify.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回 DisplayObject 的 child 实例的索引位置。
- * @param child 要测试的子对象。
- * @returns 要查找的子显示对象的索引位置。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- getChildIndex(child: egret.DisplayObject): number;
- /**
- * Returns the child display object that exists with the specified name. If more that one child display object has
- * the specified name, the method returns the first object in the child list.The getChildAt() method is faster than
- * the getChildByName() method. The getChildAt() method accesses a child from a cached array, whereas the getChildByName()
- * method has to traverse a linked list to access a child.
- * @param name The name of the child to return.
- * @returns The child display object with the specified name.
- * @see #getChildAt()
- * @see egret.DisplayObject#name
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回具有指定名称的子显示对象。如果多个子显示对象具有指定名称,则该方法会返回子级列表中的第一个对象。
- * getChildAt() 方法比 getChildByName() 方法快。getChildAt() 方法从缓存数组中访问子项,而 getChildByName() 方法则必须遍历链接的列表来访问子项。
- * @param name 要返回的子项的名称。
- * @returns 具有指定名称的子显示对象。
- * @see #getChildAt()
- * @see egret.DisplayObject#name
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- getChildByName(name: string): DisplayObject;
- /**
- * Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance.
- * The parent property of the removed child is set to null , and the object is garbage collected if no other references
- * to the child exist. The index positions of any display objects above the child in the DisplayObjectContainer are
- * decreased by 1.
- * @param child The DisplayObject instance to remove.
- * @returns The DisplayObject instance that you pass in the child parameter.
- * @see #removeChildAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从 DisplayObjectContainer 实例的子列表中删除指定的 child DisplayObject 实例。将已删除子项的 parent 属性设置为 null;
- * 如果不存在对该子项的任何其它引用,则将该对象作为垃圾回收。DisplayObjectContainer 中该子项之上的任何显示对象的索引位置都减去 1。
- * @param child 要删除的 DisplayObject 实例。
- * @returns 在 child 参数中传递的 DisplayObject 实例。
- * @see #removeChildAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- removeChild(child: DisplayObject): DisplayObject;
- /**
- * Removes a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer.
- * The parent property of the removed child is set to null, and the object is garbage collected if no other references
- * to the child exist. The index positions of any display objects above the child in the DisplayObjectContainer are decreased by 1.
- * @param index The child index of the DisplayObject to remove.
- * @returns The DisplayObject instance that was removed.
- * @see #removeChild()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从 DisplayObjectContainer 的子列表中指定的 index 位置删除子 DisplayObject。将已删除子项的 parent 属性设置为 null;
- * 如果没有对该子项的任何其他引用,则将该对象作为垃圾回收。DisplayObjectContainer 中该子项之上的任何显示对象的索引位置都减去 1。
- * @param index 要删除的 DisplayObject 的子索引。
- * @returns 已删除的 DisplayObject 实例。
- * @see #removeChild()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- removeChildAt(index: number): DisplayObject;
- /**
- * @private
- */
- $doRemoveChild(index: number, notifyListeners?: boolean): DisplayObject;
- /**
- * Changes the position of an existing child in the display object container. This affects the layering of child objects.
- * @param child The child DisplayObject instance for which you want to change the index number.
- * @param index The resulting index number for the child display object.
- * @see #addChildAt()
- * @see #getChildAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 更改现有子项在显示对象容器中的位置。这会影响子对象的分层。
- * @param child 要为其更改索引编号的 DisplayObject 子实例。
- * @param index 生成的 child 显示对象的索引编号。当新的索引编号小于0或大于已有子元件数量时,新加入的DisplayObject对象将会放置于最上层。
- * @see #addChildAt()
- * @see #getChildAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- setChildIndex(child: DisplayObject, index: number): void;
- /**
- * @private
- */
- private doSetChildIndex(child, index);
- /**
- * Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child
- * list. All other child objects in the display object container remain in the same index positions.
- * @param index1 The index position of the first child object.
- * @param index2 The index position of the second child object.
- * @see #swapChildren()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在子级列表中两个指定的索引位置,交换子对象的 Z 轴顺序(前后顺序)。显示对象容器中所有其他子对象的索引位置保持不变。
- * @param index1 第一个子对象的索引位置。
- * @param index2 第二个子对象的索引位置。
- * @see #swapChildren()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- swapChildrenAt(index1: number, index2: number): void;
- /**
- * Swaps the z-order (front-to-back order) of the two specified child objects. All other child objects in the
- * display object container remain in the same index positions.
- * @param child1 The first child object.
- * @param child2 The second child object.
- * @see #swapChildrenAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 交换两个指定子对象的 Z 轴顺序(从前到后顺序)。显示对象容器中所有其他子对象的索引位置保持不变。
- * @param child1 第一个子对象。
- * @param child2 第二个子对象。
- * @see #swapChildrenAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- swapChildren(child1: DisplayObject, child2: DisplayObject): void;
- /**
- * @private
- */
- private doSwapChildrenAt(index1, index2);
- /**
- * Removes all child DisplayObject instances from the child list of the DisplayObjectContainer instance. The parent
- * property of the removed children is set to null , and the objects are garbage collected if no other references to the children exist.
- * @see #removeChild()
- * @see #removeChildAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从 DisplayObjectContainer 实例的子级列表中删除所有 child DisplayObject 实例。
- * @see #removeChild()
- * @see #removeChildAt()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- removeChildren(): void;
- /**
- * @private
- * 一个子项被添加到容器内,此方法不仅在操作addChild()时会被回调,在操作setChildIndex()或swapChildren时也会回调。
- * 当子项索引发生改变时,会先触发$childRemoved()方法,然后触发$childAdded()方法。
- */
- $childAdded(child: DisplayObject, index: number): void;
- /**
- * @private
- * 一个子项从容器内移除,此方法不仅在操作removeChild()时会被回调,在操作setChildIndex()或swapChildren时也会回调。
- * 当子项索引发生改变时,会先触发$childRemoved()方法,然后触发$childAdded()方法。
- */
- $childRemoved(child: DisplayObject, index: number): void;
- /**
- * @private
- */
- $onAddToStage(stage: Stage, nestLevel: number): void;
- /**
- * @private
- *
- */
- $onRemoveFromStage(): void;
- /**
- * @private
- */
- $measureChildBounds(bounds: Rectangle): void;
- $touchChildren: boolean;
- /**
- * Determines whether or not the children of the object are touch, or user input device, enabled. If an object is
- * enabled, a user can interact with it by using a touch or user input device.
- * @default true
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定对象的子级是否支持触摸或用户输入设备。如果对象支持触摸或用户输入设备,用户可以通过使用触摸或用户输入设备与之交互。
- * @default true
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- touchChildren: boolean;
- /**
- * @private
- *
- * @returns
- */
- $getTouchChildren(): boolean;
- /**
- * @private
- */
- $setTouchChildren(value: boolean): boolean;
- /**
- * @private
- */
- $hitTest(stageX: number, stageY: number): DisplayObject;
- }
-}
-declare namespace egret {
- /**
- * SpriteSheet is a mosaic of multiple sub-bitmaps, comprising a plurality of Texture objects.
- * Each Texture object shares the set bitmap of SpriteSheet, but it points to its different areas.
- * On WebGL / OpenGL, this operation can significantly improve performance.
- * At the same time, SpriteSheet can carry out material integration easily to reduce the number of HTTP requests
- * For specification of the SpriteSheet format, see the document https://github.com/egret-labs/egret-core/wiki/Egret-SpriteSheet-Specification
- * @see http://edn.egret.com/cn/docs/page/135 The use of texture packs
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/SpriteSheet.ts
- * @language en_US
- */
- /**
- * SpriteSheet 是一张由多个子位图拼接而成的集合位图,它包含多个 Texture 对象。
- * 每一个 Texture 都共享 SpriteSheet 的集合位图,但是指向它的不同的区域。
- * 在WebGL / OpenGL上,这种做法可以显著提升性能
- * 同时,SpriteSheet可以很方便的进行素材整合,降低HTTP请求数量
- * SpriteSheet 格式的具体规范可以参见此文档 https://github.com/egret-labs/egret-core/wiki/Egret-SpriteSheet-Specification
- * @see http://edn.egret.com/cn/docs/page/135 纹理集的使用
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/SpriteSheet.ts
- * @language zh_CN
- */
- class SpriteSheet extends HashObject {
- /**
- * Create an egret.SpriteSheet object
- * @param texture {Texture} Texture
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 egret.SpriteSheet 对象
- * @param texture {Texture} 纹理
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(texture: Texture);
- /**
- * @private
- * 表示这个SpriteSheet的位图区域在bitmapData上的起始位置x。
- */
- private _bitmapX;
- /**
- * @private
- * 表示这个SpriteSheet的位图区域在bitmapData上的起始位置y。
- */
- private _bitmapY;
- /**
- * @private
- * 共享的位图数据
- */
- $texture: Texture;
- /**
- * @private
- * 纹理缓存字典
- */
- _textureMap: MapLike;
- /**
- * Obtain a cached Texture object according to the specified texture name
- * @param name {string} Cache the name of this Texture object
- * @returns {egret.Texture} The Texture object
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 根据指定纹理名称获取一个缓存的 Texture 对象
- * @param name {string} 缓存这个 Texture 对象所使用的名称
- * @returns {egret.Texture} Texture 对象
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- getTexture(name: string): Texture;
- /**
- * Create a new Texture object for the specified area on SpriteSheet and cache it
- * @param name {string} Cache the name of this Texture object. If the name already exists, the previous Texture object will be overwrited.
- * @param bitmapX {number} Starting coordinate x of texture area on bitmapData
- * @param bitmapY {number} Starting coordinate y of texture area on bitmapData
- * @param bitmapWidth {number} Width of texture area on bitmapData
- * @param bitmapHeight {number} Height of texture area on bitmapData
- * @param offsetX {number} Starting point x for a non-transparent area of the original bitmap
- * @param offsetY {number} Starting point y for a non-transparent area of the original bitmap
- * @param textureWidth {number} Width of the original bitmap. If it is not passed, use the bitmapWidth value.
- * @param textureHeight {number} Height of the original bitmap. If it is not passed, use the bitmapHeight value.
- * @returns {egret.Texture} The created Texture object
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 为 SpriteSheet 上的指定区域创建一个新的 Texture 对象并缓存它
- * @param name {string} 缓存这个 Texture 对象所使用的名称,如果名称已存在,将会覆盖之前的 Texture 对象
- * @param bitmapX {number} 纹理区域在 bitmapData 上的起始坐标x
- * @param bitmapY {number} 纹理区域在 bitmapData 上的起始坐标y
- * @param bitmapWidth {number} 纹理区域在 bitmapData 上的宽度
- * @param bitmapHeight {number} 纹理区域在 bitmapData 上的高度
- * @param offsetX {number} 原始位图的非透明区域 x 起始点
- * @param offsetY {number} 原始位图的非透明区域 y 起始点
- * @param textureWidth {number} 原始位图的高度,若不传入,则使用 bitmapWidth 的值。
- * @param textureHeight {number} 原始位图的宽度,若不传入,则使用 bitmapHeight 的值。
- * @returns {egret.Texture} 创建的 Texture 对象
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- createTexture(name: string, bitmapX: number, bitmapY: number, bitmapWidth: number, bitmapHeight: number, offsetX?: number, offsetY?: number, textureWidth?: number, textureHeight?: number): Texture;
- /**
- * dispose texture
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 释放纹理
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- dispose(): void;
- }
-}
-declare namespace egret {
- /**
- * @private
- */
- let $locale_strings: any;
- /**
- * @private
- */
- let $language: string;
-}
-declare namespace egret.sys {
- /**
- * @private
- * 全局多语言翻译函数
- * @param code 要查询的字符串代码
- * @param args 替换字符串中{0}标志的参数列表
- * @returns 返回拼接后的字符串
- */
- function tr(code: number, ...args: any[]): string;
-}
-declare namespace egret {
- /**
- * The Bitmap class represents display objects that represent bitmap images.
- * The Bitmap() constructor allows you to create a Bitmap object that contains a reference to a BitmapData object.
- * After you create a Bitmap object, use the addChild() or addChildAt() method of the parent DisplayObjectContainer
- * instance to place the bitmap on the display list.A Bitmap object can share its texture reference among several
- * Bitmap objects, independent of translation or rotation properties. Because you can create multiple Bitmap objects
- * that reference the same texture object, multiple display objects can use the same complex texture object
- * without incurring the memory overhead of a texture object for each display object instance.
- *
- * @see egret.Texture
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Bitmap.ts
- * @language en_US
- */
- /**
- * Bitmap 类表示用于显示位图图片的显示对象。
- * 利用 Bitmap() 构造函数,可以创建包含对 BitmapData 对象引用的 Bitmap 对象。创建了 Bitmap 对象后,
- * 使用父级 DisplayObjectContainer 实例的 addChild() 或 addChildAt() 方法可以将位图放在显示列表中。
- * 一个 Bitmap 对象可在若干 Bitmap 对象之中共享其 texture 引用,与缩放或旋转属性无关。
- * 由于能够创建引用相同 texture 对象的多个 Bitmap 对象,因此,多个显示对象可以使用相同的 texture 对象,
- * 而不会因为每个显示对象实例使用一个 texture 对象而产生额外内存开销。
- *
- * @see egret.Texture
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Bitmap.ts
- * @language zh_CN
- */
- class Bitmap extends DisplayObject {
- /**
- * Initializes a Bitmap object to refer to the specified Texture object.
- * @param value The Texture object being referenced.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个引用指定 Texture 实例的 Bitmap 对象
- * @param value 被引用的 Texture 实例
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(value?: Texture);
- protected $texture: Texture;
- $bitmapData: BitmapData;
- protected $bitmapX: number;
- protected $bitmapY: number;
- protected $bitmapWidth: number;
- protected $bitmapHeight: number;
- protected $offsetX: number;
- protected $offsetY: number;
- protected $textureWidth: number;
- protected $textureHeight: number;
- protected $sourceWidth: number;
- protected $sourceHeight: number;
- protected $smoothing: boolean;
- protected $explicitBitmapWidth: number;
- protected $explicitBitmapHeight: number;
- protected createNativeDisplayObject(): void;
- /**
- * @private
- * 显示对象添加到舞台
- */
- $onAddToStage(stage: Stage, nestLevel: number): void;
- /**
- * @private
- * 显示对象从舞台移除
- */
- $onRemoveFromStage(): void;
- /**
- * The Texture object being referenced.
- * If you pass the constructor of type BitmapData or last set for bitmapData, this value returns null.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 被引用的 Texture 对象。
- * 如果传入构造函数的类型为 BitmapData 或者最后设置的为 bitmapData,则此值返回 null。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- texture: Texture;
- /**
- * @private
- */
- $setTexture(value: Texture): boolean;
- $setBitmapData(value: any): void;
- /**
- * @private
- */
- protected setBitmapDataToWasm(data?: Texture): void;
- /**
- * @private
- */
- $refreshImageData(): void;
- /**
- * @private
- */
- private setImageData(bitmapData, bitmapX, bitmapY, bitmapWidth, bitmapHeight, offsetX, offsetY, textureWidth, textureHeight, sourceWidth, sourceHeight);
- /**
- * @private
- */
- $scale9Grid: egret.Rectangle;
- /**
- * Represent a Rectangle Area that the 9 scale area of Image.
- * Notice: This property is valid only when fillMode
- * is BitmapFillMode.SCALE
.
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 矩形区域,它定义素材对象的九个缩放区域。
- * 注意:此属性仅在fillMode
为BitmapFillMode.SCALE
时有效。
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- scale9Grid: egret.Rectangle;
- protected $setScale9Grid(value: egret.Rectangle): void;
- /**
- * @private
- */
- $fillMode: string;
- /**
- * Determines how the bitmap fills in the dimensions.
- * When set to BitmapFillMode.REPEAT
, the bitmap
- * repeats to fill the region.
- * When set to BitmapFillMode.SCALE
, the bitmap
- * stretches to fill the region.
- *
- * @default BitmapFillMode.SCALE
- *
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 确定位图填充尺寸的方式。
- * 设置为 BitmapFillMode.REPEAT
时,位图将重复以填充区域。
- * 设置为 BitmapFillMode.SCALE
时,位图将拉伸以填充区域。
- *
- * @default BitmapFillMode.SCALE
- *
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- fillMode: string;
- $setFillMode(value: string): boolean;
- /**
- * The default value of whether or not is smoothed when scaled.
- * When object such as Bitmap is created,smoothing property will be set to this value.
- * @default true。
- * @version Egret 3.0
- * @platform Web
- * @language en_US
- */
- /**
- * 控制在缩放时是否进行平滑处理的默认值。
- * 在 Bitmap 等对象创建时,smoothing 属性会被设置为该值。
- * @default true。
- * @version Egret 3.0
- * @platform Web
- * @language zh_CN
- */
- static defaultSmoothing: boolean;
- /**
- * Whether or not the bitmap is smoothed when scaled.
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 控制在缩放时是否对位图进行平滑处理。
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- smoothing: boolean;
- /**
- * @private
- *
- * @param value
- */
- $setWidth(value: number): boolean;
- /**
- * @private
- *
- * @param value
- */
- $setHeight(value: number): boolean;
- /**
- * @private
- * 获取显示宽度
- */
- $getWidth(): number;
- /**
- * @private
- * 获取显示宽度
- */
- $getHeight(): number;
- /**
- * @private
- */
- $measureContentBounds(bounds: Rectangle): void;
- /**
- * @private
- */
- $updateRenderNode(): void;
- private _pixelHitTest;
- /**
- * Specifies whether this object use precise hit testing by checking the alpha value of each pixel.If pixelHitTest
- * is set to true,the transparent area of the bitmap will be touched through.
- * Note:If the image is loaded from cross origin,that we can't access to the pixel data,so it might cause
- * the pixelHitTest property invalid.
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 是否开启精确像素碰撞。设置为true显示对象本身的透明区域将能够被穿透。
- * 注意:若图片资源是以跨域方式从外部服务器加载的,将无法访问图片的像素数据,而导致此属性失效。
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- pixelHitTest: boolean;
- $hitTest(stageX: number, stageY: number): DisplayObject;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 渲染节点类型
- */
- const enum RenderNodeType {
- /**
- * 位图渲染节点
- */
- BitmapNode = 1,
- /**
- * 文本渲染节点
- */
- TextNode = 2,
- /**
- * 矢量渲染节点
- */
- GraphicsNode = 3,
- /**
- * 组渲染节点
- */
- GroupNode = 4,
- /**
- * Mesh 节点
- */
- MeshNode = 5,
- /**
- * 普通位图渲染节点
- */
- NormalBitmapNode = 6,
- }
- /**
- * @private
- * 渲染节点基类
- */
- class RenderNode {
- /**
- * 节点类型..
- */
- type: number;
- /**
- * 绘制数据
- */
- drawData: any[];
- /**
- * 绘制次数
- */
- protected renderCount: number;
- /**
- * 在显示对象的$updateRenderNode()方法被调用前,自动清空自身的drawData数据。
- */
- cleanBeforeRender(): void;
- $getRenderCount(): number;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 路径类型
- */
- const enum PathType {
- /**
- * 纯色填充路径
- */
- Fill = 1,
- /**
- * 渐变填充路径
- */
- GradientFill = 2,
- /**
- * 线条路径
- */
- Stroke = 3,
- }
- /**
- * @private
- * 2D路径命令
- */
- const enum PathCommand {
- MoveTo = 1,
- LineTo = 2,
- CurveTo = 3,
- CubicCurveTo = 4,
- }
- /**
- * @private
- * 2D路径
- */
- class Path2D {
- /**
- * 路径类型
- */
- type: number;
- $commands: number[];
- $data: number | number[][];
- protected commandPosition: number;
- protected dataPosition: number;
- /**
- * 当前移动到的坐标X
- * 注意:目前只有drawArc之前会被赋值
- */
- $lastX: number;
- /**
- * 当前移动到的坐标Y
- * 注意:目前只有drawArc之前会被赋值
- */
- $lastY: number;
- /**
- * 将当前绘图位置移动到 (x, y)。如果缺少任何一个参数,则此方法将失败,并且当前绘图位置不改变。
- * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
- * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
- */
- moveTo(x: number, y: number): void;
- /**
- * 使用当前线条样式绘制一条从当前绘图位置开始到 (x, y) 结束的直线;当前绘图位置随后会设置为 (x, y)。
- * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
- * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
- */
- lineTo(x: number, y: number): void;
- /**
- * 使用当前线条样式和由 (controlX, controlY) 指定的控制点绘制一条从当前绘图位置开始到 (anchorX, anchorY) 结束的二次贝塞尔曲线。当前绘图位置随后设置为 (anchorX, anchorY)。
- * 如果在调用 moveTo() 方法之前调用了 curveTo() 方法,则当前绘图位置的默认值为 (0, 0)。如果缺少任何一个参数,则此方法将失败,并且当前绘图位置不改变。
- * 绘制的曲线是二次贝塞尔曲线。二次贝塞尔曲线包含两个锚点和一个控制点。该曲线内插这两个锚点,并向控制点弯曲。
- * @param controlX 一个数字,指定控制点相对于父显示对象注册点的水平位置。
- * @param controlY 一个数字,指定控制点相对于父显示对象注册点的垂直位置。
- * @param anchorX 一个数字,指定下一个锚点相对于父显示对象注册点的水平位置。
- * @param anchorY 一个数字,指定下一个锚点相对于父显示对象注册点的垂直位置。
- */
- curveTo(controlX: number, controlY: number, anchorX: number, anchorY: number): void;
- /**
- * 从当前绘图位置到指定的锚点绘制一条三次贝塞尔曲线。三次贝塞尔曲线由两个锚点和两个控制点组成。该曲线内插这两个锚点,并向两个控制点弯曲。
- * @param controlX1 指定首个控制点相对于父显示对象的注册点的水平位置。
- * @param controlY1 指定首个控制点相对于父显示对象的注册点的垂直位置。
- * @param controlX2 指定第二个控制点相对于父显示对象的注册点的水平位置。
- * @param controlY2 指定第二个控制点相对于父显示对象的注册点的垂直位置。
- * @param anchorX 指定锚点相对于父显示对象的注册点的水平位置。
- * @param anchorY 指定锚点相对于父显示对象的注册点的垂直位置。
- */
- cubicCurveTo(controlX1: number, controlY1: number, controlX2: number, controlY2: number, anchorX: number, anchorY: number): void;
- /**
- * 绘制一个矩形
- * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
- * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
- * @param width 矩形的宽度(以像素为单位)。
- * @param height 矩形的高度(以像素为单位)。
- */
- drawRect(x: number, y: number, width: number, height: number): void;
- /**
- * 绘制一个圆角矩形。
- * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
- * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
- * @param width 矩形的宽度(以像素为单位)。
- * @param height 矩形的高度(以像素为单位)。
- * @param ellipseWidth 用于绘制圆角的椭圆的宽度(以像素为单位)。
- * @param ellipseHeight 用于绘制圆角的椭圆的高度(以像素为单位)。 (可选)如果未指定值,则默认值与为 ellipseWidth 参数提供的值相匹配。
- */
- drawRoundRect(x: number, y: number, width: number, height: number, ellipseWidth: number, ellipseHeight?: number): void;
- /**
- * 绘制一个圆。
- * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
- * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
- * @param radius 圆的半径(以像素为单位)。
- */
- drawCircle(x: number, y: number, radius: number): void;
- /**
- * 绘制一个椭圆。
- * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
- * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
- * @param width 矩形的宽度(以像素为单位)。
- * @param height 矩形的高度(以像素为单位)。
- */
- drawEllipse(x: number, y: number, width: number, height: number): void;
- /**
- * 绘制一段圆弧路径。圆弧路径的圆心在 (x, y) 位置,半径为 r ,根据anticlockwise (默认为顺时针)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
- * @param x 圆弧中心(圆心)的 x 轴坐标。
- * @param y 圆弧中心(圆心)的 y 轴坐标。
- * @param radius 圆弧的半径。
- * @param startAngle 圆弧的起始点, x轴方向开始计算,单位以弧度表示。
- * 注意,必须在0~2π之间。
- * @param endAngle 圆弧的终点, 单位以弧度表示。
- * 注意,必须在0~2π之间。
- * @param anticlockwise 如果为 true,逆时针绘制圆弧,反之,顺时针绘制。
- */
- drawArc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean): void;
- /**
- * 绘制一段圆弧路径
- * @param x 圆弧中心(圆心)的 x 轴坐标。
- * @param y 圆弧中心(圆心)的 y 轴坐标。
- * @param radiusX 圆弧的半径 x。
- * @param radiusY 圆弧的半径 y。
- * @param startAngle 圆弧的起始点, x轴方向开始计算,单位以弧度表示。
- * 注意:必须为正数。
- * @param endAngle 圆弧的终点, 单位以弧度表示。
- * 注意:与startAngle差值必须在0~2π之间。
- * @param anticlockwise 如果为 true,逆时针绘制圆弧,反之,顺时针绘制。
- * 注意:如果为true,endAngle必须小于startAngle,反之必须大于。
- */
- private arcToBezier(x, y, radiusX, radiusY, startAngle, endAngle, anticlockwise?);
- }
-}
-declare namespace egret {
- /**
- * Writes an error message to the console if the assertion is false. If the assertion is true, nothing will happen.
- * @param assertion Any boolean expression. If the assertion is false, the message will get written to the console.
- * @param message the message written to the console
- * @param optionalParams the extra messages written to the console
- * @language en_US
- */
- /**
- * 判断参数assertion是否为true,若为false则抛出异常并且在console输出相应信息,反之什么也不做。
- * @param assertion 一个 boolean 表达式,若结果为false,则抛出错误并输出信息。
- * @param message 要输出到控制台的信息
- * @param optionalParams 要输出到控制台的额外可选信息
- * @language zh_CN
- */
- function assert(assertion?: boolean, message?: string, ...optionalParams: any[]): void;
- /**
- * Writes a warning message to the console.
- * @param message the message written to the console
- * @param optionalParams the extra messages written to the console
- * @language en_US
- */
- /**
- * 输出一个警告信息到控制台。
- * @param message 要输出到控制台的信息
- * @param optionalParams 要输出到控制台的额外信息
- * @language zh_CN
- */
- function warn(message?: any, ...optionalParams: any[]): void;
- /**
- * Writes an error message to the console.
- * @param message the message written to the console
- * @param optionalParams the extra messages written to the console
- * @language en_US
- */
- /**
- * 输出一个错误信息到控制台。
- * @param message 要输出到控制台的信息
- * @param optionalParams 要输出到控制台的额外信息
- * @language zh_CN
- */
- function error(message?: any, ...optionalParams: any[]): void;
- /**
- * Writes an message to the console.
- * @param message the message written to the console
- * @param optionalParams the extra messages written to the console
- * @language en_US
- */
- /**
- * 输出一个日志信息到控制台。
- * @param message 要输出到控制台的信息
- * @param optionalParams 要输出到控制台的额外信息
- * @language zh_CN
- */
- function log(message?: any, ...optionalParams: any[]): void;
-}
-/**
- * @private
- */
-declare namespace egret {
- /**
- * @private
- */
- let fontMapping: {};
-}
-/**
- * @private
- */
-declare namespace egret_native {
- function readUpdateFileSync(filePath: any): any;
- function readResourceFileSync(filePath: any): any;
- function sendInfoToPlugin(info: string): void;
- function receivedPluginInfo(info: string): void;
- function nrInit(): void;
- function nrDownloadBuffers(callback: (displayCmdBuffer: Float32Array) => void): void;
- function nrSetRenderMode(mode: number): void;
- function nrRenderDisplayObject(id: number, scale: number, useClip: boolean, clipX: number, clipY: number, clipW: number, clipH: number): void;
- function nrRenderDisplayObject2(id: number, offsetX: number, offsetY: number, forHitTest: boolean): void;
- function nrLocalToGlobal(id: number, localX: number, localY: number): string;
- function nrGlobalToLocal(id: number, globalX: number, globalY: number): string;
- function nrGetTextFieldWidth(id: number): number;
- function nrGetTextFieldHeight(id: number): number;
- function nrGetTextWidth(id: number): number;
- function nrGetTextHeight(id: number): number;
- function nrResize(width: number, height: number): void;
- function nrSetCanvasScaleFactor(factor: number, scalex: number, scaley: number): void;
- function nrUpdate(): void;
- function nrRender(): void;
- function nrSendTextFieldData(textFieldId: number, strData: string): void;
- function nrUpdateCallbackList(dt: number): void;
- function nrActiveBuffer(id: number, width: number, height: number): void;
- function nrGetPixels(x: number, y: number, width: number, height: number, pixels: Uint8Array): void;
- class NrNode {
- constructor(id: number, type: number);
- }
-}
-/**
- * @private
- */
-declare namespace egret_native {
- let rootWebGLBuffer: egret.sys.RenderBuffer;
- let forHitTest: boolean;
- let addModuleCallback: (callback: Function, thisObj: any) => void;
- let initNativeRender: () => void;
- let updateNativeRender: () => void;
- let activateBuffer: (buffer: egret.sys.RenderBuffer) => void;
- let getJsCustomFilterVertexSrc: (key: any) => any;
- let getJsCustomFilterFragSrc: (key: any) => any;
- let getJsCustomFilterUniforms: (key: any) => any;
- let nrABIVersion: number;
- let nrMinEgretVersion: string;
-}
-declare namespace egret_native {
- /**
- * @private
- */
- class NativeRenderSurface {
- width: number;
- height: number;
- constructor(currRenderBuffer: any, w?: number, h?: number, root?: boolean);
- resize(w: number, h: number): void;
- }
- /**
- * @private
- */
- class NativeDisplayObject {
- id: number;
- constructor(type: number);
- addChildAt(childId: number, index: number): void;
- removeChild(childId: number): void;
- swapChild(index1: number, index2: number): void;
- setX(value: number): void;
- setY(value: number): void;
- setRotation(value: number): void;
- setScaleX(value: number): void;
- setScaleY(value: number): void;
- setSkewX(value: number): void;
- setSkewY(value: number): void;
- setAlpha(value: number): void;
- setAnchorOffsetX(value: number): void;
- setAnchorOffsetY(value: number): void;
- setVisible(value: boolean): void;
- setBlendMode(value: number): void;
- setMaskRect(x: number, y: number, w: number, h: number): void;
- setScrollRect(x: number, y: number, w: number, h: number): void;
- setFilters(filters: Array): void;
- static createFilter(filter: egret.Filter): void;
- static setFilterPadding(filterId: number, paddingTop: number, paddingBottom: number, paddingLeft: number, paddingRight: number): void;
- setMask(value: number): void;
- setBitmapData(value: egret.Texture): void;
- setBitmapDataToMesh(value: egret.Texture): void;
- setBitmapDataToParticle(value: egret.Texture): void;
- setStopToParticle(value: boolean): void;
- setCustomData(config: any): void;
- setWidth(value: number): void;
- setHeight(value: number): void;
- setCacheAsBitmap(value: boolean): void;
- setBitmapFillMode(fillMode: string): void;
- setScale9Grid(x: number, y: number, w: number, h: number): void;
- setMatrix(a: number, b: number, c: number, d: number, tx: number, ty: number): void;
- setIsTyping(value: boolean): void;
- setDataToBitmapNode(id: number, texture: egret.Texture, arr: number[]): void;
- setDataToMesh(vertexArr: number[], indiceArr: number[], uvArr: number[]): void;
- static setDataToFilter(currFilter: egret.Filter): void;
- static disposeTexture(texture: egret.Texture): void;
- static disposeBitmapData(bitmapData: egret.BitmapData): void;
- static disposeTextData(node: egret.TextField): void;
- static disposeGraphicData(graphic: egret.Graphics): void;
- setFontSize(value: number): void;
- setLineSpacing(value: number): void;
- setTextColor(value: number): void;
- setTextFieldWidth(value: number): void;
- setTextFieldHeight(value: number): void;
- setFontFamily(value: string): void;
- setTextFlow(textArr: Array): void;
- setTextAlign(value: string): void;
- setVerticalAlign(value: string): void;
- setText(value: string): void;
- setBold(value: boolean): void;
- setItalic(value: boolean): void;
- setWordWrap(value: boolean): void;
- setMaxChars(value: number): void;
- setType(value: string): void;
- setStrokeColor(value: number): void;
- setStroke(value: number): void;
- setScrollV(value: number): void;
- setMultiline(value: boolean): void;
- setBorder(value: boolean): void;
- setBorderColor(value: number): void;
- setBackground(value: boolean): void;
- setBackgroundColor(value: number): void;
- setInputType(value: string): void;
- setBeginFill(color: number, alpha?: number): void;
- setBeginGradientFill(type: string, colors: number[], alphas: number[], ratios: number[], matrix: egret.Matrix): void;
- setEndFill(): void;
- setLineStyle(thickness?: number, color?: number, alpha?: number, pixelHinting?: boolean, scaleMode?: string, caps?: string, joints?: string, miterLimit?: number, lineDash?: number[]): void;
- setDrawRect(x: number, y: number, width: number, height: number): void;
- setDrawRoundRect(x: number, y: number, width: number, height: number, ellipseWidth: number, ellipseHeight?: number): void;
- setDrawCircle(x: number, y: number, radius: number): void;
- setDrawEllipse(x: number, y: number, width: number, height: number): void;
- setMoveTo(x: number, y: number): void;
- setLineTo(x: number, y: number): void;
- setCurveTo(controlX: number, controlY: number, anchorX: number, anchorY: number): void;
- setCubicCurveTo(controlX1: number, controlY1: number, controlX2: number, controlY2: number, anchorX: number, anchorY: number): void;
- setDrawArc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
- setGraphicsClear(): void;
- }
-}
-/**
- * @private
- */
-declare namespace egret_native {
- /**
- * @private
- */
- const enum NativeObjectType {
- /**
- * 容器
- */
- CONTAINER = 0,
- /**
- * 位图
- */
- BITMAP = 1,
- /**
- * 位图数据
- */
- BITMAP_DATA = 2,
- /**
- * 滤镜
- */
- FILTER = 6,
- /**
- * 文本
- */
- TEXT = 7,
- /**
- * 矢量绘图
- */
- GRAPHICS = 8,
- /**
- * 含一个适量绘图的容器
- */
- SPRITE = 9,
- /**
- * 粒子系统
- */
- PARTICLE_SYSTEM = 10,
- /**
- * 位图文本
- */
- BITMAP_TEXT = 11,
- /**
- * 网格
- */
- MESH = 12,
- /**
- * 舞台(根容器)
- */
- STAGE = 13,
- }
-}
-declare namespace egret {
- /**
- * @private
- */
- interface MapLike {
- [key: string]: T;
- [key: number]: T;
- }
- /**
- * @private
- */
- function createMap(): MapLike;
-}
-declare namespace egret {
- /**
- * @class egret.GlowFilter
- * @classdesc
- * 使用 GlowFilter 类可以对显示对象应用发光效果。在投影滤镜的 distance 和 angle 属性设置为 0 时,发光滤镜与投影滤镜极为相似。
- * @extends egret.Filter
- * @version Egret 3.1.4
- * @platform Web,Native
- */
- class GlowFilter extends Filter {
- /**
- * @private
- */
- $red: number;
- /**
- * @private
- */
- $green: number;
- /**
- * @private
- */
- $blue: number;
- /**
- * Initializes a new GlowFilter instance.
- * @method egret.GlowFilter#constructor
- * @param color {number} The color of the glow. Valid values are in the hexadecimal format 0xRRGGBB. The default value is 0xFF0000.
- * @param alpha {number} The alpha transparency value for the color. Valid values are 0 to 1. For example, .25 sets a transparency value of 25%. The default value is 1.
- * @param blurX {number} The amount of horizontal blur. Valid values are 0 to 255 (floating point).
- * @param blurY {number} The amount of vertical blur. Valid values are 0 to 255 (floating point).
- * @param strength {number} The strength of the imprint or spread. The higher the value, the more color is imprinted and the stronger the contrast between the glow and the background. Valid values are 0 to 255.
- * @param quality {number} The number of times to apply the filter.
- * @param inner {boolean} Specifies whether the glow is an inner glow. The value true indicates an inner glow. The default is false, an outer glow (a glow around the outer edges of the object).
- * @param knockout {number} Specifies whether the object has a knockout effect. A value of true makes the object's fill transparent and reveals the background color of the document. The default value is false (no knockout effect).
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 初始化 GlowFilter 对象
- * @method egret.GlowFilter#constructor
- * @param color {number} 光晕颜色,采用十六进制格式 0xRRGGBB。默认值为 0xFF0000。
- * @param alpha {number} 颜色的 Alpha 透明度值。有效值为 0 到 1。例如,0.25 设置透明度值为 25%。
- * @param blurX {number} 水平模糊量。有效值为 0 到 255(浮点)。
- * @param blurY {number} 垂直模糊量。有效值为 0 到 255(浮点)。
- * @param strength {number} 印记或跨页的强度。该值越高,压印的颜色越深,而且发光与背景之间的对比度也越强。有效值为 0 到 255。
- * @param quality {number} 应用滤镜的次数。暂未实现。
- * @param inner {boolean} 指定发光是否为内侧发光。值 true 指定发光是内侧发光。值 false 指定发光是外侧发光(对象外缘周围的发光)。
- * @param knockout {number} 指定对象是否具有挖空效果。值为 true 将使对象的填充变为透明,并显示文档的背景颜色。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- constructor(color?: number, alpha?: number, blurX?: number, blurY?: number, strength?: number, quality?: number, inner?: boolean, knockout?: boolean);
- /**
- * @private
- */
- $color: number;
- /**
- * The color of the glow.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 光晕颜色。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- color: number;
- /**
- * @private
- */
- $alpha: number;
- /**
- * The alpha transparency value for the color.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 颜色的 Alpha 透明度值。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- alpha: number;
- /**
- * @private
- */
- $blurX: number;
- /**
- * The amount of horizontal blur.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 水平模糊量。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- blurX: number;
- /**
- * @private
- */
- $blurY: number;
- /**
- * The amount of vertical blur.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 垂直模糊量。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- blurY: number;
- /**
- * @private
- */
- $strength: number;
- /**
- * The strength of the imprint or spread.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 印记或跨页的强度。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- strength: number;
- /**
- * @private
- */
- $quality: number;
- /**
- * The number of times to apply the filter.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 应用滤镜的次数。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- quality: number;
- /**
- * @private
- */
- $inner: boolean;
- /**
- * Specifies whether the glow is an inner glow.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 指定发光是否为内侧发光。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- inner: boolean;
- /**
- * @private
- */
- $knockout: boolean;
- /**
- * Specifies whether the object has a knockout effect.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 指定对象是否具有挖空效果。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- knockout: boolean;
- /**
- * @private
- */
- $toJson(): string;
- protected updatePadding(): void;
- }
-}
-declare namespace egret {
- /**
- * A class that provides constant values for visual blend mode effects. These constants are used in the blendMode
- * property of the DisplayObject class.
- * @see egret.DisplayObject#blendMode
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/BlendMode.ts
- * @see http://edn.egret.com/cn/docs/page/108 显示容器的概念与实现
- * @language en_US
- */
- /**
- * 提供混合模式可视效果的常量值的类,通常用于 DisplayObject 的 blendMode 属性上。
- * @see egret.DisplayObject#blendMode
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/BlendMode.ts
- * @see http://edn.egret.com/cn/docs/page/108 显示容器的概念与实现
- * @language zh_CN
- */
- class BlendMode {
- /**
- * The display object appears in front of the background. Pixel values of the display object override the pixel
- * values of the background. Where the display object is transparent, the background is visible.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 该显示对象出现在背景前面。显示对象的像素值会覆盖背景的像素值。在显示对象为透明的区域,背景是可见的。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static NORMAL: string;
- /**
- * Adds the values of the constituent colors of the display object to the colors of its background, applying a
- * ceiling of 0xFF. This setting is commonly used for animating a lightening dissolve between two objects.
- * For example, if the display object has a pixel with an RGB value of 0xAAA633, and the background pixel has an
- * RGB value of 0xDD2200, the resulting RGB value for the displayed pixel is 0xFFC833 (because 0xAA + 0xDD > 0xFF,
- * 0xA6 + 0x22 = 0xC8, and 0x33 + 0x00 = 0x33).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将显示对象的原色值添加到它的背景颜色中,上限值为 0xFF。此设置通常用于使两个对象间的加亮溶解产生动画效果。
- * 例如,如果显示对象的某个像素的 RGB 值为 0xAAA633,背景像素的 RGB 值为 0xDD2200,则显示像素的结果 RGB 值为 0xFFC833
- * (因为 0xAA + 0xDD > 0xFF,0xA6 + 0x22 = 0xC8,且 0x33 + 0x00 = 0x33)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ADD: string;
- /**
- * Erases the background based on the alpha value of the display object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 根据显示对象的 Alpha 值擦除背景。Alpha 值不为0的区域将被擦除。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ERASE: string;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 转换 blendMode 字符串为数字。
- */
- function blendModeToNumber(blendMode: string): number;
- /**
- * @private
- * 转换数字为 blendMode 字符串。
- */
- function numberToBlendMode(blendMode: number): string;
-}
-declare namespace egret {
- /**
- * The CapsStyle class is an enumeration of constant values that specify the caps style to use in drawing lines.
- * The constants are provided for use as values in the caps parameter of the egret.Graphics.lineStyle() method.
- * @see egret.Graphics#lineStyle()
- * @version Egret 2.5
- * @platform Web,Native
- * @language en_US
- */
- /**
- * CapsStyle 类是可指定在绘制线条中使用的端点样式的常量值枚举。常量可用作 egret.Graphics.lineStyle() 方法的 caps 参数中的值。
- * @see egret.Graphics#lineStyle()
- * @version Egret 2.5
- * @platform Web,Native
- * @language zh_CN
- */
- const CapsStyle: {
- NONE: string;
- ROUND: string;
- SQUARE: string;
- };
-}
-declare namespace egret {
- /**
- * @private
- */
- class WebGLUtils {
- static compileProgram(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string): WebGLProgram;
- static compileFragmentShader(gl: WebGLRenderingContext, shaderSrc: string): WebGLShader;
- static compileVertexShader(gl: WebGLRenderingContext, shaderSrc: string): WebGLShader;
- private static _compileShader(gl, shaderSrc, shaderType);
- private static canUseWebGL;
- static checkCanUseWebGL(): boolean;
- static deleteWebGLTexture(bitmapData: any): void;
- }
-}
-declare namespace egret {
- /**
- * The EventPhase class provides values for the eventPhase property of the Event class.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/EventPhase.ts
- * @language en_US
- */
- /**
- * EventPhase 可为 Event 类的 eventPhase 属性提供值。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/EventPhase.ts
- * @language zh_CN
- */
- const enum EventPhase {
- /**
- * The capturing phase, which is the first phase of the event flow.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 捕获阶段。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- CAPTURING_PHASE = 1,
- /**
- * The target phase, which is the second phase of the event flow.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 目标阶段,是事件流的第二个阶段。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- AT_TARGET = 2,
- /**
- * The bubbling phase, which is the third phase of the event flow.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 冒泡阶段。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- BUBBLING_PHASE = 3,
- }
-}
-declare namespace egret {
- /**
- * When the user changes the focus from one object in the display list to another object, the object dispatches a FocusEvent object. Currently only supports input text.
- * Focus events: FocusEvent.FOCUS_IN FocusEvent.FOCUS_OUT
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 用户将焦点从显示列表中的一个对象更改到另一个对象时,对象将调度 FocusEvent 对象。目前只支持输入文本。
- * 焦点事件:FocusEvent.FOCUS_IN FocusEvent.FOCUS_OUT
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class FocusEvent extends egret.Event {
- /**
- * Gets focus
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获得焦点
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static FOCUS_IN: "focusIn";
- /**
- * Loses focus
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 失去焦点
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static FOCUS_OUT: "focusOut";
- /**
- * Create a egret.FocusEvent objects
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 egret.FocusEvent 对象
- * @param type 事件的类型,可以作为 Event.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean);
- }
-}
-declare namespace egret {
- interface Geolocation {
- addEventListener(type: "ioError", listener: (this: Z, e: GeolocationEvent) => void, thisObject: Z, useCapture?: boolean, priority?: number): any;
- addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): any;
- }
- /**
- * The GeolocationEvent represents the position and altitude of the device on Earth,
- * and show errors occurred while getting the location of the device.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/sensor/Geolocation.ts
- * @see http://edn.egret.com/cn/docs/page/662 获取位置信息
- * @language en_US
- */
- /**
- * GeolocationEvent 提供设备的地理位置信息和获取位置时发生的错误信息
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/sensor/Geolocation.ts
- * @see http://edn.egret.com/cn/docs/page/662 获取位置信息
- * @language zh_CN
- */
- class GeolocationEvent extends Event {
- /**
- * The acquisition of the location information failed because of app don't have permission.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 由于用户拒绝访问位置信息,获取位置信息失败
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static PERMISSION_DENIED: string;
- /**
- * The acquisition of the location failed because at least one internal source of position returned an internal error.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 设备位置服务不可用或者超时等原因没有得到位置信息
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static UNAVAILABLE: string;
- /**
- * The position's longitude in decimal degrees.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当前位置的经度信息
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- longitude: number;
- /**
- * The position's latitude in decimal degrees.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当前位置的纬度信息
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- latitude: number;
- /**
- * The velocity of the device in meters per second. This value can be null.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当前设备的速度 单位是 米/秒,这个值可能为 null
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- speed: number;
- /**
- * The direction in which the device is traveling. This value, specified in degrees,
- * indicates how far off from heading due north the device is. 0 degrees represents
- * true true north, and the direction is determined clockwise (which means that east
- * is 90 degrees and west is 270 degrees). If speed is 0, heading is NaN. If the
- * device is unable to provide heading information, this value is null.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示设备正在前进的方向,单位是度。heading 表示从正北开始顺时针旋转到当前方向的角度,
- * 比如正东是 90 度,正西是 270 度,如果 speed 是 0,heading 为 NaN。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- heading: number;
- /**
- * The position's altitude in metres, relative to sea level.
- * This value can be null if the implementation cannot provide the data.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 该位置的海拔信息,如果设备没有实现这个属性时,这个值有可能为 null
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- altitude: number;
- /**
- * The accuracy of the latitude and longitude properties, expressed in meters.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 经纬度的准确性,单位是米
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- accuracy: number;
- /**
- * The accuracy of the altitude expressed in meters. This value can be null.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 该位置海拔信息的准确性,单位是米,这个值有可能为 null
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- altitudeAccuracy: number;
- /**
- * The type of error occurred while get the location of the device. The value could be:
- * @see egret.GeolocationEvent.PERMISSION_DENIED
- * @see egret.GeolocationEvent.UNAVAILABLE
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取位置信息错误时的错误类型。值可能为:
- * @see egret.GeolocationEvent.PERMISSION_DENIED
- * @see egret.GeolocationEvent.UNAVAILABLE
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- errorType: string;
- /**
- * The error message occurred while get the location of the device.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取位置信息错误的错误信息
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- errorMessage: string;
- }
-}
-declare namespace egret {
- /**
- * When a network request returns an HTTP status code, the application dispatches HTTPStatusEvent objects.
- * Before error or completion events will always send HTTPStatusEvent object. HTTPStatusEvent object does not necessarily indicate an error condition; it simply reflects the HTTP status code provided by the network stack (if any).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在网络请求返回 HTTP 状态代码时,应用程序将调度 HTTPStatusEvent 对象。
- * 在错误或完成事件之前,将始终发送 HTTPStatusEvent 对象。HTTPStatusEvent 对象不一定表示错误条件;它仅反映网络堆栈提供的 HTTP 状态代码(如果有的话)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class HTTPStatusEvent extends Event {
- /**
- * HTTPStatusEvent.HTTP_STATUS constant defines the value of the type property httpStatus event object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * HTTPStatusEvent.HTTP_STATUS 常量定义 httpStatus 事件对象的 type 属性值。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static HTTP_STATUS: "httpStatus";
- /**
- * Create a egret.HTTPStatusEvent objects
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 egret.HTTPStatusEvent 对象
- * @param type 事件的类型,可以作为 Event.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean);
- /**
- * @private
- */
- private _status;
- /**
- * he server returns the HTTP status code.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 由服务器返回的 HTTP 状态代码。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly status: number;
- /**
- * EventDispatcher object using the specified event object thrown Event. The objects will be thrown in the object cache pool for the next round robin.
- * @param target {egret.IEventDispatcher} Distribute event target
- * @param status {number} The server returns the HTTP status code
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用指定的EventDispatcher对象来抛出Event事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
- * @param target {egret.IEventDispatcher} 派发事件目标
- * @param status {number} 由服务器返回的 HTTP 状态代码
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static dispatchHTTPStatusEvent(target: IEventDispatcher, status: number): boolean;
- }
-}
-declare namespace egret {
- /**
- * The IEventDispatcher interface defines methods for adding or removing event listeners, checks whether specific types
- * of event listeners are registered, and dispatches events. Event targets are an important part of the Egret event model.
- * The event target serves as the focal point for how events flow through the display list hierarchy. When an event
- * such as a touch tap occurs, an event object is dispatched into the event flow from the root of the display list.
- * The event object makes a round-trip journey to the event target, which is conceptually divided into three phases:
- * the capture phase includes the journey from the root to the last node before the event target's node; the target
- * phase includes only the event target node; and the bubbling phase includes any subsequent nodes encountered on the
- * return trip to the root of the display list.In general, the easiest way for a user-defined class to gain event
- * dispatching capabilities is to extend EventDispatcher. If this is impossible (that is, if the class is already
- * extending another class), you can instead implement the IEventDispatcher interface, create an EventDispatcher member,
- * and write simple hooks to route calls into the aggregated EventDispatcher.
- * @see egret.EventDispatcher
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/IEventDispatcher.ts
- * @language en_US
- */
- /**
- * IEventDispatcher 接口定义用于添加或删除事件侦听器的方法,检查是否已注册特定类型的事件侦听器,并调度事件。
- * 事件目标是 Egret 事件模型的重要组成部分。事件目标是事件如何通过显示列表层次结构这一问题的焦点。当发生触摸轻拍事件时,
- * 会将事件对象调度到从显示列表根开始的事件流中。事件对象进行到事件目标的往返行程,在概念上,此往返行程被划分为三个阶段:
- * 捕获阶段包括从根到事件目标节点之前的最后一个节点的行程,目标阶段仅包括事件目标节点,冒泡阶段包括到显示列表的根的回程上遇到的任何后续节点。
- * 通常,使用户定义的类能够调度事件的最简单方法是扩展 EventDispatcher。如果无法扩展(即,如果该类已经扩展了另一个类),
- * 则可以实现 IEventDispatcher 接口,创建 EventDispatcher 成员,并编写一些简单的挂钩,将调用连接到聚合的 EventDispatcher 中。
- * @see egret.EventDispatcher
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/IEventDispatcher.ts
- * @language zh_CN
- */
- interface IEventDispatcher extends HashObject {
- /**
- * Registers an event listener object with an EventDispatcher object so that the listener receives notification of an
- * event. You can register event listeners on all nodes in the display list for a specific type of event, phase,
- * and priority.After you successfully register an event listener, you cannot change its priority through additional
- * calls to on(). To change a listener's priority, you must first call removeEventListener(). Then you can register the
- * listener again with the new priority level.After the listener is registered, subsequent calls to on() with a
- * different value for either type or useCapture result in the creation of a separate listener registration.
- * When you no longer need an event listener, remove it by calling EventDispatcher.removeEventListener(); otherwise, memory
- * problems might result. Objects with registered event listeners are not automatically removed from memory because
- * the garbage collector does not remove objects that still have references.Copying an EventDispatcher instance does
- * not copy the event listeners attached to it. (If your newly created node needs an event listener, you must attach
- * the listener after creating the node.) However, if you move an EventDispatcher instance, the event listeners attached
- * to it move along with it.If the event listener is being registered on a node while an event is also being processed
- * on this node, the event listener is not triggered during the current phase but may be triggered during a later phase
- * in the event flow, such as the bubbling phase.If an event listener is removed from a node while an event is being
- * processed on the node, it is still triggered by the current actions. After it is removed, the event listener is
- * never invoked again (unless it is registered again for future processing).
- * @param type The type of event.
- * @param listener The listener function that processes the event. This function must accept an event object as
- * its only parameter and must return nothing, as this example shows: function(evt:Event):void The function can
- * have any name.
- * @param thisObject the listener function's "this"
- * @param useCapture Determines whether the listener works in the capture phase or the bubbling phases. If useCapture
- * is set to true, the listener processes the event only during the capture phase and not in the bubbling phase.
- * If useCapture is false, the listener processes the event only during the bubbling phase. To listen for the event
- * in all three phases, call on() twice, once with useCapture set to true, then again with useCapture set to false.
- * @param priority The priority level of the event listener. Priorities are designated by a integer. The higher
- * the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1.
- * If two or more listeners share the same priority, they are processed in the order in which they were added.
- * The default priority is
- * @see #once()
- * @see #removeEventListener()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。可以为特定类型的事件、阶段和优先级在显示列表的所有节
- * 点上注册事件侦听器。成功注册一个事件侦听器后,无法通过额外调用 on() 来更改其优先级。要更改侦听器的优先级,必须
- * 先调用 removeEventListener()。然后,可以使用新的优先级再次注册该侦听器。注册该侦听器后,如果继续调用具有不同 type 或 useCapture
- * 值的 on(),则会创建单独的侦听器注册。
- * 如果不再需要某个事件侦听器,可调用 EventDispatcher.removeEventListener()
- * 删除它;否则会产生内存问题。由于垃圾回收器不会删除仍包含引用的对象,因此不会从内存中自动删除使用已注册事件侦听器的对象。复制
- * EventDispatcher 实例时并不复制其中附加的事件侦听器。(如果新近创建的节点需要一个事件侦听器,必须在创建该节点后附加该侦听器。)
- * 但是,如果移动 EventDispatcher 实例,则其中附加的事件侦听器也会随之移动。如果在正在处理事件的节点上注册事件侦听器,则不会在当
- * 前阶段触发事件侦听器,但会在事件流的稍后阶段触发,如冒泡阶段。如果从正在处理事件的节点中删除事件侦听器,则该事件侦听器仍由当前操
- * 作触发。删除事件侦听器后,决不会再次调用该事件侦听器(除非再次注册以备将来处理)。
- * @param type 事件的类型。
- * @param listener 处理事件的侦听器函数。此函数必须接受 Event 对象作为其唯一的参数,并且不能返回任何结果,
- * 如下面的示例所示: function(evt:Event):void 函数可以有任何名称。
- * @param thisObject 侦听函数绑定的this对象
- * @param useCapture 确定侦听器是运行于捕获阶段还是运行于冒泡阶段。如果将 useCapture 设置为 true,
- * 则侦听器只在捕获阶段处理事件,而不在冒泡阶段处理事件。如果 useCapture 为 false,则侦听器只在冒泡阶段处理事件。
- * 要在两个阶段都侦听事件,请调用 on() 两次:一次将 useCapture 设置为 true,一次将 useCapture 设置为 false。
- * @param priority 事件侦听器的优先级。优先级由一个带符号的整数指定。数字越大,优先级越高。优先级为 n 的所有侦听器会在
- * 优先级为 n -1 的侦听器之前得到处理。如果两个或更多个侦听器共享相同的优先级,则按照它们的添加顺序进行处理。默认优先级为 0。
- * @see #once()
- * @see #removeEventListener()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void;
- /**
- * Registers an event listener object with an EventDispatcher object so that the listener receives notification of an
- * event. Different from the on() method,the listener receives notification only once,and then it will be removed
- * automatically.
- * @param type The type of event.
- * @param listener The listener function that processes the event. This function must accept an event object as
- * its only parameter and must return nothing, as this example shows: function(evt:Event):void The function can
- * have any name.
- * @param thisObject the listener function's "this"
- * @param useCapture Determines whether the listener works in the capture phase or the bubbling phases. If useCapture
- * is set to true, the listener processes the event only during the capture phase and not in the bubbling phase.
- * If useCapture is false, the listener processes the event only during the bubbling phase. To listen for the event
- * in all three phases, call on() twice, once with useCapture set to true, then again with useCapture set to false.
- * @param priority The priority level of the event listener. Priorities are designated by a integer. The higher
- * the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1.
- * If two or more listeners share the same priority, they are processed in the order in which they were added.
- * The default priority is
- * @see #on()
- * @see #removeEventListener()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 添加仅回调一次的事件侦听器,此方法与on()方法不同,on()方法会持续产生回调,而此方法在第一次回调时就会自动移除监听。
- * @param type 事件的类型。
- * @param listener 处理事件的侦听器函数。此函数必须接受 Event 对象作为其唯一的参数,并且不能返回任何结果,
- * 如下面的示例所示: function(evt:Event):void 函数可以有任何名称。
- * @param thisObject 侦听函数绑定的this对象
- * @param useCapture 确定侦听器是运行于捕获阶段还是运行于冒泡阶段。如果将 useCapture 设置为 true,
- * 则侦听器只在捕获阶段处理事件,而不在冒泡阶段处理事件。如果 useCapture 为 false,则侦听器只在冒泡阶段处理事件。
- * 要在两个阶段都侦听事件,请调用 once() 两次:一次将 useCapture 设置为 true,一次将 useCapture 设置为 false。
- * @param priority 事件侦听器的优先级。优先级由一个带符号整数指定。数字越大,优先级越高。优先级为 n 的所有侦听器会在
- * 优先级为 n -1 的侦听器之前得到处理。如果两个或更多个侦听器共享相同的优先级,则按照它们的添加顺序进行处理。默认优先级为 0。
- * @see #on()
- * @see #removeEventListener()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- once(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): void;
- /**
- * Removes a listener from the EventDispatcher object. If there is no matching listener registered with the
- * EventDispatcher object, a call to this method has no effect.
- * @param type The type of event.
- * @param listener The listener object to remove.
- * @param thisObject the listener function's "this"
- * @param useCapture Specifies whether the listener was registered for the capture phase or the bubbling phases.
- * If the listener was registered for both the capture phase and the bubbling phases, two calls to removeEventListener()
- * are required to remove both: one call with useCapture set to true, and another call with useCapture set to false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从 EventDispatcher 对象中删除侦听器。如果没有向 EventDispatcher 对象注册任何匹配的侦听器,则对此方法的调用没有任何效果。
- * @param type 事件的类型。
- * @param listener 要删除的侦听器对象
- * @param thisObject 侦听函数绑定的this对象
- * @param useCapture 指出是为捕获阶段还是为冒泡阶段注册了侦听器。如果为捕获阶段以及冒泡阶段注册了侦听器,则需要对
- * removeEventListener() 进行两次调用才能将这两个侦听器删除:一次调用将 useCapture 设置为 true,另一次调用将 useCapture 设置为 false。。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- removeEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean): void;
- /**
- * Checks whether the EventDispatcher object has any listeners registered for a specific type of event. This allows
- * you to determine where an EventDispatcher object has altered handling of an event type in the event flow hierarchy.
- * To determine whether a specific event type will actually trigger an event listener, use IEventDispatcher.willTrigger().
- * The difference between hasEventListener() and willTrigger() is that hasEventListener() examines only the object to
- * which it belongs, whereas willTrigger() examines the entire event flow for the event specified by the type parameter.
- * @param type The type of event.
- * @returns A value of true if a listener of the specified type is registered; false otherwise.
- * @see #willTrigger()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。这样,您就可以确定 EventDispatcher 对象在事件流层次结构中的哪个
- * 位置改变了对事件类型的处理。要确定特定事件类型是否确实会触发事件侦听器,请使用 IEventDispatcher.willTrigger()。hasEventListener()
- * 与 willTrigger() 的区别是:hasEventListener() 只检查它所属的对象,而 willTrigger() 检查整个事件流以查找由 type 参数指定的事件。
- * @param type 事件的类型。
- * @returns 如果指定类型的侦听器已注册,则值为 true;否则,值为 false。
- * @see #willTrigger()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- hasEventListener(type: string): boolean;
- /**
- * Dispatches an event into the event flow. The event target is the EventDispatcher object upon which dispatchEvent() is called.
- * @param event The event object dispatched into the event flow.
- * @returns A value of true unless preventDefault() is called on the event, in which case it returns false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将事件分派到事件流中。事件目标是对其调用 dispatchEvent() 方法的 EventDispatcher 对象。
- * @param event 调度到事件流中的 Event 对象。
- * @returns 如果成功调度了事件,则值为 true。值 false 表示失败或对事件调用了 preventDefault()。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- dispatchEvent(event: Event): boolean;
- /**
- * Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the
- * specified event type. This method returns true if an event listener is triggered during any phase of the event
- * flow when an event of the specified type is dispatched to this EventDispatcher object or any of its descendants.
- * @param type The type of event.
- * @returns A value of true if a listener of the specified type will be triggered; false otherwise.
- * @see #hasEventListener()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 检查是否用此 EventDispatcher 对象或其任何始祖为指定事件类型注册了事件侦听器。将指定类型的事件调度给此
- * EventDispatcher 对象或其任一后代时,如果在事件流的任何阶段触发了事件侦听器,则此方法返回 true。
- * hasEventListener() 与 willTrigger() 方法的区别是:hasEventListener() 只检查它所属的对象,
- * 而 willTrigger() 方法检查整个事件流以查找由 type 参数指定的事件。
- * @param type 事件类型
- * @returns 是否注册过监听器,如果注册过返回true,反之返回false
- * @see #hasEventListener()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- willTrigger(type: string): boolean;
- }
-}
-declare namespace egret {
- interface HttpRequest {
- addEventListener(type: "ioError", listener: (this: Z, e: IOErrorEvent) => void, thisObject: Z, useCapture?: boolean, priority?: number): any;
- addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): any;
- }
- /**
- * @classdesc IO流事件,当错误导致输入或输出操作失败时调度 IOErrorEvent 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/IOErrorEvent.ts
- * @language en_US
- */
- /**
- * @classdesc IO流事件,当错误导致输入或输出操作失败时调度 IOErrorEvent 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/IOErrorEvent.ts
- * @language zh_CN
- */
- class IOErrorEvent extends Event {
- /**
- * io error
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * io发生错误
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static IO_ERROR: "ioError";
- /**
- * Create a egret.IOErrorEvent objects
- * @param type {string} Type of event, accessible as Event.type.
- * @param bubbles {boolean} Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable {boolean} Determine whether the Event object can be canceled. The default value is false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 egret.IOErrorEvent 对象
- * @param type {string} 事件的类型,可以作为 Event.type 访问。
- * @param bubbles {boolean} 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable {boolean} 确定是否可以取消 Event 对象。默认值为 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean);
- /**
- * EventDispatcher object using the specified event object thrown Event. The objects will be thrown in the object cache pool for the next round robin.
- * @param target {egret.IEventDispatcher} Distribute event target
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用指定的EventDispatcher对象来抛出Event事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
- * @param target {egret.IEventDispatcher} 派发事件目标
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static dispatchIOErrorEvent(target: IEventDispatcher): boolean;
- }
-}
-declare namespace egret {
- /**
- * MotionEvent represents the device's movement
- * Acceleration and accelerationIncludingGravity to represents the device's acceleration
- * RotationRate to represents the device's rotation
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/sensor/Motion.ts
- * @language en_US
- */
- /**
- * MotionEvent 类呈现设备运动的具体信息
- * Acceleration 和 accelerationIncludingGravity 呈现设备三个维度的加速度信息
- * RotationRate 呈现设备的旋转状态信息
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/sensor/Motion.ts
- * @language zh_CN
- */
- class MotionEvent extends Event {
- /**
- * An object giving the acceleration of the device on the three axis X, Y and Z. Acceleration is expressed in m/s2.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * acceleration 表示设备在 X Y Z 轴方将的加速度信息,单位是 m/s2,不包含重力
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- acceleration: DeviceAcceleration;
- /**
- * An object giving the acceleration of the device on the three axis X, Y and Z with the effect of gravity. Acceleration is expressed in m/s2.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * acceleration 表示设备在 X Y Z 轴方将的加速度信息,单位是 m/s2,包含重力
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- accelerationIncludingGravity: DeviceAcceleration;
- /**
- * An object giving the rate of change of the device's orientation on the three orientation axis alpha, beta and gamma. Rotation rate is express in degrees per seconds.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * rotationRate 表示设备在 alpha、 beta 和 gamma 三个轴向的角速度信息,单位是 角度每秒
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- rotationRate: DeviceRotationRate;
- }
-}
-declare namespace egret {
- /**
- * The OrientationEvent provides information from the physical orientation of the device.
- * Note: Currently, Browsers on the iOS and Android does not handle the coordinates the same way.
- * Take care about this while using them.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/sensor/DeviceOrientation.ts
- * @language en_US
- */
- /**
- * OrientationEvent 提供设备的方向信息
- * 注意: 目前各个浏览器和操作系统处理方向的方式不完全相同,请根据使用场景做相应的校正,
- * 比如使用两次方向数据的变化而不是直接使用方向的值
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/sensor/DeviceOrientation.ts
- * @language zh_CN
- */
- class OrientationEvent extends Event {
- /**
- * A number representing the motion of the device around the z axis,
- * express in degrees with values ranging from 0 to 360
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示设备绕 Z 轴的角度,单位是 角度 范围是 0 到 360
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- alpha: number;
- /**
- * A number representing the motion of the device around the x axis,
- * express in degrees with values ranging from -180 to 180.
- * This represents a front to back motion of the device.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示设备绕 X 轴的角度,单位是 角度 范围是 -180 到 180.
- * 这个值表示设备从前向后的旋转状态
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- beta: number;
- /**
- * A number representing the motion of the device around the y axis,
- * express in degrees with values ranging from -90 to 90.
- * This represents a left to right motion of the device.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示设备绕 Y 轴的角度,单位是 角度 范围是 -90 到 90.
- * 这个值表示设备从前向后的旋转状态
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- gamma: number;
- }
-}
-declare namespace egret {
- interface HttpRequest {
- addEventListener(type: "progress", listener: (this: Z, e: ProgressEvent) => void, thisObject: Z, useCapture?: boolean, priority?: number): any;
- addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): any;
- }
- /**
- * When a load operation has begun or a socket has received data, ProgressEvent object is dispatched.
- * There are two types of progress events: ProgressEvent.PROGRESS and ProgressEvent.SOCKET_DATA.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当加载操作已开始或套接字已接收到数据时,将调度 ProgressEvent 对象。
- * 有两种类型的进程事件:ProgressEvent.PROGRESS 和 ProgressEvent.SOCKET_DATA。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class ProgressEvent extends egret.Event {
- /**
- * Changes in the loading progress
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 加载进度发生变化
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static PROGRESS: "progress";
- /**
- * Get the data
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取到数据
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static SOCKET_DATA: "socketData";
- /**
- * Number of items or bytes when the listener processes the event。
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在侦听器处理事件时加载的项数或字节数。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- bytesLoaded: number;
- /**
- * If the loading process succeeds, the total number or the total number of bytes that will be loaded term.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 如果加载过程成功,将加载的总项数或总字节数。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- bytesTotal: number;
- /**
- * 创建一个 egret.ProgressEvent 对象
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @param bytesLoaded {number} Number of items or bytes loaded
- * @param bytesTotal {number} The total number of items or bytes loaded
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 egret.ProgressEvent 对象
- * @param type 事件的类型,可以作为 Event.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @param bytesLoaded {number} 加载的项数或字节数
- * @param bytesTotal {number} 加载的总项数或总字节数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean, bytesLoaded?: number, bytesTotal?: number);
- /**
- * EventDispatcher object using the specified event object thrown Event. The objects will be thrown in the object cache pool for the next round robin.
- * @param target {egret.IEventDispatcher} Distribute event target
- * @param type The type of the event, accessible as Event.type.
- * @param bytesLoaded {number} Number of items or bytes loaded
- * @param bytesTotal {number} The total number of items or bytes loaded
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用指定的EventDispatcher对象来抛出Event事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
- * @param target {egret.IEventDispatcher} 派发事件目标
- * @param type {string} 事件类型
- * @param bytesLoaded {number} 加载的项数或字节数
- * @param bytesTotal {number} 加载的总项数或总字节数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static dispatchProgressEvent(target: IEventDispatcher, type: string, bytesLoaded?: number, bytesTotal?: number): boolean;
- }
-}
-declare namespace egret {
- interface Stage {
- addEventListener(type: "orientationChange", listener: (this: Z, e: StageOrientationEvent) => void, thisObject: Z, useCapture?: boolean, priority?: number): any;
- addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): any;
- }
- /**
- * When the direction of the stage of change, Stage object dispatches StageOrientationEvent object.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/StageOrientationEvent.ts
- * @language en_US
- */
- /**
- * 当舞台的方向更改时,Stage 对象将调度 StageOrientationEvent 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/StageOrientationEvent.ts
- * @language zh_CN
- */
- class StageOrientationEvent extends Event {
- /**
- * After screen rotation distribute events.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 屏幕旋转后派发的事件。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ORIENTATION_CHANGE: "orientationChange";
- /**
- * Creating contains specific information related to the event and the stage direction of StageOrientationEvent object.
- * @param type Event types:StageOrientationEvent.ORIENTATION_CHANGE
- * @param bubbles It indicates whether the Event object participates in the bubbling stage of the event flow.
- * @param cancelable It indicates whether the Event object can be canceled.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建包含与舞台方向事件相关的特定信息的 StageOrientationEvent 对象。
- * @param type 事件的类型:StageOrientationEvent.ORIENTATION_CHANGE
- * @param bubbles 表示 Event 对象是否参与事件流的冒泡阶段。
- * @param cancelable 表示是否可以取消 Event 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean);
- /**
- * 派发一个屏幕旋转的事件。
- * @param target {egret.IEventDispatcher} 派发事件目标
- * @param type {egret.IEventDispatcher} 派发事件类型
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 派发一个屏幕旋转的事件。
- * @param target {egret.IEventDispatcher} Distribute event target
- * @param type {egret.IEventDispatcher} Distribute event type
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static dispatchStageOrientationEvent(target: IEventDispatcher, type: string): boolean;
- }
-}
-declare namespace egret {
- /**
- * When a user clicks a hyperlink rich text object dispatches TextEvent object. Text Event Type: TextEvent.LINK.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/TextEvent.ts
- * @language en_US
- */
- /**
- * 用户在富文本中单击超链接时,对象将调度 TextEvent 对象。文本事件类型:TextEvent.LINK。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/TextEvent.ts
- * @language zh_CN
- */
- class TextEvent extends Event {
- /**
- * TextEvent create an object that contains information about text events.
- * @param type Type of event, you can access the TextEvent.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determine whether the Event object can be canceled. The default value is false.
- * @param text One or more characters of text entered by the user. Event listeners can access this information through the text property.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 TextEvent 对象,其中包含有关文本事件的信息。
- * @param type 事件的类型,可以作为 TextEvent.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @param text 用户输入的一个或多个文本字符。事件侦听器可以通过 text 属性访问此信息。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean, text?: string);
- /**
- * It defines the value of the type property of a link event object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 定义 link 事件对象的 type 属性值。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static LINK: "link";
- /**
- * In TextEvent.LINK event, event corresponding string.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在 TextEvent.LINK 事件中,event对应的字符串。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- text: string;
- /**
- * EventDispatcher object using the specified event object thrown TextEvent. The objects will be thrown in the object cache pool for the next round robin.
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param text Text TextEvent object assignment
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用指定的EventDispatcher对象来抛出TextEvent事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
- * @param target 派发事件目标
- * @param type 事件类型
- * @param text TextEvent对象的text赋值
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static dispatchTextEvent(target: IEventDispatcher, type: string, text: string): boolean;
- }
-}
-declare namespace egret {
- interface Timer {
- addEventListener(type: "timer" | "timerComplete", listener: (this: Z, e: TimerEvent) => void, thisObject: Z, useCapture?: boolean, priority?: number): any;
- addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): any;
- }
- /**
- * A Timer object dispatches a TimerEvent objects whenever the Timer object reaches the interval specified by the Timer.delay property.
- * @see egret.Timer
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/TimerEvent.ts
- * @language en_US
- */
- /**
- * 每当 Timer 对象达到由 Timer.delay 属性指定的间隔时,Timer 对象即会调度 TimerEvent 对象。
- * @see egret.Timer
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/TimerEvent.ts
- * @language zh_CN
- */
- class TimerEvent extends Event {
- /**
- * Dispatched whenever a Timer object reaches an interval specified according to the Timer.delay property.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 每当 Timer 对象达到根据 Timer.delay 属性指定的间隔时调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static TIMER: "timer";
- /**
- * Dispatched whenever it has completed the number of requests set by Timer.repeatCount.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 每当它完成 Timer.repeatCount 设置的请求数后调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static TIMER_COMPLETE: "timerComplete";
- /**
- * Creates an Event object with specific information relevant to timer events.
- * @param type The type of the event. Event listeners can access this information through the inherited type property.
- * @param bubbles Determines whether the Event object bubbles. Event listeners can access this information through
- * the inherited bubbles property.
- * @param cancelable Determines whether the Event object can be canceled. Event listeners can access this information
- * through the inherited cancelable property.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 Event 对象,其中包含有关 timer 事件的特定信息。
- * @param type 事件的类型。事件侦听器可以通过继承的 type 属性访问此信息。
- * @param bubbles 确定 Event 对象是否冒泡。事件侦听器可以通过继承的 bubbles 属性访问此信息。
- * @param cancelable 确定是否可以取消 Event 对象。事件侦听器可以通过继承的 cancelable 属性访问此信息。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean);
- /**
- * Instructs Egret runtime to render after processing of this event completes, if the display list has been modified.
- * @example
- *
- * function onTimer(event:TimerEvent):void {
- * if (40 < mySp.x && mySp.x < 375) {
- * mySp.x-= 50;
- * } else {
- * mySp.x=374;
- * }
- * event.updateAfterEvent();
- * }
- *
- * let moveTimer:Timer=new Timer(50,250);
- * moveTimer.addEventListener(TimerEvent.TIMER,onTimer);
- * moveTimer.start();
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 如果已修改显示列表,调用此方法将会忽略帧频限制,在此事件处理完成后立即重绘屏幕。
- * @example
- *
- * function onTimer(event:TimerEvent):void {
- * if (40 < mySp.x && mySp.x < 375) {
- * mySp.x-= 50;
- * } else {
- * mySp.x=374;
- * }
- * event.updateAfterEvent();
- * }
- *
- * let moveTimer:Timer=new Timer(50,250);
- * moveTimer.addEventListener(TimerEvent.TIMER,onTimer);
- * moveTimer.start();
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- updateAfterEvent(): void;
- /**
- * uses a specified target to dispatchEvent an event. Using this method can reduce the number of
- * reallocate event objects, which allows you to get better code execution performance.
- * @param target the event target
- * @param type The type of the event. Event listeners can access this information through the inherited type property.
- * @param bubbles Determines whether the Event object bubbles. Event listeners can access this information through
- * the inherited bubbles property.
- * @param cancelable Determines whether the Event object can be canceled. Event listeners can access this information
- * through the inherited cancelable property.
- * @see egret.Event.create()
- * @see egret.Event.release()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用指定的EventDispatcher对象来抛出事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
- * @param target 事件派发目标
- * @param type 事件的类型。事件侦听器可以通过继承的 type 属性访问此信息。
- * @param bubbles 确定 Event 对象是否冒泡。事件侦听器可以通过继承的 bubbles 属性访问此信息。
- * @param cancelable 确定是否可以取消 Event 对象。事件侦听器可以通过继承的 cancelable 属性访问此信息。
- * @see egret.Event.create()
- * @see egret.Event.release()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static dispatchTimerEvent(target: IEventDispatcher, type: string, bubbles?: boolean, cancelable?: boolean): boolean;
- }
-}
-declare namespace egret {
- /**
- * A BitmapData object contains an array of pixel data. This data can represent either a fully opaque bitmap or a
- * transparent bitmap that contains alpha channel data. Either type of BitmapData object is stored as a buffer of 32-bit
- * integers. Each 32-bit integer determines the properties of a single pixel in the bitmap.
- * Each 32-bit integer is a combination of four 8-bit channel values (from 0 to 255) that describe the alpha transparency
- * and the red, green, and blue (ARGB) values of the pixel. (For ARGB values, the most significant byte represents the
- * alpha channel value, followed by red, green, and blue.)
- * @see egret.Bitmap
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * BitmapData 对象是一个包含像素数据的数组。此数据可以表示完全不透明的位图,或表示包含 Alpha 通道数据的透明位图。
- * 以上任一类型的 BitmapData 对象都作为 32 位整数的缓冲区进行存储。每个 32 位整数确定位图中单个像素的属性。
- * 每个 32 位整数都是四个 8 位通道值(从 0 到 255)的组合,这些值描述像素的 Alpha 透明度以及红色、绿色、蓝色 (ARGB) 值。
- * (对于 ARGB 值,最高有效字节代表 Alpha 通道值,其后的有效字节分别代表红色、绿色和蓝色通道值。)
- * @see egret.Bitmap
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class BitmapData extends HashObject {
- /**
- * The width of the bitmap image in pixels.
- * @readOnly
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 位图图像的宽度,以像素为单位。
- * @readOnly
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- width: number;
- /**
- * The height of the bitmap image in pixels.
- * @readOnly
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 位图图像的高度,以像素为单位。
- * @readOnly
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- height: number;
- /**
- * Original bitmap image.
- * HTMLImageElement|HTMLCanvasElement|HTMLVideoElement
- * @version Egret 2.4
- * @platform Web,Native
- * @private
- * @language en_US
- */
- /**
- * 原始位图图像。
- * HTMLImageElement|HTMLCanvasElement|HTMLVideoElement
- * @version Egret 2.4
- * @platform Web,Native
- * @private
- * @language zh_CN
- */
- source: any;
- /**
- * WebGL texture.
- * @version Egret 2.4
- * @platform Web,Native
- * @private
- * @language en_US
- */
- /**
- * WebGL纹理。
- * @version Egret 2.4
- * @platform Web,Native
- * @private
- * @language zh_CN
- */
- webGLTexture: any;
- /**
- * Texture format.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 纹理格式。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- format: string;
- /**
- * @private
- * webgl纹理生成后,是否删掉原始图像数据
- */
- $deleteSource: boolean;
- /**
- * @private
- * id
- */
- $bitmapDataId: number;
- /**
- * Initializes a BitmapData object to refer to the specified source object.
- * @param source The source object being referenced.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个引用指定 source 实例的 BitmapData 对象
- * @param source 被引用的 source 实例
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(source: any);
- static create(type: "arraybuffer", data: ArrayBuffer, callback?: (bitmapData: BitmapData) => void): BitmapData;
- static create(type: "base64", data: string, callback?: (bitmapData: BitmapData) => void): BitmapData;
- $dispose(): void;
- private static _displayList;
- static $addDisplayObject(displayObject: DisplayObject, bitmapData: BitmapData): void;
- static $removeDisplayObject(displayObject: DisplayObject, bitmapData: BitmapData): void;
- static $invalidate(bitmapData: BitmapData): void;
- static $dispose(bitmapData: BitmapData): void;
- }
-}
-declare namespace egret {
- interface DisplayObject {
- addEventListener(type: "touchMove" | "touchBegin" | "touchEnd" | "touchCancel" | "touchTap" | "touchReleaseOutside" | "touchRollOut" | "touchRollOver", listener: (this: Z, e: TouchEvent) => void, thisObject: Z, useCapture?: boolean, priority?: number): any;
- addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): any;
- }
- /**
- * The TouchEvent class lets you handle events on devices that detect user contact with the device (such as a finger
- * on a touch screen).When a user interacts with a device such as a mobile phone or tablet with a touch screen, the
- * user typically touches the screen with his or her fingers or a pointing device. You can develop applications that
- * respond to basic touch events (such as a single finger tap) with the TouchEvent class. Create event listeners using
- * the event types defined in this class.
- * Note: When objects are nested on the display list, touch events target the deepest possible nested object that is
- * visible in the display list. This object is called the target node. To have a target node's ancestor (an object
- * containing the target node in the display list) receive notification of a touch event, use EventDispatcher.addEventListener()
- * on the ancestor node with the type parameter set to the specific touch event you want to detect.
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/TouchEvent.ts
- * @language en_US
- */
- /**
- * 使用 TouchEvent 类,您可以处理设备上那些检测用户与设备之间的接触的事件。
- * 当用户与带有触摸屏的移动电话或平板电脑等设备交互时,用户通常使用手指或指针设备接触屏幕。可使用 TouchEvent
- * 类开发响应基本触摸事件(如单个手指点击)的应用程序。使用此类中定义的事件类型创建事件侦听器。
- * 注意:当对象嵌套在显示列表中时,触摸事件的目标将是显示列表中可见的最深的可能嵌套对象。
- * 此对象称为目标节点。要使目标节点的祖代(祖代是一个包含显示列表中所有目标节点的对象,从舞台到目标节点的父节点均包括在内)
- * 接收触摸事件的通知,请对祖代节点使用 EventDispatcher.on() 并将 type 参数设置为要检测的特定触摸事件。
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/events/TouchEvent.ts
- * @language zh_CN
- */
- class TouchEvent extends Event {
- /**
- * Dispatched when the user touches the device, and is continuously dispatched until the point of contact is removed.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当用户触碰设备时进行调度,而且会连续调度,直到接触点被删除。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static TOUCH_MOVE: "touchMove";
- /**
- * Dispatched when the user first contacts a touch-enabled device (such as touches a finger to a mobile phone or tablet with a touch screen).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当用户第一次触摸启用触摸的设备时(例如,用手指触摸配有触摸屏的移动电话或平板电脑)调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static TOUCH_BEGIN: "touchBegin";
- /**
- * Dispatched when the user removes contact with a touch-enabled device (such as lifts a finger off a mobile phone
- * or tablet with a touch screen).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当用户移除与启用触摸的设备的接触时(例如,将手指从配有触摸屏的移动电话或平板电脑上抬起)调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static TOUCH_END: "touchEnd";
- /**
- * Dispatched when an event of some kind occurred that canceled the touch.
- * Such as the eui.Scroller will dispatch 'TOUCH_CANCEL' when it start move, the 'TOUCH_END' and 'TOUCH_TAP' will not be triggered.
- * @version Egret 3.0.1
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 由于某个事件取消了触摸时触发。比如 eui.Scroller 在开始滚动后会触发 'TOUCH_CANCEL' 事件,不再触发后续的 'TOUCH_END' 和 'TOUCH_TAP' 事件
- * @version Egret 3.0.1
- * @platform Web,Native
- * @language zh_CN
- */
- static TOUCH_CANCEL: "touchCancel";
- /**
- * Dispatched when the user lifts the point of contact over the same DisplayObject instance on which the contact
- * was initiated on a touch-enabled device.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当用户在触摸设备上与开始触摸的同一 DisplayObject 实例上抬起接触点时调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static TOUCH_TAP: "touchTap";
- /**
- * Dispatched when the user lifts the point of contact over the different DisplayObject instance on which the contact
- * was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display
- * object on a mobile phone or tablet with a touch screen).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当用户在触摸设备上与开始触摸的不同 DisplayObject 实例上抬起接触点时调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static TOUCH_RELEASE_OUTSIDE: "touchReleaseOutside";
- /**
- * Creates an Event object that contains information about touch events.
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @param stageX The horizontal coordinate at which the event occurred in global Stage coordinates.
- * @param stageY The vertical coordinate at which the event occurred in global Stage coordinates.
- * @param touchPointID A unique identification number assigned to the touch point.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 TouchEvent 对象,其中包含有关Touch事件的信息
- * @param type 事件的类型,可以作为 Event.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @param stageX 事件发生点在全局舞台坐标系中的水平坐标
- * @param stageY 事件发生点在全局舞台坐标系中的垂直坐标
- * @param touchPointID 分配给触摸点的唯一标识号
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(type: string, bubbles?: boolean, cancelable?: boolean, stageX?: number, stageY?: number, touchPointID?: number);
- /**
- * @private
- */
- $initTo(stageX: number, stageY: number, touchPointID: number): void;
- /**
- * @private
- */
- $stageX: number;
- /**
- * The horizontal coordinate at which the event occurred in global Stage coordinates.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 事件发生点在全局舞台坐标中的水平坐标。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly stageX: number;
- /**
- * @private
- */
- $stageY: number;
- /**
- * The vertical coordinate at which the event occurred in global Stage coordinates.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 事件发生点在全局舞台坐标中的垂直坐标。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly stageY: number;
- private _localX;
- /**
- * The horizontal coordinate at which the event occurred relative to the display object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 事件发生点相对于所属显示对象的水平坐标。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly localX: number;
- private _localY;
- /**
- * The vertical coordinate at which the event occurred relative to the display object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 事件发生点相对于所属显示对象的垂直坐标。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly localY: number;
- private targetChanged;
- /**
- * @private
- */
- private getLocalXY();
- $setTarget(target: any): boolean;
- /**
- * A unique identification number assigned to the touch point.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 分配给触摸点的唯一标识号
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- touchPointID: number;
- /**
- * Instructs Egret runtime to render after processing of this event completes, if the display list has been modified.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 如果已修改显示列表,调用此方法将会忽略帧频限制,在此事件处理完成后立即重绘屏幕。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- updateAfterEvent(): void;
- /**
- * Whether the touch is pressed (true) or not pressed (false).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示触摸已按下 (true) 还是未按下 (false)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- touchDown: boolean;
- /**
- * uses a specified target to dispatchEvent an event. Using this method can reduce the number of
- * reallocate event objects, which allows you to get better code execution performance.
- * @param target the event target
- * @param type The type of the event, accessible as Event.type.
- * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
- * @param cancelable Determines whether the Event object can be canceled. The default values is false.
- * @param stageX The horizontal coordinate at which the event occurred in global Stage coordinates.
- * @param stageY The vertical coordinate at which the event occurred in global Stage coordinates.
- * @param touchPointID A unique identification number (as an int) assigned to the touch point.
- *
- * @see egret.Event.create()
- * @see egret.Event.release()
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用指定的EventDispatcher对象来抛出Event事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
- * @param target 派发事件目标
- * @param type 事件的类型,可以作为 Event.type 访问。
- * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
- * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
- * @param stageX 事件发生点在全局舞台坐标系中的水平坐标
- * @param stageY 事件发生点在全局舞台坐标系中的垂直坐标
- * @param touchPointID 分配给触摸点的唯一标识号
- *
- * @see egret.Event.create()
- * @see egret.Event.release()
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static dispatchTouchEvent(target: IEventDispatcher, type: string, bubbles?: boolean, cancelable?: boolean, stageX?: number, stageY?: number, touchPointID?: number, touchDown?: boolean): boolean;
- }
-}
-declare namespace egret {
- /**
- * h5 and native interaction.
- * @see http://edn.egret.com/cn/article/index/id/714 Egret basic skills to communicate with Native
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/external/ExternalInterface.ts
- * @language en_US
- */
- /**
- * h5与native交互。
- * @see http://edn.egret.com/cn/article/index/id/714 Egret 与 Native 通信基本技巧
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/external/ExternalInterface.ts
- * @language zh_CN
- */
- interface ExternalInterface {
- }
- let ExternalInterface: {
- /**
- * Call functionName, and the value passed to the native.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 调用 functionName,并将value传入到native中。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- call(functionName: string, value: string): void;
- /**
- * FunctionName callback listener, you need to have to call functionName this field in native rather than such a call.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 监听 functionName 回调,需要在native中有调用 functionName 这个字段,而不是 此类的call。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- addCallback(functionName: string, listener: (value: string) => void): void;
- };
-}
-declare namespace egret {
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- const enum BitmapFilterQuality {
- /**
- * 定义低品质滤镜设置
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- LOW = 1,
- /**
- * 定义中等品质滤镜设置
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- MEDIUM = 2,
- /**
- * 定义高品质滤镜设置
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- HIGH = 3,
- }
-}
-declare namespace egret {
- /**
- * The BlurFilter class lets you apply a blur visual effect to display objects. A blur effect softens the details of an image.
- * You can produce blurs that range from a softly unfocused look to a Gaussian blur, a hazy appearance like viewing an image through semi-opaque glass.
- * @version Egret 3.0.1
- * @platform Web
- * @see http://edn.egret.com/cn/docs/page/947#模糊滤镜 模糊滤镜
- * @language en_US
- */
- /**
- * 可使用 BlurFilter 类将模糊视觉效果应用于显示对象。模糊效果可以柔化图像的细节。
- * 您可以生成一些模糊效果,范围从创建一个柔化的、未聚焦的外观到高斯模糊(就像通过半透明玻璃查看图像一样的朦胧的外观)。
- * @version Egret 3.1.0
- * @platform Web
- * @see http://edn.egret.com/cn/docs/page/947#模糊滤镜 模糊滤镜
- * @language zh_CN
- */
- class BlurFilter extends Filter {
- /**
- * Initializes a BlurFilter object.
- * @param blurX {number} The amount of horizontal blur. Valid values are 0 to 255 (floating point).
- * @param blurY {number} The amount of vertical blur. Valid values are 0 to 255 (floating point).
- * @param quality {number} The number of times to apply the filter.
- * @version Egret 3.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 创建一个 BlurFilter 对象。
- * @param blurX {number} 水平模糊量。有效值为 0 到 255(浮点)。
- * @param blurY {number} 垂直模糊量。有效值为 0 到 255(浮点)。
- * @param quality {number} 应用滤镜的次数。暂未实现。
- * @version Egret 3.1.0
- * @platform Web
- * @language zh_CN
- */
- constructor(blurX?: number, blurY?: number, quality?: number);
- /**
- * @private
- */
- blurXFilter: IBlurXFilter;
- /**
- * @private
- */
- blurYFilter: IBlurYFilter;
- /**
- * @private
- */
- $quality: number;
- /**
- * The amount of horizontal blur.
- * @version Egret 3.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 水平模糊量。
- * @version Egret 3.1.0
- * @platform Web
- * @language zh_CN
- */
- blurX: number;
- /**
- * @private
- */
- $blurX: number;
- /**
- * The amount of vertical blur.
- * @version Egret 3.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 垂直模糊量。
- * @version Egret 3.1.0
- * @platform Web
- * @language zh_CN
- */
- blurY: number;
- /**
- * @private
- */
- $blurY: number;
- /**
- * @private
- */
- $toJson(): string;
- protected updatePadding(): void;
- onPropertyChange(): void;
- }
- /**
- * @private
- */
- interface IBlurXFilter extends Filter {
- type: string;
- $uniforms: any;
- blurX: number;
- }
- /**
- * @private
- */
- interface IBlurYFilter extends Filter {
- type: string;
- $uniforms: any;
- blurY: number;
- }
-}
-declare namespace egret {
- /**
- * The ColorMatrixFilter class lets you apply a 4 x 5 matrix transformation on the RGBA color and alpha values of every pixel in the input image to produce a result with a new set of RGBA color and alpha values.
- * It allows saturation changes, hue rotation, luminance to alpha, and various other effects.
- * @version Egret 3.1.0
- * @platform Web
- * @see http://edn.egret.com/cn/docs/page/947 颜色矩阵滤镜
- * @language en_US
- */
- /**
- * 使用 ColorMatrixFilter 类可以将 4 x 5 矩阵转换应用于输入图像上的每个像素的 RGBA 颜色和 Alpha 值,以生成具有一组新的 RGBA 颜色和 Alpha 值的结果。
- * 该类允许饱和度更改、色相旋转、亮度为 Alpha 以及各种其他效果。
- * @version Egret 3.1.0
- * @platform Web
- * @see http://edn.egret.com/cn/docs/page/947 颜色矩阵滤镜
- * @language zh_CN
- */
- class ColorMatrixFilter extends Filter {
- /**
- * @private
- */
- $matrix: number[];
- /**
- * @private
- */
- private matrix2;
- /**
- * Initializes a ColorMatrixFilter object.
- * @version Egret 3.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 创建一个 ColorMatrixFilter 对象。
- * @version Egret 3.1.0
- * @platform Web
- * @language zh_CN
- */
- constructor(matrix?: number[]);
- /**
- * A comma delimited list of 20 doubles that comprise a 4x5 matrix applied to the rendered element.
- * The matrix is in row major order -- that is, the first five elements are multipled by the vector [srcR,srcG,srcB,srcA,1] to determine the output red value, the second five determine the output green value, etc.
- * The value must either be an array or comma delimited string of 20 numbers.
- * @version Egret 3.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 构成应用于所呈示的元素的一个 4x5 矩阵的、以逗号分隔的 20 个双精度数的列表。
- * 矩阵以行作为主要顺序,即用第一行五个元素乘以矢量 [srcR,srcG,srcB,srcA,1] 以确定输出的红色值,用第二行的五个元素确定输出的绿色值,等等。
- * 该值必须为 20 个数字组成的数组或以逗号分隔的字符串。
- * @version Egret 3.1.0
- * @platform Web
- * @language zh_CN
- */
- matrix: number[];
- /**
- * @private
- */
- private setMatrix(value);
- /**
- * @private
- */
- $toJson(): string;
- }
-}
-declare namespace egret {
- /**
- * custom filter, now support WebGL mode only.
- * @version Egret 4.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 自定义滤镜,目前仅支持WebGL模式
- * @version Egret 4.1.0
- * @platform Web
- * @language zh_CN
- */
- class CustomFilter extends Filter {
- /**
- * @private
- */
- $vertexSrc: string;
- /**
- * @private
- */
- $fragmentSrc: string;
- /**
- * @private
- */
- $shaderKey: string;
- /**
- * @private
- */
- type: string;
- private $padding;
- /**
- * The inner margin of the filter.
- * If the desired area of the custom filter is larger than the original area (stroke, etc.), you need to set it manually.
- * @version Egret 4.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 滤镜的内边距
- * 如果自定义滤镜所需区域比原区域大(描边等),需要手动设置
- * @version Egret 4.1.0
- * @platform Web
- * @language zh_CN
- */
- padding: number;
- /**
- * The initial value of the uniform in the shader (key, value one-to-one correspondence), currently only supports numbers and arrays.
- * @version Egret 4.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 着色器中uniform的初始值(key,value一一对应),目前仅支持数字和数组。
- * @version Egret 4.1.0
- * @platform Web
- * @language zh_CN
- */
- readonly uniforms: any;
- /**
- * Initialize the CustomFilter object.
- * @param vertexSrc Custom vertex shader program.
- * @param fragmentSrc Custom fragment shader program.
- * @param uniforms The initial value of the uniform in the shader (key, value one-to-one correspondence), currently only supports numbers and arrays.
- * @version Egret 4.1.0
- * @platform Web
- * @language en_US
- */
- /**
- * 初始化 CustomFilter 对象
- * @param vertexSrc 自定义的顶点着色器程序。
- * @param fragmentSrc 自定义的片段着色器程序。
- * @param uniforms 着色器中uniform的初始值(key,value一一对应),目前仅支持数字和数组。
- * @version Egret 4.1.0
- * @platform Web
- * @language zh_CN
- */
- constructor(vertexSrc: string, fragmentSrc: string, uniforms?: any);
- onPropertyChange(): void;
- }
-}
-declare namespace egret {
- /**
- * @class egret.DropShadowFilter
- * @classdesc
- * 可使用 DropShadowFilter 类向显示对象添加投影。
- * @extends egret.GlowFilter
- * @version Egret 3.1.4
- * @platform Web,Native
- */
- class DropShadowFilter extends GlowFilter {
- /**
- * Initializes a new DropShadowFilter instance.
- * @method egret.DropShadowFilter#constructor
- * @param distance {number} The offset distance of the bevel. Valid values are in pixels (floating point).
- * @param angle {number} The angle of the bevel. Valid values are from 0 to 360°.
- * @param color {number} The color of the glow. Valid values are in the hexadecimal format 0xRRGGBB. The default value is 0xFF0000.
- * @param alpha {number} The alpha transparency value for the color. Valid values are 0 to 1. For example, .25 sets a transparency value of 25%. The default value is 1.
- * @param blurX {number} The amount of horizontal blur. Valid values are 0 to 255 (floating point).
- * @param blurY {number} The amount of vertical blur. Valid values are 0 to 255 (floating point).
- * @param strength {number} The strength of the imprint or spread. The higher the value, the more color is imprinted and the stronger the contrast between the glow and the background. Valid values are 0 to 255.
- * @param quality {number} The number of times to apply the filter.
- * @param inner {boolean} Specifies whether the glow is an inner glow. The value true indicates an inner glow. The default is false, an outer glow (a glow around the outer edges of the object).
- * @param knockout {number} Specifies whether the object has a knockout effect. A value of true makes the object's fill transparent and reveals the background color of the document. The default value is false (no knockout effect).
- * @param hideObject {number} Indicates whether or not the object is hidden. The value true indicates that the object itself is not drawn; only the shadow is visible. The default is false, meaning that the object is shown.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 初始化 DropShadowFilter 对象
- * @method egret.DropShadowFilter#constructor
- * @param distance {number} 阴影的偏移距离,以像素为单位。
- * @param angle {number} 阴影的角度,0 到 360 度(浮点)。
- * @param color {number} 光晕颜色,采用十六进制格式 0xRRGGBB。默认值为 0xFF0000。
- * @param alpha {number} 颜色的 Alpha 透明度值。有效值为 0 到 1。例如,0.25 设置透明度值为 25%。
- * @param blurX {number} 水平模糊量。有效值为 0 到 255(浮点)。
- * @param blurY {number} 垂直模糊量。有效值为 0 到 255(浮点)。
- * @param strength {number} 印记或跨页的强度。该值越高,压印的颜色越深,而且发光与背景之间的对比度也越强。有效值为 0 到 255。
- * @param quality {number} 应用滤镜的次数。暂未实现。
- * @param inner {boolean} 指定发光是否为内侧发光。值 true 指定发光是内侧发光。值 false 指定发光是外侧发光(对象外缘周围的发光)。
- * @param knockout {number} 指定对象是否具有挖空效果。值为 true 将使对象的填充变为透明,并显示文档的背景颜色。
- * @param hideObject {number} 表示是否隐藏对象。如果值为 true,则表示没有绘制对象本身,只有阴影是可见的。默认值为 false(显示对象)。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- constructor(distance?: number, angle?: number, color?: number, alpha?: number, blurX?: number, blurY?: number, strength?: number, quality?: number, inner?: boolean, knockout?: boolean, hideObject?: boolean);
- /**
- * @private
- */
- $distance: number;
- /**
- * The offset distance of the bevel.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 阴影的偏移距离,以像素为单位。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- distance: number;
- /**
- * @private
- */
- $angle: number;
- /**
- * The angle of the bevel.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 阴影的角度。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- angle: number;
- /**
- * @private
- */
- $hideObject: boolean;
- /**
- * Indicates whether or not the object is hidden.
- * @version Egret 3.1.4
- * @platform Web
- * @language en_US
- */
- /**
- * 表示是否隐藏对象。
- * @version Egret 3.1.4
- * @platform Web
- * @language zh_CN
- */
- hideObject: boolean;
- /**
- * @private
- */
- $toJson(): string;
- protected updatePadding(): void;
- }
-}
-declare namespace egret {
- /**
- * The GradientType class provides values for the type parameter in the beginGradientFill() methods of the egret.Graphics class.
- *
- * @see egret.Graphics#beginGradientFill()
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * GradientType 类为 egret.Graphics 类的 beginGradientFill() 方法中的 type 参数提供值。
- *
- * @see egret.Graphics#beginGradientFill()
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class GradientType {
- /**
- * Value used to specify a linear gradient fill.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 用于指定线性渐变填充的值
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static LINEAR: string;
- /**
- * Value used to specify a radial gradient fill.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 用于指定放射状渐变填充的值
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static RADIAL: string;
- }
-}
-declare namespace egret {
- /**
- * The Graphics class contains a set of methods for creating vector shape. Display objects that support drawing include Sprite and Shape objects. Each class in these classes includes the graphics attribute that is a Graphics object.
- * The following auxiliary functions are provided for ease of use: drawRect(), drawRoundRect(), drawCircle(), and drawEllipse().
- * @see http://edn.egret.com/cn/docs/page/136 Draw Rectangle
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Graphics.ts
- * @language en_US
- */
- /**
- * Graphics 类包含一组可用来创建矢量形状的方法。支持绘制的显示对象包括 Sprite 和 Shape 对象。这些类中的每一个类都包括 graphics 属性,该属性是一个 Graphics 对象。
- * 以下是为便于使用而提供的一些辅助函数:drawRect()、drawRoundRect()、drawCircle() 和 drawEllipse()。
- * @see http://edn.egret.com/cn/docs/page/136 绘制矩形
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Graphics.ts
- * @language zh_CN
- */
- class Graphics extends HashObject {
- /**
- * Initializes a Graphics object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 Graphics 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor();
- /**
- * @private
- */
- $renderNode: sys.GraphicsNode;
- /**
- * 绑定到的目标显示对象
- */
- $targetDisplay: DisplayObject;
- $targetIsSprite: boolean;
- /**
- * @private
- * 设置绑定到的目标显示对象
- */
- $setTarget(target: DisplayObject): void;
- /**
- * 当前移动到的坐标X
- */
- private lastX;
- /**
- * 当前移动到的坐标Y
- */
- private lastY;
- /**
- * 当前正在绘制的填充
- */
- private fillPath;
- /**
- * 当前正在绘制的线条
- */
- private strokePath;
- /**
- * 线条的左上方宽度
- */
- private topLeftStrokeWidth;
- /**
- * 线条的右下方宽度
- */
- private bottomRightStrokeWidth;
- /**
- * 对1像素和3像素特殊处理,向右下角偏移0.5像素,以显示清晰锐利的线条。
- */
- private setStrokeWidth(width);
- /**
- * Specify a simple single color fill that will be used for subsequent calls to other Graphics methods (for example, lineTo() and drawCircle()) when drawing.
- * Calling the clear() method will clear the fill.
- * @param color Filled color
- * @param alpha Filled Alpha value
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 指定一种简单的单一颜色填充,在绘制时该填充将在随后对其他 Graphics 方法(如 lineTo() 或 drawCircle())的调用中使用。
- * 调用 clear() 方法会清除填充。
- * @param color 填充的颜色
- * @param alpha 填充的 Alpha 值
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- beginFill(color: number, alpha?: number): void;
- /**
- * Specifies a gradient fill used by subsequent calls to other Graphics methods (such as lineTo() or drawCircle()) for the object.
- * Calling the clear() method clears the fill.
- * @param type A value from the GradientType class that specifies which gradient type to use: GradientType.LINEAR or GradientType.RADIAL.
- * @param colors An array of RGB hexadecimal color values used in the gradient; for example, red is 0xFF0000, blue is 0x0000FF, and so on. You can specify up to 15 colors. For each color, specify a corresponding value in the alphas and ratios parameters.
- * @param alphas An array of alpha values for the corresponding colors in the colors array;
- * @param ratios An array of color distribution ratios; valid values are 0-255.
- * @param matrix A transformation matrix as defined by the egret.Matrix class. The egret.Matrix class includes a createGradientBox() method, which lets you conveniently set up the matrix for use with the beginGradientFill() method.
- * @platform Web,Native
- * @version Egret 2.4
- * @language en_US
- */
- /**
- * 指定一种渐变填充,用于随后调用对象的其他 Graphics 方法(如 lineTo() 或 drawCircle())。
- * 调用 clear() 方法会清除填充。
- * @param type 用于指定要使用哪种渐变类型的 GradientType 类的值:GradientType.LINEAR 或 GradientType.RADIAL。
- * @param colors 渐变中使用的 RGB 十六进制颜色值的数组(例如,红色为 0xFF0000,蓝色为 0x0000FF,等等)。对于每种颜色,请在 alphas 和 ratios 参数中指定对应值。
- * @param alphas colors 数组中对应颜色的 alpha 值数组。
- * @param ratios 颜色分布比率的数组。有效值为 0 到 255。
- * @param matrix 一个由 egret.Matrix 类定义的转换矩阵。egret.Matrix 类包括 createGradientBox() 方法,通过该方法可以方便地设置矩阵,以便与 beginGradientFill() 方法一起使用
- * @platform Web,Native
- * @version Egret 2.4
- * @language zh_CN
- */
- beginGradientFill(type: string, colors: number[], alphas: number[], ratios: number[], matrix?: egret.Matrix): void;
- /**
- * Apply fill to the lines and curves added after the previous calling to the beginFill() method.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 对从上一次调用 beginFill()方法之后添加的直线和曲线应用填充。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- endFill(): void;
- /**
- * Specify a line style that will be used for subsequent calls to Graphics methods such as lineTo() and drawCircle().
- * @param thickness An integer, indicating the thickness of the line in points. Valid values are 0 to 255. If a number is not specified, or if the parameter is undefined, a line is not drawn. If a value less than 0 is passed, the default value is 0. Value 0 indicates hairline thickness; the maximum thickness is 255. If a value greater than 255 is passed, the default value is 255.
- * @param color A hexadecimal color value of the line (for example, red is 0xFF0000, and blue is 0x0000FF, etc.). If no value is specified, the default value is 0x000000 (black). Optional.
- * @param alpha Indicates Alpha value of the line's color. Valid values are 0 to 1. If no value is specified, the default value is 1 (solid). If the value is less than 0, the default value is 0. If the value is greater than 1, the default value is 1.
- * @param pixelHinting A boolean value that specifies whether to hint strokes to full pixels. This affects both the position of anchors of a curve and the line stroke size itself. With pixelHinting set to true, the line width is adjusted to full pixel width. With pixelHinting set to false, disjoints can appear for curves and straight lines.
- * @param scaleMode Specifies the scale mode to be used
- * @param caps Specifies the value of the CapsStyle class of the endpoint type at the end of the line. (default = CapsStyle.ROUND)
- * @param joints Specifies the type of joint appearance of corner. (default = JointStyle.ROUND)
- * @param miterLimit Indicates the limit number of cut miter.
- * @param lineDash set the line dash.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 指定一种线条样式以用于随后对 lineTo() 或 drawCircle() 等 Graphics 方法的调用。
- * @param thickness 一个整数,以点为单位表示线条的粗细,有效值为 0 到 255。如果未指定数字,或者未定义该参数,则不绘制线条。如果传递的值小于 0,则默认值为 0。值 0 表示极细的粗细;最大粗细为 255。如果传递的值大于 255,则默认值为 255。
- * @param color 线条的十六进制颜色值(例如,红色为 0xFF0000,蓝色为 0x0000FF 等)。如果未指明值,则默认值为 0x000000(黑色)。可选。
- * @param alpha 表示线条颜色的 Alpha 值的数字;有效值为 0 到 1。如果未指明值,则默认值为 1(纯色)。如果值小于 0,则默认值为 0。如果值大于 1,则默认值为 1。
- * @param pixelHinting 布尔型值,指定是否提示笔触采用完整像素。它同时影响曲线锚点的位置以及线条笔触大小本身。在 pixelHinting 设置为 true 的情况下,线条宽度会调整到完整像素宽度。在 pixelHinting 设置为 false 的情况下,对于曲线和直线可能会出现脱节。
- * @param scaleMode 用于指定要使用的比例模式
- * @param caps 用于指定线条末端处端点类型的 CapsStyle 类的值。默认值:CapsStyle.ROUND
- * @param joints 指定用于拐角的连接外观的类型。默认值:JointStyle.ROUND
- * @param miterLimit 用于表示剪切斜接的极限值的数字。
- * @param lineDash 设置虚线样式。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- lineStyle(thickness?: number, color?: number, alpha?: number, pixelHinting?: boolean, scaleMode?: string, caps?: string, joints?: string, miterLimit?: number, lineDash?: number[]): void;
- /**
- * Draw a rectangle
- * @param x x position of the center, relative to the registration point of the parent display object (in pixels).
- * @param y y position of the center, relative to the registration point of the parent display object (in pixels).
- * @param width Width of the rectangle (in pixels).
- * @param height Height of the rectangle (in pixels).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 绘制一个矩形
- * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
- * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
- * @param width 矩形的宽度(以像素为单位)。
- * @param height 矩形的高度(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- drawRect(x: number, y: number, width: number, height: number): void;
- /**
- * Draw a rectangle with rounded corners.
- * @param x x position of the center, relative to the registration point of the parent display object (in pixels).
- * @param y y position of the center, relative to the registration point of the parent display object (in pixels).
- * @param width Width of the rectangle (in pixels).
- * @param height Height of the rectangle (in pixels).
- * @param ellipseWidth Width used to draw an ellipse with rounded corners (in pixels).
- * @param ellipseHeight Height used to draw an ellipse with rounded corners (in pixels). (Optional) If no value is specified, the default value matches the value of the ellipseWidth parameter.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 绘制一个圆角矩形。
- * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
- * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
- * @param width 矩形的宽度(以像素为单位)。
- * @param height 矩形的高度(以像素为单位)。
- * @param ellipseWidth 用于绘制圆角的椭圆的宽度(以像素为单位)。
- * @param ellipseHeight 用于绘制圆角的椭圆的高度(以像素为单位)。 (可选)如果未指定值,则默认值与为 ellipseWidth 参数提供的值相匹配。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- drawRoundRect(x: number, y: number, width: number, height: number, ellipseWidth: number, ellipseHeight?: number): void;
- /**
- * Draw a circle.
- * @param x x position of the center, relative to the registration point of the parent display object (in pixels).
- * @param y y position of the center, relative to the registration point of the parent display object (in pixels).
- * @param r Radius of the circle (in pixels).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 绘制一个圆。
- * @param x 圆心相对于父显示对象注册点的 x 位置(以像素为单位)。
- * @param y 相对于父显示对象注册点的圆心的 y 位置(以像素为单位)。
- * @param radius 圆的半径(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- drawCircle(x: number, y: number, radius: number): void;
- /**
- * Draw an ellipse.
- * @param x A number indicating the horizontal position, relative to the registration point of the parent display object (in pixels).
- * @param y A number indicating the vertical position, relative to the registration point of the parent display object (in pixels).
- * @param width Width of the rectangle (in pixels).
- * @param height Height of the rectangle (in pixels).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 绘制一个椭圆。
- * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
- * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
- * @param width 矩形的宽度(以像素为单位)。
- * @param height 矩形的高度(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- drawEllipse(x: number, y: number, width: number, height: number): void;
- /**
- * Move the current drawing position to (x, y). If any of these parameters is missed, calling this method will fail and the current drawing position keeps unchanged.
- * @param x A number indicating the horizontal position, relative to the registration point of the parent display object (in pixels).
- * @param y A number indicating the vertical position, relative to the registration point of the parent display object (in pixels).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将当前绘图位置移动到 (x, y)。如果缺少任何一个参数,则此方法将失败,并且当前绘图位置不改变。
- * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
- * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- moveTo(x: number, y: number): void;
- /**
- * Draw a straight line from the current drawing position to (x, y) using the current line style; the current drawing position is then set to (x, y).
- * @param x A number indicating the horizontal position, relative to the registration point of the parent display object (in pixels).
- * @param y A number indicating the vertical position, relative to the registration point of the parent display object (in pixels).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用当前线条样式绘制一条从当前绘图位置开始到 (x, y) 结束的直线;当前绘图位置随后会设置为 (x, y)。
- * @param x 一个表示相对于父显示对象注册点的水平位置的数字(以像素为单位)。
- * @param y 一个表示相对于父显示对象注册点的垂直位置的数字(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- lineTo(x: number, y: number): void;
- /**
- * Draw a quadratic Bezier curve from the current drawing position to (anchorX, anchorY) using the current line style according to the control points specified by (controlX, controlY). The current drawing position is then set to (anchorX, anchorY).
- * If the curveTo() method is called before the moveTo() method, the default value of the current drawing position is (0, 0). If any of these parameters is missed, calling this method will fail and the current drawing position keeps unchanged.
- * The drawn curve is a quadratic Bezier curve. A quadratic Bezier curve contains two anchor points and one control point. The curve interpolates the two anchor points and bends to the control point.
- * @param controlX A number indicating the horizontal position of the control point, relative to the registration point of the parent display object.
- * @param controlY A number indicating the vertical position of the control point, relative to the registration point of the parent display object.
- * @param anchorX A number indicating the horizontal position of the next anchor point, relative to the registration point of the parent display object.
- * @param anchorY A number indicating the vertical position of the next anchor point, relative to the registration point of the parent display object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用当前线条样式和由 (controlX, controlY) 指定的控制点绘制一条从当前绘图位置开始到 (anchorX, anchorY) 结束的二次贝塞尔曲线。当前绘图位置随后设置为 (anchorX, anchorY)。
- * 如果在调用 moveTo() 方法之前调用了 curveTo() 方法,则当前绘图位置的默认值为 (0, 0)。如果缺少任何一个参数,则此方法将失败,并且当前绘图位置不改变。
- * 绘制的曲线是二次贝塞尔曲线。二次贝塞尔曲线包含两个锚点和一个控制点。该曲线内插这两个锚点,并向控制点弯曲。
- * @param controlX 一个数字,指定控制点相对于父显示对象注册点的水平位置。
- * @param controlY 一个数字,指定控制点相对于父显示对象注册点的垂直位置。
- * @param anchorX 一个数字,指定下一个锚点相对于父显示对象注册点的水平位置。
- * @param anchorY 一个数字,指定下一个锚点相对于父显示对象注册点的垂直位置。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- curveTo(controlX: number, controlY: number, anchorX: number, anchorY: number): void;
- /**
- * Draws a cubic Bezier curve from the current drawing position to the specified anchor. Cubic Bezier curves consist of two anchor points and two control points. The curve interpolates the two anchor points and two control points to the curve.
- * @param controlX1 Specifies the first control point relative to the registration point of the parent display the horizontal position of the object.
- * @param controlY1 Specifies the first control point relative to the registration point of the parent display the vertical position of the object.
- * @param controlX2 Specify the second control point relative to the registration point of the parent display the horizontal position of the object.
- * @param controlY2 Specify the second control point relative to the registration point of the parent display the vertical position of the object.
- * @param anchorX Specifies the anchor point relative to the registration point of the parent display the horizontal position of the object.
- * @param anchorY Specifies the anchor point relative to the registration point of the parent display the vertical position of the object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从当前绘图位置到指定的锚点绘制一条三次贝塞尔曲线。三次贝塞尔曲线由两个锚点和两个控制点组成。该曲线内插这两个锚点,并向两个控制点弯曲。
- * @param controlX1 指定首个控制点相对于父显示对象的注册点的水平位置。
- * @param controlY1 指定首个控制点相对于父显示对象的注册点的垂直位置。
- * @param controlX2 指定第二个控制点相对于父显示对象的注册点的水平位置。
- * @param controlY2 指定第二个控制点相对于父显示对象的注册点的垂直位置。
- * @param anchorX 指定锚点相对于父显示对象的注册点的水平位置。
- * @param anchorY 指定锚点相对于父显示对象的注册点的垂直位置。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- cubicCurveTo(controlX1: number, controlY1: number, controlX2: number, controlY2: number, anchorX: number, anchorY: number): void;
- /**
- * adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending
- * at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
- * @param x The x coordinate of the arc's center.
- * @param y The y coordinate of the arc's center.
- * @param radius The arc's radius.
- * @param startAngle The angle at which the arc starts, measured clockwise from the positive x axis and expressed in radians.
- * @param endAngle The angle at which the arc ends, measured clockwise from the positive x axis and expressed in radians.
- * @param anticlockwise if true, causes the arc to be drawn counter-clockwise between the two angles. By default it is drawn clockwise.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 绘制一段圆弧路径。圆弧路径的圆心在 (x, y) 位置,半径为 r ,根据anticlockwise (默认为顺时针)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
- * @param x 圆弧中心(圆心)的 x 轴坐标。
- * @param y 圆弧中心(圆心)的 y 轴坐标。
- * @param radius 圆弧的半径。
- * @param startAngle 圆弧的起始点, x轴方向开始计算,单位以弧度表示。
- * @param endAngle 圆弧的终点, 单位以弧度表示。
- * @param anticlockwise 如果为 true,逆时针绘制圆弧,反之,顺时针绘制。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- drawArc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
- private dirty();
- /**
- * @private
- * 测量圆弧的矩形大小
- */
- private arcBounds(x, y, radius, startAngle, endAngle);
- /**
- * Clear graphics that are drawn to this Graphics object, and reset fill and line style settings.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 清除绘制到此 Graphics 对象的图形,并重置填充和线条样式设置。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- clear(): void;
- /**
- * @private
- */
- private minX;
- /**
- * @private
- */
- private minY;
- /**
- * @private
- */
- private maxX;
- /**
- * @private
- */
- private maxY;
- /**
- * @private
- */
- private extendBoundsByPoint(x, y);
- /**
- * @private
- */
- private extendBoundsByX(x);
- /**
- * @private
- */
- private extendBoundsByY(y);
- /**
- * @private
- */
- private updateNodeBounds();
- /**
- * 是否已经包含上一次moveTo的坐标点
- */
- private includeLastPosition;
- /**
- * 更新当前的lineX和lineY值,并标记尺寸失效。
- * @private
- */
- private updatePosition(x, y);
- /**
- * @private
- */
- $measureContentBounds(bounds: Rectangle): void;
- /**
- * @private
- *
- */
- $hitTest(stageX: number, stageY: number): DisplayObject;
- /**
- * @private
- */
- $onRemoveFromStage(): void;
- }
-}
-declare namespace egret {
- /**
- * The Matrix class represents a transformation matrix that determines how to map points from one coordinate space to
- * another. You can perform various graphical transformations on a display object by setting the properties of a Matrix
- * object, applying that Matrix object to the matrix property of a display object, These transformation functions include
- * translation (x and y repositioning), rotation, scaling, and skewing.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/geom/Matrix.ts
- * @language en_US
- */
- /**
- * Matrix 类表示一个转换矩阵,它确定如何将点从一个坐标空间映射到另一个坐标空间。
- * 您可以对一个显示对象执行不同的图形转换,方法是设置 Matrix 对象的属性,将该 Matrix
- * 对象应用于显示对象的 matrix 属性。这些转换函数包括平移(x 和 y 重新定位)、旋转、缩放和倾斜。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/geom/Matrix.ts
- * @language zh_CN
- */
- class Matrix extends HashObject {
- /**
- * Releases a matrix instance to the object pool
- * @param matrix matrix that Needs to be recycled
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 释放一个Matrix实例到对象池
- * @param matrix 需要回收的 matrix
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static release(matrix: Matrix): void;
- /**
- * get a matrix instance from the object pool or create a new one.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从对象池中取出或创建一个新的Matrix对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static create(): Matrix;
- /**
- * Creates a new Matrix object with the specified parameters.
- * @param a The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
- * @param b The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
- * @param c The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
- * @param d The value that affects the positioning of pixels along the y axis when scaling or rotating an image..
- * @param tx The distance by which to translate each point along the x axis.
- * @param ty The distance by which to translate each point along the y axis.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用指定参数创建一个 Matrix 对象
- * @param a 缩放或旋转图像时影响像素沿 x 轴定位的值。
- * @param b 旋转或倾斜图像时影响像素沿 y 轴定位的值。
- * @param c 旋转或倾斜图像时影响像素沿 x 轴定位的值。
- * @param d 缩放或旋转图像时影响像素沿 y 轴定位的值。
- * @param tx 沿 x 轴平移每个点的距离。
- * @param ty 沿 y 轴平移每个点的距离。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
- /**
- * The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 缩放或旋转图像时影响像素沿 x 轴定位的值
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- a: number;
- /**
- * The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 旋转或倾斜图像时影响像素沿 y 轴定位的值
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- b: number;
- /**
- * The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 旋转或倾斜图像时影响像素沿 x 轴定位的值
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- c: number;
- /**
- * The value that affects the positioning of pixels along the y axis when scaling or rotating an image.
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 缩放或旋转图像时影响像素沿 y 轴定位的值
- * @default 1
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- d: number;
- /**
- * The distance by which to translate each point along the x axis.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 沿 x 轴平移每个点的距离
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- tx: number;
- /**
- * The distance by which to translate each point along the y axis.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 沿 y 轴平移每个点的距离
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- ty: number;
- /**
- * Returns a new Matrix object that is a clone of this matrix, with an exact copy of the contained object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回一个新的 Matrix 对象,它是此矩阵的克隆,带有与所含对象完全相同的副本。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- clone(): Matrix;
- /**
- * Concatenates a matrix with the current matrix, effectively combining the geometric effects of the two. In mathematical
- * terms, concatenating two matrixes is the same as combining them using matrix multiplication.
- * @param other The matrix to be concatenated to the source matrix.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将某个矩阵与当前矩阵连接,从而将这两个矩阵的几何效果有效地结合在一起。在数学术语中,将两个矩阵连接起来与使用矩阵乘法将它们结合起来是相同的。
- * @param other 要连接到源矩阵的矩阵。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- concat(other: Matrix): void;
- /**
- * Copies all of the matrix data from the source Point object into the calling Matrix object.
- * @param other The Matrix object from which to copy the data.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将源 Matrix 对象中的所有矩阵数据复制到调用方 Matrix 对象中。
- * @param other 要拷贝的目标矩阵
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- copyFrom(other: Matrix): Matrix;
- /**
- * Sets each matrix property to a value that causes a null transformation. An object transformed by applying an
- * identity matrix will be identical to the original. After calling the identity() method, the resulting matrix
- * has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 为每个矩阵属性设置一个值,该值将导致矩阵无转换。通过应用恒等矩阵转换的对象将与原始对象完全相同。
- * 调用 identity() 方法后,生成的矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0 和 ty=0。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- identity(): void;
- /**
- * Performs the opposite transformation of the original matrix. You can apply an inverted matrix to an object to
- * undo the transformation performed when applying the original matrix.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 执行原始矩阵的逆转换。
- * 您可以将一个逆矩阵应用于对象来撤消在应用原始矩阵时执行的转换。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- invert(): void;
- /**
- * @private
- */
- $invertInto(target: Matrix): void;
- /**
- * Applies a rotation transformation to the Matrix object.
- * The rotate() method alters the a, b, c, and d properties of the Matrix object.
- * @param angle The rotation angle in radians.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 对 Matrix 对象应用旋转转换。
- * rotate() 方法将更改 Matrix 对象的 a、b、c 和 d 属性。
- * @param angle 以弧度为单位的旋转角度。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- rotate(angle: number): void;
- /**
- * Applies a scaling transformation to the matrix. The x axis is multiplied by sx, and the y axis it is multiplied by sy.
- * The scale() method alters the a and d properties of the Matrix object.
- * @param sx A multiplier used to scale the object along the x axis.
- * @param sy A multiplier used to scale the object along the y axis.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 对矩阵应用缩放转换。x 轴乘以 sx,y 轴乘以 sy。
- * scale() 方法将更改 Matrix 对象的 a 和 d 属性。
- * @param sx 用于沿 x 轴缩放对象的乘数。
- * @param sy 用于沿 y 轴缩放对象的乘数。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- scale(sx: number, sy: number): void;
- /**
- * Sets the members of Matrix to the specified values
- * @param a The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
- * @param b The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
- * @param c The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
- * @param d The value that affects the positioning of pixels along the y axis when scaling or rotating an image..
- * @param tx The distance by which to translate each point along the x axis.
- * @param ty The distance by which to translate each point along the y axis.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将 Matrix 的成员设置为指定值
- * @param a 缩放或旋转图像时影响像素沿 x 轴定位的值。
- * @param b 旋转或倾斜图像时影响像素沿 y 轴定位的值。
- * @param c 旋转或倾斜图像时影响像素沿 x 轴定位的值。
- * @param d 缩放或旋转图像时影响像素沿 y 轴定位的值。
- * @param tx 沿 x 轴平移每个点的距离。
- * @param ty 沿 y 轴平移每个点的距离。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- setTo(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix;
- /**
- * Returns the result of applying the geometric transformation represented by the Matrix object to the specified point.
- * @param pointX The x coordinate for which you want to get the result of the Matrix transformation.
- * @param pointY The y coordinate for which you want to get the result of the Matrix transformation.
- * @param resultPoint A reusable instance of Point for saving the results. Passing this parameter can reduce the
- * number of reallocate objects, which allows you to get better code execution performance.
- * @returns The point resulting from applying the Matrix transformation.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回将 Matrix 对象表示的几何转换应用于指定点所产生的结果。
- * @param pointX 想要获得其矩阵转换结果的点的x坐标。
- * @param pointY 想要获得其矩阵转换结果的点的y坐标。
- * @param resultPoint 框架建议尽可能减少创建对象次数来优化性能,可以从外部传入一个复用的Point对象来存储结果,若不传入将创建一个新的Point对象返回。
- * @returns 由应用矩阵转换所产生的点。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- transformPoint(pointX: number, pointY: number, resultPoint?: Point): Point;
- /**
- * Translates the matrix along the x and y axes, as specified by the dx and dy parameters.
- * @param dx The amount of movement along the x axis to the right, in pixels.
- * @param dy The amount of movement down along the y axis, in pixels.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 沿 x 和 y 轴平移矩阵,由 dx 和 dy 参数指定。
- * @param dx 沿 x 轴向右移动的量(以像素为单位)。
- * @param dy 沿 y 轴向下移动的量(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- translate(dx: number, dy: number): void;
- /**
- * Determines whether two matrixes are equal.
- * @param other The matrix to be compared.
- * @returns A value of true if the object is equal to this Matrix object; false if it is not equal.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 是否与另一个矩阵数据相等
- * @param other 要比较的另一个矩阵对象。
- * @returns 是否相等,ture表示相等。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- equals(other: Matrix): boolean;
- /**
- * prepend matrix
- * @param a The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
- * @param b The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
- * @param c The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
- * @param d The value that affects the positioning of pixels along the y axis when scaling or rotating an image..
- * @param tx The distance by which to translate each point along the x axis.
- * @param ty The distance by which to translate each point along the y axis.
- * @returns matrix
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 前置矩阵
- * @param a 缩放或旋转图像时影响像素沿 x 轴定位的值
- * @param b 缩放或旋转图像时影响像素沿 y 轴定位的值
- * @param c 缩放或旋转图像时影响像素沿 x 轴定位的值
- * @param d 缩放或旋转图像时影响像素沿 y 轴定位的值
- * @param tx 沿 x 轴平移每个点的距离
- * @param ty 沿 y 轴平移每个点的距离
- * @returns 矩阵自身
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- prepend(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix;
- /**
- * append matrix
- * @param a The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
- * @param b The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
- * @param c The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
- * @param d The value that affects the positioning of pixels along the y axis when scaling or rotating an image..
- * @param tx The distance by which to translate each point along the x axis.
- * @param ty The distance by which to translate each point along the y axis.
- * @returns matrix
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 后置矩阵
- * @param a 缩放或旋转图像时影响像素沿 x 轴定位的值
- * @param b 缩放或旋转图像时影响像素沿 y 轴定位的值
- * @param c 缩放或旋转图像时影响像素沿 x 轴定位的值
- * @param d 缩放或旋转图像时影响像素沿 y 轴定位的值
- * @param tx 沿 x 轴平移每个点的距离
- * @param ty 沿 y 轴平移每个点的距离
- * @returns 矩阵自身
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- append(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix;
- /**
- * Given a point in the pretransform coordinate space, returns the coordinates of that point after the transformation occurs.
- * Unlike the standard transformation applied using the transformPoint() method, the deltaTransformPoint() method's transformation does not consider the translation parameters tx and ty.
- * @param point The point for which you want to get the result of the matrix transformation.
- * @returns The point resulting from applying the matrix transformation.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 如果给定预转换坐标空间中的点,则此方法返回发生转换后该点的坐标。
- * 与使用 transformPoint() 方法应用的标准转换不同,deltaTransformPoint() 方法的转换不考虑转换参数 tx 和 ty。
- * @param point 想要获得其矩阵转换结果的点
- * @returns 由应用矩阵转换所产生的点
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- deltaTransformPoint(point: Point): Point;
- /**
- * Returns a text value listing the properties of the Matrix object.
- * @returns A string containing the values of the properties of the Matrix object: a, b, c, d, tx, and ty.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回将 Matrix 对象表示的几何转换应用于指定点所产生的结果。
- * @returns 一个字符串,它包含 Matrix 对象的属性值:a、b、c、d、tx 和 ty。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- toString(): string;
- /**
- * Includes parameters for scaling, rotation, and translation. When applied to a matrix it sets the matrix's values based on those parameters.
- * @param scaleX The factor by which to scale horizontally.
- * @param scaleY The factor by which scale vertically.
- * @param rotation The amount to rotate, in radians.
- * @param tx The number of pixels to translate (move) to the right along the x axis.
- * @param ty The number of pixels to translate (move) down along the y axis.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 包括用于缩放、旋转和转换的参数。当应用于矩阵时,该方法会基于这些参数设置矩阵的值。
- * @param scaleX 水平缩放所用的系数
- * @param scaleY 垂直缩放所用的系数
- * @param rotation 旋转量(以弧度为单位)
- * @param tx 沿 x 轴向右平移(移动)的像素数
- * @param ty 沿 y 轴向下平移(移动)的像素数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- createBox(scaleX: number, scaleY: number, rotation?: number, tx?: number, ty?: number): void;
- /**
- * Creates the specific style of matrix expected by the beginGradientFill() and lineGradientStyle() methods of the Graphics class.
- * Width and height are scaled to a scaleX/scaleY pair and the tx/ty values are offset by half the width and height.
- * @param width The width of the gradient box.
- * @param height The height of the gradient box.
- * @param rotation The amount to rotate, in radians.
- * @param tx The distance, in pixels, to translate to the right along the x axis. This value is offset by half of the width parameter.
- * @param ty The distance, in pixels, to translate down along the y axis. This value is offset by half of the height parameter.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建 Graphics 类的 beginGradientFill() 和 lineGradientStyle() 方法所需的矩阵的特定样式。
- * 宽度和高度被缩放为 scaleX/scaleY 对,而 tx/ty 值偏移了宽度和高度的一半。
- * @param width 渐变框的宽度
- * @param height 渐变框的高度
- * @param rotation 旋转量(以弧度为单位)
- * @param tx 沿 x 轴向右平移的距离(以像素为单位)。此值将偏移 width 参数的一半
- * @param ty 沿 y 轴向下平移的距离(以像素为单位)。此值将偏移 height 参数的一半
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- createGradientBox(width: number, height: number, rotation?: number, tx?: number, ty?: number): void;
- /**
- * @private
- */
- $transformBounds(bounds: Rectangle): void;
- /**
- * @private
- */
- private getDeterminant();
- /**
- * @private
- */
- $getScaleX(): number;
- /**
- * @private
- */
- $getScaleY(): number;
- /**
- * @private
- */
- $getSkewX(): number;
- /**
- * @private
- */
- $getSkewY(): number;
- /**
- * @private
- */
- $updateScaleAndRotation(scaleX: number, scaleY: number, skewX: number, skewY: number): void;
- /**
- * @private
- * target = other * this
- */
- $preMultiplyInto(other: Matrix, target: Matrix): void;
- }
- /**
- * @private
- * 仅供框架内复用,要防止暴露引用到外部。
- */
- let $TempMatrix: Matrix;
-}
-declare namespace egret {
- /**
- * A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its
- * width and its height.
- * The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of
- * one property has no effect on the others. However, the right and bottom properties are integrally related to those
- * four properties. For example, if you change the value of the right property, the value of the width property changes;
- * if you change the bottom property, the value of the height property changes.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/geom/Rectangle.ts
- * @language en_US
- */
- /**
- * Rectangle 对象是按其位置(由它左上角的点 (x, y) 确定)以及宽度和高度定义的区域。
- * Rectangle 类的 x、y、width 和 height 属性相互独立;更改一个属性的值不会影响其他属性。
- * 但是,right 和 bottom 属性与这四个属性是整体相关的。例如,如果更改 right 属性的值,则 width
- * 属性的值将发生变化;如果更改 bottom 属性,则 height 属性的值将发生变化。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/geom/Rectangle.ts
- * @language zh_CN
- */
- class Rectangle extends HashObject {
- /**
- * Releases a rectangle instance to the object pool.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 释放一个Rectangle实例到对象池
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static release(rect: Rectangle): void;
- /**
- * get a rectangle instance from the object pool or create a new one.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从对象池中取出或创建一个新的Rectangle对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static create(): Rectangle;
- /**
- * Creates a new Rectangle object with the top-left corner specified by the x and y parameters and with the specified
- * width and height parameters.
- * @param x The x coordinate of the top-left corner of the rectangle.
- * @param y The y coordinate of the top-left corner of the rectangle.
- * @param width The width of the rectangle, in pixels.
- * @param height The height of the rectangle, in pixels.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个新 Rectangle 对象,其左上角由 x 和 y 参数指定,并具有指定的 width 和 height 参数。
- * @param x 矩形左上角的 x 坐标。
- * @param y 矩形左上角的 y 坐标。
- * @param width 矩形的宽度(以像素为单位)。
- * @param height 矩形的高度(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(x?: number, y?: number, width?: number, height?: number);
- /**
- * The x coordinate of the top-left corner of the rectangle.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 矩形左上角的 x 坐标。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- x: number;
- /**
- * The y coordinate of the top-left corner of the rectangle.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 矩形左上角的 y 坐标。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- y: number;
- /**
- * The width of the rectangle, in pixels.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 矩形的宽度(以像素为单位)。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- width: number;
- /**
- * 矩形的高度(以像素为单位)。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * The height of the rectangle, in pixels.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- height: number;
- /**
- * The sum of the x and width properties.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * x 和 width 属性的和。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- right: number;
- /**
- * The sum of the y and height properties.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * y 和 height 属性的和。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- bottom: number;
- /**
- * The x coordinate of the top-left corner of the rectangle. Changing the left property of a Rectangle object has
- * no effect on the y and height properties. However it does affect the width property, whereas changing the x value
- * does not affect the width property.
- * The value of the left property is equal to the value of the x property.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 矩形左上角的 x 坐标。更改 Rectangle 对象的 left 属性对 y 和 height 属性没有影响。但是,它会影响 width 属性,而更改 x 值不会影响 width 属性。
- * left 属性的值等于 x 属性的值。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- left: number;
- /**
- * The y coordinate of the top-left corner of the rectangle. Changing the top property of a Rectangle object has
- * no effect on the x and width properties. However it does affect the height property, whereas changing the y
- * value does not affect the height property.
- * The value of the top property is equal to the value of the y property.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 矩形左上角的 y 坐标。更改 Rectangle 对象的 top 属性对 x 和 width 属性没有影响。但是,它会影响 height 属性,而更改 y 值不会影响 height 属性。
- * top 属性的值等于 y 属性的值。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- top: number;
- /**
- * The location of the Rectangle object's top-left corner, determined by the x and y coordinates of the point.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 由该点的 x 和 y 坐标确定的 Rectangle 对象左上角的位置。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- topLeft: Point;
- /**
- * The location of the Rectangle object's bottom-right corner, determined by the values of the right and bottom properties.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 由 right 和 bottom 属性的值确定的 Rectangle 对象的右下角的位置。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- bottomRight: Point;
- /**
- * Copies all of rectangle data from the source Rectangle object into the calling Rectangle object.
- * @param sourceRect The Rectangle object from which to copy the data.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将源 Rectangle 对象中的所有矩形数据复制到调用方 Rectangle 对象中。
- * @param sourceRect 要从中复制数据的 Rectangle 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- copyFrom(sourceRect: Rectangle): Rectangle;
- /**
- * Sets the members of Rectangle to the specified values
- * @param x The x coordinate of the top-left corner of the rectangle.
- * @param y The y coordinate of the top-left corner of the rectangle.
- * @param width The width of the rectangle, in pixels.
- * @param height The height of the rectangle, in pixels.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将 Rectangle 的成员设置为指定值
- * @param x 矩形左上角的 x 坐标。
- * @param y 矩形左上角的 y 坐标。
- * @param width 矩形的宽度(以像素为单位)。
- * @param height 矩形的高度(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- setTo(x: number, y: number, width: number, height: number): Rectangle;
- /**
- * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object.
- * @param x The x coordinate (horizontal position) of the point.
- * @param y The y coordinate (vertical position) of the point.
- * @returns A value of true if the Rectangle object contains the specified point; otherwise false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定由此 Rectangle 对象定义的矩形区域内是否包含指定的点。
- * @param x 检测点的x轴
- * @param y 检测点的y轴
- * @returns 如果检测点位于矩形内,返回true,否则,返回false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- contains(x: number, y: number): boolean;
- /**
- * If the Rectangle object specified in the toIntersect parameter intersects with this Rectangle object, returns
- * the area of intersection as a Rectangle object. If the rectangles do not intersect, this method returns an empty
- * Rectangle object with its properties set to 0.
- * @param toIntersect The Rectangle object to compare against to see if it intersects with this Rectangle object.
- * @returns A Rectangle object that equals the area of intersection. If the rectangles do not intersect, this method
- * returns an empty Rectangle object; that is, a rectangle with its x, y, width, and height properties set to 0.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 如果在 toIntersect 参数中指定的 Rectangle 对象与此 Rectangle 对象相交,则返回交集区域作为 Rectangle 对象。如果矩形不相交,
- * 则此方法返回一个空的 Rectangle 对象,其属性设置为 0。
- * @param toIntersect 要对照比较以查看其是否与此 Rectangle 对象相交的 Rectangle 对象。
- * @returns 等于交集区域的 Rectangle 对象。如果该矩形不相交,则此方法返回一个空的 Rectangle 对象;即,其 x、y、width 和
- * height 属性均设置为 0 的矩形。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- intersection(toIntersect: Rectangle): Rectangle;
- /**
- * Increases the size of the Rectangle object by the specified amounts, in pixels.
- * The center point of the Rectangle object stays the same, and its size increases to the left and right by the dx value, and to the top and the bottom by the dy value.
- * @param dx The value to be added to the left and the right of the Rectangle object.
- * @param dy The value to be added to the top and the bottom of the Rectangle.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 按指定量增加 Rectangle 对象的大小(以像素为单位)
- * 保持 Rectangle 对象的中心点不变,使用 dx 值横向增加它的大小,使用 dy 值纵向增加它的大小。
- * @param dx Rectangle 对象横向增加的值。
- * @param dy Rectangle 对象纵向增加的值。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- inflate(dx: number, dy: number): void;
- /**
- * @private
- */
- $intersectInPlace(clipRect: Rectangle): Rectangle;
- /**
- * Determines whether the object specified in the toIntersect parameter intersects with this Rectangle object.
- * This method checks the x, y, width, and height properties of the specified Rectangle object to see if it
- * intersects with this Rectangle object.
- * @param toIntersect The Rectangle object to compare against this Rectangle object.
- * @returns A value of true if the specified object intersects with this Rectangle object; otherwise false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定在 toIntersect 参数中指定的对象是否与此 Rectangle 对象相交。此方法检查指定的 Rectangle
- * 对象的 x、y、width 和 height 属性,以查看它是否与此 Rectangle 对象相交。
- * @param toIntersect 要与此 Rectangle 对象比较的 Rectangle 对象。
- * @returns 如果两个矩形相交,返回true,否则返回false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- intersects(toIntersect: Rectangle): boolean;
- /**
- * Determines whether or not this Rectangle object is empty.
- * @returns A value of true if the Rectangle object's width or height is less than or equal to 0; otherwise false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定此 Rectangle 对象是否为空。
- * @returns 如果 Rectangle 对象的宽度或高度小于等于 0,则返回 true 值,否则返回 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- isEmpty(): boolean;
- /**
- * Sets all of the Rectangle object's properties to 0. A Rectangle object is empty if its width or height is less than or equal to 0.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将 Rectangle 对象的所有属性设置为 0。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- setEmpty(): void;
- /**
- * Returns a new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object.
- * @returns A new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回一个新的 Rectangle 对象,其 x、y、width 和 height 属性的值与原始 Rectangle 对象的对应值相同。
- * @returns 新的 Rectangle 对象,其 x、y、width 和 height 属性的值与原始 Rectangle 对象的对应值相同。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- clone(): Rectangle;
- /**
- * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object.
- * This method is similar to the Rectangle.contains() method, except that it takes a Point object as a parameter.
- * @param point The point, as represented by its x and y coordinates.
- * @returns A value of true if the Rectangle object contains the specified point; otherwise false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定由此 Rectangle 对象定义的矩形区域内是否包含指定的点。
- * 此方法与 Rectangle.contains() 方法类似,只不过它采用 Point 对象作为参数。
- * @param point 包含点对象
- * @returns 如果包含,返回true,否则返回false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- containsPoint(point: Point): boolean;
- /**
- * Determines whether the Rectangle object specified by the rect parameter is contained within this Rectangle object.
- * A Rectangle object is said to contain another if the second Rectangle object falls entirely within the boundaries of the first.
- * @param rect The Rectangle object being checked.
- * @returns A value of true if the Rectangle object that you specify is contained by this Rectangle object; otherwise false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定此 Rectangle 对象内是否包含由 rect 参数指定的 Rectangle 对象。
- * 如果一个 Rectangle 对象完全在另一个 Rectangle 的边界内,我们说第二个 Rectangle 包含第一个 Rectangle。
- * @param rect 所检查的 Rectangle 对象
- * @returns 如果此 Rectangle 对象包含您指定的 Rectangle 对象,则返回 true 值,否则返回 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- containsRect(rect: egret.Rectangle): boolean;
- /**
- * Determines whether the object specified in the toCompare parameter is equal to this Rectangle object.
- * This method compares the x, y, width, and height properties of an object against the same properties of this Rectangle object.
- * @param The rectangle to compare to this Rectangle object.
- * @returns A value of true if the object has exactly the same values for the x, y, width, and height properties as this Rectangle object; otherwise false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 确定在 toCompare 参数中指定的对象是否等于此 Rectangle 对象。
- * 此方法将某个对象的 x、y、width 和 height 属性与此 Rectangle 对象所对应的相同属性进行比较。
- * @param toCompare 要与此 Rectangle 对象进行比较的矩形。
- * @returns 如果对象具有与此 Rectangle 对象完全相同的 x、y、width 和 height 属性值,则返回 true 值,否则返回 false。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- equals(toCompare: Rectangle): boolean;
- /**
- * Increases the size of the Rectangle object. This method is similar to the Rectangle.inflate() method except it takes a Point object as a parameter.
- * @param point 此 Point 对象的 x 属性用于增加 Rectangle 对象的水平尺寸。y 属性用于增加 Rectangle 对象的垂直尺寸。
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 增加 Rectangle 对象的大小。此方法与 Rectangle.inflate() 方法类似,只不过它采用 Point 对象作为参数。
- * @param point The x property of this Point object is used to increase the horizontal dimension of the Rectangle object. The y property is used to increase the vertical dimension of the Rectangle object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- inflatePoint(point: Point): void;
- /**
- * Adjusts the location of the Rectangle object, as determined by its top-left corner, by the specified amounts.
- * @param dx Moves the x value of the Rectangle object by this amount.
- * @param dy Moves the y value of the Rectangle object by this amount.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 按指定量调整 Rectangle 对象的位置(由其左上角确定)。
- * @param dx 将 Rectangle 对象的 x 值移动此数量。
- * @param dy 将 Rectangle 对象的 t 值移动此数量。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- offset(dx: number, dy: number): void;
- /**
- * Adjusts the location of the Rectangle object using a Point object as a parameter. This method is similar to the Rectangle.offset() method, except that it takes a Point object as a parameter.
- * @param point A Point object to use to offset this Rectangle object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将 Point 对象用作参数来调整 Rectangle 对象的位置。此方法与 Rectangle.offset() 方法类似,只不过它采用 Point 对象作为参数。
- * @param point 要用于偏移此 Rectangle 对象的 Point 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- offsetPoint(point: Point): void;
- /**
- * Builds and returns a string that lists the horizontal and vertical positions and the width and height of the Rectangle object.
- * @returns A string listing the value of each of the following properties of the Rectangle object: x, y, width, and height.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 生成并返回一个字符串,该字符串列出 Rectangle 对象的水平位置和垂直位置以及高度和宽度。
- * @returns 一个字符串,它列出了 Rectangle 对象的下列各个属性的值:x、y、width 和 height。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- toString(): string;
- /**
- * Adds two rectangles together to create a new Rectangle object, by filling in the horizontal and vertical space between the two rectangles.
- * @param toUnion A Rectangle object to add to this Rectangle object.
- * @returns A new Rectangle object that is the union of the two rectangles.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 通过填充两个矩形之间的水平和垂直空间,将这两个矩形组合在一起以创建一个新的 Rectangle 对象。
- * @param toUnion 要添加到此 Rectangle 对象的 Rectangle 对象。
- * @returns 充当两个矩形的联合的新 Rectangle 对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- union(toUnion: Rectangle): Rectangle;
- /**
- * @private
- */
- $getBaseWidth(angle: number): number;
- /**
- * @private
- */
- $getBaseHeight(angle: number): number;
- }
- /**
- * @private
- * 仅供框架内复用,要防止暴露引用到外部。
- */
- let $TempRectangle: Rectangle;
-}
-declare namespace egret {
-}
-declare namespace egret {
- /**
- * The JointStyle class is an enumeration of constant values that specify the joint style to use in drawing lines.
- * These constants are provided for use as values in the joints parameter of the egret.Graphics.lineStyle() method.
- * @see egret.Graphics#lineStyle()
- * @version Egret 2.5
- * @platform Web,Native
- * @language en_US
- */
- /**
- * JointStyle 类是指定要在绘制线条中使用的联接点样式的常量值枚举。提供的这些常量用作 egret.Graphics.lineStyle() 方法的 joints 参数中的值。
- * @see egret.Graphics#lineStyle()
- * @version Egret 2.5
- * @platform Web,Native
- * @language zh_CN
- */
- const JointStyle: {
- BEVEL: string;
- MITER: string;
- ROUND: string;
- };
-}
-declare namespace egret {
-}
-/**
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/localStorage/localStorage.ts
- */
-declare namespace egret.localStorage {
- /**
- * Read data
- * @param key {string} Name of the key to be read
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 读取数据
- * @param key {string} 要读取的键名称
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- let getItem: (key: string) => string;
- /**
- * Save data
- * @param key {string} Name of the key to be saved
- * @param value {string} Value to be saved
- * @returns {boolean} Whether data is saved successfully
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 保存数据
- * @param key {string} 要保存的键名称
- * @param value {string} 要保存的值
- * @returns {boolean} 数据保存是否成功
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- let setItem: (key: string, value: string) => boolean;
- /**
- * Delete data
- * @param key {string} Name of the key to be deleted
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 删除数据
- * @param key {string} 要删除的键名称
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- let removeItem: (key: string) => void;
- /**
- * Clear all data
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将所有数据清空
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- let clear: () => void;
-}
-declare namespace egret.sys {
- /**
- * @private
- * @param channel
- */
- function $pushSoundChannel(channel: SoundChannel): void;
- /**
- * @private
- * @param channel
- */
- function $popSoundChannel(channel: SoundChannel): boolean;
-}
-declare namespace egret {
- /**
- * The Sound class lets you work with sound in an application.
- * The Sound class lets you create a Sound object, load and play an external audio file into that object.
- * More detailed control of the sound is performed through the SoundChannel
- *
- * @event egret.Event.COMPLETE Dispatch when the audio resource is loaded and ready to play
- * @event egret.IOErrorEvent.IO_ERROR Dispatch when the audio resource is failed to load
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/media/Sound.ts
- * @language en_US
- */
- /**
- * Sound 允许您在应用程序中使用声音。使用 Sound 类可以创建 Sound 对象、将外部音频文件加载到该对象并播放该文件。
- * 可通过 SoundChannel 对声音执行更精细的控制,如控制音量和监控播放进度。
- * @see http://edn.egret.com/cn/docs/page/156 音频系统
- *
- * @event egret.Event.COMPLETE 音频加载完成时抛出
- * @event egret.IOErrorEvent.IO_ERROR 音频加载失败时抛出
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/media/Sound.ts
- * @language zh_CN
- */
- interface Sound extends EventDispatcher {
- /**
- * Initiates loading of an external audio file from the specified URL.
- * @param url Audio file URL
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 启动从指定 URL 加载外部音频文件的过程。
- * @param url 需要加载的音频文件URL
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- load(url: string): void;
- /**
- * Generates a new SoundChannel object to play back the sound.
- * @param startTime The initial position in seconds at which playback should start, (default = 0)
- * @param loops Plays, the default value is 0. Greater than 0 to the number of plays, such as 1 to play 1, less than or equal to 0, to loop.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 生成一个新的 SoundChannel 对象来播放该声音。此方法返回 SoundChannel 对象,访问该对象可停止声音调整音量。
- * @param startTime 应开始播放的初始位置(以秒为单位),默认值是 0
- * @param loops 播放次数,默认值是 0,循环播放。 大于 0 为播放次数,如 1 为播放 1 次;小于等于 0,为循环播放。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- play(startTime?: number, loops?: number): SoundChannel;
- /**
- * Closes the stream, causing any download of data to cease
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 关闭该流,从而停止所有数据的下载。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- close(): void;
- /**
- * Type, default is egret.Sound.EFFECT.
- * In the native and runtime environment, while only play a background music, sound length so as not to be too long.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 类型,默认为 egret.Sound.EFFECT。
- * 在 native 和 runtime 环境下,背景音乐同时只能播放一个,音效长度尽量不要太长。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- type: string;
- /**
- * Length of the current sound (in seconds).
- * @version Egret 2.4
- * @platform Web,Native
- * @readOnly
- * @language en_US
- */
- /**
- * 当前声音的长度(以秒为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @readOnly
- * @language zh_CN
- */
- length: number;
- }
- /**
- * @copy egret.Sound
- */
- let Sound: {
- /**
- * Create Sound object, load an external audio file and play
- * @param url Audio file URL, Sound will start to load the media if url is not empty
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建 Sound 对象、将外部音频文件加载到该对象并播放该文件
- * @param url 需要加载的音频文件URL,如果指定了 url, Sound会立即开始加载指定的媒体文件
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- new (): Sound;
- /**
- * Background music
- * @default "music"
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 背景音乐
- * @default "music"
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- MUSIC: string;
- /**
- * EFFECT
- * @default "effect"
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 音效
- * @default "effect"
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- EFFECT: string;
- };
-}
-declare namespace egret {
- /**
- * The SoundChannel class controls a sound in an application.
- * Every sound is assigned to a sound channel, and the application
- * can have multiple sound channels that are mixed together.
- * The SoundChannel class contains a stop() method, properties for
- * set the volume of the channel
- *
- * @event egret.Event.SOUND_COMPLETE Dispatch when a sound has finished playing at last time
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/media/Sound.ts
- * @language en_US
- */
- /**
- * SoundChannel 类控制应用程序中的声音。每个声音均分配给一个声道,而且应用程序可以具有混合在一起的多个声道。
- * SoundChannel 类包含 stop() 方法、用于设置音量和监视播放进度的属性。
- *
- * @event egret.Event.SOUND_COMPLETE 音频最后一次播放完成时抛出
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/media/Sound.ts
- * @language zh_CN
- */
- interface SoundChannel extends IEventDispatcher {
- /**
- * The volume, ranging from 0 (silent) to 1 (full volume).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 音量范围从 0(静音)至 1(最大音量)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- volume: number;
- /**
- * When the sound is playing, the position property indicates
- * in seconds the current point that is being played in the sound file.
- * @version Egret 2.4
- * @platform Web,Native
- * @readOnly
- * @language en_US
- */
- /**
- * 当播放声音时,position 属性表示声音文件中当前播放的位置(以秒为单位)
- * @version Egret 2.4
- * @platform Web,Native
- * @readOnly
- * @language zh_CN
- */
- position: number;
- /**
- * Stops the sound playing in the channel.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 停止在该声道中播放声音。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- stop(): void;
- }
-}
-declare namespace egret {
- /**
- * The Video class lets you work with video in an application.
- * The Video class lets you create a Video object, load and play an external video file into that object.
- * Note: On most mobile device, the video is playback in the full screen mode.
- *
- * @param url URL of the media to play, Video will start to load if the url is not empty
- *
- * @event egret.Event.COMPLETE Dispatch when the video resource is loaded and ready to play
- * @event egret.Event.ENDED Dispatch when the video playback ended
- * @event egret.IOErrorEvent.IO_ERROR when the video is failed to load
- * @version Egret 2.4
- * @platform Web
- * @includeExample egret/media/Video.ts
- * @language en_US
- */
- /**
- * Video 允许您在应用程序中使用视频。使用 Video 类可以创建 Video 对象、将外部视频文件加载到该对象并播放该文件。
- * 注意: 在大多数移动设备中,视频是强制全屏播放的,所以你可以直接调用 play() 方法全屏播放视频,不用将它绘制在Stage中。
- * @see http://edn.egret.com/cn/docs/page/657 视频系统
- *
- * @param url 要播放的视频的URL,如果url不为空,Video会立即加载这个视频
- *
- * @event egret.Event.COMPLETE 视频加载完成时抛出
- * @event egret.Event.ENDED 视频播放完成时抛出
- * @event egret.IOErrorEvent.IO_ERROR 视频加载失败时触发
- * @version Egret 2.4
- * @platform Web
- * @includeExample egret/media/Video.ts
- * @language zh_CN
- */
- interface Video extends DisplayObject {
- /**
- * Initiates loading of an external video file from the specified URL.
- * @param url Audio file URL
- * * @param cache Should cache the video,only used in Native
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 启动从指定 URL 加载外部视频文件的过程。
- * @param url 需要加载的视频文件URL
- * @param cache 是否需要缓存到本地,只在 Native 上使用
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- load(url: string, cache?: boolean): void;
- /**
- * Play back the video.
- * @param startTime The initial position in seconds at which playback should start, (default = 0)
- * @param loop Defines should play the video again when the video is ended. (default = false)
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 播放该视频
- * @param startTime 应开始播放的初始位置(以秒为单位),默认值是视频上次结束的位置
- * @param loop 是否需要循环播放,默认值是 false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- play(startTime?: number, loop?: boolean): any;
- /**
- * Closes the stream, causing any download of data to cease
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 关闭该流,从而停止所有数据的下载。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- close(): void;
- /**
- * The URL of the video you want to play.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 想要播放的视频的URL
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- src: string;
- /**
- * The URL of an image you want to display before the video is loaded or video cannot been draw on the canvas on some mobile device.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 视频加载前,或者在不支持将 video 画在 canvas 的设备上,想要显示的视频截图地址。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- poster: string;
- /**
- * Should play the video in fullscreen mode (default = true).
- * Currently only supports full-screen mobile terminal web.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 是否全屏播放这个视频(默认值是 true)。
- * 目前移动端 web 只支持全屏。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- fullscreen: boolean;
- /**
- * The volume, ranging from 0 (silent) to 1 (full volume).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 音量范围从 0(静音)至 1(最大音量)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- volume: number;
- /**
- * When the video is playing, the position property indicates
- * in seconds the current point that is being played in the video file.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当播放视频时,position 属性表示视频文件中当前播放的位置(以秒为单位)
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- position: number;
- /**
- * Pause the video playing.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 暂停播放。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- pause(): void;
- /**
- * Get bitmapData of the video file, you can use the video as bitmapData on the stage.
- * Note: On most mobile device, the video is playback in the full screen mode.
- * So you can just use the play() method instead of draw it on the Stage
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 获取视频的 bitmapData, 你可以将视频绘制到舞台上。
- * 注意: 在大多数移动设备中,视频是全屏播放的,所以你可以直接调用 play() 方法全屏播放视频,不用将它绘制在Stage中。
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- bitmapData?: BitmapData;
- /**
- * Whether current video is paused.
- * @version Egret 2.4
- * @platform Web,Native
- * @readOnly
- * @language en_US
- */
- /**
- * 当前视频是否在暂停状态。
- * @version Egret 2.4
- * @platform Web,Native
- * @readOnly
- * @language zh_CN
- */
- paused: boolean;
- /**
- * Length of the current video (in seconds).
- * @version Egret 3.0.8
- * @platform Web,Native
- * @readOnly
- * @language en_US
- */
- /**
- * 当前视频的长度(以秒为单位)。
- * @version Egret 3.0.8
- * @platform Web,Native
- * @readOnly
- * @language zh_CN
- */
- length: number;
- }
- /**
- * @copy egret.Video
- */
- let Video: {
- new (url?: string, cache?: boolean): Video;
- };
-}
-declare namespace egret {
- /**
- * The HttpMethod class provides values that specify whether the HttpRequest object should use the POST method
- * or the GET method when sending data to a server.
- * @see egret.HttpRequest
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * HttpRequestMethod 类提供了一些值,这些值可指定在将数据发送到服务器时,
- * HttpRequest 对象应使用 POST 方法还是 GET 方法。
- * @see egret.HttpRequest
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- namespace HttpMethod {
- /**
- * Specifies that the HttpRequest object is a GET.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示 HttpRequest 对象是一个 GET。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const GET = "GET";
- /**
- * Specifies that the HttpRequest object is a POST.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示 HttpRequest 对象是一个 POST。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const POST = "POST";
- }
-}
-declare namespace egret {
- /**
- * The HttpRequest class downloads data from a URL as text or binary data. It is useful for downloading text files,
- * XML, or other information to be used in a dynamic, data-driven application. A HttpRequest object downloads all
- * of the data from a URL before making it available to code in the applications. It sends out notifications about
- * the progress of the download, which you can monitor through the bytesLoaded and bytesTotal properties,
- * as well as through dispatched events.
- * @event egret.Event.COMPLETE Dispatched when the net request is complete.
- * @event egret.Event.IO_ERROR Dispatched when the net request is failed.
- * @event egret.ProgressEvent.PROGRESS Dispatched when data is received as the download operation progresses.
- * @see egret.HttpMethod
- * @see egret.HttpResponseType
- * @includeExample egret/net/HttpRequestExample.ts
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * HttpRequest 类以文本或二进制数据的形式从 URL 下载数据。
- * HttpRequest 对象会先从 URL 中下载所有数据,然后才将数据用于应用程序中的代码。它会发出有关下载进度的通知,
- * 通过 bytesLoaded 和 bytesTotal 属性以及已调度的事件,可以监视下载进度。
- * @event egret.Event.COMPLETE 加载完成
- * @event egret.Event.IO_ERROR 加载失败
- * @event egret.ProgressEvent.PROGRESS 加载进度,可通过event.bytesLoaded和event.bytesTotal统计进度信息。
- * @see egret.HttpMethod
- * @see egret.HttpResponseType
- * @includeExample egret/net/HttpRequestExample.ts
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- interface HttpRequest extends EventDispatcher {
- /**
- * The data received from the load operation. The format of the data depends on the setting of the responseType property.
- * @readOnly
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 本次请求返回的数据,数据类型根据 responseType 设置的值确定。
- * @readOnly
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- response: any;
- /**
- * Controls whether the downloaded data is received as text (HttpResponseType.TEXT) or raw binary data (HttpResponseType.ArrayBuffer)
- * Note:If you attempt to set this property to an invalid value, Egret runtime set the value to HttpResponseType.TEXT.
- * @default egret.HttpResponseType.TEXT
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 设置返回的数据格式为文本(HttpResponseType.TEXT)还是二进制数据(HttpResponseType.ArrayBuffer)
- * 注意:若尝试设置此属性为一个非法的值,运行时将使用HttpResponseType.TEXT。
- * @default egret.HttpResponseType.TEXT
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- responseType: string;
- /**
- * indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies
- * or authorization headers. (This never affects same-site requests.)
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表明在进行跨站(cross-site)的访问控制(Access-Control)请求时,是否使用认证信息(例如cookie或授权的header)。(这个标志不会影响同站的请求)
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- withCredentials: boolean;
- /**
- * Initializes a request.
- * Note: Calling this method for an already active request (one for which open() or openRequest() has already been
- * called) is the equivalent of calling abort().
- * @param url The URL to send the request to.
- * @param method The HTTP method to use, please use the const value in the HttpMethod class.
- * @see egret.HttpMethod
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 初始化一个请求.
- * 注意: 若在已经发出请求的对象上调用此方法,相当于立即调用abort().
- * @param url 该请求所要访问的URL该请求所要访问的URL
- * @param method 请求所使用的HTTP方法, 请使用 HttpMethod 定义的枚举值.
- * @see egret.HttpMethod
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- open(url: string, method?: string): void;
- /**
- * Sends the request.
- * @param data the data to send.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 发送请求.
- * @param data 需要发送的数据
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- send(data?: any): void;
- /**
- * Aborts the request if it has already been sent.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 如果请求已经被发送,则立刻中止请求.
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- abort(): void;
- /**
- * Returns all the response headers as a string, or null if no response has been received.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回所有响应头信息(响应头名和值), 如果响应头还没接受,则返回"".
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- getAllResponseHeaders(): string;
- /**
- * Sets the value of an HTTP request header. You must call setRequestHeader() after open().
- * @param header The name of the header whose value is to be set.
- * @param value The value to set as the body of the header.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 给指定的HTTP请求头赋值.在这之前,您必须确认已经调用 open() 方法打开了一个url.
- * @param header 将要被赋值的请求头名称.
- * @param value 给指定的请求头赋的值.
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- setRequestHeader(header: string, value: string): void;
- /**
- * Returns the string containing the text of the specified header, or null if either the response has not yet been
- * received or the header doesn't exist in the response.
- * @param header The name of the header whose value is to be get.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回指定的响应头的值, 如果响应头还没被接受,或该响应头不存在,则返回"".
- * @param header 要返回的响应头名称
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- getResponseHeader(header: string): string;
- }
- /**
- * Creates a HttpRequest object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 HttpRequest 实例。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- let HttpRequest: {
- new (): HttpRequest;
- };
-}
-declare namespace egret {
- /**
- * The HttpResponseType class provides values that specify how downloaded data is received.
- * @see egret.HttpRequest
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * URLLoaderDataFormat 类提供了一些用于指定如何接收已下载数据的值。
- * @see egret.HttpRequest
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class HttpResponseType {
- /**
- * Specifies that downloaded data is received as text. This is the default value of HttpRequest.responseType
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回字符串。HttpRequest.responseType属性的默认值。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static TEXT: string;
- /**
- * Specifies that downloaded data is received as raw binary data.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 返回二进制的ArrayBuffer对象。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ARRAY_BUFFER: string;
- }
-}
-declare namespace egret {
- /**
- * The Loader class is used to load image (JPG, PNG, or GIF) files. Use the load() method to initiate loading.
- * The loaded image data is in the data property of ImageLoader.
- * @event egret.Event.COMPLETE Dispatched when the net request is complete.
- * @event egret.IOErrorEvent.IO_ERROR Dispatched when the net request is failed.
- * @see egret.HttpRequest
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/net/ImageLoaderExample.ts
- * @see http://edn.egret.com/cn/docs/page/590 加载位图文件
- * @language en_US
- */
- /**
- * ImageLoader 类可用于加载图像(JPG、PNG 或 GIF)文件。使用 load() 方法来启动加载。被加载的图像对象数据将存储在 ImageLoader.data 属性上 。
- * @event egret.Event.COMPLETE 加载完成
- * @event egret.IOErrorEvent.IO_ERROR 加载失败
- * @see egret.HttpRequest
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/net/ImageLoaderExample.ts
- * @see http://edn.egret.com/cn/docs/page/590 加载位图文件
- * @language zh_CN
- */
- interface ImageLoader extends EventDispatcher {
- /**
- * The data received from the load operation.
- * @default null
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 使用 load() 方法加载成功的 BitmapData 图像数据。
- * @default null
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- data: BitmapData;
- /**
- * Specifies whether or not cross-site Access-Control requests should be made when loading a image from foreign origins.
- * possible values are:"anonymous","use-credentials" or null.
- * @default null
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 当从其他站点加载一个图片时,指定是否启用跨域资源共享(CORS),默认值为null。
- * 可以设置为"anonymous","use-credentials"或null,设置为其他值将等同于"anonymous"。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- crossOrigin: string;
- /**
- * start a load operation。
- * Note: Calling this method for an already active request (one for which load() has already been
- * called) will abort the last load operation immediately.
- * @param url 要加载的图像文件的地址。
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 启动一次图像加载。
- * 注意:若之前已经调用过加载请求,重新调用 load() 将终止先前的请求,并开始新的加载。
- * @param url 要加载的图像文件的地址。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- load(url: string): void;
- }
- /**
- * Creates a ImageLoader object
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 ImageLoader 实例
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- let ImageLoader: {
- /**
- * constructor
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 构造函数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- new (): ImageLoader;
- /**
- * Specifies whether to enable cross-origin resource sharing, If ImageLoader instance has been set crossOrigin property will be used to set the property.
- * @version Egret 2.5.7
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 指定是否启用跨域资源共享,如果ImageLoader实例有设置过crossOrigin属性将使用设置的属性
- * @version Egret 2.5.7
- * @platform Web,Native
- * @language zh_CN
- */
- crossOrigin: string;
- };
-}
-declare namespace egret.sys {
- /**
- * @private
- * 显示列表
- */
- class DisplayList extends HashObject {
- /**
- * 创建一个DisplayList对象,若内存不足或无法创建RenderBuffer,将会返回null。
- */
- static create(target: DisplayObject): DisplayList;
- /**
- * @private
- * 创建一个DisplayList对象
- */
- constructor(root: DisplayObject);
- private isStage;
- /**
- * 位图渲染节点
- */
- $renderNode: RenderNode;
- /**
- * @private
- * 获取渲染节点
- */
- $getRenderNode(): sys.RenderNode;
- /**
- * @private
- */
- renderBuffer: RenderBuffer;
- /**
- * @private
- */
- offsetX: number;
- /**
- * @private
- */
- offsetY: number;
- /**
- * @private
- */
- private offsetMatrix;
- /**
- * @private
- * 显示列表根节点
- */
- root: DisplayObject;
- /**
- * @private
- * 设置剪裁边界,不再绘制完整目标对象,画布尺寸由外部决定,超过边界的节点将跳过绘制。
- */
- setClipRect(width: number, height: number): void;
- $canvasScaleX: number;
- $canvasScaleY: number;
- /**
- * @private
- * 绘制根节点显示对象到目标画布,返回draw的次数。
- */
- drawToSurface(): number;
- private bitmapData;
- /**
- * @private
- * 改变画布的尺寸,由于画布尺寸修改会清空原始画布。所以这里将原始画布绘制到一个新画布上,再与原始画布交换。
- */
- changeSurfaceSize(): void;
- static $canvasScaleFactor: number;
- /**
- * @private
- */
- static $canvasScaleX: number;
- static $canvasScaleY: number;
- /**
- * @private
- */
- static $setCanvasScale(x: number, y: number): void;
- }
-}
-declare namespace egret {
- type runEgretOptions = {
- renderMode?: string;
- audioType?: number;
- screenAdapter?: sys.IScreenAdapter;
- antialias?: boolean;
- canvasScaleFactor?: number;
- calculateCanvasScaleFactor?: (context: CanvasRenderingContext2D) => number;
- entryClassName?: string;
- scaleMode?: string;
- frameRate?: number;
- contentWidth?: number;
- contentHeight?: number;
- orientation?: string;
- };
- /**
- * egret project entry function
- * @param options An object containing the initialization properties for egret engine.
- * @language en_US
- */
- /**
- * egret工程入口函数
- * @param options 一个可选对象,包含初始化Egret引擎需要的参数。
- * @language zh_CN
- */
- function runEgret(options?: runEgretOptions): void;
- /**
- * Refresh the screen display
- * @language en_US
- */
- /**
- * 刷新屏幕显示
- * @language zh_CN
- */
- function updateAllScreens(): void;
-}
-declare namespace egret {
- /**
- * @private
- */
- interface FPSDisplay {
- /**
- * 更新FPS信息
- */
- update(datas: FPSData): void;
- /**
- * 插入一条log信息
- */
- updateInfo(info: string): void;
- /**
- * 插入一条warn信息
- */
- updateWarn(info: string): void;
- /**
- * 插入一条error信息
- */
- updateError(info: string): void;
- }
- /**
- * @private
- */
- let FPSDisplay: {
- new (stage: Stage, showFPS: boolean, showLog: boolean, logFilter: string, styles: Object): FPSDisplay;
- };
-}
-/**
- * @private
- */
-interface FPSData extends Object {
- fps: number;
- draw: number;
- costTicker: number;
- costRender: number;
-}
-declare namespace egret.sys {
- let $TempStage: egret.Stage;
- /**
- * @private
- * Egret播放器
- */
- class Player extends HashObject {
- /**
- * @private
- * 实例化一个播放器对象。
- */
- constructor(buffer: RenderBuffer, stage: Stage, entryClassName: string);
- /**
- * @private
- */
- private createDisplayList(stage, buffer);
- /**
- * @private
- */
- private screenDisplayList;
- /**
- * @private
- * 入口类的完整类名
- */
- private entryClassName;
- /**
- * @private
- * 舞台引用
- */
- stage: Stage;
- /**
- * @private
- * 入口类实例
- */
- private root;
- /**
- * @private
- */
- private isPlaying;
- /**
- * @private
- * 启动播放器
- */
- start(): void;
- /**
- * @private
- */
- private initialize();
- /**
- * @private
- * 停止播放器,停止后将不能重新启动。
- */
- stop(): void;
- /**
- * @private
- * 暂停播放器,后续可以通过调用start()重新启动播放器。
- */
- pause(): void;
- /**
- * @private
- * 渲染屏幕
- */
- $render(triggerByFrame: boolean, costTicker: number): void;
- /**
- * @private
- * 更新舞台尺寸
- * @param stageWidth 舞台宽度(以像素为单位)
- * @param stageHeight 舞台高度(以像素为单位)
- */
- updateStageSize(stageWidth: number, stageHeight: number): void;
- /**
- * @private
- * 显示FPS。
- */
- displayFPS(showFPS: boolean, showLog: boolean, logFilter: string, styles: Object): void;
- /**
- * @private
- */
- private showFPS;
- /**
- * @private
- */
- private showLog;
- /**
- * @private
- */
- private stageDisplayList;
- }
- /**
- * @private
- */
- let $logToFPS: (info: string) => void;
- /**
- * @private
- */
- let $warnToFPS: (info: string) => void;
- /**
- * @private
- */
- let $errorToFPS: (info: string) => void;
-}
-/**
- * @private
- */
-declare module egret {
- /**
- * @private
- */
- var nativeRender: boolean;
-}
-/**
- * @private
- */
-interface PlayerOption {
- /**
- * 入口类完整类名
- */
- entryClassName?: string;
- /**
- * 默认帧率
- */
- frameRate?: number;
- /**
- * 屏幕适配模式
- */
- scaleMode?: string;
- /**
- * 初始内容宽度
- */
- contentWidth?: number;
- /**
- * 初始内容高度
- */
- contentHeight?: number;
- /**
- * 屏幕方向
- */
- orientation?: string;
- /**
- * 显示FPS
- */
- showFPS?: boolean;
- /**
- *
- */
- fpsStyles?: Object;
- /**
- * 显示日志
- */
- showLog?: boolean;
- /**
- * 过滤日志的正则表达式
- */
- logFilter?: string;
- /**
- *
- */
- maxTouches?: number;
- /**
- *
- */
- textureScaleFactor?: number;
-}
-declare namespace egret {
- /**
- * @private
- */
- class Mesh extends Bitmap {
- constructor(value?: Texture);
- protected createNativeDisplayObject(): void;
- /**
- * @private
- */
- protected setBitmapDataToWasm(data?: Texture): void;
- /**
- * @private
- */
- $updateRenderNode(): void;
- /**
- * @private
- */
- private _verticesDirty;
- private _bounds;
- /**
- * @private
- */
- $updateVertices(): void;
- /**
- * @private
- */
- $measureContentBounds(bounds: Rectangle): void;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 设备屏幕
- */
- interface Screen {
- /**
- * @private
- * 更新屏幕视口尺寸
- */
- updateScreenSize(): any;
- /**
- * @private
- * 更新触摸数量
- */
- updateMaxTouches(): any;
- /**
- * @private
- * 设置分辨率尺寸
- */
- setContentSize(width: number, height: number): any;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 屏幕适配器接口,当播放器视口尺寸改变时,屏幕适配器将被用于计算当前对应的舞台显示尺寸。
- */
- interface IScreenAdapter {
- /**
- * @private
- * 计算舞台显示尺寸
- * @param scaleMode 当前的缩放模式
- * @param screenWidth 播放器视口宽度
- * @param screenHeight 播放器视口高度
- * @param contentWidth 初始化内容宽度
- * @param contentHeight 初始化内容高度
- */
- calculateStageSize(scaleMode: string, screenWidth: number, screenHeight: number, contentWidth: number, contentHeight: number): StageDisplaySize;
- }
- /**
- * @private
- * 舞台显示尺寸数据
- */
- interface StageDisplaySize {
- /**
- * @private
- * 舞台宽度
- */
- stageWidth: number;
- /**
- * @private
- * 舞台高度
- */
- stageHeight: number;
- /**
- * @private
- * 显示宽度,若跟舞台宽度不同,将会产生缩放。
- */
- displayWidth: number;
- /**
- * @private
- * 显示高度,若跟舞台高度不同,将会产生缩放。
- */
- displayHeight: number;
- }
- /**
- * @private
- * 屏幕适配器实例,开发者可以通过给这个变量赋值实现了IScreenAdapter接口的实例,从而注入自定义的屏幕适配器。
- */
- let screenAdapter: IScreenAdapter;
- /**
- * @private
- * 屏幕适配器默认实现,开发者可以实现自定义规则的屏幕适配器。并在初始化加载时将适配器的实例赋值给egret.sys.screenAdapter上,从而替换掉默认适配器。
- */
- class DefaultScreenAdapter extends HashObject implements IScreenAdapter {
- /**
- * @private
- */
- constructor();
- /**
- * @private
- * 计算舞台显示尺寸
- * @param scaleMode 当前的缩放模式
- * @param screenWidth 播放器视口宽度
- * @param screenHeight 播放器视口高度
- * @param contentWidth 初始化内容宽度
- * @param contentHeight 初始化内容高度
- */
- calculateStageSize(scaleMode: string, screenWidth: number, screenHeight: number, contentWidth: number, contentHeight: number): StageDisplaySize;
- }
-}
-declare namespace egret {
- /**
- * StageScaleMode class provides values for the stage zoom mode.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/player/StageScaleMode.ts
- * @language en_US
- */
- /**
- * StageScaleMode 类为舞台缩放模式提供值。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/player/StageScaleMode.ts
- * @language zh_CN
- */
- class StageScaleMode {
- /**
- * Do not scale application content. Even when you change the player viewport size, it remains unchanged. If the player is smaller than the viewport content, possibly with some cropping.
- * In this mode, the stage size (Stage.stageWidth, Stage.stageHeight) always with the player viewport size consistent.
- * @language en_US
- */
- /**
- * 不缩放应用程序内容。即使在更改播放器视口大小时,它仍然保持不变。如果播放器视口比内容小,则可能进行一些裁切。
- * 在此模式下,舞台尺寸(Stage.stageWidth,Stage.stageHeight)始终跟播放器视口大小保持一致。
- * @language zh_CN
- */
- static NO_SCALE: string;
- /**
- * Keep the original aspect ratio scaling application content, after scaling a wide directions application content to fill the viewport players on both sides in the other direction may not be wide enough and left black bars.
- * In this mode, the stage size (Stage.stageWidth, Stage.stageHeight) is always equal to the initialization incoming external application content size.
- * @language en_US
- */
- /**
- * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容的较宽方向填满播放器视口,另一个方向的两侧可能会不够宽而留有黑边。
- * 在此模式下,舞台尺寸(Stage.stageWidth,Stage.stageHeight)始终等于初始化时外部传入的应用程序内容尺寸。
- * @language zh_CN
- */
- static SHOW_ALL: string;
- /**
- * Keep the original aspect ratio scaling application content, after scaling a narrow direction of application content to fill the viewport players on both sides in the other direction may exceed the viewport and the player is cut.
- * In this mode, the stage size (Stage.stageWidth, Stage.stageHeight) is always equal to the initialization incoming external application content size.
- * @language en_US
- */
- /**
- * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容的较窄方向填满播放器视口,另一个方向的两侧可能会超出播放器视口而被裁切。
- * 在此模式下,舞台尺寸(Stage.stageWidth,Stage.stageHeight)始终等于初始化时外部传入的应用程序内容尺寸。
- * @language zh_CN
- */
- static NO_BORDER: string;
- /**
- * Do not keep the original aspect ratio scaling application content, after scaling application content just fill the player viewport.
- * In this mode, the stage size (Stage.stageWidth, Stage.stageHeight) is always equal to the initialization incoming external application content size.
- * @language en_US
- */
- /**
- * 不保持原始宽高比缩放应用程序内容,缩放后应用程序内容正好填满播放器视口。
- * 在此模式下,舞台尺寸(Stage.stageWidth,Stage.stageHeight)始终等于初始化时外部传入的应用程序内容尺寸。
- * @language zh_CN
- */
- static EXACT_FIT: string;
- /**
- * Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, but only to keep the contents of the original application constant width, height may change.
- * In this mode, the stage width (Stage.stageWidth) is always equal to initialize external incoming application content width. Stage height (Stage.stageHeight) by the current scale with the player viewport height decision.
- * @language en_US
- */
- /**
- * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,但只保持应用程序内容的原始宽度不变,高度可能会改变。
- * 在此模式下,舞台宽度(Stage.stageWidth)始终等于初始化时外部传入的应用程序内容宽度。舞台高度(Stage.stageHeight)由当前的缩放比例与播放器视口高度决定。
- * @language zh_CN
- */
- static FIXED_WIDTH: string;
- /**
- * Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, but only to keep the contents of the original application constant height, width may change.
- * In this mode, the stage height (Stage.stageHeight) is always equal to initialize external incoming application content height. Stage width (Stage.stageWidth) by the current scale with the player viewport width decision.
- * @language en_US
- */
- /**
- * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,但只保持应用程序内容的原始高度不变,宽度可能会改变。
- * 在此模式下,舞台高度(Stage.stageHeight)始终等于初始化时外部传入的应用程序内容高度。舞台宽度(Stage.stageWidth)由当前的缩放比例与播放器视口宽度决定。
- * @language zh_CN
- */
- static FIXED_HEIGHT: string;
- /**
- * Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player,a narrow direction may not be wide enough and fill.
- * In this mode, the stage height (Stage.stageHeight) and the stage width (Stage.stageWidth) by the current scale with the player viewport size.
- * @language en_US
- */
- /**
- * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,应用程序内容的较窄方向可能会不够宽而填充。
- * 在此模式下,舞台高度(Stage.stageHeight)和舞台宽度(Stage.stageWidth)由当前的缩放比例与播放器视口宽高决定。
- * @language zh_CN
- */
- static FIXED_NARROW: string;
- /**
- * Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, a wide direction may exceed the viewport and the player is cut.
- * In this mode, the stage height (Stage.stageHeight) and the stage width (Stage.stageWidth) by the current scale with the player viewport size.
- * @language en_US
- */
- /**
- * 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,应用程序内容的较宽方向的两侧可能会超出播放器视口而被裁切。
- * 在此模式下,舞台高度(Stage.stageHeight)和舞台宽度(Stage.stageWidth)由当前的缩放比例与播放器视口宽高决定。
- * @language zh_CN
- */
- static FIXED_WIDE: string;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- */
- let systemRenderer: SystemRenderer;
- /**
- * @private
- * 用于碰撞检测绘制
- */
- let canvasRenderer: SystemRenderer;
- /**
- * @private
- * 显示渲染器接口
- */
- interface SystemRenderer {
- /**
- * 渲染一个显示对象
- * @param displayObject 要渲染的显示对象
- * @param buffer 渲染缓冲
- * @param matrix 要叠加的矩阵
- * @param forRenderTexture 绘制目标是RenderTexture的标志
- * @returns drawCall触发绘制的次数
- */
- render(displayObject: DisplayObject, buffer: RenderBuffer, matrix: Matrix, forRenderTexture?: boolean): number;
- /**
- * 将一个RenderNode对象绘制到渲染缓冲
- * @param node 要绘制的节点
- * @param buffer 渲染缓冲
- * @param matrix 要叠加的矩阵
- * @param forHitTest 绘制结果是用于碰撞检测。若为true,当渲染GraphicsNode时,会忽略透明度样式设置,全都绘制为不透明的。
- */
- drawNodeToBuffer(node: sys.RenderNode, buffer: RenderBuffer, matrix: Matrix, forHitTest?: boolean): void;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- */
- let $START_TIME: number;
- /**
- * @private
- * 是否要广播Event.RENDER事件的标志。
- */
- let $invalidateRenderFlag: boolean;
- /**
- * @private
- * 需要立即刷新屏幕的标志
- */
- let $requestRenderingFlag: boolean;
- /**
- * Egret心跳计时器
- */
- class SystemTicker {
- /**
- * @private
- */
- constructor();
- /**
- * @private
- */
- private playerList;
- /**
- * @private
- * 注册一个播放器实例并运行
- */
- $addPlayer(player: Player): void;
- /**
- * @private
- * 停止一个播放器实例的运行。
- */
- $removePlayer(player: Player): void;
- /**
- * @private
- */
- private callBackList;
- /**
- * @private
- */
- private thisObjectList;
- /**
- * @private
- */
- $startTick(callBack: (timeStamp: number) => boolean, thisObject: any): void;
- /**
- * @private
- */
- $stopTick(callBack: (timeStamp: number) => boolean, thisObject: any): void;
- /**
- * @private
- */
- private getTickIndex(callBack, thisObject);
- /**
- * @private
- *
- */
- private concatTick();
- /**
- * @private
- * 全局帧率
- */
- $frameRate: number;
- /**
- * @private
- */
- private frameInterval;
- /**
- * @private
- */
- private frameDeltaTime;
- /**
- * @private
- */
- private lastTimeStamp;
- /**
- * @private
- * 设置全局帧率
- */
- $setFrameRate(value: number): boolean;
- /**
- * @private
- */
- private lastCount;
- /**
- * @private
- * ticker 花销的时间
- */
- private costEnterFrame;
- /**
- * @private
- * 是否被暂停
- */
- private isPaused;
- /**
- * Pause the ticker.
- * @version Egret 5.0.2
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 暂停心跳
- * @version Egret 5.0.2
- * @platform Web,Native
- * @language zh_CN
- */
- pause(): void;
- /**
- * Resume the ticker.
- * @version Egret 5.0.2
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 恢复心跳
- * @version Egret 5.0.2
- * @platform Web,Native
- * @language zh_CN
- */
- resume(): void;
- /**
- * @private
- * 执行一次刷新
- */
- update(): void;
- /**
- * @private
- * 执行一次屏幕渲染
- */
- private render(triggerByFrame, costTicker);
- /**
- * @private
- * 广播EnterFrame事件。
- */
- private broadcastEnterFrame();
- /**
- * @private
- * 广播Render事件。
- */
- private broadcastRender();
- /**
- * @private
- */
- private callLaters();
- /**
- * @private
- */
- private callLaterAsyncs();
- }
-}
-declare module egret {
- namespace lifecycle {
- type LifecyclePlugin = (context: LifecycleContext) => void;
- /**
- * @private
- */
- let stage: egret.Stage;
- /**
- * @private
- */
- let contexts: LifecycleContext[];
- class LifecycleContext {
- pause(): void;
- resume(): void;
- onUpdate?: () => void;
- }
- let onResume: () => void;
- let onPause: () => void;
- function addLifecycleListener(plugin: LifecyclePlugin): void;
- }
- /**
- * 心跳计时器单例
- */
- let ticker: sys.SystemTicker;
-}
-/**
- * @private
- */
-declare let egret_stages: egret.Stage[];
-declare namespace egret.sys {
- /**
- * @private
- * 用户交互操作管理器
- */
- class TouchHandler extends HashObject {
- private maxTouches;
- private useTouchesCount;
- /**
- * @private
- */
- constructor(stage: Stage);
- /**
- * @private
- * 设置同时触摸数量
- */
- $initMaxTouches(): void;
- /**
- * @private
- */
- private stage;
- /**
- * @private
- */
- private touchDownTarget;
- /**
- * @private
- * 触摸开始(按下)
- * @param x 事件发生处相对于舞台的坐标x
- * @param y 事件发生处相对于舞台的坐标y
- * @param touchPointID 分配给触摸点的唯一标识号
- */
- onTouchBegin(x: number, y: number, touchPointID: number): void;
- /**
- * @private
- */
- private lastTouchX;
- /**
- * @private
- */
- private lastTouchY;
- /**
- * @private
- * 触摸移动
- * @param x 事件发生处相对于舞台的坐标x
- * @param y 事件发生处相对于舞台的坐标y
- * @param touchPointID 分配给触摸点的唯一标识号
- */
- onTouchMove(x: number, y: number, touchPointID: number): void;
- /**
- * @private
- * 触摸结束(弹起)
- * @param x 事件发生处相对于舞台的坐标x
- * @param y 事件发生处相对于舞台的坐标y
- * @param touchPointID 分配给触摸点的唯一标识号
- */
- onTouchEnd(x: number, y: number, touchPointID: number): void;
- /**
- * @private
- * 获取舞台坐标下的触摸对象
- */
- private findTarget(stageX, stageY);
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 位图渲染节点
- */
- class BitmapNode extends RenderNode {
- constructor();
- /**
- * 要绘制的位图
- */
- image: BitmapData;
- /**
- * 控制在缩放时是否对位图进行平滑处理。
- */
- smoothing: boolean;
- /**
- * 相对偏移矩阵。
- */
- matrix: egret.Matrix;
- /**
- * 图片宽度。WebGL渲染使用
- */
- imageWidth: number;
- /**
- * 图片高度。WebGL渲染使用
- */
- imageHeight: number;
- /**
- * 使用的混合模式
- */
- blendMode: number;
- /**
- * 相对透明度
- */
- alpha: number;
- /**
- * 颜色变换滤镜
- */
- filter: ColorMatrixFilter;
- /**
- * 翻转
- */
- rotated: boolean;
- /**
- * 绘制一次位图
- */
- drawImage(sourceX: number, sourceY: number, sourceW: number, sourceH: number, drawX: number, drawY: number, drawW: number, drawH: number): void;
- /**
- * 在显示对象的$updateRenderNode()方法被调用前,自动清空自身的drawData数据。
- */
- cleanBeforeRender(): void;
- static $updateTextureData(node: sys.NormalBitmapNode, image: BitmapData, bitmapX: number, bitmapY: number, bitmapWidth: number, bitmapHeight: number, offsetX: number, offsetY: number, textureWidth: number, textureHeight: number, destW: number, destH: number, sourceWidth: number, sourceHeight: number, fillMode: string, smoothing: boolean): void;
- /**
- * @private
- * 绘制九宫格位图
- */
- static $updateTextureDataWithScale9Grid(node: sys.NormalBitmapNode, image: BitmapData, scale9Grid: egret.Rectangle, bitmapX: number, bitmapY: number, bitmapWidth: number, bitmapHeight: number, offsetX: number, offsetY: number, textureWidth: number, textureHeight: number, destW: number, destH: number, sourceWidth: number, sourceHeight: number, smoothing: boolean): void;
- /**
- * @private
- */
- private static drawClipImage(node, scale, bitmapX, bitmapY, scaledBitmapW, scaledBitmapH, offsetX, offsetY, destW, destH, startX?, startY?);
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 矢量渲染节点
- */
- class GraphicsNode extends RenderNode {
- constructor();
- /**
- * 指定一种简单的单一颜色填充,在绘制时该填充将在随后对其他 Graphics 方法(如 lineTo() 或 drawCircle())的调用中使用。
- * @param color 填充的颜色
- * @param alpha 填充的 Alpha 值
- * @param beforePath 插入在指定的路径命令之前绘制,通常是插入到当前正在绘制的线条路径之前,以确保线条总在填充的上方。
- */
- beginFill(color: number, alpha?: number, beforePath?: Path2D): Path2D;
- /**
- * 指定一种简单的单一颜色填充,在绘制时该填充将在随后对其他 Graphics 方法(如 lineTo() 或 drawCircle())的调用中使用。
- * 调用 clear() 方法会清除填充。
- * @param type 用于指定要使用哪种渐变类型的 GradientType 类的值:GradientType.LINEAR 或 GradientType.RADIAL。
- * @param colors 渐变中使用的 RGB 十六进制颜色值的数组(例如,红色为 0xFF0000,蓝色为 0x0000FF,等等)。对于每种颜色,请在 alphas 和 ratios 参数中指定对应值。
- * @param alphas colors 数组中对应颜色的 alpha 值数组。
- * @param ratios 颜色分布比率的数组。有效值为 0 到 255。
- * @param matrix 一个由 egret.Matrix 类定义的转换矩阵。egret.Matrix 类包括 createGradientBox() 方法,通过该方法可以方便地设置矩阵,以便与 beginGradientFill() 方法一起使用
- * @param beforePath 插入在指定的路径命令之前绘制,通常是插入到当前正在绘制的线条路径之前,以确保线条总在填充的上方。
- */
- beginGradientFill(type: string, colors: number[], alphas: number[], ratios: number[], matrix?: egret.Matrix, beforePath?: Path2D): Path2D;
- /**
- * 指定一种线条样式以用于随后对 lineTo() 或 drawCircle() 等 Graphics 方法的调用。
- * @param thickness 一个整数,以点为单位表示线条的粗细,有效值为 0 到 255。如果未指定数字,或者未定义该参数,则不绘制线条。如果传递的值小于 0,则默认值为 0。值 0 表示极细的粗细;最大粗细为 255。如果传递的值大于 255,则默认值为 255。
- * @param color 线条的十六进制颜色值(例如,红色为 0xFF0000,蓝色为 0x0000FF 等)。如果未指明值,则默认值为 0x000000(黑色)。可选。
- * @param alpha 表示线条颜色的 Alpha 值的数字;有效值为 0 到 1。如果未指明值,则默认值为 1(纯色)。如果值小于 0,则默认值为 0。如果值大于 1,则默认值为 1。
- * @param caps 用于指定线条末端处端点类型的 CapsStyle 类的值。默认值:CapsStyle.ROUND
- * @param joints 指定用于拐角的连接外观的类型。默认值:JointStyle.ROUND
- * @param miterLimit 用于表示剪切斜接的极限值的数字。
- */
- lineStyle(thickness?: number, color?: number, alpha?: number, caps?: string, joints?: string, miterLimit?: number, lineDash?: number[]): StrokePath;
- /**
- * 清空所有缓存的绘制数据
- */
- clear(): void;
- /**
- * 覆盖父类方法,不自动清空缓存的绘图数据,改为手动调用clear()方法清空。
- */
- cleanBeforeRender(): void;
- /**
- * 绘制x偏移
- */
- x: number;
- /**
- * 绘制y偏移
- */
- y: number;
- /**
- * 绘制宽度
- */
- width: number;
- /**
- * 绘制高度
- */
- height: number;
- /**
- * 脏渲染标记
- * 暂时调用lineStyle,beginFill,beginGradientFill标记,实际应该draw时候标记在Path2D
- */
- dirtyRender: boolean;
- $texture: WebGLTexture;
- $textureWidth: number;
- $textureHeight: number;
- $canvasScaleX: number;
- $canvasScaleY: number;
- /**
- * 清除非绘制的缓存数据
- */
- clean(): void;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 组渲染节点,用于组合多个渲染节点
- */
- class GroupNode extends RenderNode {
- /**
- * 相对偏移矩阵。
- */
- matrix: egret.Matrix;
- constructor();
- addNode(node: RenderNode): void;
- /**
- * 覆盖父类方法,不自动清空缓存的绘图数据,改为手动调用clear()方法清空。
- * 这里只是想清空绘制命令,因此不调用super
- */
- cleanBeforeRender(): void;
- $getRenderCount(): number;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * Mesh 渲染节点
- */
- class MeshNode extends RenderNode {
- constructor();
- /**
- * 要绘制的位图
- */
- image: BitmapData;
- /**
- * 控制在缩放时是否对位图进行平滑处理。
- */
- smoothing: boolean;
- /**
- * 图片宽度。WebGL渲染使用
- */
- imageWidth: number;
- /**
- * 图片高度。WebGL渲染使用
- */
- imageHeight: number;
- /**
- * 相对偏移矩阵。
- */
- matrix: egret.Matrix;
- /**
- * UV 坐标。
- */
- uvs: number[];
- /**
- * 顶点坐标。
- */
- vertices: number[];
- /**
- * 顶点索引。
- */
- indices: number[];
- /**
- * 顶点索引。
- */
- bounds: Rectangle;
- /**
- * 使用的混合模式
- */
- blendMode: number;
- /**
- * 相对透明度
- */
- alpha: number;
- /**
- * 颜色变换滤镜
- */
- filter: ColorMatrixFilter;
- /**
- * 翻转
- */
- rotated: boolean;
- /**
- * 绘制一次位图
- */
- drawMesh(sourceX: number, sourceY: number, sourceW: number, sourceH: number, drawX: number, drawY: number, drawW: number, drawH: number): void;
- /**
- * 在显示对象的$updateRenderNode()方法被调用前,自动清空自身的drawData数据。
- */
- cleanBeforeRender(): void;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 位图渲染节点
- */
- class NormalBitmapNode extends RenderNode {
- constructor();
- /**
- * 要绘制的位图
- */
- image: BitmapData;
- /**
- * 控制在缩放时是否对位图进行平滑处理。
- */
- smoothing: boolean;
- /**
- * 图片宽度。WebGL渲染使用
- */
- imageWidth: number;
- /**
- * 图片高度。WebGL渲染使用
- */
- imageHeight: number;
- /**
- * 翻转
- */
- rotated: boolean;
- sourceX: number;
- sourceY: number;
- sourceW: number;
- sourceH: number;
- drawX: number;
- drawY: number;
- drawW: number;
- drawH: number;
- /**
- * 绘制一次位图
- */
- drawImage(sourceX: number, sourceY: number, sourceW: number, sourceH: number, drawX: number, drawY: number, drawW: number, drawH: number): void;
- /**
- * 在显示对象的$updateRenderNode()方法被调用前,自动清空自身的drawData数据。
- */
- cleanBeforeRender(): void;
- }
-}
-declare namespace egret {
- /**
- * OrientationMode 类为舞台初始旋转模式提供值。
- */
- const OrientationMode: {
- AUTO: string;
- PORTRAIT: string;
- LANDSCAPE: string;
- LANDSCAPE_FLIPPED: string;
- };
-}
-declare namespace egret.sys {
- /**
- * @private
- * 文本格式
- */
- interface TextFormat {
- /**
- * 颜色值
- */
- textColor?: number;
- /**
- * 描边颜色值
- */
- strokeColor?: number;
- /**
- * 字号
- */
- size?: number;
- /**
- * 描边大小
- */
- stroke?: number;
- /**
- * 是否加粗
- */
- bold?: boolean;
- /**
- * 是否倾斜
- */
- italic?: boolean;
- /**
- * 字体名称
- */
- fontFamily?: string;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 文本渲染节点
- */
- class TextNode extends RenderNode {
- constructor();
- /**
- * 颜色值
- */
- textColor: number;
- /**
- * 描边颜色值
- */
- strokeColor: number;
- /**
- * 字号
- */
- size: number;
- /**
- * 描边大小
- */
- stroke: number;
- /**
- * 是否加粗
- */
- bold: boolean;
- /**
- * 是否倾斜
- */
- italic: boolean;
- /**
- * 字体名称
- */
- fontFamily: string;
- /**
- * 绘制一行文本
- */
- drawText(x: number, y: number, text: string, format: TextFormat): void;
- /**
- * 绘制x偏移
- */
- x: number;
- /**
- * 绘制y偏移
- */
- y: number;
- /**
- * 绘制宽度
- */
- width: number;
- /**
- * 绘制高度
- */
- height: number;
- /**
- * 脏渲染标记
- */
- dirtyRender: boolean;
- $texture: WebGLTexture;
- $textureWidth: number;
- $textureHeight: number;
- $canvasScaleX: number;
- $canvasScaleY: number;
- /**
- * 清除非绘制的缓存数据
- */
- clean(): void;
- /**
- * 在显示对象的$updateRenderNode()方法被调用前,自动清空自身的drawData数据。
- */
- cleanBeforeRender(): void;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 填充路径
- */
- class FillPath extends Path2D {
- constructor();
- /**
- * 填充颜色
- */
- fillColor: number;
- /**
- * 填充透明度
- */
- fillAlpha: number;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 渐变填充路径
- */
- class GradientFillPath extends Path2D {
- constructor();
- gradientType: string;
- colors: number[];
- alphas: number[];
- ratios: number[];
- matrix: Matrix;
- }
-}
-declare namespace egret {
- /**
- * RenderTexture is a dynamic texture
- * @extends egret.Texture
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/RenderTexture.ts
- * @language en_US
- */
- /**
- * RenderTexture 是动态纹理类,他实现了将显示对象及其子对象绘制成为一个纹理的功能
- * @extends egret.Texture
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/RenderTexture.ts
- * @language zh_CN
- */
- class RenderTexture extends egret.Texture {
- constructor();
- $renderBuffer: sys.RenderBuffer;
- /**
- * The specified display object is drawn as a texture
- * @param displayObject {egret.DisplayObject} the display to draw
- * @param clipBounds {egret.Rectangle} clip rect
- * @param scale {number} scale factor
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将指定显示对象绘制为一个纹理
- * @param displayObject {egret.DisplayObject} 需要绘制的显示对象
- * @param clipBounds {egret.Rectangle} 绘制矩形区域
- * @param scale {number} 缩放比例
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- drawToTexture(displayObject: egret.DisplayObject, clipBounds?: Rectangle, scale?: number): boolean;
- /**
- * @inheritDoc
- */
- getPixel32(x: number, y: number): number[];
- /**
- * @inheritDoc
- */
- dispose(): void;
- }
-}
-declare namespace egret.sys {
- /**
- * @private
- * 线条路径。
- * 注意:当线条宽度(lineWidth)为1或3像素时,需要特殊处理,往右下角偏移0.5像素,以显示清晰锐利的线条。
- */
- class StrokePath extends Path2D {
- constructor();
- /**
- * 线条宽度。
- * 注意:绘制时对1像素和3像素要特殊处理,整体向右下角偏移0.5像素,以显示清晰锐利的线条。
- */
- lineWidth: number;
- /**
- * 线条颜色
- */
- lineColor: number;
- /**
- * 线条透明度
- */
- lineAlpha: number;
- /**
- * 端点样式,"none":无端点,"round":圆头端点,"square":方头端点
- */
- caps: string;
- /**
- * 联接点样式,"bevel":斜角连接,"miter":尖角连接,"round":圆角连接
- */
- joints: string;
- /**
- * 用于表示剪切斜接的极限值的数字。
- */
- miterLimit: number;
- /**
- * 描述交替绘制线段和间距(坐标空间单位)长度的数字。
- */
- lineDash: number[];
- }
-}
-/**
- * @private
- */
-interface CanvasRenderingContext2D {
- imageSmoothingEnabled: boolean;
- $imageSmoothingEnabled: boolean;
- $offsetX: number;
- $offsetY: number;
-}
-declare namespace egret {
- class CanvasRenderer {
- private nestLevel;
- render(displayObject: DisplayObject, buffer: sys.RenderBuffer, matrix: Matrix, forRenderTexture?: boolean): number;
- /**
- * @private
- * 绘制一个显示对象
- */
- private drawDisplayObject(displayObject, context, offsetX, offsetY, isStage?);
- private drawWithFilter(displayObject, context, offsetX, offsetY);
- private drawWithClip(displayObject, context, offsetX, offsetY);
- private drawWithScrollRect(displayObject, context, offsetX, offsetY);
- drawNodeToBuffer(node: sys.RenderNode, buffer: sys.RenderBuffer, matrix: Matrix, forHitTest?: boolean): void;
- /**
- * 将一个DisplayObject绘制到渲染缓冲,用于RenderTexture绘制
- * @param displayObject 要绘制的显示对象
- * @param buffer 渲染缓冲
- * @param matrix 要叠加的矩阵
- */
- drawDisplayToBuffer(displayObject: DisplayObject, buffer: sys.RenderBuffer, matrix: Matrix): number;
- private renderNode(node, context, forHitTest?);
- private renderNormalBitmap(node, context);
- private renderBitmap(node, context);
- private renderMesh(node, context);
- renderText(node: sys.TextNode, context: CanvasRenderingContext2D): void;
- private renderingMask;
- /**
- * @private
- */
- renderGraphics(node: sys.GraphicsNode, context: CanvasRenderingContext2D, forHitTest?: boolean): number;
- private renderPath(path, context);
- private renderGroup(groupNode, context);
- private createRenderBuffer(width, height, useForFilters?);
- }
- /**
- * @private
- * 获取字体字符串
- */
- function getFontString(node: sys.TextNode, format: sys.TextFormat): string;
- /**
- * @private
- * 获取RGBA字符串
- */
- function getRGBAString(color: number, alpha: number): string;
-}
-declare namespace egret {
- /**
- * Orientation monitor the orientation of the device, send CHANGE event when the orientation is changed
- *
- * @event egret.Event.CHANGE device's orientation is changed
- * @version Egret 2.4
- * @platform Web
- * @includeExample egret/sensor/DeviceOrientation.ts
- * @see http://edn.egret.com/cn/docs/page/661 获取设备旋转角度
- * @language en_US
- */
- /**
- * Orientation 监听设备方向的变化,当方向变化时派发 CHANGE 事件
- * @event egret.Event.CHANGE 设备方向改变时派发
- * @version Egret 2.4
- * @platform Web
- * @includeExample egret/sensor/DeviceOrientation.ts
- * @see http://edn.egret.com/cn/docs/page/661 获取设备旋转角度
- * @language zh_CN
- */
- interface DeviceOrientation extends EventDispatcher {
- /**
- * Start to monitor the device's orientation
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 开始监听设备方向变化
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- start(): void;
- /**
- * Stop monitor the device's orientation
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 停止监听设备方向变化
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- stop(): void;
- }
- /**
- * @copy egret.Orientation
- */
- let DeviceOrientation: {
- new (): DeviceOrientation;
- };
-}
-declare namespace egret {
- /**
- * The Geolocation able to obtain the position of the device.
- * Geolocation will emit CHANGE event when the device's location is changed.
- * It will emit IO_ERROR event if the location request is denied
- * or there is no location service on the device.
- *
- * @event egret.Event.CHANGE The device's location is changed
- * @event egret.Event.IO_ERROR Error occurred while getting the location
- * @version Egret 2.4
- * @platform Web
- * @includeExample egret/sensor/Geolocation.ts
- * @language en_US
- */
- /**
- * Geolocation 能够从设备的定位服务获取设备的当前位置。
- * 当设备的位置发生改变时 Geolocation 会派发 CHANGE 事件。
- * 当定位请求被拒绝或该设备没有定位服务时 Geolocation 会派发 IO_ERROR 事件。
- *
- * @event egret.Event.CHANGE 设备位置发生改变
- * @event egret.Event.IO_ERROR 获取设备位置时发生错误
- * @version Egret 2.4
- * @platform Web
- * @includeExample egret/sensor/Geolocation.ts
- * @language zh_CN
- */
- interface Geolocation extends EventDispatcher {
- /**
- * Start to monitor the device's location
- * @returns
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 开始监听设备位置信息
- * @returns
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- start(): void;
- /**
- * Stop monitor the device's location
- * @returns
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 停止监听设备位置信息
- * @returns
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- stop(): void;
- }
- /**
- * @copy egret.Geolocation
- */
- let Geolocation: {
- /**
- * constructor
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 构造函数
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- new (): Geolocation;
- };
-}
-declare namespace egret {
- /**
- * @copy egret.Motion
- */
- let Motion: {
- new (): Motion;
- };
- /**
- * The Motion class emits events based on activity detected by the device's motion sensor.
- * This data represents the device's movement along a 3-dimensional axis. When the device moves,
- * the sensor detects this movement and emit the CHANGE event. @see egret.MotionEvent
- *
- * @event egret.Event.CHANGE device is moved
- * @version Egret 2.4
- * @platform Web
- * @includeExample egret/sensor/Motion.ts
- * @language en_US
- */
- /**
- * Motion 类从用户设备读取运动状态信息并派发 CHANGE 事件。
- * 当设备移动时,传感器会检测到此移动并返回设备加速度,重力和旋转数据。@see egret.MotionEvent
- * Motion 类提供了 start 和 stop 方法,来启动和停止运动信息检查
- *
- * @event egret.Event.CHANGE 运动状态发生改变
- * @version Egret 2.4
- * @platform Web
- * @includeExample egret/sensor/Motion.ts
- * @language zh_CN
- */
- interface Motion extends EventDispatcher {
- /**
- * Start to monitor device movement
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 开始监听设备运动状态
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- start(): void;
- /**
- * Stop monitor device movement
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 停止监听设备运动状态
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- stop(): void;
- }
- /**
- * A DeviceRotationRate object provides information about the rate at which
- * the device is rotating around all three axes.
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * DeviceRotationRate 提供设备围绕三个轴旋转的角速度信息,单位是 角度/秒
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- interface DeviceRotationRate {
- /**
- * The amount of rotation around the Z axis, in degrees per second.
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 设备绕 Z 轴旋转的角速度信息,单位是 度/秒
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- alpha: number;
- /**
- * The amount of rotation around the X axis, in degrees per second.
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 设备绕 X 轴旋转的角速度信息,单位是 度/秒
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- beta: number;
- /**
- * The amount of rotation around the Y axis, in degrees per second.
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * 设备绕 Y 轴旋转的角速度信息,单位是 度/秒
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- gamma: number;
- }
- /**
- * A DeviceAcceleration object provides information about the amount
- * of acceleration the device is experiencing along all three axes.
- * Acceleration is expressed in m/s2.
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * DeviceAcceleration 提供设备在三个维度的加速度信息,加速度值的单位是 m/s2
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- interface DeviceAcceleration {
- /**
- * The amount of acceleration along the X axis
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * X 轴方向的加速度值
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- x: number;
- /**
- * The amount of acceleration along the Y axis
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * Y 轴方向的加速度值
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- y: number;
- /**
- * The amount of acceleration along the Z axis
- * @version Egret 2.4
- * @platform Web
- * @language en_US
- */
- /**
- * Z 轴方向的加速度值
- * @version Egret 2.4
- * @platform Web
- * @language zh_CN
- */
- z: number;
- }
-}
-declare namespace egret {
- /**
- * Type of operation.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 运行类型的类型。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- namespace RuntimeType {
- /**
- * Running on Web
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 运行在Web上
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- const WEB = "web";
- /**
- * Running on NATIVE
- * @version Egret 2.4
- * @deprecated
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 运行在NATIVE上
- * @version Egret 2.4
- * @deprecated
- * @platform Web,Native
- * @language zh_CN
- */
- const NATIVE = "native";
- /**
- * Running on Runtime2.0
- * @version Egret 5.1.5
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 运行在Runtime2.0上
- * @version Egret 5.1.5
- * @platform Web,Native
- * @language zh_CN
- */
- const RUNTIME2 = "runtime2";
- /**
- * Running on WeChat mini game
- * @version Egret 5.1.5
- * @platform All
- * @language en_US
- */
- /**
- * 运行在微信小游戏上
- * @version Egret 5.1.5
- * @platform All
- * @language zh_CN
- */
- const WXGAME = "wxgame";
- }
- /**
- * The Capabilities class provides properties that describe the system and runtime that are hosting the application.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/system/Capabilities.ts
- * @language en_US
- */
- /**
- * Capabilities 类提供一些属性,这些属性描述了承载应用程序的系统和运行时。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/system/Capabilities.ts
- * @language zh_CN
- */
- class Capabilities {
- /**
- * Specifies the language code of the system on which the content is running. The language is specified as a lowercase
- * two-letter language code from ISO 639-1. For Chinese, an additional uppercase two-letter country code from ISO 3166
- * distinguishes between Simplified and Traditional Chinese.
- * The following table lists the possible values,but not limited to them:
- *
- * - Simplified Chinese zh-CN
- * - Traditional Chinese zh-TW
- * - English en
- * - Japanese ja
- * - Korean ko
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示运行内容的系统的语言代码。语言指定为 ISO 639-1 中的小写双字母语言代码。
- * 对于中文,另外使用 ISO 3166 中的大写双字母国家/地区代码,以区分简体中文和繁体中文。
- * 以下是可能但不限于的语言和值:
- *
- * - 简体中文 zh-CN
- * - 繁体中文 zh-TW
- * - 英语 en
- * - 日语 ja
- * - 韩语 ko
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static readonly language: string;
- /**
- * Specifies whether the system is running in a mobile device.(such as a mobile phone or tablet)
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示程序内容是否运行在移动设备中(例如移动电话或平板电脑)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static readonly isMobile: boolean;
- /**
- * Specifies the current operating system. The os property can return the following strings:
- *
- * - iPhone "iOS"
- * - Android Phone "Android"
- * - Windows Phone "Windows Phone"
- * - Windows Desktop "Windows PC"
- * - Mac Desktop "Mac OS"
- * - Unknown OS "Unknown"
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 指示当前的操作系统。os 属性返回下列字符串:
- *
- * - 苹果手机操作系统 "iOS"
- * - 安卓手机操作系统 "Android"
- * - 微软手机操作系统 "Windows Phone"
- * - 微软桌面操作系统 "Windows PC"
- * - 苹果桌面操作系统 "Mac OS"
- * - 未知操作系统 "Unknown"
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static readonly os: string;
- /**
- * It indicates the current type of operation. runtimeType property returns the following string:
- *
- * - Run on Web egret.RuntimeType.WEB
- * - Run on Runtime2.0 egret.RuntimeType.RUNTIME2
- * - Run on WeChat mini game egret.RuntimeType.WXGAME
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 指示当前的运行类型。runtimeType 属性返回下列字符串:
- *
- * - 运行在Web上 egret.RuntimeType.WEB
- * - 运行在Runtime2.0上 egret.RuntimeType.RUNTIME2
- * - 运行在微信小游戏上 egret.RuntimeType.WXGAME
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static readonly runtimeType: string;
- /***
- * version of Egret.
- * @type {string}
- * @version Egret 3.2.0
- * @platform Web,Native
- * @language en_US
- */
- /***
- * Egret 的版本号。
- * @type {string}
- * @version Egret 3.2.0
- * @platform Web,Native
- * @language zh_CN
- */
- static readonly engineVersion: string;
- /***
- * current render mode.
- * @type {string}
- * @version Egret 3.0.7
- * @platform Web,Native
- * @language en_US
- */
- /***
- * 当前渲染模式。
- * @type {string}
- * @version Egret 3.0.7
- * @platform Web,Native
- * @language zh_CN
- */
- static readonly renderMode: string;
- /***
- * Clients border width.
- * The value before the document class initialization is always 0.
- * This value will change after the distribution Event.RESIZE and StageOrientationEvent.ORIENTATION_CHANGE.
- * @version Egret 3.1.3
- * @platform Web,Native
- * @language en_US
- */
- /***
- * 客户端边界宽度。
- * 该值在文档类初始化之前始终是0。
- * 该值在派发 Event.RESIZE 以及 StageOrientationEvent.ORIENTATION_CHANGE 之后会发生改变。
- * @version Egret 3.1.3
- * @platform Web,Native
- * @language zh_CN
- */
- static readonly boundingClientWidth: number;
- /***
- * Clients border height.
- * The value before the document class initialization is always 0.
- * This value will change after the distribution Event.RESIZE and StageOrientationEvent.ORIENTATION_CHANGE.
- * @version Egret 3.1.3
- * @platform Web,Native
- * @language en_US
- */
- /***
- * 客户端边界高度。
- * 该值在文档类初始化之前始终是0。
- * 该值在派发 Event.RESIZE 以及 StageOrientationEvent.ORIENTATION_CHANGE 之后会发生改变。
- * @version Egret 3.1.3
- * @platform Web,Native
- * @language zh_CN
- */
- static readonly boundingClientHeight: number;
- }
-}
-declare namespace egret {
- /**
- * This class is used to create lightweight shapes using the drawing application program interface (API). The Shape
- * class includes a graphics property, which lets you access methods from the Graphics class.
- * @see egret.Graphics
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Shape.ts
- * @language en_US
- */
- /**
- * 此类用于使用绘图应用程序编程接口 (API) 创建简单形状。Shape 类含有 graphics 属性,通过该属性您可以访问各种矢量绘图方法。
- * @see egret.Graphics
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Shape.ts
- * @language zh_CN
- */
- class Shape extends DisplayObject {
- /**
- * Creates a new Shape object.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 Shape 对象
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor();
- protected createNativeDisplayObject(): void;
- /**
- * @private
- */
- $graphics: Graphics;
- /**
- * Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取 Shape 中的 Graphics 对象。可通过此对象执行矢量绘图命令。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly graphics: Graphics;
- /**
- * @private
- */
- $measureContentBounds(bounds: Rectangle): void;
- $hitTest(stageX: number, stageY: number): DisplayObject;
- /**
- * @private
- */
- $onRemoveFromStage(): void;
- }
-}
-declare namespace egret {
- /**
- * Adds an interface-name-to-implementation-class mapping to the registry.
- * @param interfaceName the interface name to register. For example:"eui.IAssetAdapter","eui.Theme"
- * @param instance the instance to register.
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 注册一个接口实现。
- * @param interfaceName 注入的接口名称。例如:"eui.IAssetAdapter","eui.Theme"
- * @param instance 实现此接口的实例。
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language zh_CN
- */
- function registerImplementation(interfaceName: string, instance: any): void;
- /**
- * Returns the singleton instance of the implementation class that was registered for the specified interface.
- * This method is usually called by egret framework.
- * @param interfaceName The interface name to identify. For example:"eui.IAssetAdapter","eui.Theme"
- * @returns the singleton instance of the implementation class
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取一个接口实现。此方法通常由框架内部调用。获取项目注入的自定义实现实例。
- * @param interfaceName 要获取的接口名称。例如:"eui.IAssetAdapter","eui.Theme"
- * @returns 返回实现此接口的实例。
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language zh_CN
- */
- function getImplementation(interfaceName: string): any;
-}
-declare namespace egret {
- /**
- * The Sprite class is a basic display list building block: a display list node that can contain children.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Sprite.ts
- * @language en_US
- */
- /**
- * Sprite 类是基本显示列表构造块:一个可包含子项的显示列表节点。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Sprite.ts
- * @language zh_CN
- */
- class Sprite extends DisplayObjectContainer {
- /**
- * Creates a new Sprite instance.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 实例化一个容器
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor();
- protected createNativeDisplayObject(): void;
- /**
- * @private
- */
- $graphics: Graphics;
- /**
- * Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取 Shape 中的 Graphics 对象。可通过此对象执行矢量绘图命令。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly graphics: Graphics;
- $hitTest(stageX: number, stageY: number): DisplayObject;
- /**
- * @private
- */
- $measureContentBounds(bounds: Rectangle): void;
- /**
- * @private
- */
- $onRemoveFromStage(): void;
- }
-}
-declare namespace egret {
- /**
- * Bitmap font, texture set of a font. It is generally used as the value of the BitmapText.font attribute.
- * @see http://bbs.egret-labs.org/thread-918-1-1.html TextureMerger
- * @see http://bbs.egret-labs.org/forum.php?mod=viewthread&tid=251 Text(Containing the specific usage of the bitmap font )
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/text/BitmapFont.ts
- * @language en_US
- */
- /**
- * 位图字体,是一个字体的纹理集,通常作为BitmapText.font属性的值。
- * @see http://bbs.egret-labs.org/thread-918-1-1.html TextureMerger
- * @see http://bbs.egret-labs.org/forum.php?mod=viewthread&tid=251 文本(含位图字体具体用法)
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/text/BitmapFont.ts
- * @language zh_CN
- */
- class BitmapFont extends SpriteSheet {
- /**
- * Create an egret.BitmapFont object
- * @param texture {egret.Texture} Texture set that use TextureMerger create
- * @param config {any} Configure data that use TextureMerger create
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 egret.BitmapFont 对象
- * @param texture {egret.Texture} 使用TextureMerger生成的纹理集
- * @param config {any} 使用TextureMerger生成的配置数据
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor(texture: Texture, config: any);
- /**
- * @private
- */
- private charList;
- /**
- * Obtain corresponding texture through the name attribute
- * @param name {string} name Attribute
- * @returns {egret.Texture}
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 通过 name 属性获取对应纹理
- * @param name {string} name属性
- * @returns {egret.Texture}
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- getTexture(name: string): Texture;
- /**
- * @private
- */
- getConfig(name: string, key: string): number;
- /**
- * @private
- */
- private firstCharHeight;
- /**
- * @private
- *
- * @returns
- */
- _getFirstCharHeight(): number;
- /**
- * @private
- *
- * @param fntText
- * @returns
- */
- private parseConfig(fntText);
- /**
- * @private
- *
- * @param configText
- * @param key
- * @returns
- */
- private getConfigByKey(configText, key);
- }
-}
-declare namespace egret {
- /**
- * Bitmap font adopts the Bitmap+SpriteSheet mode to render text.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/text/BitmapText.ts
- * @language en_US
- */
- /**
- * 位图字体采用了Bitmap+SpriteSheet的方式来渲染文字。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/text/BitmapText.ts
- * @language zh_CN
- */
- class BitmapText extends DisplayObject {
- /**
- * Create an egret.BitmapText object
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 创建一个 egret.BitmapText 对象
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- constructor();
- protected createNativeDisplayObject(): void;
- private $smoothing;
- /**
- * Whether or not is smoothed when scaled.
- * @default true。
- * @version Egret 3.0
- * @platform Web
- * @language en_US
- */
- /**
- * 控制在缩放时是否进行平滑处理。
- * @default true。
- * @version Egret 3.0
- * @platform Web
- * @language zh_CN
- */
- smoothing: boolean;
- private $text;
- /**
- * A string to display in the text field.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 要显示的文本内容
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- text: string;
- /**
- * @private
- */
- $setText(value: string): boolean;
- protected $textFieldWidth: number;
- /**
- * @private
- */
- $getWidth(): number;
- /**
- * @private
- */
- $setWidth(value: number): boolean;
- private $textLinesChanged;
- /**
- * @private
- */
- $invalidateContentBounds(): void;
- protected $textFieldHeight: number;
- /**
- * @private
- */
- $getHeight(): number;
- /**
- * @private
- */
- $setHeight(value: number): boolean;
- protected $font: BitmapFont;
- protected $fontStringChanged: boolean;
- /**
- * The name of the font to use, or a comma-separated list of font names, the type of value must be BitmapFont.
- * @default null
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 要使用的字体的名称或用逗号分隔的字体名称列表,类型必须是 BitmapFont。
- * @default null
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- font: Object;
- $setFont(value: any): boolean;
- private $lineSpacing;
- /**
- /**
- * An integer representing the amount of vertical space between lines.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 一个整数,表示行与行之间的垂直间距量
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- lineSpacing: number;
- $setLineSpacing(value: number): boolean;
- private $letterSpacing;
- /**
- * An integer representing the amount of distance between characters.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 一个整数,表示字符之间的距离。
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- letterSpacing: number;
- $setLetterSpacing(value: number): boolean;
- private $textAlign;
- /**
- * Horizontal alignment of text.
- * @default:egret.HorizontalAlign.LEFT
- * @version Egret 2.5.6
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文本的水平对齐方式。
- * @default:egret.HorizontalAlign.LEFT
- * @version Egret 2.5.6
- * @platform Web,Native
- * @language zh_CN
- */
- textAlign: string;
- $setTextAlign(value: string): boolean;
- private $verticalAlign;
- /**
- * Vertical alignment of text.
- * @default:egret.VerticalAlign.TOP
- * @version Egret 2.5.6
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文字的垂直对齐方式。
- * @default:egret.VerticalAlign.TOP
- * @version Egret 2.5.6
- * @platform Web,Native
- * @language zh_CN
- */
- verticalAlign: string;
- $setVerticalAlign(value: string): boolean;
- /**
- * A ratio of the width of the space character. This value is multiplied by the height of the first character is the space character width.
- * @default 0.33
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 一个空格字符的宽度比例。这个数值乘以第一个字符的高度即为空格字符的宽。
- * @default 0.33
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static EMPTY_FACTOR: number;
- /**
- * @private
- */
- $updateRenderNode(): void;
- /**
- * @private
- */
- $measureContentBounds(bounds: Rectangle): void;
- private $textWidth;
- /**
- * Get the BitmapText measured width
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取位图文本测量宽度
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly textWidth: number;
- private $textHeight;
- /**
- * Get Text BitmapText height
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取位图文本测量高度
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly textHeight: number;
- /**
- * @private
- */
- private $textOffsetX;
- /**
- * @private
- */
- private $textOffsetY;
- /**
- * @private
- */
- private $textStartX;
- /**
- * @private
- */
- private $textStartY;
- /**
- * @private
- */
- private textLines;
- /**
- * @private 每一行文字的宽度
- */
- private $textLinesWidth;
- /**
- * @private
- */
- $lineHeights: number[];
- /**
- * @private
- *
- * @returns
- */
- $getTextLines(): string[];
- }
-}
-declare namespace egret {
- /**
- * The HorizontalAlign class defines the possible values for the horizontal alignment.
- * @see egret.TextField#textAlign
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * HorizontalAlign 类为水平对齐方式定义可能的值。
- * @see egret.TextField#textAlign
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class HorizontalAlign {
- /**
- * Horizontally align content to the left of the container.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将内容与容器的左侧对齐。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static LEFT: string;
- /**
- * Horizontally align content to the right of the container.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将内容与容器的右侧对齐。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static RIGHT: string;
- /**
- * Horizontally align content in the center of the container.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在容器的水平中心对齐内容。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static CENTER: string;
- /**
- * Horizontal alignment with both edges.
- * Note: TextFiled does not support this alignment method.
- * @constant egret.HorizontalAlign.JUSTIFY
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 水平两端对齐。
- * 注意:TextFiled不支持此对齐方式。
- * @constant egret.HorizontalAlign.JUSTIFY
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static JUSTIFY: string;
- /**
- * Align the content of the child items, relative to the container. This operation will adjust uniformly the size of all the child items to be the Content Width \" of the container \".
- * The Content Width \" of the container \" is the size of the max. child item. If the size of all child items are less than the width of the container, they will be adjusted to the width of the container.
- * Note: TextFiled does not support this alignment method.
- * @constant egret.HorizontalAlign.CONTENT_JUSTIFY
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 相对于容器对子项进行内容对齐。这会将所有子项的大小统一调整为容器的"内容宽度"。
- * 容器的"内容宽度"是最大子项的大小,如果所有子项都小于容器的宽度,则会将所有子项的大小调整为容器的宽度。
- * 注意:TextFiled不支持此对齐方式。
- * @constant egret.HorizontalAlign.CONTENT_JUSTIFY
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static CONTENT_JUSTIFY: string;
- }
-}
-declare namespace egret {
- /**
- * Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
- * @see http://edn.egret.com/cn/docs/page/146 Text mixed in a variety of style
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/text/HtmlTextParser.ts
- * @language en_US
- */
- /**
- * 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
- * @see http://edn.egret.com/cn/docs/page/146 多种样式文本混合
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/text/HtmlTextParser.ts
- * @language zh_CN
- */
- class HtmlTextParser {
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- constructor();
- private replaceArr;
- private initReplaceArr();
- /**
- * @private
- *
- * @param value
- * @returns
- */
- private replaceSpecial(value);
- /**
- * @private
- */
- private resutlArr;
- /**
- * Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
- * @param htmltext {string} Text in html
- * @returns {Array} 可赋值给 egret.TextField#textFlow Object that can be assigned to the egret.TextField#textFlow property
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
- * @param htmltext {string} html文本
- * @returns {Array} 可赋值给 egret.TextField#textFlow 属性的对象
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- parse(htmltext: string): egret.ITextElement[];
- parser(htmltext: string): Array;
- /**
- * @private
- *
- * @param value
- */
- private addToResultArr(value);
- private changeStringToObject(str);
- /**
- * @private
- *
- * @returns
- */
- private getHeadReg();
- /**
- * @private
- *
- * @param info
- * @param head
- * @param value
- */
- private addProperty(info, head, value);
- /**
- * @private
- */
- private stackArray;
- /**
- * @private
- *
- * @param infoStr
- */
- private addToArray(infoStr);
- }
-}
-declare namespace egret {
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- interface IHitTextElement {
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- lineIndex: number;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- textElementIndex: number;
- }
- /**
- * Text Style
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文本样式
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- interface ITextStyle {
- /**
- * text color
- * @version Egret 2.4
- * @platform Web,Native
- * @see http://edn.egret.com/cn/docs/page/146 多种样式混合文本的基本结构
- * @language en_US
- */
- /**
- * 颜色值
- * @version Egret 2.4
- * @platform Web,Native
- * @see http://edn.egret.com/cn/docs/page/146 多种样式混合文本的基本结构
- * @language zh_CN
- */
- textColor?: number;
- /**
- * stroke color
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 描边颜色值
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- strokeColor?: number;
- /**
- * size
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 字号
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- size?: number;
- /**
- * stroke width
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 描边大小
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- stroke?: number;
- /**
- * whether bold
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 是否加粗
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- bold?: boolean;
- /**
- * whether italic
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 是否倾斜
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- italic?: boolean;
- /**
- * fontFamily
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 字体名称
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- fontFamily?: string;
- /**
- * Link events or address
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 链接事件或者地址
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- href?: string;
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- target?: string;
- /**
- * Is underlined
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 是否加下划线
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- underline?: boolean;
- }
- /**
- * Used to build the basic structure of text with a variety of mixed styles, mainly for setting textFlow property
- * @see http://edn.egret.com/cn/docs/page/146 Text mixed in a variety of style
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 用于建立多种样式混合文本的基本结构,主要用于设置 textFlow 属性
- * @see http://edn.egret.com/cn/docs/page/146 多种样式文本混合
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- interface ITextElement {
- /**
- * String Content
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 字符串内容
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- text: string;
- /**
- * Text Style
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文本样式
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- style?: ITextStyle;
- }
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- interface IWTextElement extends ITextElement {
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- width: number;
- }
- /**
- * 文本最终解析的一行数据格式
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- interface ILineElement {
- /**
- * 文本占用宽度
- * @version Egret 2.4
- * @platform Web,Native
- */
- width: number;
- /**
- * 文本占用高度
- * @version Egret 2.4
- * @platform Web,Native
- */
- height: number;
- /**
- * 当前文本字符总数量(包括换行符)
- * @version Egret 2.4
- * @platform Web,Native
- */
- charNum: number;
- /**
- * 是否含有换行符
- * @version Egret 2.4
- * @platform Web,Native
- */
- hasNextLine: boolean;
- /**
- * 本行文本内容
- * @version Egret 2.4
- * @platform Web,Native
- */
- elements: Array;
- }
-}
-declare namespace egret {
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- class InputController extends HashObject {
- /**
- * @private
- */
- private stageText;
- /**
- * @private
- */
- private stageTextAdded;
- /**
- * @private
- */
- private _text;
- /**
- * @private
- */
- private _isFocus;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- constructor();
- /**
- *
- * @param text
- * @version Egret 2.4
- * @platform Web,Native
- */
- init(text: TextField): void;
- /**
- * @private
- *
- */
- _addStageText(): void;
- /**
- * @private
- *
- */
- _removeStageText(): void;
- /**
- * @private
- *
- * @returns
- */
- _getText(): string;
- /**
- * @private
- *
- * @param value
- */
- _setText(value: string): void;
- /**
- * @private
- */
- _setColor(value: number): void;
- /**
- * @private
- *
- * @param event
- */
- private focusHandler(event);
- /**
- * @private
- *
- * @param event
- */
- private blurHandler(event);
- private tempStage;
- private onMouseDownHandler(event);
- $onFocus(): void;
- private onStageDownHandler(event);
- /**
- * @private
- *
- * @param event
- */
- private updateTextHandler(event);
- /**
- * @private
- *
- */
- private resetText();
- /**
- * @private
- *
- */
- _hideInput(): void;
- /**
- * @private
- *
- */
- private updateInput();
- /**
- * @private
- *
- */
- _updateProperties(): void;
- }
-}
-declare namespace egret {
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- interface StageText extends EventDispatcher {
- /**
- * @private
- */
- $textfield: egret.TextField;
- /**
- * @private
- *
- * @param textfield
- */
- $setTextField(textfield: egret.TextField): boolean;
- /**
- * @private
- *
- */
- $resetStageText(): void;
- /**
- * @private
- *
- * @returns
- */
- $getText(): string;
- /**
- * @private
- *
- * @param value
- */
- $setText(value: string): boolean;
- /**
- * @private
- *
- * @param value
- */
- $setColor(value: number): boolean;
- /**
- * @private
- *
- */
- $show(): void;
- /**
- * @private
- *
- */
- $hide(): void;
- /**
- * @private
- *
- */
- $addToStage(): void;
- /**
- * @private
- *
- */
- $removeFromStage(): void;
- /**
- * @private
- *
- */
- $onBlur(): void;
- }
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- let StageText: {
- new (): StageText;
- };
-}
-declare namespace egret.sys {
- /**
- * @private
- */
- const enum TextKeys {
- /**
- * @private
- */
- fontSize = 0,
- /**
- * @private
- */
- lineSpacing = 1,
- /**
- * @private
- */
- textColor = 2,
- /**
- * @private
- */
- textFieldWidth = 3,
- /**
- * @private
- */
- textFieldHeight = 4,
- /**
- * @private
- */
- textWidth = 5,
- /**
- * @private
- */
- textHeight = 6,
- /**
- * @private
- */
- textDrawWidth = 7,
- /**
- * @private
- */
- fontFamily = 8,
- /**
- * @private
- */
- textAlign = 9,
- /**
- * @private
- */
- verticalAlign = 10,
- /**
- * @private
- */
- textColorString = 11,
- /**
- * @private
- */
- fontString = 12,
- /**
- * @private
- */
- text = 13,
- /**
- * @private
- */
- measuredWidths = 14,
- /**
- * @private
- */
- bold = 15,
- /**
- * @private
- */
- italic = 16,
- /**
- * @private
- */
- fontStringChanged = 17,
- /**
- * @private
- */
- textLinesChanged = 18,
- /**
- * @private
- */
- wordWrap = 19,
- /**
- * @private
- */
- displayAsPassword = 20,
- /**
- * @private
- */
- maxChars = 21,
- /**
- * @private
- */
- selectionActivePosition = 22,
- /**
- * @private
- */
- selectionAnchorPosition = 23,
- /**
- * @private
- */
- type = 24,
- /**
- * @private
- */
- strokeColor = 25,
- /**
- * @private
- */
- strokeColorString = 26,
- /**
- * @private
- */
- stroke = 27,
- /**
- * @private
- */
- scrollV = 28,
- /**
- * @private
- */
- numLines = 29,
- /**
- * @private
- */
- multiline = 30,
- /**
- * @private
- */
- border = 31,
- /**
- * @private
- */
- borderColor = 32,
- /**
- * @private
- */
- background = 33,
- /**
- * @private
- */
- backgroundColor = 34,
- /**
- * @private
- */
- restrictAnd = 35,
- /**
- * @private
- */
- restrictNot = 36,
- /**
- * @private
- */
- inputType = 37,
- /**
- * @private
- */
- textLinesChangedForNativeRender = 38,
- }
-}
-declare namespace egret {
- /**
- * TextField is the text rendering class of egret. It conducts rendering by using the browser / device API. Due to different ways of font rendering in different browsers / devices, there may be differences in the rendering
- * If developers expect no differences among all platforms, please use BitmapText
- * @see http://edn.egret.com/cn/docs/page/141 Create Text
- *
- * @event egret.Event.CHANGE Dispatched when entering text user input。
- * @event egret.FocusEvent.FOCUS_IN Dispatched after the focus to enter text.
- * @event egret.FocusEvent.FOCUS_OUT Enter the text loses focus after dispatch.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/text/TextField.ts
- * @language en_US
- */
- /**
- * TextField是egret的文本渲染类,采用浏览器/设备的API进行渲染,在不同的浏览器/设备中由于字体渲染方式不一,可能会有渲染差异
- * 如果开发者希望所有平台完全无差异,请使用BitmapText
- * @see http://edn.egret.com/cn/docs/page/141 创建文本
- *
- * @event egret.Event.CHANGE 输入文本有用户输入时调度。
- * @event egret.FocusEvent.FOCUS_IN 聚焦输入文本后调度。
- * @event egret.FocusEvent.FOCUS_OUT 输入文本失去焦点后调度。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/text/TextField.ts
- * @language zh_CN
- */
- class TextField extends DisplayObject {
- /**
- * default fontFamily
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 默认文本字体
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static default_fontFamily: string;
- /**
- * default size in pixels of text
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 默认文本字号大小
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language zh_CN
- */
- static default_size: number;
- /**
- * default color of the text.
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 默认文本颜色
- * @version Egret 3.2.1
- * @platform Web,Native
- * @language zh_CN
- */
- static default_textColor: number;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- constructor();
- protected createNativeDisplayObject(): void;
- /**
- * @private
- */
- $TextField: Object;
- /**
- * @private
- */
- private isInput();
- $inputEnabled: boolean;
- $setTouchEnabled(value: boolean): void;
- /**
- * The name of the font to use, or a comma-separated list of font names.
- * @default "Arial"
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 要使用的字体的名称或用逗号分隔的字体名称列表。
- * @default "Arial"
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- fontFamily: string;
- $setFontFamily(value: string): boolean;
- /**
- * The size in pixels of text
- * @default 30
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文本的字号大小。
- * @default 30
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- size: number;
- $setSize(value: number): boolean;
- /**
- * Specifies whether the text is boldface.
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 是否显示为粗体。
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- bold: boolean;
- $setBold(value: boolean): boolean;
- /**
- * Determines whether the text is italic font.
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 是否显示为斜体。
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- italic: boolean;
- $setItalic(value: boolean): boolean;
- /**
- * @private
- *
- */
- private invalidateFontString();
- /**
- * Horizontal alignment of text.
- * @default:egret.HorizontalAlign.LEFT
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文本的水平对齐方式。
- * @default:egret.HorizontalAlign.LEFT
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- textAlign: string;
- $setTextAlign(value: string): boolean;
- /**
- * Vertical alignment of text.
- * @default:egret.VerticalAlign.TOP
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文字的垂直对齐方式。
- * @default:egret.VerticalAlign.TOP
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- verticalAlign: string;
- $setVerticalAlign(value: string): boolean;
- /**
- * An integer representing the amount of vertical space between lines.
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 一个整数,表示行与行之间的垂直间距量
- * @default 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- lineSpacing: number;
- $setLineSpacing(value: number): boolean;
- /**
- * Color of the text.
- * @default 0x000000
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文本颜色
- * @default 0x000000
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- textColor: number;
- $setTextColor(value: number): boolean;
- /**
- * A Boolean value that indicates whether the text field word wrap. If the value is true, then the text field by word wrap;
- * if the value is false, the text field by newline characters.
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 一个布尔值,表示文本字段是否按单词换行。如果值为 true,则该文本字段按单词换行;
- * 如果值为 false,则该文本字段按字符换行。
- * @default false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- wordWrap: boolean;
- $setWordWrap(value: boolean): void;
- /**
- * @private
- */
- private inputUtils;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * Type of the text field.
- * Any one of the following TextFieldType constants: TextFieldType.DYNAMIC (specifies the dynamic text field that users can not edit), or TextFieldType.INPUT (specifies the dynamic text field that users can edit).
- * @default egret.TextFieldType.DYNAMIC
- * @language en_US
- */
- /**
- * 文本字段的类型。
- * 以下 TextFieldType 常量中的任一个:TextFieldType.DYNAMIC(指定用户无法编辑的动态文本字段),或 TextFieldType.INPUT(指定用户可以编辑的输入文本字段)。
- * @default egret.TextFieldType.DYNAMIC
- * @language zh_CN
- */
- type: string;
- /**
- * @private
- *
- * @param value
- */
- $setType(value: string): boolean;
- /**
- * @version Egret 3.1.2
- * @platform Web,Native
- */
- /**
- * Pop-up keyboard type.
- * Any of a TextFieldInputType constants.
- * @language en_US
- */
- /**
- * 弹出键盘的类型。
- * TextFieldInputType 常量中的任一个。
- * @language zh_CN
- */
- inputType: string;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * Serve as a string of the current text field in the text
- * @language en_US
- */
- /**
- * 作为文本字段中当前文本的字符串
- * @language zh_CN
- */
- text: string;
- /**
- * @private
- *
- * @returns
- */
- $getText(): string;
- /**
- * @private
- *
- * @param value
- */
- $setBaseText(value: string): boolean;
- /**
- * @private
- *
- * @param value
- */
- $setText(value: string): boolean;
- /**
- * Specify whether the text field is a password text field.
- * If the value of this property is true, the text field is treated as a password text field and hides the input characters using asterisks instead of the actual characters. If false, the text field is not treated as a password text field.
- * @default false
- * @language en_US
- */
- /**
- * 指定文本字段是否是密码文本字段。
- * 如果此属性的值为 true,则文本字段被视为密码文本字段,并使用星号而不是实际字符来隐藏输入的字符。如果为 false,则不会将文本字段视为密码文本字段。
- * @default false
- * @language zh_CN
- */
- displayAsPassword: boolean;
- /**
- * @private
- *
- * @param value
- */
- $setDisplayAsPassword(value: boolean): boolean;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * Represent the stroke color of the text.
- * Contain three 8-bit numbers with RGB color components; for example, 0xFF0000 is red, 0x00FF00 is green.
- * @default 0x000000
- * @language en_US
- */
- /**
- * 表示文本的描边颜色。
- * 包含三个 8 位 RGB 颜色成分的数字;例如,0xFF0000 为红色,0x00FF00 为绿色。
- * @default 0x000000
- * @language zh_CN
- */
- strokeColor: number;
- /**
- * @private
- *
- * @param value
- */
- $setStrokeColor(value: number): boolean;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * Indicate the stroke width.
- * 0 means no stroke.
- * @default 0
- * @language en_US
- */
- /**
- * 表示描边宽度。
- * 0为没有描边。
- * @default 0
- * @language zh_CN
- */
- stroke: number;
- /**
- * @private
- *
- * @param value
- */
- $setStroke(value: number): boolean;
- /**
- * The maximum number of characters that the text field can contain, as entered by a user. \n A script can insert more text than maxChars allows; the maxChars property indicates only how much text a user can enter. If the value of this property is 0, a user can enter an unlimited amount of text.
- * The default value is 0.
- * @default 0
- * @language en_US
- */
- /**
- * 文本字段中最多可包含的字符数(即用户输入的字符数)。
- * 脚本可以插入比 maxChars 允许的字符数更多的文本;maxChars 属性仅表示用户可以输入多少文本。如果此属性的值为 0,则用户可以输入无限数量的文本。
- * @default 0
- * @language zh_CN
- */
- maxChars: number;
- /**
- * @private
- *
- * @param value
- */
- $setMaxChars(value: number): boolean;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * Vertical position of text in a text field. scrollV property helps users locate specific passages in a long article, and create scrolling text fields.
- * Vertically scrolling units are lines, and horizontal scrolling unit is pixels.
- * If the first displayed line is the first line in the text field, scrollV is set to 1 (instead of 0).
- * @language en_US
- */
- /**
- * 文本在文本字段中的垂直位置。scrollV 属性可帮助用户定位到长篇文章的特定段落,还可用于创建滚动文本字段。
- * 垂直滚动的单位是行,而水平滚动的单位是像素。
- * 如果显示的第一行是文本字段中的第一行,则 scrollV 设置为 1(而非 0)。
- * @language zh_CN
- */
- scrollV: number;
- /**
- * The maximum value of scrollV
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * scrollV 的最大值
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly maxScrollV: number;
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- readonly selectionBeginIndex: number;
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- readonly selectionEndIndex: number;
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- readonly caretIndex: number;
- /**
- * @private
- *
- * @param beginIndex
- * @param endIndex
- */
- $setSelection(beginIndex: number, endIndex: number): boolean;
- /**
- * @private
- *
- * @returns
- */
- $getLineHeight(): number;
- /**
- * Number of lines of text.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 文本行数。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly numLines: number;
- /**
- * Indicate whether field is a multiline text field. Note that this property is valid only when the type is TextFieldType.INPUT.
- * If the value is true, the text field is multiline; if the value is false, the text field is a single-line text field. In a field of type TextFieldType.INPUT, the multiline value determines whether the Enter key creates a new line (a value of false, and the Enter key is ignored).
- * @default false
- * @language en_US
- */
- /**
- * 表示字段是否为多行文本字段。注意,此属性仅在type为TextFieldType.INPUT时才有效。
- * 如果值为 true,则文本字段为多行文本字段;如果值为 false,则文本字段为单行文本字段。在类型为 TextFieldType.INPUT 的字段中,multiline 值将确定 Enter 键是否创建新行(如果值为 false,则将忽略 Enter 键)。
- * @default false
- * @language zh_CN
- */
- multiline: boolean;
- /**
- * @private
- *
- * @param value
- */
- $setMultiline(value: boolean): boolean;
- /**
- * Indicates a user can enter into the text field character set. If you restrict property is null, you can enter any character. If you restrict property is an empty string, you can not enter any character. If you restrict property is a string of characters, you can enter only characters in the string in the text field. The string is scanned from left to right. You can use a hyphen (-) to specify a range. Only restricts user interaction; a script may put any text into the text field.
- * If the string of characters caret (^) at the beginning, all characters are initially accepted, then the string are excluded from receiving ^ character. If the string does not begin with a caret (^) to, any characters are initially accepted and then a string of characters included in the set of accepted characters.
- * The following example allows only uppercase characters, spaces, and numbers in the text field:
- * My_txt.restrict = "A-Z 0-9";
- * The following example includes all characters except lowercase letters:
- * My_txt.restrict = "^ a-z";
- * If you need to enter characters \ ^, use two backslash "\\ -" "\\ ^":
- * Can be used anywhere in the string ^ to rule out including characters and switch between characters, but can only be used to exclude a ^. The following code includes only uppercase letters except uppercase Q:
- * My_txt.restrict = "A-Z ^ Q";
- * @version Egret 2.4
- * @platform Web,Native
- * @default null
- * @language en_US
- */
- /**
- * 表示用户可输入到文本字段中的字符集。如果 restrict 属性的值为 null,则可以输入任何字符。如果 restrict 属性的值为空字符串,则不能输入任何字符。如果 restrict 属性的值为一串字符,则只能在文本字段中输入该字符串中的字符。从左向右扫描该字符串。可以使用连字符 (-) 指定一个范围。只限制用户交互;脚本可将任何文本放入文本字段中。
- * 如果字符串以尖号 (^) 开头,则先接受所有字符,然后从接受字符集中排除字符串中 ^ 之后的字符。如果字符串不以尖号 (^) 开头,则最初不接受任何字符,然后将字符串中的字符包括在接受字符集中。
- * 下例仅允许在文本字段中输入大写字符、空格和数字:
- * my_txt.restrict = "A-Z 0-9";
- * 下例包含除小写字母之外的所有字符:
- * my_txt.restrict = "^a-z";
- * 如果需要输入字符 \ ^,请使用2个反斜杠 "\\-" "\\^" :
- * 可在字符串中的任何位置使用 ^,以在包含字符与排除字符之间进行切换,但是最多只能有一个 ^ 用来排除。下面的代码只包含除大写字母 Q 之外的大写字母:
- * my_txt.restrict = "A-Z^Q";
- * @version Egret 2.4
- * @platform Web,Native
- * @default null
- * @language zh_CN
- */
- restrict: string;
- /**
- * @private
- *
- * @param value
- */
- $setWidth(value: number): boolean;
- /**
- * @private
- *
- * @param value
- */
- $setHeight(value: number): boolean;
- /**
- * @private
- * 获取显示宽度
- */
- $getWidth(): number;
- /**
- * @private
- * 获取显示宽度
- */
- $getHeight(): number;
- /**
- * @private
- */
- private textNode;
- /**
- * @private
- */
- $graphicsNode: sys.GraphicsNode;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * Specifies whether the text field has a border.
- * If true, the text field has a border. If false, the text field has no border.
- * Use borderColor property to set the border color.
- * @default false
- * @language en_US
- */
- /**
- * 指定文本字段是否具有边框。
- * 如果为 true,则文本字段具有边框。如果为 false,则文本字段没有边框。
- * 使用 borderColor 属性来设置边框颜色。
- * @default false
- * @language zh_CN
- */
- border: boolean;
- /**
- * @private
- */
- $setBorder(value: boolean): void;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * The color of the text field border.
- * Even currently is no border can be retrieved or set this property, but only if the text field has the border property is set to true, the color is visible.
- * @default 0x000000
- * @language en_US
- */
- /**
- * 文本字段边框的颜色。
- * 即使当前没有边框,也可检索或设置此属性,但只有当文本字段已将 border 属性设置为 true 时,才可以看到颜色。
- * @default 0x000000
- * @language zh_CN
- */
- borderColor: number;
- /**
- * @private
- */
- $setBorderColor(value: number): void;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * Specifies whether the text field has a background fill.
- * If true, the text field has a background fill. If false, the text field has no background fill.
- * Use the backgroundColor property to set the background color of the text field.
- * @default false
- * @language en_US
- */
- /**
- * 指定文本字段是否具有背景填充。
- * 如果为 true,则文本字段具有背景填充。如果为 false,则文本字段没有背景填充。
- * 使用 backgroundColor 属性来设置文本字段的背景颜色。
- * @default false
- * @language zh_CN
- */
- background: boolean;
- /**
- * @private
- */
- $setBackground(value: boolean): void;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * Color of the text field background.
- * Even currently is no background, can be retrieved or set this property, but only if the text field has the background property set to true, the color is visible.
- * @default 0xFFFFFF
- * @language en_US
- */
- /**
- * 文本字段背景的颜色。
- * 即使当前没有背景,也可检索或设置此属性,但只有当文本字段已将 background 属性设置为 true 时,才可以看到颜色。
- * @default 0xFFFFFF
- * @language zh_CN
- */
- backgroundColor: number;
- /**
- * @private
- */
- $setBackgroundColor(value: number): void;
- /**
- * @private
- *
- */
- private fillBackground(lines?);
- /**
- * Enter the text automatically entered into the input state, the input type is text only and may only be invoked in the user interaction.
- * @version Egret 3.0.8
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 输入文本自动进入到输入状态,仅在类型是输入文本并且是在用户交互下才可以调用。
- * @version Egret 3.0.8
- * @platform Web,Native
- * @language zh_CN
- */
- setFocus(): void;
- /**
- * @private
- *
- */
- $onRemoveFromStage(): void;
- /**
- * @private
- *
- * @param stage
- * @param nestLevel
- */
- $onAddToStage(stage: Stage, nestLevel: number): void;
- $invalidateTextField(): void;
- $getRenderBounds(): Rectangle;
- /**
- * @private
- */
- $measureContentBounds(bounds: Rectangle): void;
- $updateRenderNode(): void;
- /**
- * @private
- */
- private isFlow;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * Set rich text
- * @language en_US
- */
- /**
- * 设置富文本
- * @see http://edn.egret.com/cn/index.php/article/index/id/146
- * @language zh_CN
- */
- textFlow: Array;
- /**
- * @private
- *
- * @param text
- * @returns
- */
- private changeToPassText(text);
- /**
- * @private
- */
- private textArr;
- /**
- * @private
- *
- * @param textArr
- */
- private setMiddleStyle(textArr);
- /**
- * Get the text measured width
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取文本测量宽度
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly textWidth: number;
- /**
- * Get Text measuring height
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取文本测量高度
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly textHeight: number;
- /**
- * @private
- * @param text
- * @version Egret 2.4
- * @platform Web,Native
- */
- appendText(text: string): void;
- /**
- * @private
- * @param element
- * @version Egret 2.4
- * @platform Web,Native
- */
- appendElement(element: egret.ITextElement): void;
- /**
- * @private
- */
- private linesArr;
- $getLinesArr(): Array;
- /**
- * @private
- *
- * @returns
- */
- $getLinesArr2(): Array;
- /**
- * @private
- */
- $isTyping: boolean;
- /**
- * @private
- */
- $setIsTyping(value: boolean): void;
- /**
- * @private
- * 返回要绘制的下划线列表
- */
- private drawText();
- private addEvent();
- private removeEvent();
- private onTapHandler(e);
- }
- interface TextField {
- addEventListener(type: "link", listener: (this: Z, e: TextEvent) => void, thisObject: Z, useCapture?: boolean, priority?: number): any;
- addEventListener(type: "focusIn" | "focusOut", listener: (this: Z, e: FocusEvent) => void, thisObject: Z, useCapture?: boolean, priority?: number): any;
- addEventListener(type: string, listener: Function, thisObject: any, useCapture?: boolean, priority?: number): any;
- }
-}
-declare namespace egret {
- /**
- * TextFieldInputType class is an enumeration of constant value used in setting the inputType property of the TextField class.
- * @version Egret 3.1.2
- * @platform Web,Native
- * @language en_US
- */
- /**
- * TextFieldInputType 类是在设置 TextField 类的 inputType 属性时使用的常数值的枚举。
- * @version Egret 3.1.2
- * @platform Web,Native
- * @language zh_CN
- */
- class TextFieldInputType {
- /**
- * The default
- * @version Egret 3.1.2
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 默认 input 类型
- * @version Egret 3.1.2
- * @platform Web,Native
- * @language zh_CN
- */
- static TEXT: string;
- /**
- * Telephone Number Inputs
- * @version Egret 3.1.2
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 电话号码 input 类型
- * @version Egret 3.1.2
- * @platform Web,Native
- * @language zh_CN
- */
- static TEL: string;
- /**
- * Password Inputs
- * @version Egret 3.1.2
- * @platform Web,Native
- * @language en_US
- */
- /**
- * password 类型
- * @version Egret 3.1.2
- * @platform Web,Native
- * @language zh_CN
- */
- static PASSWORD: string;
- }
-}
-declare namespace egret {
- /**
- * TextFieldType class is an enumeration of constant value used in setting the type property of the TextField class.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * TextFieldType 类是在设置 TextField 类的 type 属性时使用的常数值的枚举。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class TextFieldType {
- /**
- * Used to specify dynamic text
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 用于指定动态文本
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static DYNAMIC: string;
- /**
- * Used to specify the input text
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 用于指定输入文本
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static INPUT: string;
- }
-}
-declare namespace egret {
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- class TextFieldUtils {
- /**
- * 获取第一个绘制的行数
- * @param textfield 文本
- * @returns {number} 行数,从0开始
- * @private
- */
- static $getStartLine(textfield: egret.TextField): number;
- /**
- * 获取水平比例
- * @param textfield 文本
- * @returns {number} 水平比例
- * @private
- */
- static $getHalign(textfield: egret.TextField): number;
- /**
- * @private
- *
- * @param textfield
- * @returns
- */
- static $getTextHeight(textfield: egret.TextField): number;
- /**
- * 获取垂直比例
- * @param textfield 文本
- * @returns {number} 垂直比例
- * @private
- */
- static $getValign(textfield: egret.TextField): number;
- /**
- * 根据x、y获取文本项
- * @param textfield 文本
- * @param x x坐标值
- * @param y y坐标值
- * @returns 文本单项
- * @private
- */
- static $getTextElement(textfield: egret.TextField, x: number, y: number): ITextElement;
- /**
- * 获取文本点击块
- * @param textfield 文本
- * @param x x坐标值
- * @param y y坐标值
- * @returns 文本点击块
- * @private
- */
- static $getHit(textfield: egret.TextField, x: number, y: number): IHitTextElement;
- /**
- * 获取当前显示多少行
- * @param textfield 文本
- * @returns {number} 显示的行数
- * @private
- */
- static $getScrollNum(textfield: egret.TextField): number;
- }
-}
-/**
- * @private
- */
-declare namespace egret.sys {
- /**
- * 测量文本在指定样式下的宽度。
- * @param text 要测量的文本内容。
- * @param fontFamily 字体名称
- * @param fontSize 字体大小
- * @param bold 是否粗体
- * @param italic 是否斜体
- */
- let measureText: (text: string, fontFamily: string, fontSize: number, bold: boolean, italic: boolean) => number;
-}
-declare namespace egret {
- /**
- * The VerticalAlign class defines the possible values for the vertical alignment.
- * @see egret.TextField#verticalAlign
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * VerticalAlign 类为垂直对齐方式定义可能的值。
- * @see egret.TextField#verticalAlign
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class VerticalAlign {
- /**
- * Vertically align content to the top of the container.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将内容与容器的顶部对齐。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static TOP: string;
- /**
- * Vertically align content to the bottom of the container.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将内容与容器的底部对齐。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static BOTTOM: string;
- /**
- * Vertically align content in the middle of the container.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在容器的垂直中心对齐内容。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static MIDDLE: string;
- /**
- * Vertical alignment with both edges
- * Note: TextFiled does not support this alignment method."
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 垂直两端对齐
- * 注意:TextFiled不支持此对齐方式。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static JUSTIFY: string;
- /**
- * Align the content of the child items, relative to the container. This operation will adjust uniformly the size of all the child items to be the Content Height \" of the container \".
- * The Content Height \" of the container \" is the size of the max. child item. If the size of all child items are less than the height of the container, they will be adjusted to the height of the container.
- * Note: TextFiled does not support this alignment method.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 相对于容器对子项进行内容对齐。这会将所有子项的大小统一调整为容器的"内容高度"。
- * 容器的"内容高度"是最大子项的大小,如果所有子项都小于容器的高度,则会将所有子项的大小调整为容器的高度。
- * 注意:TextFiled不支持此对齐方式。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static CONTENT_JUSTIFY: string;
- }
-}
-declare namespace egret {
- /**
- * @language en_US
- * The Base64Util class provides methods for encoding and decoding base64.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/utils/Base64Util.ts
- */
- /**
- * @language zh_CN
- * Base64Util 类提供用于编解码base64的方法。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/utils/Base64Util.ts
- */
- class Base64Util {
- /**
- * @language en_US
- * encode base64.
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * @language zh_CN
- * 编码base64。
- * @version Egret 2.4
- * @platform Web,Native
- */
- static encode(arraybuffer: ArrayBuffer): string;
- /**
- * @language en_US
- * decode base64.
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * @language zh_CN
- * 解码base64。
- * @version Egret 2.4
- * @platform Web,Native
- */
- static decode(base64: string): ArrayBuffer;
- }
-}
-/**
- * @private
- */
-declare let chars: string;
-/**
- * @private
- */
-declare let lookup: Uint8Array;
-declare namespace egret {
- /**
- * The Endian class contains values that denote the byte order used to represent multibyte numbers.
- * The byte order is either bigEndian (most significant byte first) or littleEndian (least significant byte first).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * Endian 类中包含一些值,它们表示用于表示多字节数字的字节顺序。
- * 字节顺序为 bigEndian(最高有效字节位于最前)或 littleEndian(最低有效字节位于最前)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class Endian {
- /**
- * Indicates the least significant byte of the multibyte number appears first in the sequence of bytes.
- * The hexadecimal number 0x12345678 has 4 bytes (2 hexadecimal digits per byte). The most significant byte is 0x12. The least significant byte is 0x78. (For the equivalent decimal number, 305419896, the most significant digit is 3, and the least significant digit is 6).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示多字节数字的最低有效字节位于字节序列的最前面。
- * 十六进制数字 0x12345678 包含 4 个字节(每个字节包含 2 个十六进制数字)。最高有效字节为 0x12。最低有效字节为 0x78。(对于等效的十进制数字 305419896,最高有效数字是 3,最低有效数字是 6)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static LITTLE_ENDIAN: string;
- /**
- * Indicates the most significant byte of the multibyte number appears first in the sequence of bytes.
- * The hexadecimal number 0x12345678 has 4 bytes (2 hexadecimal digits per byte). The most significant byte is 0x12. The least significant byte is 0x78. (For the equivalent decimal number, 305419896, the most significant digit is 3, and the least significant digit is 6).
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 表示多字节数字的最高有效字节位于字节序列的最前面。
- * 十六进制数字 0x12345678 包含 4 个字节(每个字节包含 2 个十六进制数字)。最高有效字节为 0x12。最低有效字节为 0x78。(对于等效的十进制数字 305419896,最高有效数字是 3,最低有效数字是 6)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static BIG_ENDIAN: string;
- }
- const enum EndianConst {
- LITTLE_ENDIAN = 0,
- BIG_ENDIAN = 1,
- }
- /**
- * The ByteArray class provides methods and attributes for optimized reading and writing as well as dealing with binary data.
- * Note: The ByteArray class is applied to the advanced developers who need to access data at the byte layer.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/utils/ByteArray.ts
- * @language en_US
- */
- /**
- * ByteArray 类提供用于优化读取、写入以及处理二进制数据的方法和属性。
- * 注意:ByteArray 类适用于需要在字节层访问数据的高级开发人员。
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/utils/ByteArray.ts
- * @language zh_CN
- */
- class ByteArray {
- /**
- * @private
- */
- protected bufferExtSize: number;
- protected data: DataView;
- protected _bytes: Uint8Array;
- /**
- * @private
- */
- protected _position: number;
- /**
- *
- * 已经使用的字节偏移量
- * @protected
- * @type {number}
- * @memberOf ByteArray
- */
- protected write_position: number;
- /**
- * Changes or reads the byte order; egret.EndianConst.BIG_ENDIAN or egret.EndianConst.LITTLE_EndianConst.
- * @default egret.EndianConst.BIG_ENDIAN
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 更改或读取数据的字节顺序;egret.EndianConst.BIG_ENDIAN 或 egret.EndianConst.LITTLE_ENDIAN。
- * @default egret.EndianConst.BIG_ENDIAN
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- endian: string;
- protected $endian: EndianConst;
- /**
- * @version Egret 2.4
- * @platform Web,Native
- */
- constructor(buffer?: ArrayBuffer | Uint8Array, bufferExtSize?: number);
- /**
- * @deprecated
- * @version Egret 2.4
- * @platform Web,Native
- */
- setArrayBuffer(buffer: ArrayBuffer): void;
- /**
- * 可读的剩余字节数
- *
- * @returns
- *
- * @memberOf ByteArray
- */
- readonly readAvailable: number;
- /**
- * @private
- */
- buffer: ArrayBuffer;
- readonly rawBuffer: ArrayBuffer;
- readonly bytes: Uint8Array;
- /**
- * @private
- * @version Egret 2.4
- * @platform Web,Native
- */
- /**
- * @private
- */
- dataView: DataView;
- /**
- * @private
- */
- readonly bufferOffset: number;
- /**
- * The current position of the file pointer (in bytes) to move or return to the ByteArray object. The next time you start reading reading method call in this position, or will start writing in this position next time call a write method.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将文件指针的当前位置(以字节为单位)移动或返回到 ByteArray 对象中。下一次调用读取方法时将在此位置开始读取,或者下一次调用写入方法时将在此位置开始写入。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- position: number;
- /**
- * The length of the ByteArray object (in bytes).
- * If the length is set to be larger than the current length, the right-side zero padding byte array.
- * If the length is set smaller than the current length, the byte array is truncated.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * ByteArray 对象的长度(以字节为单位)。
- * 如果将长度设置为大于当前长度的值,则用零填充字节数组的右侧。
- * 如果将长度设置为小于当前长度的值,将会截断该字节数组。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- length: number;
- protected _validateBuffer(value: number): void;
- /**
- * The number of bytes that can be read from the current position of the byte array to the end of the array data.
- * When you access a ByteArray object, the bytesAvailable property in conjunction with the read methods each use to make sure you are reading valid data.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 可从字节数组的当前位置到数组末尾读取的数据的字节数。
- * 每次访问 ByteArray 对象时,将 bytesAvailable 属性与读取方法结合使用,以确保读取有效的数据。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly bytesAvailable: number;
- /**
- * Clears the contents of the byte array and resets the length and position properties to 0.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 清除字节数组的内容,并将 length 和 position 属性重置为 0。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- clear(): void;
- /**
- * Read a Boolean value from the byte stream. Read a simple byte. If the byte is non-zero, it returns true; otherwise, it returns false.
- * @return If the byte is non-zero, it returns true; otherwise, it returns false.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取布尔值。读取单个字节,如果字节非零,则返回 true,否则返回 false
- * @return 如果字节不为零,则返回 true,否则返回 false
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readBoolean(): boolean;
- /**
- * Read signed bytes from the byte stream.
- * @return An integer ranging from -128 to 127
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取带符号的字节
- * @return 介于 -128 和 127 之间的整数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readByte(): number;
- /**
- * Read data byte number specified by the length parameter from the byte stream. Starting from the position specified by offset, read bytes into the ByteArray object specified by the bytes parameter, and write bytes into the target ByteArray
- * @param bytes ByteArray object that data is read into
- * @param offset Offset (position) in bytes. Read data should be written from this position
- * @param length Byte number to be read Default value 0 indicates reading all available data
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取 length 参数指定的数据字节数。从 offset 指定的位置开始,将字节读入 bytes 参数指定的 ByteArray 对象中,并将字节写入目标 ByteArray 中
- * @param bytes 要将数据读入的 ByteArray 对象
- * @param offset bytes 中的偏移(位置),应从该位置写入读取的数据
- * @param length 要读取的字节数。默认值 0 导致读取所有可用的数据
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readBytes(bytes: ByteArray, offset?: number, length?: number): void;
- /**
- * Read an IEEE 754 double-precision (64 bit) floating point number from the byte stream
- * @return Double-precision (64 bit) floating point number
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取一个 IEEE 754 双精度(64 位)浮点数
- * @return 双精度(64 位)浮点数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readDouble(): number;
- /**
- * Read an IEEE 754 single-precision (32 bit) floating point number from the byte stream
- * @return Single-precision (32 bit) floating point number
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取一个 IEEE 754 单精度(32 位)浮点数
- * @return 单精度(32 位)浮点数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readFloat(): number;
- /**
- * Read a 32-bit signed integer from the byte stream.
- * @return A 32-bit signed integer ranging from -2147483648 to 2147483647
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取一个带符号的 32 位整数
- * @return 介于 -2147483648 和 2147483647 之间的 32 位带符号整数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readInt(): number;
- /**
- * Read a 16-bit signed integer from the byte stream.
- * @return A 16-bit signed integer ranging from -32768 to 32767
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取一个带符号的 16 位整数
- * @return 介于 -32768 和 32767 之间的 16 位带符号整数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readShort(): number;
- /**
- * Read unsigned bytes from the byte stream.
- * @return A unsigned integer ranging from 0 to 255
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取无符号的字节
- * @return 介于 0 和 255 之间的无符号整数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readUnsignedByte(): number;
- /**
- * Read a 32-bit unsigned integer from the byte stream.
- * @return A 32-bit unsigned integer ranging from 0 to 4294967295
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取一个无符号的 32 位整数
- * @return 介于 0 和 4294967295 之间的 32 位无符号整数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readUnsignedInt(): number;
- /**
- * Read a 16-bit unsigned integer from the byte stream.
- * @return A 16-bit unsigned integer ranging from 0 to 65535
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取一个无符号的 16 位整数
- * @return 介于 0 和 65535 之间的 16 位无符号整数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readUnsignedShort(): number;
- /**
- * Read a UTF-8 character string from the byte stream Assume that the prefix of the character string is a short unsigned integer (use byte to express length)
- * @return UTF-8 character string
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取一个 UTF-8 字符串。假定字符串的前缀是无符号的短整型(以字节表示长度)
- * @return UTF-8 编码的字符串
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readUTF(): string;
- /**
- * Read a UTF-8 byte sequence specified by the length parameter from the byte stream, and then return a character string
- * @param Specify a short unsigned integer of the UTF-8 byte length
- * @return A character string consists of UTF-8 bytes of the specified length
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 从字节流中读取一个由 length 参数指定的 UTF-8 字节序列,并返回一个字符串
- * @param length 指明 UTF-8 字节长度的无符号短整型数
- * @return 由指定长度的 UTF-8 字节组成的字符串
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readUTFBytes(length: number): string;
- /**
- * Write a Boolean value. A single byte is written according to the value parameter. If the value is true, write 1; if the value is false, write 0.
- * @param value A Boolean value determining which byte is written. If the value is true, write 1; if the value is false, write 0.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 写入布尔值。根据 value 参数写入单个字节。如果为 true,则写入 1,如果为 false,则写入 0
- * @param value 确定写入哪个字节的布尔值。如果该参数为 true,则该方法写入 1;如果该参数为 false,则该方法写入 0
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeBoolean(value: boolean): void;
- /**
- * Write a byte into the byte stream
- * The low 8 bits of the parameter are used. The high 24 bits are ignored.
- * @param value A 32-bit integer. The low 8 bits will be written into the byte stream
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在字节流中写入一个字节
- * 使用参数的低 8 位。忽略高 24 位
- * @param value 一个 32 位整数。低 8 位将被写入字节流
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeByte(value: number): void;
- /**
- * Write the byte sequence that includes length bytes in the specified byte array, bytes, (starting at the byte specified by offset, using a zero-based index), into the byte stream
- * If the length parameter is omitted, the default length value 0 is used and the entire buffer starting at offset is written. If the offset parameter is also omitted, the entire buffer is written
- * If the offset or length parameter is out of range, they are clamped to the beginning and end of the bytes array.
- * @param bytes ByteArray Object
- * @param offset A zero-based index specifying the position into the array to begin writing
- * @param length An unsigned integer specifying how far into the buffer to write
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将指定字节数组 bytes(起始偏移量为 offset,从零开始的索引)中包含 length 个字节的字节序列写入字节流
- * 如果省略 length 参数,则使用默认长度 0;该方法将从 offset 开始写入整个缓冲区。如果还省略了 offset 参数,则写入整个缓冲区
- * 如果 offset 或 length 超出范围,它们将被锁定到 bytes 数组的开头和结尾
- * @param bytes ByteArray 对象
- * @param offset 从 0 开始的索引,表示在数组中开始写入的位置
- * @param length 一个无符号整数,表示在缓冲区中的写入范围
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeBytes(bytes: ByteArray, offset?: number, length?: number): void;
- /**
- * Write an IEEE 754 double-precision (64 bit) floating point number into the byte stream
- * @param value Double-precision (64 bit) floating point number
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在字节流中写入一个 IEEE 754 双精度(64 位)浮点数
- * @param value 双精度(64 位)浮点数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeDouble(value: number): void;
- /**
- * Write an IEEE 754 single-precision (32 bit) floating point number into the byte stream
- * @param value Single-precision (32 bit) floating point number
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在字节流中写入一个 IEEE 754 单精度(32 位)浮点数
- * @param value 单精度(32 位)浮点数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeFloat(value: number): void;
- /**
- * Write a 32-bit signed integer into the byte stream
- * @param value An integer to be written into the byte stream
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在字节流中写入一个带符号的 32 位整数
- * @param value 要写入字节流的整数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeInt(value: number): void;
- /**
- * Write a 16-bit integer into the byte stream. The low 16 bits of the parameter are used. The high 16 bits are ignored.
- * @param value A 32-bit integer. Its low 16 bits will be written into the byte stream
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在字节流中写入一个 16 位整数。使用参数的低 16 位。忽略高 16 位
- * @param value 32 位整数,该整数的低 16 位将被写入字节流
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeShort(value: number): void;
- /**
- * Write a 32-bit unsigned integer into the byte stream
- * @param value An unsigned integer to be written into the byte stream
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在字节流中写入一个无符号的 32 位整数
- * @param value 要写入字节流的无符号整数
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeUnsignedInt(value: number): void;
- /**
- * Write a 16-bit unsigned integer into the byte stream
- * @param value An unsigned integer to be written into the byte stream
- * @version Egret 2.5
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 在字节流中写入一个无符号的 16 位整数
- * @param value 要写入字节流的无符号整数
- * @version Egret 2.5
- * @platform Web,Native
- * @language zh_CN
- */
- writeUnsignedShort(value: number): void;
- /**
- * Write a UTF-8 string into the byte stream. The length of the UTF-8 string in bytes is written first, as a 16-bit integer, followed by the bytes representing the characters of the string
- * @param value Character string value to be written
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将 UTF-8 字符串写入字节流。先写入以字节表示的 UTF-8 字符串长度(作为 16 位整数),然后写入表示字符串字符的字节
- * @param value 要写入的字符串值
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeUTF(value: string): void;
- /**
- * Write a UTF-8 string into the byte stream. Similar to the writeUTF() method, but the writeUTFBytes() method does not prefix the string with a 16-bit length word
- * @param value Character string value to be written
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 将 UTF-8 字符串写入字节流。类似于 writeUTF() 方法,但 writeUTFBytes() 不使用 16 位长度的词为字符串添加前缀
- * @param value 要写入的字符串值
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- writeUTFBytes(value: string): void;
- /**
- *
- * @returns
- * @version Egret 2.4
- * @platform Web,Native
- */
- toString(): string;
- /**
- * @private
- * 将 Uint8Array 写入字节流
- * @param bytes 要写入的Uint8Array
- * @param validateBuffer
- */
- _writeUint8Array(bytes: Uint8Array | ArrayLike, validateBuffer?: boolean): void;
- /**
- * @param len
- * @returns
- * @version Egret 2.4
- * @platform Web,Native
- * @private
- */
- validate(len: number): boolean;
- /**********************/
- /**********************/
- /**
- * @private
- * @param len
- * @param needReplace
- */
- protected validateBuffer(len: number): void;
- /**
- * @private
- * UTF-8 Encoding/Decoding
- */
- private encodeUTF8(str);
- /**
- * @private
- *
- * @param data
- * @returns
- */
- private decodeUTF8(data);
- /**
- * @private
- *
- * @param code_point
- */
- private encoderError(code_point);
- /**
- * @private
- *
- * @param fatal
- * @param opt_code_point
- * @returns
- */
- private decoderError(fatal, opt_code_point?);
- /**
- * @private
- */
- private EOF_byte;
- /**
- * @private
- */
- private EOF_code_point;
- /**
- * @private
- *
- * @param a
- * @param min
- * @param max
- */
- private inRange(a, min, max);
- /**
- * @private
- *
- * @param n
- * @param d
- */
- private div(n, d);
- /**
- * @private
- *
- * @param string
- */
- private stringToCodePoints(string);
- }
-}
-declare namespace egret {
- /**
- * The BitmapFillMode class defines the image fill mode of Bitmap.
- * The BitmapFillMode class defines a pattern enumeration for adjusting size. These patterns determine how Bitmap fill the size designated by the layout system.
- * @see http://edn.egret.com/cn/docs/page/134 Texture filling way
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/BitmapFillMode.ts
- * @language en_US
- */
- /**
- * BitmapFillMode 类定义Bitmap的图像填充方式。
- * BitmapFillMode 类定义了调整大小模式的一个枚举,这些模式确定 Bitmap 如何填充由布局系统指定的尺寸。
- * @see http://edn.egret.com/cn/docs/page/134 纹理的填充方式
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/BitmapFillMode.ts
- * @language zh_CN
- */
- const BitmapFillMode: {
- REPEAT: string;
- SCALE: string;
- CLIP: string;
- };
-}
-declare namespace egret {
- /**
- * Registers the runtime class information for a class.This method adds some strings which represent the class name or
- * some interface names to the class definition. After the registration,you can use egret.is() method to do the type checking
- * for the instance of this class.
- * Note:If you use the TypeScript programming language, the egret command line tool will automatically generate the registration code line.
- * You don't need to manually call this method.
- *
- * @example the following code shows how to register the runtime class information for the EventDispatcher class and do the type checking:
- *
- * egret.registerClass(egret.EventDispatcher,"egret.EventDispatcher",["egret.IEventDispatcher"]);
- * let dispatcher = new egret.EventDispatcher();
- * egret.log(egret.is(dispatcher, "egret.IEventDispatcher")); //true。
- * egret.log(egret.is(dispatcher, "egret.EventDispatcher")); //true。
- * egret.log(egret.is(dispatcher, "egret.Bitmap")); //false。
- *
- * @param classDefinition the class definition to be registered.
- * @param className a unique identification string of the specific class
- * @param interfaceNames a list of unique identification string of the specific interfaces.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 为一个类定义注册运行时类信息,用此方法往类定义上注册它自身以及所有接口对应的字符串。
- * 在运行时,这个类的实例将可以使用 egret.is() 方法传入一个字符串来判断实例类型。
- * @example 以下代码演示了如何为EventDispatcher类注册运行时类信息并判断类型:
- *
- * //为egret.EventDispatcher类注册运行时类信息,由于它实现了IEventDispatcher接口,这里应同时传入接口名对应的字符串。
- * egret.registerClass(egret.EventDispatcher,"egret.EventDispatcher",["egret.IEventDispatcher"]);
- * let dispatcher = new egret.EventDispatcher();
- * egret.log(egret.is(dispatcher, "egret.IEventDispatcher")); //true。
- * egret.log(egret.is(dispatcher, "egret.EventDispatcher")); //true。
- * egret.log(egret.is(dispatcher, "egret.Bitmap")); //false。
- *
- * 注意:若您使用 TypeScript 来编写程序,egret 命令行会自动帮您生成类信息注册代码行到最终的 Javascript 文件中。因此您不需要手动调用此方法。
- *
- * @param classDefinition 要注册的类定义。
- * @param className 要注册的类名。
- * @param interfaceNames 要注册的类所实现的接口名列表。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- function registerClass(classDefinition: any, className: string, interfaceNames?: string[]): void;
-}
-declare namespace egret {
- /**
- * The Stage class represents the main drawing area.The Stage object is not globally accessible. You need to access
- * it through the stage property of a DisplayObject instance.
- * The Stage class has several ancestor classes — Sprite, DisplayObject, and EventDispatcher — from which it inherits
- * properties and methods. Many of these properties and methods are inapplicable to Stage objects.
- * @event egret.Event.RESIZE Dispatched when the stageWidth or stageHeight property of the Stage object is changed.
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Stage.ts
- * @language en_US
- */
- /**
- * Stage 类代表主绘图区。
- * 可以利用 DisplayObject 实例的 stage 属性进行访问。
- * Stage 类具有多个祖代类: Sprite、DisplayObject 和 EventDispatcher,属性和方法便是从这些类继承而来的。
- * 从这些继承的许多属性和方法不适用于 Stage 对象。
- * @event egret.Event.RESIZE 当stageWidth或stageHeight属性发生改变时调度
- * @event egret.Event.DEACTIVATE 当stage失去焦点后调度
- * @event egret.Event.ACTIVATE 当stage获得焦点后调度
- *
- * @version Egret 2.4
- * @platform Web,Native
- * @includeExample egret/display/Stage.ts
- * @language zh_CN
- */
- class Stage extends DisplayObjectContainer {
- /**
- * @private
- * Stage不许允许自行实例化
- * @version Egret 2.4
- * @platform Web,Native
- */
- constructor();
- protected createNativeDisplayObject(): void;
- /**
- * Gets and sets the frame rate of the stage. The frame rate is defined as frames per second. Valid range for the
- * frame rate is from 0.01 to 1000 frames per second.
- * Note: setting the frameRate property of one Stage object changes the frame rate for all Stage objects
- * @default 30
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 获取并设置舞台的帧速率。帧速率是指每秒显示的帧数。帧速率的有效范围为每秒 0.01 到 60 个帧。
- * 注意: 修改任何一个Stage的frameRate属性都会同步修改其他Stage的帧率。
- * @default 30
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- frameRate: number;
- /**
- * @private
- */
- $stageWidth: number;
- /**
- * Indicates the width of the stage, in pixels.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 舞台的当前宽度(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly stageWidth: number;
- /**
- * @private
- */
- $stageHeight: number;
- /**
- * Indicates the height of the stage, in pixels.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 舞台的当前高度(以像素为单位)。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- readonly stageHeight: number;
- /**
- * After you call the invalidate() method, when the display list is next rendered, the Egret runtime sends a render
- * event to each display object that has registered to listen for the render event. You must call the invalidate()
- * method each time you want the Egret runtime to send render events.
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 调用 invalidate() 方法后,在显示列表下次呈现时,Egret 会向每个已注册侦听 Event.RENDER 事件的显示对象发送一个 Event.RENDER 事件。
- * 每次您希望 Egret 发送 Event.RENDER 事件时,都必须调用 invalidate() 方法。
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- invalidate(): void;
- /**
- * @deprecated
- */
- registerImplementation(interfaceName: string, instance: any): void;
- /**
- * @deprecated
- */
- getImplementation(interfaceName: string): any;
- /**
- * @private
- * 设备屏幕引用
- */
- $screen: egret.sys.Screen;
- $scaleMode: string;
- /**
- * A StageScaleMode class that specifies which scale mode to use. The following are valid values:
- *
- * - StageScaleMode.EXACT_FIT -- The entire application be visible in the specified area without trying to preserve the original aspect ratio. Distortion can occur, the application may be stretched or compressed.
- * - StageScaleMode.SHOW_ALL -- The entire application is visible in the specified area without distortion while maintaining the application of the original aspect ratio. Applications may display border.
- * - StageScaleMode.NO_SCALE -- The size of the entire application is fixed, so that even if the size of the player window changes, it remains unchanged. If the player window is smaller than the content, it may do some trimming.
- * - StageScaleMode.NO_BORDER -- Keep the original aspect ratio scaling application content, after scaling a narrow direction of application content to fill the viewport players on both sides in the other direction may exceed the viewport and the player is cut.
- * - StageScaleMode.FIXED_WIDTH -- Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, but only to keep the contents of the original application constant width, height may change.
- * - StageScaleMode.FIXED_HEIGHT -- Keep the original aspect ratio scaling application content, after scaling application content in the horizontal and vertical directions to fill the viewport player, but only to keep the contents of the original application constant height, width may change.
- *
- * @default egret.StageScaleMode.SHOW_ALL
- * @language en_US
- */
- /**
- * 一个 StageScaleMode 类中指定要使用哪种缩放模式的值。以下是有效值:
- *
- * - StageScaleMode.EXACT_FIT -- 整个应用程序在指定区域中可见,但不尝试保持原始高宽比。可能会发生扭曲,应用程序可能会拉伸或压缩显示。
- * - StageScaleMode.SHOW_ALL -- 整个应用程序在指定区域中可见,且不发生扭曲,同时保持应用程序的原始高宽比。应用程序的可能会显示边框。
- * - StageScaleMode.NO_SCALE -- 整个应用程序的大小固定,因此,即使播放器窗口的大小更改,它也会保持不变。如果播放器窗口比内容小,则可能进行一些裁切。
- * - StageScaleMode.NO_BORDER -- 保持原始宽高比缩放应用程序内容,缩放后应用程序内容的较窄方向填满播放器视口,另一个方向的两侧可能会超出播放器视口而被裁切。
- * - StageScaleMode.FIXED_WIDTH -- 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,但只保持应用程序内容的原始宽度不变,高度可能会改变。
- * - StageScaleMode.FIXED_HEIGHT -- 保持原始宽高比缩放应用程序内容,缩放后应用程序内容在水平和垂直方向都填满播放器视口,但只保持应用程序内容的原始高度不变,宽度可能会改变。
- *
- * @default egret.StageScaleMode.SHOW_ALL
- * @language zh_CN
- */
- scaleMode: string;
- $orientation: string;
- /**
- * Horizontal and vertical screen display screen, can only be set under the current Native in the configuration file. A egret.OrientationMode class that specifies which display mode to use. The following are valid values:
- *
- * - egret.OrientationMode.AUTO -- Always follow the direction of application display screen, always guaranteed by the look down.
- * - egret.OrientationMode.PORTRAIT -- Applications remain portrait mode, namely horizontal screen look, the screen from left to right.
- * - egret.OrientationMode.LANDSCAPE -- Applications remain horizontal screen mode, namely vertical screen, the screen from right to left.
- * - egret.OrientationMode.LANDSCAPE_FLIPPED -- Applications remain horizontal screen mode, namely vertical screen, the screen from left to right.
- *
- * @platform Web
- * @version 2.4
- * @language en_US
- */
- /**
- * 屏幕横竖屏显示方式,目前 Native 下只能在配置文件里设置。一个 egret.OrientationMode 类中指定要使用哪种显示方式。以下是有效值:
- *
- * - egret.OrientationMode.AUTO -- 应用始终跟随屏幕的方向显示,始终保证由上往下看。
- * - egret.OrientationMode.PORTRAIT -- 应用始终保持竖屏模式,即横屏看时,屏幕由左往右看。
- * - egret.OrientationMode.LANDSCAPE -- 应用始终保持横屏模式,即竖屏看时,屏幕显示由右往左。
- * - egret.OrientationMode.LANDSCAPE_FLIPPED -- 应用始终保持横屏模式,即竖屏看时,屏幕显示由左往右。
- *
- * @platform Web
- * @version 2.4
- * @language zh_CN
- */
- orientation: string;
- /**
- * Draw texture zoom ratio
- * @default 1
- * @language en_US
- */
- /**
- * 绘制纹理的缩放比率,默认值为1
- * @default 1
- * @language zh_CN
- */
- textureScaleFactor: number;
- $maxTouches: number;
- /**
- * Set the number of screens can simultaneously touch. Above this amount will not be triggered in response.
- * @default 99
- * @language en_US
- */
- /**
- * 设置屏幕同时可以触摸的数量。高于这个数量将不会被触发响应。
- * @default 99
- * @language zh_CN
- */
- maxTouches: number;
- /**
- * Set resolution size
- * @param width width
- * @param height height
- * @version Egret 2.5.5
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 设置分辨率尺寸
- * @param width 宽度
- * @param height 高度
- * @version Egret 2.5.5
- * @platform Web,Native
- * @language zh_CN
- */
- setContentSize(width: number, height: number): void;
- }
-}
-declare namespace egret {
- /**
- * Logger is an entrance for the log processing namespace of the engine
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * Logger是引擎的日志处理模块入口
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- class Logger {
- /**
- * open all
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 全开
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ALL: string;
- /**
- * level: DEBUG
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 等级为 DEBUG
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static DEBUG: string;
- /**
- * level: INFO
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 等级为 INFO
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static INFO: string;
- /**
- * level: WARN
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 等级为 WARN
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static WARN: string;
- /**
- * level: ERROR
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 等级为 ERROR
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static ERROR: string;
- /**
- * close all
- * @version Egret 2.4
- * @platform Web,Native
- * @language en_US
- */
- /**
- * 全关
- * @version Egret 2.4
- * @platform Web,Native
- * @language zh_CN
- */
- static OFF: string;
- /**
- * Set the current need to open the log level. Grade level are: ALL
- * This feature is only in DEBUG mode to take effect.
- *