Skip to content

Commit

Permalink
Merge branch 'master' into 5.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
himuil committed Jan 10, 2018
2 parents 870f9e9 + 66775a3 commit c63c2d7
Show file tree
Hide file tree
Showing 21 changed files with 378 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ src/tsc_config_temp.txt
/tests**
/target**
test-script.js
tsconfig.debug.json
tsconfig.debug.json
12 changes: 11 additions & 1 deletion build/egret/egret.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9089,9 +9089,17 @@ declare namespace egret {
*/
update(datas: FPSData): void;
/**
* 插入一条日志信息
* 插入一条log信息
*/
updateInfo(info: string): void;
/**
* 插入一条warn信息
*/
updateWarn(info: string): void;
/**
* 插入一条error信息
*/
updateError(info: string): void;
}
/**
* @private
Expand Down Expand Up @@ -9205,6 +9213,8 @@ declare namespace egret.sys {
* @private
*/
let $logToFPS: (info: string) => void;
let $warnToFPS: (info: string) => void;
let $errorToFPS: (info: string) => void;
}
declare namespace egret {
/**
Expand Down
122 changes: 101 additions & 21 deletions build/egret/egret.js
Original file line number Diff line number Diff line change
Expand Up @@ -6425,7 +6425,7 @@ var egret;
}
var text = egret.sys.tr.apply(null, arguments);
if (true) {
egret.sys.$logToFPS("Error #" + code + ": " + text);
egret.sys.$errorToFPS("Error #" + code + ": " + text);
}
throw new Error("#" + code + ": " + text); //使用这种方式报错能够终止后续代码继续运行
}
Expand All @@ -6437,7 +6437,7 @@ var egret;
}
var text = egret.sys.tr.apply(null, arguments);
if (true) {
egret.sys.$logToFPS("Warning #" + code + ": " + text);
egret.sys.$warnToFPS("Warning #" + code + ": " + text);
}
egret.warn("Warning #" + code + ": " + text);
}
Expand Down Expand Up @@ -13133,16 +13133,32 @@ var egret;
}(egret.HashObject));
sys.Player = Player;
__reflect(Player.prototype, "egret.sys.Player");
var infoLines = [];
var logLines = [];
var warnLines = [];
var errorLines = [];
var fpsDisplay;
var fpsStyle;
sys.$logToFPS = function (info) {
if (!fpsDisplay) {
infoLines.push(info);
logLines.push(info);
return;
}
fpsDisplay.updateInfo(info);
};
sys.$warnToFPS = function (info) {
if (!fpsDisplay) {
warnLines.push(info);
return;
}
fpsDisplay.updateWarn(info);
};
sys.$errorToFPS = function (info) {
if (!fpsDisplay) {
errorLines.push(info);
return;
}
fpsDisplay.updateError(info);
};
function displayFPS(showFPS, showLog, logFilter, styles) {
if (showLog) {
egret.log = function () {
Expand All @@ -13154,6 +13170,24 @@ var egret;
sys.$logToFPS(info);
console.log.apply(console, toArray(arguments));
};
egret.warn = function () {
var length = arguments.length;
var info = "";
for (var i = 0; i < length; i++) {
info += arguments[i] + " ";
}
sys.$warnToFPS(info);
console.warn.apply(console, toArray(arguments));
};
egret.error = function () {
var length = arguments.length;
var info = "";
for (var i = 0; i < length; i++) {
info += arguments[i] + " ";
}
sys.$errorToFPS(info);
console.error.apply(console, toArray(arguments));
};
}
fpsStyle = styles ? {} : styles;
showLog = !!showLog;
Expand All @@ -13165,11 +13199,21 @@ var egret;
fpsDisplay = this.fps = new FPS(this.stage, showFPS, showLog, logFilter, styles);
fpsDisplay.x = x;
fpsDisplay.y = y;
var length_2 = infoLines.length;
for (var i = 0; i < length_2; i++) {
fpsDisplay.updateInfo(infoLines[i]);
var logLength = logLines.length;
for (var i = 0; i < logLength; i++) {
fpsDisplay.updateInfo(logLines[i]);
}
logLines = null;
var warnLength = warnLines.length;
for (var i = 0; i < warnLength; i++) {
fpsDisplay.updateWarn(warnLines[i]);
}
infoLines = null;
warnLines = null;
var errorLength = errorLines.length;
for (var i = 0; i < errorLength; i++) {
fpsDisplay.updateError(errorLines[i]);
}
errorLines = null;
}
}
var FPSImpl = (function (_super) {
Expand Down Expand Up @@ -13256,6 +13300,40 @@ var egret;
}
this.fpsDisplay.updateInfo(info);
};
FPSImpl.prototype.updateWarn = function (info) {
if (!info) {
return;
}
if (!this.showLog) {
return;
}
if (!this.filter(info)) {
return;
}
if (this.fpsDisplay.updateWarn) {
this.fpsDisplay.updateWarn(info);
}
else {
this.fpsDisplay.updateInfo("[Warning]" + info);
}
};
FPSImpl.prototype.updateError = function (info) {
if (!info) {
return;
}
if (!this.showLog) {
return;
}
if (!this.filter(info)) {
return;
}
if (this.fpsDisplay.updateError) {
this.fpsDisplay.updateError(info);
}
else {
this.fpsDisplay.updateInfo("[Error]" + info);
}
};
return FPSImpl;
}(egret.Sprite));
__reflect(FPSImpl.prototype, "FPSImpl");
Expand Down Expand Up @@ -14138,8 +14216,8 @@ var egret;
egret.$callLaterArgsList = [];
}
if (functionList) {
var length_3 = functionList.length;
for (var i = 0; i < length_3; i++) {
var length_2 = functionList.length;
for (var i = 0; i < length_2; i++) {
var func = functionList[i];
if (func != null) {
func.apply(thisList[i], argsList[i]);
Expand Down Expand Up @@ -15539,8 +15617,8 @@ var egret;
if (renderBufferPool.length > 6) {
renderBufferPool.length = 6;
}
var length_4 = renderBufferPool.length;
for (var i = 0; i < length_4; i++) {
var length_3 = renderBufferPool.length;
for (var i = 0; i < length_3; i++) {
renderBufferPool[i].resize(0, 0);
}
}
Expand Down Expand Up @@ -15603,8 +15681,8 @@ var egret;
}
var children = displayObject.$children;
if (children) {
var length_5 = children.length;
for (var i = 0; i < length_5; i++) {
var length_4 = children.length;
for (var i = 0; i < length_4; i++) {
var child = children[i];
var offsetX2 = void 0;
var offsetY2 = void 0;
Expand Down Expand Up @@ -15984,8 +16062,8 @@ var egret;
}
var children = displayObject.$children;
if (children) {
var length_6 = children.length;
for (var i = 0; i < length_6; i++) {
var length_5 = children.length;
for (var i = 0; i < length_5; i++) {
var child = children[i];
switch (child.$renderMode) {
case 1 /* NONE */:
Expand Down Expand Up @@ -17642,7 +17720,7 @@ var egret;
*/
BitmapFont.prototype.getConfigByKey = function (configText, key) {
var itemConfigTextList = configText.split(" ");
for (var i = 0, length_7 = itemConfigTextList.length; i < length_7; i++) {
for (var i = 0, length_6 = itemConfigTextList.length; i < length_6; i++) {
var itemConfigText = itemConfigTextList[i];
if (key == itemConfigText.substring(0, key.length)) {
var value = itemConfigText.substring(key.length + 1);
Expand Down Expand Up @@ -18156,6 +18234,8 @@ var egret;
var lineHeights = [];
this.$lineHeights = lineHeights;
if (!values[2 /* text */] || !values[5 /* font */]) {
values[8 /* textWidth */] = 0;
values[9 /* textHeight */] = 0;
return textLines;
}
var lineSpacing = values[3 /* lineSpacing */];
Expand Down Expand Up @@ -20322,8 +20402,8 @@ var egret;
if (lines && lines.length > 0) {
var textColor = values[2 /* textColor */];
var lastColor = -1;
var length_8 = lines.length;
for (var i = 0; i < length_8; i += 4) {
var length_7 = lines.length;
for (var i = 0; i < length_7; i += 4) {
var x = lines[i];
var y = lines[i + 1];
var w = lines[i + 2];
Expand Down Expand Up @@ -23006,8 +23086,8 @@ var egret;
}
var superTypes = prototype.__types__;
if (prototype.__types__) {
var length_9 = superTypes.length;
for (var i = 0; i < length_9; i++) {
var length_8 = superTypes.length;
for (var i = 0; i < length_8; i++) {
var name_1 = superTypes[i];
if (types.indexOf(name_1) == -1) {
types.push(name_1);
Expand Down
8 changes: 4 additions & 4 deletions build/egret/egret.min.js

Large diffs are not rendered by default.

36 changes: 20 additions & 16 deletions build/egret/egret.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,7 @@ var egret;
fps.textColor = this.fontColor;
fps.textFlow = [
{ text: "0 FPS " + egret.Capabilities.renderMode + "\n" },
{ text: "min0 max60 avg30\n" },
{ text: "Draw: 0\nDirty: 0%\n" },
{ text: "Cost: " },
{ text: "0 ", style: { "textColor": 0x18fefe } },
Expand All @@ -2272,7 +2273,6 @@ var egret;
this.addChild(text);
this.textLog = text;
};
;
NativeFps.prototype.update = function (datas) {
this.arrFps.push(datas.fps);
var fpsTotal = 0;
Expand All @@ -2299,16 +2299,31 @@ var egret;
{ text: datas.costTicker + " ", style: { "textColor": 0x18fefe } },
{ text: datas.costRender + " ", style: { "textColor": 0xff0000 } }
];
this.updateLayout();
};
;
NativeFps.prototype.updateInfo = function (info) {
this.updateLogDisplay(info, 1);
};
NativeFps.prototype.updateWarn = function (info) {
this.updateLogDisplay(info, 2);
};
NativeFps.prototype.updateError = function (info) {
this.updateLogDisplay(info, 3);
};
NativeFps.prototype.updateLogDisplay = function (info, type) {
var fpsHeight = 0;
if (this.showFps) {
fpsHeight = this.textFps.height;
fpsHeight = this.textFps.textHeight;
this.textLog.y = fpsHeight + 4;
}
this.arrLog.push(info);
if (type == 3) {
this.arrLog.push("[Error]" + info);
}
else if (type == 2) {
this.arrLog.push("[Warning]" + info);
}
else {
this.arrLog.push(info);
}
this.textLog.text = this.arrLog.join('\n');
if (this._stage.stageHeight > 0) {
if (this.textLog.textWidth > this._stage.stageWidth - 20 - this.panelX) {
Expand All @@ -2319,17 +2334,6 @@ var egret;
this.textLog.text = this.arrLog.join("\n");
}
}
this.updateLayout();
};
NativeFps.prototype.updateLayout = function () {
if (egret.Capabilities.runtimeType == egret.RuntimeType.NATIVE) {
return;
}
var g = this.shape.$graphics;
g.clear();
g.beginFill(0x000000, this.bgAlpha);
g.drawRect(0, 0, this.width + 8, this.height + 8);
g.endFill();
};
return NativeFps;
}(egret.Sprite));
Expand Down
4 changes: 2 additions & 2 deletions build/egret/egret.native.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions build/egret/egret.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,17 @@ var egret;
;
WebFps.prototype.updateInfo = function (info) {
this.arrLog.push(info);
this.updateLogLayout();
};
WebFps.prototype.updateWarn = function (info) {
this.arrLog.push("[Warning]" + info);
this.updateLogLayout();
};
WebFps.prototype.updateError = function (info) {
this.arrLog.push("[Error]" + info);
this.updateLogLayout();
};
WebFps.prototype.updateLogLayout = function () {
this.log.innerHTML = this.arrLog.join('<br/>');
while (document.body.clientHeight < (this.log.offsetHeight + this.fpsHeight + this.panelY + this.fontSize * 2)) {
this.arrLog.shift();
Expand Down
2 changes: 1 addition & 1 deletion build/egret/egret.web.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion build/eui/eui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2573,7 +2573,9 @@ var eui;
if (target || this.$Group[5 /* touchThrough */]) {
return target;
}
if (!this.$visible || !this.touchEnabled) {
//Bug: 当 group.sacleX or scaleY ==0 的时候,随便点击那里都点击成功
//虽然 super.$hitTest里面检测过一次 宽高大小,但是没有直接退出这个函数,所以要再判断一次;(width,height可以不判断)
if (!this.$visible || !this.touchEnabled || this.scaleX === 0 || this.scaleY === 0 || this.width === 0 || this.height === 0) {
return null;
}
var point = this.globalToLocal(stageX, stageY, egret.$TempPoint);
Expand Down
14 changes: 7 additions & 7 deletions build/eui/eui.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/game/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -4415,7 +4415,7 @@ var egret;
* @private
*/
egret["testDeviceType1"] = function () {
if (!this["navigator"]) {
if (!__global["navigator"]) {
return true;
}
var ua = navigator.userAgent.toLowerCase();
Expand All @@ -4425,7 +4425,7 @@ egret["testDeviceType1"] = function () {
* @private
*/
egret["testRuntimeType1"] = function () {
if (this["navigator"]) {
if (__global["navigator"]) {
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion build/game/game.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/cn/release-note/5.0.14/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

通过使用白鹭引擎,开发者可以尽可能的不用关注浏览器的底层实现,解决HTML5游戏性能问题及碎片化问题,灵活地满足开发者开发2D或3D游戏的需求。

该版本为官方推荐稳定版本
本版本为官方推荐稳定版本。本次更新的大部分内容均为解决开发者反馈的 BUG

## 更新内容

Expand Down
Loading

0 comments on commit c63c2d7

Please sign in to comment.