修复foreach迭代无法返回问题
This commit is contained in:
@@ -43,6 +43,36 @@ var __extends = (this && this.__extends) || (function () {
|
|||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
var __values = (this && this.__values) || function (o) {
|
||||||
|
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
||||||
|
if (m) return m.call(o);
|
||||||
|
return {
|
||||||
|
next: function () {
|
||||||
|
if (o && i >= o.length) o = void 0;
|
||||||
|
return { value: o && o[i++], done: !o };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
var __read = (this && this.__read) || function (o, n) {
|
||||||
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||||
|
if (!m) return o;
|
||||||
|
var i = m.call(o), r, ar = [], e;
|
||||||
|
try {
|
||||||
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||||
|
}
|
||||||
|
catch (error) { e = { error: error }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||||
|
}
|
||||||
|
finally { if (e) throw e.error; }
|
||||||
|
}
|
||||||
|
return ar;
|
||||||
|
};
|
||||||
|
var __spread = (this && this.__spread) || function () {
|
||||||
|
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||||
|
return ar;
|
||||||
|
};
|
||||||
var es;
|
var es;
|
||||||
(function (es) {
|
(function (es) {
|
||||||
/**
|
/**
|
||||||
@@ -3243,10 +3273,20 @@ var es;
|
|||||||
* @param array
|
* @param array
|
||||||
*/
|
*/
|
||||||
FastList.prototype.addRange = function (array) {
|
FastList.prototype.addRange = function (array) {
|
||||||
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
|
var e_1, _a;
|
||||||
var item = array_1[_i];
|
try {
|
||||||
|
for (var array_1 = __values(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {
|
||||||
|
var item = array_1_1.value;
|
||||||
this.add(item);
|
this.add(item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (array_1_1 && !array_1_1.done && (_a = array_1.return)) _a.call(array_1);
|
||||||
|
}
|
||||||
|
finally { if (e_1) throw e_1.error; }
|
||||||
|
}
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 对缓冲区中的所有项目进行排序,长度不限。
|
* 对缓冲区中的所有项目进行排序,长度不限。
|
||||||
@@ -5962,36 +6002,46 @@ var es;
|
|||||||
* @param layerMask
|
* @param layerMask
|
||||||
*/
|
*/
|
||||||
SpatialHash.prototype.overlapCircle = function (circleCenter, radius, results, layerMask) {
|
SpatialHash.prototype.overlapCircle = function (circleCenter, radius, results, layerMask) {
|
||||||
var _this = this;
|
var e_2, _a;
|
||||||
var bounds = new es.Rectangle(circleCenter.x - radius, circleCenter.y - radius, radius * 2, radius * 2);
|
var bounds = new es.Rectangle(circleCenter.x - radius, circleCenter.y - radius, radius * 2, radius * 2);
|
||||||
this._overlapTestCircle.radius = radius;
|
this._overlapTestCircle.radius = radius;
|
||||||
this._overlapTestCircle.position = circleCenter;
|
this._overlapTestCircle.position = circleCenter;
|
||||||
var resultCounter = 0;
|
var resultCounter = 0;
|
||||||
var potentials = this.aabbBroadphase(bounds, null, layerMask);
|
var potentials = this.aabbBroadphase(bounds, null, layerMask);
|
||||||
potentials.forEach(function (collider) {
|
try {
|
||||||
|
for (var potentials_1 = __values(potentials), potentials_1_1 = potentials_1.next(); !potentials_1_1.done; potentials_1_1 = potentials_1.next()) {
|
||||||
|
var collider = potentials_1_1.value;
|
||||||
if (collider instanceof es.BoxCollider) {
|
if (collider instanceof es.BoxCollider) {
|
||||||
results[resultCounter] = collider;
|
results[resultCounter] = collider;
|
||||||
resultCounter++;
|
resultCounter++;
|
||||||
}
|
}
|
||||||
else if (collider instanceof es.CircleCollider) {
|
else if (collider instanceof es.CircleCollider) {
|
||||||
if (collider.shape.overlaps(_this._overlapTestCircle)) {
|
if (collider.shape.overlaps(this._overlapTestCircle)) {
|
||||||
results[resultCounter] = collider;
|
results[resultCounter] = collider;
|
||||||
resultCounter++;
|
resultCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (collider instanceof es.PolygonCollider) {
|
else if (collider instanceof es.PolygonCollider) {
|
||||||
if (collider.shape.overlaps(_this._overlapTestCircle)) {
|
if (collider.shape.overlaps(this._overlapTestCircle)) {
|
||||||
results[resultCounter] = collider;
|
results[resultCounter] = collider;
|
||||||
resultCounter++;
|
resultCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error("overlapCircle against this collider type is not implemented!");
|
throw new Error("对这个对撞机类型的overlapCircle没有实现!");
|
||||||
}
|
}
|
||||||
// 如果我们所有的结果数据有了则返回
|
// 如果我们所有的结果数据有了则返回
|
||||||
if (resultCounter == results.length)
|
if (resultCounter == results.length)
|
||||||
return resultCounter;
|
return resultCounter;
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (potentials_1_1 && !potentials_1_1.done && (_a = potentials_1.return)) _a.call(potentials_1);
|
||||||
|
}
|
||||||
|
finally { if (e_2) throw e_2.error; }
|
||||||
|
}
|
||||||
return resultCounter;
|
return resultCounter;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@@ -8626,7 +8676,7 @@ var stopwatch;
|
|||||||
* 获取自上次重置以来该秒表已完成/记录的所有片的列表,以及当前挂起的片。
|
* 获取自上次重置以来该秒表已完成/记录的所有片的列表,以及当前挂起的片。
|
||||||
*/
|
*/
|
||||||
Stopwatch.prototype.getCompletedAndPendingSlices = function () {
|
Stopwatch.prototype.getCompletedAndPendingSlices = function () {
|
||||||
return this._completeSlices.concat([this.getPendingSlice()]);
|
return __spread(this._completeSlices, [this.getPendingSlice()]);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 获取关于这个秒表当前挂起的切片的详细信息。
|
* 获取关于这个秒表当前挂起的切片的详细信息。
|
||||||
@@ -8801,7 +8851,7 @@ var linq;
|
|||||||
for (var _i = 0; _i < arguments.length; _i++) {
|
for (var _i = 0; _i < arguments.length; _i++) {
|
||||||
args[_i] = arguments[_i];
|
args[_i] = arguments[_i];
|
||||||
}
|
}
|
||||||
return !pred.apply(void 0, args);
|
return !pred.apply(void 0, __spread(args));
|
||||||
}; };
|
}; };
|
||||||
/**
|
/**
|
||||||
* 比较器助手
|
* 比较器助手
|
||||||
@@ -8856,7 +8906,7 @@ var linq;
|
|||||||
*/
|
*/
|
||||||
List.prototype.addRange = function (elements) {
|
List.prototype.addRange = function (elements) {
|
||||||
var _a;
|
var _a;
|
||||||
(_a = this._elements).push.apply(_a, elements);
|
(_a = this._elements).push.apply(_a, __spread(elements));
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 对序列应用累加器函数。
|
* 对序列应用累加器函数。
|
||||||
@@ -9031,11 +9081,11 @@ var linq;
|
|||||||
};
|
};
|
||||||
List.prototype.max = function (selector) {
|
List.prototype.max = function (selector) {
|
||||||
var id = function (x) { return x; };
|
var id = function (x) { return x; };
|
||||||
return Math.max.apply(Math, this._elements.map(selector || id));
|
return Math.max.apply(Math, __spread(this._elements.map(selector || id)));
|
||||||
};
|
};
|
||||||
List.prototype.min = function (selector) {
|
List.prototype.min = function (selector) {
|
||||||
var id = function (x) { return x; };
|
var id = function (x) { return x; };
|
||||||
return Math.min.apply(Math, this._elements.map(selector || id));
|
return Math.min.apply(Math, __spread(this._elements.map(selector || id)));
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 根据指定的类型筛选序列中的元素。
|
* 根据指定的类型筛选序列中的元素。
|
||||||
@@ -9222,11 +9272,21 @@ var linq;
|
|||||||
* 创建一个Set从一个Enumerable.List< T>。
|
* 创建一个Set从一个Enumerable.List< T>。
|
||||||
*/
|
*/
|
||||||
List.prototype.toSet = function () {
|
List.prototype.toSet = function () {
|
||||||
|
var e_3, _a;
|
||||||
var result = new Set();
|
var result = new Set();
|
||||||
for (var _i = 0, _a = this._elements; _i < _a.length; _i++) {
|
try {
|
||||||
var x = _a[_i];
|
for (var _b = __values(this._elements), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||||
|
var x = _c.value;
|
||||||
result.add(x);
|
result.add(x);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||||
|
}
|
||||||
|
finally { if (e_3) throw e_3.error; }
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
|||||||
2
source/bin/framework.min.js
vendored
2
source/bin/framework.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -209,7 +209,7 @@ module es {
|
|||||||
|
|
||||||
let resultCounter = 0;
|
let resultCounter = 0;
|
||||||
let potentials = this.aabbBroadphase(bounds, null, layerMask);
|
let potentials = this.aabbBroadphase(bounds, null, layerMask);
|
||||||
potentials.forEach(collider => {
|
for (let collider of potentials) {
|
||||||
if (collider instanceof BoxCollider) {
|
if (collider instanceof BoxCollider) {
|
||||||
results[resultCounter] = collider;
|
results[resultCounter] = collider;
|
||||||
resultCounter++;
|
resultCounter++;
|
||||||
@@ -224,13 +224,13 @@ module es {
|
|||||||
resultCounter++;
|
resultCounter++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error("overlapCircle against this collider type is not implemented!");
|
throw new Error("对这个对撞机类型的overlapCircle没有实现!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果我们所有的结果数据有了则返回
|
// 如果我们所有的结果数据有了则返回
|
||||||
if (resultCounter == results.length)
|
if (resultCounter == results.length)
|
||||||
return resultCounter;
|
return resultCounter;
|
||||||
});
|
}
|
||||||
|
|
||||||
return resultCounter;
|
return resultCounter;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
|
"downlevelIteration": true,
|
||||||
"module": "system",
|
"module": "system",
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user