light-h5-core-lib 2.10.6 → 2.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LightCore.js +23 -20
- package/common/base/BaseSingleton.js +8 -11
- package/common/base/SetterGetterBase.js +23 -26
- package/common/md5/MD5.js +67 -89
- package/common/util/BeizerUtil.js +47 -51
- package/common/util/BitUtil.js +9 -12
- package/common/util/BooleanUtil.js +4 -8
- package/common/util/ClassNameUtil.js +6 -10
- package/common/util/CollisionDetectionUtil.js +119 -161
- package/common/util/Crc32Util.js +10 -15
- package/common/util/DateUtil.js +26 -40
- package/common/util/FloatDigitUtil.js +14 -20
- package/common/util/GetDecorateUtils.js +9 -12
- package/common/util/MapUtil.js +28 -0
- package/common/util/NumberUtil.js +4 -8
- package/common/util/PromiseUtil.js +39 -82
- package/common/util/RandomNumUtil.js +21 -28
- package/common/util/SelfDecrypt.js +19 -22
- package/common/util/StringUtil.js +52 -65
- package/common/util/UniqueIDUtil.js +7 -10
- package/package.json +18 -18
- package/pool/PoolObj.js +52 -77
- package/type/index.d.ts +17 -1
package/common/util/BitUtil.js
CHANGED
|
@@ -5,20 +5,18 @@ exports.BitUtil = void 0;
|
|
|
5
5
|
* 位操作工具(从右向左←)
|
|
6
6
|
* @author Aonaufly
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
function BitUtil() {
|
|
10
|
-
}
|
|
8
|
+
class BitUtil {
|
|
11
9
|
/**
|
|
12
10
|
* 读取uint类型某位的值, bit从1开始
|
|
13
11
|
*/
|
|
14
|
-
|
|
12
|
+
static getBit(value, bit) {
|
|
15
13
|
return (value & (1 << (bit - 1))) >> (bit - 1);
|
|
16
|
-
}
|
|
14
|
+
}
|
|
17
15
|
/**
|
|
18
16
|
* 设置value 第bit(从1开始)位的值为v(0|1)
|
|
19
17
|
* 谨记bit<32
|
|
20
18
|
*/
|
|
21
|
-
|
|
19
|
+
static setBit(value, bit, v) {
|
|
22
20
|
if (bit > 32) {
|
|
23
21
|
return undefined;
|
|
24
22
|
}
|
|
@@ -28,16 +26,15 @@ var BitUtil = /** @class */ (function () {
|
|
|
28
26
|
else {
|
|
29
27
|
return (value &= ~0 ^ (1 << (bit - 1)));
|
|
30
28
|
}
|
|
31
|
-
}
|
|
29
|
+
}
|
|
32
30
|
/**获取1的个数 */
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
static get1num(value) {
|
|
32
|
+
let count = 0;
|
|
35
33
|
while (value) {
|
|
36
34
|
value = value & (value - 1);
|
|
37
35
|
count++;
|
|
38
36
|
}
|
|
39
37
|
return count;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
43
40
|
exports.BitUtil = BitUtil;
|
|
@@ -5,19 +5,15 @@ exports.BooleanUtil = void 0;
|
|
|
5
5
|
* Bool类型处理
|
|
6
6
|
* @author Aonaufly
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
function BooleanUtil() {
|
|
10
|
-
}
|
|
8
|
+
class BooleanUtil {
|
|
11
9
|
/**
|
|
12
10
|
* 获得Proto中的Bool值
|
|
13
11
|
*/
|
|
14
|
-
|
|
15
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
12
|
+
static getProtoBool(data, key, defaultValue = false) {
|
|
16
13
|
if (key in data) {
|
|
17
14
|
return data[key];
|
|
18
15
|
}
|
|
19
16
|
return defaultValue;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
23
19
|
exports.BooleanUtil = BooleanUtil;
|
|
@@ -5,17 +5,13 @@ exports.ClassNameUtil = void 0;
|
|
|
5
5
|
* 获得类的名称
|
|
6
6
|
* @author Aonaufly
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
function ClassNameUtil() {
|
|
10
|
-
}
|
|
8
|
+
class ClassNameUtil {
|
|
11
9
|
/**
|
|
12
10
|
* 获取类的名称
|
|
13
11
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return ClassNameUtil;
|
|
20
|
-
}());
|
|
12
|
+
static getClassName(obj) {
|
|
13
|
+
const constructor = Reflect.getPrototypeOf(obj)?.constructor;
|
|
14
|
+
return constructor?.name;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
21
17
|
exports.ClassNameUtil = ClassNameUtil;
|
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.CollisionDetectionUtil = void 0;
|
|
19
4
|
/**
|
|
20
5
|
* 碰撞检测工具
|
|
21
6
|
* @author Aonaufly
|
|
22
7
|
*/
|
|
23
|
-
|
|
24
|
-
function CollisionDetectionUtil() {
|
|
25
|
-
}
|
|
8
|
+
class CollisionDetectionUtil {
|
|
26
9
|
/**
|
|
27
10
|
* AABB检测
|
|
28
11
|
* @param aAnchor A的锚点(0~1)
|
|
@@ -30,14 +13,14 @@ var CollisionDetectionUtil = /** @class */ (function () {
|
|
|
30
13
|
* @param aBox
|
|
31
14
|
* @param bBox
|
|
32
15
|
*/
|
|
33
|
-
|
|
16
|
+
static aABB(aAnchor, bAnchor, aBox, bBox) {
|
|
34
17
|
if (!CollisionDetectionUtil._aabb) {
|
|
35
18
|
CollisionDetectionUtil._aabb = new AABB();
|
|
36
19
|
}
|
|
37
|
-
|
|
20
|
+
const result = CollisionDetectionUtil._aabb.conllision(aAnchor, bAnchor, aBox, bBox);
|
|
38
21
|
CollisionDetectionUtil._aabb.clear();
|
|
39
22
|
return result;
|
|
40
|
-
}
|
|
23
|
+
}
|
|
41
24
|
/**
|
|
42
25
|
* OBB检测
|
|
43
26
|
* @param aCenter A的中心位置
|
|
@@ -45,42 +28,42 @@ var CollisionDetectionUtil = /** @class */ (function () {
|
|
|
45
28
|
* @param aOBB
|
|
46
29
|
* @param bOBB
|
|
47
30
|
*/
|
|
48
|
-
|
|
31
|
+
static oBB(aCenter, bCenter, aOBB, bOBB) {
|
|
49
32
|
if (!CollisionDetectionUtil._obb) {
|
|
50
33
|
CollisionDetectionUtil._obb = new OBB();
|
|
51
34
|
}
|
|
52
|
-
|
|
35
|
+
const result = CollisionDetectionUtil._obb.conllision(aCenter, bCenter, aOBB, bOBB);
|
|
53
36
|
CollisionDetectionUtil._obb.clear();
|
|
54
37
|
return result;
|
|
55
|
-
}
|
|
38
|
+
}
|
|
56
39
|
/**
|
|
57
40
|
* 多边形检测
|
|
58
41
|
* @param aVertices A的每个点的位置
|
|
59
42
|
* @param bVertices B的每个点的位置
|
|
60
43
|
*/
|
|
61
|
-
|
|
44
|
+
static polygon(aVertices, bVertices) {
|
|
62
45
|
if (!CollisionDetectionUtil._polygon) {
|
|
63
46
|
CollisionDetectionUtil._polygon = new Polygon();
|
|
64
47
|
}
|
|
65
|
-
|
|
48
|
+
const result = CollisionDetectionUtil._polygon.conllision(null, null, aVertices, bVertices);
|
|
66
49
|
CollisionDetectionUtil._polygon.clear();
|
|
67
50
|
return result;
|
|
68
|
-
}
|
|
51
|
+
}
|
|
69
52
|
/**
|
|
70
53
|
* 检测旋转矩形和圆形是否相交<br>
|
|
71
54
|
* <div style="color: #FF0000;">锚点都为0.5</div>
|
|
72
55
|
* @param circle 圆形
|
|
73
56
|
* @param rect 矩形
|
|
74
57
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
static circle2Rect(circle, rect) {
|
|
59
|
+
const angle = rect.angle / Math.PI * 180;
|
|
60
|
+
const rectMidPointX = rect.position.x;
|
|
61
|
+
const rectMidPointY = rect.position.y;
|
|
62
|
+
const rectLeftBottomX = rect.position.x - rect.width / 2;
|
|
63
|
+
const rectLeftBottomY = rect.position.y - rect.height / 2;
|
|
64
|
+
const unrotatedCircleX = Math.cos(-angle) * (circle.position.x - rectMidPointX) - Math.sin(-angle) * (circle.position.y - rectMidPointY) + rectMidPointX;
|
|
65
|
+
const unrotatedCircleY = Math.sin(-angle) * (circle.position.x - rectMidPointX) + Math.cos(-angle) * (circle.position.y - rectMidPointY) + rectMidPointY;
|
|
66
|
+
let closestX = 0, closestY = 0;
|
|
84
67
|
if (unrotatedCircleX < rectLeftBottomX)
|
|
85
68
|
closestX = rectLeftBottomX;
|
|
86
69
|
else if (unrotatedCircleX > rectLeftBottomX + rect.width)
|
|
@@ -93,21 +76,21 @@ var CollisionDetectionUtil = /** @class */ (function () {
|
|
|
93
76
|
closestY = rectLeftBottomY + rect.height;
|
|
94
77
|
else
|
|
95
78
|
closestY = unrotatedCircleY;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
79
|
+
const findDistance = (fromX, fromY, toX, toY) => {
|
|
80
|
+
const a = Math.abs(fromX - toX);
|
|
81
|
+
const b = Math.abs(fromY - toY);
|
|
99
82
|
return Math.sqrt((a * a) + (b * b));
|
|
100
83
|
};
|
|
101
|
-
|
|
84
|
+
const distance = findDistance(unrotatedCircleX, unrotatedCircleY, closestX, closestY);
|
|
102
85
|
return distance < circle.radius;
|
|
103
|
-
}
|
|
86
|
+
}
|
|
104
87
|
/**
|
|
105
88
|
* 2个圆形是否碰撞
|
|
106
89
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
90
|
+
static circle2Circle(aCircle, bCircle) {
|
|
91
|
+
const distance = Math.sqrt(Math.pow((aCircle.position.x - bCircle.position.x), 2) + Math.pow((aCircle.position.y - bCircle.position.y), 2));
|
|
109
92
|
return distance <= aCircle.radius + bCircle.radius;
|
|
110
|
-
}
|
|
93
|
+
}
|
|
111
94
|
/**
|
|
112
95
|
* 判断某个点的位置是否位于椭圆内
|
|
113
96
|
* @param pos 点的位置
|
|
@@ -115,93 +98,76 @@ var CollisionDetectionUtil = /** @class */ (function () {
|
|
|
115
98
|
* @param ellipseAxis 椭圆轴
|
|
116
99
|
* @returns
|
|
117
100
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
101
|
+
static IsInEllipse(pos, centerPos, ellipseAxis) {
|
|
102
|
+
const diffX = pos.x - centerPos.x;
|
|
103
|
+
const diffY = pos.y - centerPos.y;
|
|
121
104
|
return ((diffX * diffX) / (ellipseAxis.x * ellipseAxis.x) + (diffY * diffY) / (ellipseAxis.y * ellipseAxis.y)) <= 1;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
}());
|
|
105
|
+
}
|
|
106
|
+
}
|
|
125
107
|
exports.CollisionDetectionUtil = CollisionDetectionUtil;
|
|
126
108
|
//#region 碰撞检测基类
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
CollisionBase.prototype.clear = function () {
|
|
109
|
+
class CollisionBase {
|
|
110
|
+
clear() {
|
|
131
111
|
this._aAnchor = null;
|
|
132
112
|
this._bAnchor = null;
|
|
133
|
-
}
|
|
113
|
+
}
|
|
134
114
|
/**
|
|
135
115
|
* 碰撞检测处理
|
|
136
116
|
*/
|
|
137
|
-
|
|
138
|
-
var args = [];
|
|
139
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
140
|
-
args[_i - 2] = arguments[_i];
|
|
141
|
-
}
|
|
117
|
+
conllision(aAnchor, bAnchor, ...args) {
|
|
142
118
|
this._aAnchor = aAnchor;
|
|
143
119
|
this._bAnchor = bAnchor;
|
|
144
120
|
return this.check();
|
|
145
|
-
}
|
|
146
|
-
|
|
121
|
+
}
|
|
122
|
+
destroy() {
|
|
147
123
|
this.clear();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
}());
|
|
124
|
+
}
|
|
125
|
+
}
|
|
151
126
|
//#endregion
|
|
152
127
|
//#region AABB碰撞(2个矩形的简单碰撞)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
function AABB() {
|
|
156
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
157
|
-
}
|
|
158
|
-
AABB.prototype.conllision = function (aAnchor, bAnchor, aBox, bBox) {
|
|
128
|
+
class AABB extends CollisionBase {
|
|
129
|
+
conllision(aAnchor, bAnchor, aBox, bBox) {
|
|
159
130
|
this._aBox = aBox;
|
|
160
131
|
this._bBox = bBox;
|
|
161
|
-
return
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
132
|
+
return super.conllision(aAnchor, bAnchor);
|
|
133
|
+
}
|
|
134
|
+
check() {
|
|
135
|
+
const aX = this._aBox.x - this._aAnchor.x * this._aBox.width;
|
|
136
|
+
const aY = this._aBox.y - this._aAnchor.y * this._aBox.height;
|
|
137
|
+
const bX = this._bBox.x - this._bAnchor.x * this._bBox.width;
|
|
138
|
+
const bY = this._bBox.y - this._bAnchor.y * this._bBox.height;
|
|
168
139
|
return aX < bX + this._bBox.width &&
|
|
169
140
|
aX + this._aBox.width > bX &&
|
|
170
141
|
aY < bY + this._bBox.height &&
|
|
171
142
|
aY + this._aBox.height > bY;
|
|
172
|
-
}
|
|
173
|
-
|
|
143
|
+
}
|
|
144
|
+
clear() {
|
|
174
145
|
this._aBox = null;
|
|
175
146
|
this._bBox = null;
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
}(CollisionBase));
|
|
147
|
+
super.clear();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
180
150
|
//#endregion
|
|
181
151
|
//#region OBB适用于旋转的矩形,需要使用分离轴定理(SAT)进行检测
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
function OBB() {
|
|
185
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
186
|
-
}
|
|
187
|
-
OBB.prototype.clear = function () {
|
|
152
|
+
class OBB extends CollisionBase {
|
|
153
|
+
clear() {
|
|
188
154
|
this._aOBB = null;
|
|
189
155
|
this._bOBB = null;
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
156
|
+
super.clear();
|
|
157
|
+
}
|
|
158
|
+
conllision(aAnchor, bAnchor, aOBB, bOBB) {
|
|
193
159
|
this._aOBB = aOBB;
|
|
194
160
|
this._bOBB = bOBB;
|
|
195
|
-
return
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
161
|
+
return super.conllision(aAnchor, bAnchor);
|
|
162
|
+
}
|
|
163
|
+
getVertices(isA) {
|
|
164
|
+
const obbInfo = isA ? this._aOBB : this._bOBB;
|
|
165
|
+
const center = isA ? this._aAnchor : this._bAnchor;
|
|
166
|
+
const rad = obbInfo.angle * Math.PI / 180;
|
|
167
|
+
const cos = Math.cos(rad);
|
|
168
|
+
const sin = Math.sin(rad);
|
|
169
|
+
const halfWidth = obbInfo.width / 2;
|
|
170
|
+
const halfHeight = obbInfo.height / 2;
|
|
205
171
|
return [
|
|
206
172
|
{
|
|
207
173
|
x: center.x + cos * halfWidth - sin * halfHeight,
|
|
@@ -220,91 +186,83 @@ var OBB = /** @class */ (function (_super) {
|
|
|
220
186
|
y: center.y + sin * halfWidth - cos * halfHeight
|
|
221
187
|
}
|
|
222
188
|
];
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
189
|
+
}
|
|
190
|
+
getAxes(isA) {
|
|
191
|
+
const vertices = this.getVertices(isA);
|
|
226
192
|
return [
|
|
227
193
|
{ x: vertices[1].x - vertices[0].x, y: vertices[1].y - vertices[0].y },
|
|
228
194
|
{ x: vertices[2].x - vertices[1].x, y: vertices[2].y - vertices[1].y }
|
|
229
195
|
];
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
vertices.forEach(
|
|
236
|
-
|
|
196
|
+
}
|
|
197
|
+
project(axis, isA) {
|
|
198
|
+
const vertices = this.getVertices(isA);
|
|
199
|
+
let min = Infinity;
|
|
200
|
+
let max = -Infinity;
|
|
201
|
+
vertices.forEach((vertex) => {
|
|
202
|
+
const dot = vertex.x * axis.x + vertex.y * axis.y;
|
|
237
203
|
min = Math.min(min, dot);
|
|
238
204
|
max = Math.max(max, dot);
|
|
239
205
|
});
|
|
240
|
-
return { min
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
for (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
var proj2 = this.project(axis, false);
|
|
206
|
+
return { min, max };
|
|
207
|
+
}
|
|
208
|
+
check() {
|
|
209
|
+
const axes = this.getAxes(true).concat(this.getAxes(false));
|
|
210
|
+
for (let axis of axes) {
|
|
211
|
+
const proj1 = this.project(axis, true);
|
|
212
|
+
const proj2 = this.project(axis, false);
|
|
248
213
|
if (proj1.max < proj2.min || proj2.max < proj1.min) {
|
|
249
214
|
return false;
|
|
250
215
|
}
|
|
251
216
|
}
|
|
252
217
|
return true;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
}(CollisionBase));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
256
220
|
//#endregion
|
|
257
221
|
//#region 多边形
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
function Polygon() {
|
|
261
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
262
|
-
}
|
|
263
|
-
Polygon.prototype.conllision = function (aAnchor, bAnchor, aVertices, bVertices) {
|
|
222
|
+
class Polygon extends CollisionBase {
|
|
223
|
+
conllision(aAnchor, bAnchor, aVertices, bVertices) {
|
|
264
224
|
this._aVertices = aVertices;
|
|
265
225
|
this._bVertices = bVertices;
|
|
266
|
-
return
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
for (
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
226
|
+
return super.conllision(null, null);
|
|
227
|
+
}
|
|
228
|
+
getAxes(isA) {
|
|
229
|
+
const vertices = isA ? this._aVertices : this._bVertices;
|
|
230
|
+
const axes = [];
|
|
231
|
+
for (let i = 0; i < vertices.length; i++) {
|
|
232
|
+
const p1 = vertices[i];
|
|
233
|
+
const p2 = vertices[(i + 1) % vertices.length];
|
|
234
|
+
const edge = { x: p2.x - p1.x, y: p2.y - p1.y };
|
|
235
|
+
const normal = { x: -edge.y, y: edge.x };
|
|
276
236
|
axes.push(normal);
|
|
277
237
|
}
|
|
278
238
|
return axes;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
vertices.forEach(
|
|
285
|
-
|
|
239
|
+
}
|
|
240
|
+
project(axis, isA) {
|
|
241
|
+
let min = Infinity;
|
|
242
|
+
let max = -Infinity;
|
|
243
|
+
const vertices = isA ? this._aVertices : this._bVertices;
|
|
244
|
+
vertices.forEach((vertex) => {
|
|
245
|
+
const dot = vertex.x * axis.x + vertex.y * axis.y;
|
|
286
246
|
min = Math.min(min, dot);
|
|
287
247
|
max = Math.max(max, dot);
|
|
288
248
|
});
|
|
289
|
-
return { min
|
|
290
|
-
}
|
|
291
|
-
|
|
249
|
+
return { min, max };
|
|
250
|
+
}
|
|
251
|
+
clear() {
|
|
292
252
|
this._aVertices = null;
|
|
293
253
|
this._bVertices = null;
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
for (
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
var proj2 = this.project(axis, false);
|
|
254
|
+
super.clear();
|
|
255
|
+
}
|
|
256
|
+
check() {
|
|
257
|
+
const axes = this.getAxes(true).concat(this.getAxes(false));
|
|
258
|
+
for (let axis of axes) {
|
|
259
|
+
const proj1 = this.project(axis, true);
|
|
260
|
+
const proj2 = this.project(axis, false);
|
|
302
261
|
if (proj1.max < proj2.min || proj2.max < proj1.min) {
|
|
303
262
|
return false;
|
|
304
263
|
}
|
|
305
264
|
}
|
|
306
265
|
return true;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
}(CollisionBase));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
310
268
|
//#endregion
|
package/common/util/Crc32Util.js
CHANGED
|
@@ -4,32 +4,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
* Crc32验证工具
|
|
5
5
|
* @author Aonaufly
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
function Crc32Util() {
|
|
9
|
-
}
|
|
7
|
+
class Crc32Util {
|
|
10
8
|
/**
|
|
11
9
|
* Crc32 number
|
|
12
10
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var x;
|
|
11
|
+
static getCrc32Number(str, crc = 0) {
|
|
12
|
+
let n = 0;
|
|
13
|
+
let x;
|
|
17
14
|
crc = crc ^ (-1);
|
|
18
|
-
for (
|
|
15
|
+
for (let i = 0, iTop = str.length; i < iTop; i++) {
|
|
19
16
|
n = (crc ^ str.charCodeAt(i)) & 0xFF;
|
|
20
17
|
x = "0x" + Crc32Util.table.substr(n * 9, 8);
|
|
21
18
|
crc = (crc >>> 8) ^ x;
|
|
22
19
|
}
|
|
23
20
|
return crc ^ (-1);
|
|
24
|
-
}
|
|
21
|
+
}
|
|
25
22
|
/**
|
|
26
23
|
* Crc32 string
|
|
27
24
|
*/
|
|
28
|
-
|
|
29
|
-
if (crc === void 0) { crc = 0; }
|
|
25
|
+
static getCrc32String(str, crc = 0) {
|
|
30
26
|
return Crc32Util.getCrc32Number(str, crc).toString(16);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}());
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
Crc32Util.table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
|
|
35
30
|
exports.default = Crc32Util;
|