@cc-component/cc-core 1.7.4 → 1.7.5
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/assets/core/config/LayerUI.ts +11 -11
- package/assets/core/editor/LanguageManager.ts +3 -3
- package/assets/core/editor/i18nEditorComponent.ts +4 -4
- package/assets/core/home/BaseLoading.ts +1 -1
- package/assets/core/home/BaseSkeleton.ts +4 -4
- package/assets/core/home/CameraAngel.ts +9 -9
- package/assets/core/home/FollowCamera.ts +2 -2
- package/assets/core/home/GameState.ts +2 -2
- package/assets/core/home/InViewCenter.ts +1 -1
- package/assets/core/home/ResourceManager.ts +3 -3
- package/assets/core/home/StateMachine.ts +9 -9
- package/assets/core/home/ThirdFreeLookCamera.ts +2 -2
- package/assets/core/home/Tools.ts +3 -3
- package/assets/core/interface/App.ts +13 -11
- package/assets/core/interface/Interface.ts +5 -1
- package/assets/core/lib/language/Language.ts +3 -3
- package/assets/core/lib/language/LanguageData.ts +2 -2
- package/assets/core/lib/language/LanguageLabel.ts +2 -2
- package/assets/core/lib/language/LanguagePack.ts +4 -4
- package/assets/core/lib/language/LanguageSprite.ts +1 -1
- package/assets/core/lib/logger/MLogger.ts +2 -2
- package/assets/core/lib/net/net/NetNode.ts +20 -20
- package/assets/core/lib/net/net/WebSock.ts +1 -1
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ export class LayerUI {
|
|
|
43
43
|
const data = await App.LoadAsset<JsonAsset>(params.bundleName, "config", JsonAsset)
|
|
44
44
|
this.config = data.json as IConfig;
|
|
45
45
|
App.ReleaseAssetPath('config', params.bundleName)
|
|
46
|
-
//Logger.debug(this.config)
|
|
46
|
+
//if (App.GetDebug()) Logger.debug(this.config)
|
|
47
47
|
|
|
48
48
|
const config = this.config;
|
|
49
49
|
config.gui.forEach(element => {
|
|
@@ -95,16 +95,16 @@ export class LayerUI {
|
|
|
95
95
|
}
|
|
96
96
|
setBundleName(value: string) { this.bundleName = value; }
|
|
97
97
|
initLog() {
|
|
98
|
-
const debug = this.config.debug
|
|
99
|
-
if (debug) {
|
|
100
|
-
|
|
101
|
-
} else {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
98
|
+
// const debug = this.config.debug
|
|
99
|
+
// if (debug) {
|
|
100
|
+
// if (App.GetDebug()) Logger.debug("是debug模式");
|
|
101
|
+
// } else {
|
|
102
|
+
// console.log("发布模式");
|
|
103
|
+
// console.log = function () { }; // 关闭普通日志输出
|
|
104
|
+
// console.warn = function () { }; // 关闭警告输出
|
|
105
|
+
// // console.error = function () { }; // 关闭错误输出
|
|
106
|
+
// console.info = function () { }
|
|
107
|
+
// }
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
// try {
|
|
117
117
|
// let index = 0;
|
|
118
118
|
// return value.replace(/d%/g, function () {
|
|
119
|
-
// //Logger.debug(`${index}个参数:${args[index]}`);
|
|
119
|
+
// //if (App.GetDebug()) Logger.debug(`${index}个参数:${args[index]}`);
|
|
120
120
|
|
|
121
121
|
// let str = args[index++] || "";
|
|
122
122
|
// return str;
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
// try {
|
|
280
280
|
// let index = 0;
|
|
281
281
|
// return value.replace(/d%/g, function () {
|
|
282
|
-
// //Logger.debug(`${index}个参数:${args[index]}`);
|
|
282
|
+
// //if (App.GetDebug()) Logger.debug(`${index}个参数:${args[index]}`);
|
|
283
283
|
|
|
284
284
|
// let str = args[index++] || "d%";
|
|
285
285
|
// return str;
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
// break;
|
|
316
316
|
// }
|
|
317
317
|
// }
|
|
318
|
-
// //Logger.debug("bundleName:",bundleName);
|
|
318
|
+
// //if (App.GetDebug()) Logger.debug("bundleName:",bundleName);
|
|
319
319
|
// return bundleName;
|
|
320
320
|
// }
|
|
321
321
|
// }
|
|
@@ -60,7 +60,7 @@ export class i18nEditorComponent extends Component {
|
|
|
60
60
|
let url = absoluteUrl.split("://");
|
|
61
61
|
let paths = url[1].split("/");
|
|
62
62
|
dbUrl = url[0] + "://" + paths[0] + "/" + paths[1];
|
|
63
|
-
// Logger.debug("absoluteUrl11:", absoluteUrl, dbUrl);
|
|
63
|
+
// if (App.GetDebug()) Logger.debug("absoluteUrl11:", absoluteUrl, dbUrl);
|
|
64
64
|
//label
|
|
65
65
|
return dbUrl
|
|
66
66
|
|
|
@@ -78,7 +78,7 @@ export class i18nEditorComponent extends Component {
|
|
|
78
78
|
let uuid = await Editor.Message.request("asset-db", "query-uuid", db_json);
|
|
79
79
|
await new Promise<void>((resolve) => {
|
|
80
80
|
assetManager.loadAny(uuid, (err, jsonAsset: JsonAsset) => {
|
|
81
|
-
//Logger.debug("加载表格", jsonAsset, err);
|
|
81
|
+
//if (App.GetDebug()) Logger.debug("加载表格", jsonAsset, err);
|
|
82
82
|
App.gui.config = jsonAsset.json as IConfig;
|
|
83
83
|
//console.error(App.gui.config)
|
|
84
84
|
resolve()
|
|
@@ -92,7 +92,7 @@ export class i18nEditorComponent extends Component {
|
|
|
92
92
|
console.log(db_json)
|
|
93
93
|
let uuid = await Editor.Message.request("asset-db", "query-uuid", db_json);
|
|
94
94
|
assetManager.loadAny(uuid, (err, jsonAsset: JsonAsset) => {
|
|
95
|
-
// Logger.debug("加载表格", jsonAsset, err);
|
|
95
|
+
// if (App.GetDebug()) Logger.debug("加载表格", jsonAsset, err);
|
|
96
96
|
if (!jsonAsset) return;
|
|
97
97
|
let labelData = jsonAsset.json;
|
|
98
98
|
LanguageData.language.set(LanguageDataType.Json, jsonAsset.json);
|
|
@@ -121,7 +121,7 @@ export class i18nEditorComponent extends Component {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
assetManager.loadAny(uuid, (err, imageAsset: ImageAsset) => {
|
|
124
|
-
//Logger.debug("加载图片", imageAsset, err);
|
|
124
|
+
//if (App.GetDebug()) Logger.debug("加载图片", imageAsset, err);
|
|
125
125
|
if (!imageAsset) return;
|
|
126
126
|
let spriteFrame = SpriteFrame.createWithImage(imageAsset);
|
|
127
127
|
com.updateSpriteEditor(spriteFrame)
|
|
@@ -58,7 +58,7 @@ export abstract class BaseLoading extends Component {
|
|
|
58
58
|
})
|
|
59
59
|
this.pro_total = (this.pro_total + temp_pro)
|
|
60
60
|
}
|
|
61
|
-
Logger.debug("完成", this.pro_total)
|
|
61
|
+
if (App.GetDebug()) Logger.debug("完成", this.pro_total)
|
|
62
62
|
// ✅ 先调用子类的 Finish(允许子类做自定义操作)
|
|
63
63
|
await this.Finish(); // 支持异步
|
|
64
64
|
|
|
@@ -27,10 +27,10 @@ export class SkeletonAnim {
|
|
|
27
27
|
// 设置事件监听器
|
|
28
28
|
skeleton.setEventListener((entry, event: sp.spine.Event) => {
|
|
29
29
|
const index = animations.findIndex((anim => anim.name === entry.animation.name))
|
|
30
|
-
// Logger.debug("1--事件", event.data.name, event.data.intValue, event.data)
|
|
31
|
-
// Logger.debug("2--事件", event.data.intValue)
|
|
32
|
-
// Logger.debug("2--事件", event.data.stringValue)
|
|
33
|
-
// Logger.debug("2--事件", event.data.floatValue,entry.animation.name)
|
|
30
|
+
// if (App.GetDebug()) Logger.debug("1--事件", event.data.name, event.data.intValue, event.data)
|
|
31
|
+
// if (App.GetDebug()) Logger.debug("2--事件", event.data.intValue)
|
|
32
|
+
// if (App.GetDebug()) Logger.debug("2--事件", event.data.stringValue)
|
|
33
|
+
// if (App.GetDebug()) Logger.debug("2--事件", event.data.floatValue,entry.animation.name)
|
|
34
34
|
animations[index].event?.(event.data.name)
|
|
35
35
|
});
|
|
36
36
|
}
|
|
@@ -51,7 +51,7 @@ export class CameraAngel extends Component {
|
|
|
51
51
|
|
|
52
52
|
private MouseDown(e: Event) {
|
|
53
53
|
|
|
54
|
-
Logger.debug("222");
|
|
54
|
+
if (App.GetDebug()) Logger.debug("222");
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
|
|
@@ -59,7 +59,7 @@ export class CameraAngel extends Component {
|
|
|
59
59
|
if (this.targetCube) {
|
|
60
60
|
let fff = Vec3.FORWARD
|
|
61
61
|
fff = v3(0, 0, -1).multiplyScalar(0.01)
|
|
62
|
-
// Logger.debug(fff);
|
|
62
|
+
// if (App.GetDebug()) Logger.debug(fff);
|
|
63
63
|
// this.targetCube.worldPosition = this.targetCube.worldPosition.add(fff)
|
|
64
64
|
// this.UpdatePos(0, 0)
|
|
65
65
|
// this.SetPos();
|
|
@@ -83,7 +83,7 @@ export class CameraAngel extends Component {
|
|
|
83
83
|
private TouchStart(e: EventTouch) {
|
|
84
84
|
this.isTouching = true;
|
|
85
85
|
this.touchStartPos = this.GetPos(e);
|
|
86
|
-
//å Logger.debug("开始", this.touchStartPos)
|
|
86
|
+
//å if (App.GetDebug()) Logger.debug("开始", this.touchStartPos)
|
|
87
87
|
|
|
88
88
|
this.isHave = false
|
|
89
89
|
this.f_x = v3(0)
|
|
@@ -145,21 +145,21 @@ export class CameraAngel extends Component {
|
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
}
|
|
148
|
-
// Logger.debug(x,y)
|
|
149
|
-
// Logger.debug("ddd");
|
|
148
|
+
// if (App.GetDebug()) Logger.debug(x,y)
|
|
149
|
+
// if (App.GetDebug()) Logger.debug("ddd");
|
|
150
150
|
this.followCamera.isMove = true;
|
|
151
151
|
let currentPos = new Vec3(x, y, 0);
|
|
152
152
|
let delta = currentPos.clone().subtract(this.touchStartPos);
|
|
153
153
|
|
|
154
154
|
if (delta.x < this.f_x.x && !this.f_x.equals(v3(0), 0.01)) {
|
|
155
155
|
this.touchStartPos = this.f_x
|
|
156
|
-
// Logger.debug("转");
|
|
156
|
+
// if (App.GetDebug()) Logger.debug("转");
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
//Logger.debug(currentPos)
|
|
159
|
+
//if (App.GetDebug()) Logger.debug(currentPos)
|
|
160
160
|
this.f_x = currentPos.clone();
|
|
161
161
|
// 根据 deltaX 进行旋转
|
|
162
|
-
// Logger.debug(delta);
|
|
162
|
+
// if (App.GetDebug()) Logger.debug(delta);
|
|
163
163
|
this.rotateByDeltaX(delta.x, delta.y);
|
|
164
164
|
//this.rotateAndLookAtTarget()
|
|
165
165
|
|
|
@@ -283,7 +283,7 @@ export class CameraAngel extends Component {
|
|
|
283
283
|
let rotatedPos = this.targetCube.worldPosition.clone().add(rotatedDirection.clone().multiplyScalar(distance));
|
|
284
284
|
let rotatedPos2 = this.targetCube.worldPosition.clone().add(this.node.forward.multiplyScalar(distance * -1));
|
|
285
285
|
|
|
286
|
-
Logger.debug(rotatedDirection.clone(), rotatedPos2)
|
|
286
|
+
if (App.GetDebug()) Logger.debug(rotatedDirection.clone(), rotatedPos2)
|
|
287
287
|
// 更新相机位置
|
|
288
288
|
this.node.setWorldPosition(rotatedPos);
|
|
289
289
|
|
|
@@ -88,7 +88,7 @@ export class FollowCamera extends Component {
|
|
|
88
88
|
}
|
|
89
89
|
if (this.isMove) {
|
|
90
90
|
|
|
91
|
-
// Logger.debug("阻止")
|
|
91
|
+
// if (App.GetDebug()) Logger.debug("阻止")
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -111,7 +111,7 @@ export class FollowCamera extends Component {
|
|
|
111
111
|
let ret = this.node.worldPosition.clone().add(diff.multiplyScalar(this.speedFactor));
|
|
112
112
|
//ret = ret.add(v3(0,0.5,0));
|
|
113
113
|
this.node.setWorldPosition(ret);
|
|
114
|
-
//Logger.debug('-----',this.node.worldPosition);
|
|
114
|
+
//if (App.GetDebug()) Logger.debug('-----',this.node.worldPosition);
|
|
115
115
|
//this.node.setWorldPosition(v3(ret.x,37,ret.z));
|
|
116
116
|
|
|
117
117
|
this.isUpdatePos = true
|
|
@@ -44,7 +44,7 @@ export function GameState<T extends new (...args: any[]) => Component>(Base: T)
|
|
|
44
44
|
if (jumpTarget) {
|
|
45
45
|
const targetIndex = this.states.findIndex(s => s.state === jumpTarget);
|
|
46
46
|
if (targetIndex !== -1) {
|
|
47
|
-
Logger.debug(`[状态机] 跳转到: ${jumpTarget}`);
|
|
47
|
+
if (App.GetDebug()) Logger.debug(`[状态机] 跳转到: ${jumpTarget}`);
|
|
48
48
|
index = targetIndex; // 跳转到目标索引
|
|
49
49
|
} else {
|
|
50
50
|
index++; // 正常顺序执行
|
|
@@ -59,7 +59,7 @@ export function GameState<T extends new (...args: any[]) => Component>(Base: T)
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
statesLog(name: string) {
|
|
62
|
-
Logger.debug(`状态:${name}`);
|
|
62
|
+
if (App.GetDebug()) Logger.debug(`状态:${name}`);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
|
|
@@ -44,7 +44,7 @@ export class InViewCenter {
|
|
|
44
44
|
|
|
45
45
|
isPointInsideCanvas(point: Vec3): boolean {
|
|
46
46
|
const canvasSize = this.screenSize;
|
|
47
|
-
//Logger.debug(this.width)
|
|
47
|
+
//if (App.GetDebug()) Logger.debug(this.width)
|
|
48
48
|
return (point.x >= -this.width && point.x <= this.width &&
|
|
49
49
|
point.y >= -this.height && point.y <= this.height);
|
|
50
50
|
}
|
|
@@ -211,7 +211,7 @@ export class ResourceManager {
|
|
|
211
211
|
list.push({ name: asset.name, refCount: asset.refCount })
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
|
-
Logger.debug("资源计数:\n", list)
|
|
214
|
+
if (App.GetDebug()) Logger.debug("资源计数:\n", list)
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
LogAssetsAll() {
|
|
@@ -297,7 +297,7 @@ export class ResourceManager {
|
|
|
297
297
|
let asset = bundle.get(path, type);
|
|
298
298
|
|
|
299
299
|
if (asset) {
|
|
300
|
-
//Logger.debug('已加载==', asset.refCount)
|
|
300
|
+
//if (App.GetDebug()) Logger.debug('已加载==', asset.refCount)
|
|
301
301
|
// 记录加载的资源
|
|
302
302
|
ResourceManager.instance.trackAsset(path, asset, bundleName);
|
|
303
303
|
ResourceManager.instance.LogAssets(bundleName)
|
|
@@ -312,7 +312,7 @@ export class ResourceManager {
|
|
|
312
312
|
resolve(null);
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
|
-
//Logger.debug('--加载', path)
|
|
315
|
+
//if (App.GetDebug()) Logger.debug('--加载', path)
|
|
316
316
|
// 记录加载的资源
|
|
317
317
|
ResourceManager.instance.trackAsset(path, asset, bundleName);
|
|
318
318
|
ResourceManager.instance.LogAssets(bundleName)
|
|
@@ -8,7 +8,7 @@ abstract class GameState {
|
|
|
8
8
|
abstract enter(): void;
|
|
9
9
|
abstract execute(): void;
|
|
10
10
|
exit(): void {
|
|
11
|
-
Logger.debug(`${this.constructor.name} 状态退出`);
|
|
11
|
+
if (App.GetDebug()) Logger.debug(`${this.constructor.name} 状态退出`);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
export interface IStateMachine {
|
|
@@ -50,27 +50,27 @@ export class GameController {
|
|
|
50
50
|
|
|
51
51
|
// 具体状态类:开始游戏
|
|
52
52
|
export class StartGameState extends GameState {
|
|
53
|
-
enter() { Logger.debug("进入游戏..."); }
|
|
53
|
+
enter() { if (App.GetDebug()) Logger.debug("进入游戏..."); }
|
|
54
54
|
execute() {
|
|
55
|
-
Logger.debug("准备开始游戏...");
|
|
55
|
+
if (App.GetDebug()) Logger.debug("准备开始游戏...");
|
|
56
56
|
setTimeout(() => this.delegate.next(), 1000); // 自动进入下一个状态
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// 具体状态类:游戏中
|
|
61
61
|
export class InGameState extends GameState {
|
|
62
|
-
enter() { Logger.debug("进入游戏中..."); }
|
|
62
|
+
enter() { if (App.GetDebug()) Logger.debug("进入游戏中..."); }
|
|
63
63
|
execute() {
|
|
64
|
-
Logger.debug("正在游戏中...");
|
|
64
|
+
if (App.GetDebug()) Logger.debug("正在游戏中...");
|
|
65
65
|
setTimeout(() => this.delegate.next(), 1000);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// 具体状态类:弹出选择框
|
|
70
70
|
export class PopupState extends GameState {
|
|
71
|
-
enter() { Logger.debug("弹出选择框..."); }
|
|
71
|
+
enter() { if (App.GetDebug()) Logger.debug("弹出选择框..."); }
|
|
72
72
|
execute() {
|
|
73
|
-
Logger.debug("等待玩家选择...");
|
|
73
|
+
if (App.GetDebug()) Logger.debug("等待玩家选择...");
|
|
74
74
|
setTimeout(() => {
|
|
75
75
|
const choice = prompt("请选择 (确认/取消): ");
|
|
76
76
|
this.onUserChoice(choice || "取消");
|
|
@@ -88,6 +88,6 @@ export class PopupState extends GameState {
|
|
|
88
88
|
|
|
89
89
|
// 具体状态类:结束游戏
|
|
90
90
|
export class EndGameState extends GameState {
|
|
91
|
-
enter() { Logger.debug("游戏结束..."); }
|
|
92
|
-
execute() { Logger.debug("感谢您的游玩!"); }
|
|
91
|
+
enter() { if (App.GetDebug()) Logger.debug("游戏结束..."); }
|
|
92
|
+
execute() { if (App.GetDebug()) Logger.debug("感谢您的游玩!"); }
|
|
93
93
|
}
|
|
@@ -72,7 +72,7 @@ export class ThirdFreeLookCamera extends Component {
|
|
|
72
72
|
isDown: boolean = false;
|
|
73
73
|
private MouseDown(e: EventTouch) {
|
|
74
74
|
this.isDown = true;
|
|
75
|
-
Logger.debug("点击");
|
|
75
|
+
if (App.GetDebug()) Logger.debug("点击");
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
private MouseMove(e: EventTouch) {
|
|
@@ -181,7 +181,7 @@ export class ThirdFreeLookCamera extends Component {
|
|
|
181
181
|
this.angle = Quaternion.GetEulerFromQuat(_quat);
|
|
182
182
|
this.MouseX = this.angle.y;
|
|
183
183
|
this.MouseY = this.angle.x;
|
|
184
|
-
//Logger.debug(this.MouseX.toFixed(2),this.MouseY.toFixed(2));
|
|
184
|
+
//if (App.GetDebug()) Logger.debug(this.MouseX.toFixed(2),this.MouseY.toFixed(2));
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/*************************FollowIndependentRotation end***************** */
|
|
@@ -156,7 +156,7 @@ export class Tools {
|
|
|
156
156
|
if (BYTEDANCE) {
|
|
157
157
|
//@ts-ignore
|
|
158
158
|
const info = tt.getSystemInfoSync();
|
|
159
|
-
Logger.debug('-------抖音', info.appName);
|
|
159
|
+
if (App.GetDebug()) Logger.debug('-------抖音', info.appName);
|
|
160
160
|
const appName = info.appName;
|
|
161
161
|
if (appName.toUpperCase() === "DOUYIN") {//抖音
|
|
162
162
|
// do something
|
|
@@ -234,10 +234,10 @@ export class Tools {
|
|
|
234
234
|
extra: "extra",
|
|
235
235
|
zoneId: "default",
|
|
236
236
|
success(res) {
|
|
237
|
-
Logger.debug(`排行榜设置成功: ${res}`);
|
|
237
|
+
if (App.GetDebug()) Logger.debug(`排行榜设置成功: ${res}`);
|
|
238
238
|
},
|
|
239
239
|
fail(res) {
|
|
240
|
-
Logger.debug(`排行榜设置失败: ${res.errMsg}`);
|
|
240
|
+
if (App.GetDebug()) Logger.debug(`排行榜设置失败: ${res.errMsg}`);
|
|
241
241
|
},
|
|
242
242
|
});
|
|
243
243
|
}
|
|
@@ -68,6 +68,7 @@ export class App {
|
|
|
68
68
|
private constructor() { }
|
|
69
69
|
|
|
70
70
|
time: number = 0
|
|
71
|
+
isDebug = false;
|
|
71
72
|
private openedWindows: Map<string, Component> = new Map();
|
|
72
73
|
private openedWindowsConfig: Map<string, IBundleConfig> = new Map();
|
|
73
74
|
private openWindowLayer: Map<string, string[]> = new Map();
|
|
@@ -148,7 +149,7 @@ export class App {
|
|
|
148
149
|
App.OpenBlockEvents(LayerType.LayerBlockEventsNet, true);
|
|
149
150
|
|
|
150
151
|
const url = App.gui.current_config.httpServer + config.url
|
|
151
|
-
Logger.debug(`${config.type === HttpType.GET ? "GET请求" : "POST请求"} url:${url} `, `\n 参数:`, params);
|
|
152
|
+
if (App.GetDebug()) Logger.debug(`${config.type === HttpType.GET ? "GET请求" : "POST请求"} url:${url} `, `\n 参数:`, params);
|
|
152
153
|
let ret: HttpReturn<any>;
|
|
153
154
|
if (config.type === HttpType.GET) {
|
|
154
155
|
ret = await App.http.getJson(config.url, params);
|
|
@@ -156,8 +157,8 @@ export class App {
|
|
|
156
157
|
ret = await App.http.postJson(config.url, params, ext);
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
Logger.debug(`${config.type === HttpType.GET ? "GET请求" : "POST请求"} 结果 url:${url}\n`, ` 参数:`, params);
|
|
160
|
-
Logger.debug(`返回结果:`, ret.res);
|
|
160
|
+
if (App.GetDebug()) Logger.debug(`${config.type === HttpType.GET ? "GET请求" : "POST请求"} 结果 url:${url}\n`, ` 参数:`, params);
|
|
161
|
+
if (App.GetDebug()) Logger.debug(`返回结果:`, ret.res);
|
|
161
162
|
//Logger.warn(`返回结果:${JSON.stringify(ret.res)}`);
|
|
162
163
|
|
|
163
164
|
App.OpenBlockEvents(LayerType.LayerBlockEventsNet, false);
|
|
@@ -185,7 +186,7 @@ export class App {
|
|
|
185
186
|
});
|
|
186
187
|
|
|
187
188
|
if (!userChoice) {
|
|
188
|
-
Logger.debug("用户取消请求");
|
|
189
|
+
if (App.GetDebug()) Logger.debug("用户取消请求");
|
|
189
190
|
originalReject("取消了"); // 用户取消,调用原始 reject
|
|
190
191
|
return;
|
|
191
192
|
}
|
|
@@ -247,7 +248,7 @@ export class App {
|
|
|
247
248
|
list.push(className);
|
|
248
249
|
const layerUI_list = App.Ins.openWindowLayer.get(LayerType.LayerUI)
|
|
249
250
|
if (layerUI_list && layerUI_list.length > 0) App.gui.GetLayer(LayerType.LayerGame).active = false;
|
|
250
|
-
Logger.debug('LayerType.LayerUI 打开窗口记录:', className, list);
|
|
251
|
+
if (App.GetDebug()) Logger.debug('LayerType.LayerUI 打开窗口记录:', className, list);
|
|
251
252
|
App.Emit(SystemMessage.OpenWindow, className)
|
|
252
253
|
App.gui.window?.open?.(config)
|
|
253
254
|
|
|
@@ -424,7 +425,7 @@ export class App {
|
|
|
424
425
|
if (config.layer === LayerType.LayerUI) {
|
|
425
426
|
this.ShowLayerUI(config, true)
|
|
426
427
|
}
|
|
427
|
-
Logger.debug('LayerType.LayerUI 移除窗口记录:', className, list_layer);
|
|
428
|
+
if (App.GetDebug()) Logger.debug('LayerType.LayerUI 移除窗口记录:', className, list_layer);
|
|
428
429
|
this.openedWindows.delete(className);
|
|
429
430
|
this.openedWindowsConfig.delete(className);
|
|
430
431
|
App.Emit(SystemMessage.CloseWindow, className)
|
|
@@ -445,7 +446,7 @@ export class App {
|
|
|
445
446
|
closedCount++;
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
|
-
Logger.debug(`共关闭 ${closedCount} 个窗口`);
|
|
449
|
+
if (App.GetDebug()) Logger.debug(`共关闭 ${closedCount} 个窗口`);
|
|
449
450
|
return closedCount;
|
|
450
451
|
}
|
|
451
452
|
|
|
@@ -466,7 +467,8 @@ export class App {
|
|
|
466
467
|
|
|
467
468
|
|
|
468
469
|
//#region 常用
|
|
469
|
-
|
|
470
|
+
static Debug(isDebug: boolean) { this.instance.isDebug = isDebug }
|
|
471
|
+
static GetDebug() { return this.instance.isDebug }
|
|
470
472
|
/**播放skpine动画 */
|
|
471
473
|
static PlaySpine(skeleton: sp.Skeleton, animations: { name: string, loop?: boolean, call?: (name?: string) => void, event?: (name?: string) => void }[]) { SkeletonAnim.Play(skeleton, animations); }
|
|
472
474
|
|
|
@@ -480,7 +482,7 @@ export class App {
|
|
|
480
482
|
params?.callback?.()
|
|
481
483
|
}
|
|
482
484
|
else {
|
|
483
|
-
Logger.debug("图片已销毁")
|
|
485
|
+
if (App.GetDebug()) Logger.debug("图片已销毁")
|
|
484
486
|
}
|
|
485
487
|
return;
|
|
486
488
|
}
|
|
@@ -491,7 +493,7 @@ export class App {
|
|
|
491
493
|
params?.callback?.()
|
|
492
494
|
}
|
|
493
495
|
else {
|
|
494
|
-
Logger.debug("图片已销毁")
|
|
496
|
+
if (App.GetDebug()) Logger.debug("图片已销毁")
|
|
495
497
|
}
|
|
496
498
|
}
|
|
497
499
|
})
|
|
@@ -518,7 +520,7 @@ export class App {
|
|
|
518
520
|
params?.callback?.()
|
|
519
521
|
}
|
|
520
522
|
else {
|
|
521
|
-
Logger.debug("动画已销毁")
|
|
523
|
+
if (App.GetDebug()) Logger.debug("动画已销毁")
|
|
522
524
|
}
|
|
523
525
|
}
|
|
524
526
|
})
|
|
@@ -46,7 +46,7 @@ declare global {
|
|
|
46
46
|
|
|
47
47
|
/**当前所在bundle名称 */
|
|
48
48
|
const bundleName: string;
|
|
49
|
-
/**=====================================⚠️⚠️⚠️
|
|
49
|
+
/**=====================================⚠️⚠️⚠️ 初始化必须实现======================= */
|
|
50
50
|
/** 初始化配置*/
|
|
51
51
|
function InitGameConfig(param: IInitConfig): Promise<void>;
|
|
52
52
|
/**=====================================⚠️⚠️⚠️ 必须实现的监听======================= */
|
|
@@ -125,6 +125,10 @@ declare global {
|
|
|
125
125
|
function GetOpenWindowsConfig(): IBundleConfig[];
|
|
126
126
|
/** 显示加载转圈*/
|
|
127
127
|
function OpenLoading(is_show: boolean);
|
|
128
|
+
/**=======================================✅✅日志开关======================= */
|
|
129
|
+
/**开启打印日志 */
|
|
130
|
+
function Debug(isDebug: boolean);
|
|
131
|
+
function GetDebug(): boolean;
|
|
128
132
|
|
|
129
133
|
/**=======================================✅✅常用工具======================= */
|
|
130
134
|
// function TwoBezier(param1, param2, param3, param4);
|
|
@@ -68,18 +68,18 @@ export class LanguageManager {
|
|
|
68
68
|
|
|
69
69
|
let index = this.languages.indexOf(language);
|
|
70
70
|
if (index < 0) {
|
|
71
|
-
Logger.debug(`当前不支持【${language}】语言,将自动切换到【${this._defaultLanguage}】语言`);
|
|
71
|
+
if (App.GetDebug()) Logger.debug(`当前不支持【${language}】语言,将自动切换到【${this._defaultLanguage}】语言`);
|
|
72
72
|
language = this._defaultLanguage;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
if (language === LanguageData.current) {
|
|
76
|
-
Logger.debug(`当前语言【${language}】语言,没有改变`)
|
|
76
|
+
if (App.GetDebug()) Logger.debug(`当前语言【${language}】语言,没有改变`)
|
|
77
77
|
callback && callback();
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
this.loadLanguageAssets(bundleName, language, (lang: string) => {
|
|
82
|
-
Logger.debug(`当前语言为【${language}】`);
|
|
82
|
+
if (App.GetDebug()) Logger.debug(`当前语言为【${language}】`);
|
|
83
83
|
const oldLanguage = LanguageData.current;
|
|
84
84
|
LanguageData.current = language;
|
|
85
85
|
this._languagePack.updateLanguage(language);
|
|
@@ -80,7 +80,7 @@ export class LanguageData {
|
|
|
80
80
|
let url = absoluteUrl.split("://");
|
|
81
81
|
let paths = url[1].split("/");
|
|
82
82
|
dbUrl = url[0] + "://" + paths[0] + "/" + paths[1];
|
|
83
|
-
//Logger.debug("absoluteUrl112222:", absoluteUrl, dbUrl);
|
|
83
|
+
//if (App.GetDebug()) Logger.debug("absoluteUrl112222:", absoluteUrl, dbUrl);
|
|
84
84
|
//label
|
|
85
85
|
return dbUrl
|
|
86
86
|
|
|
@@ -93,7 +93,7 @@ export class LanguageData {
|
|
|
93
93
|
let uuid = await Editor.Message.request("asset-db", "query-uuid", db_json);
|
|
94
94
|
await new Promise<void>((resolve) => {
|
|
95
95
|
assetManager.loadAny(uuid, (err, jsonAsset: JsonAsset) => {
|
|
96
|
-
// Logger.debug("2加载表格", jsonAsset, err);
|
|
96
|
+
// if (App.GetDebug()) Logger.debug("2加载表格", jsonAsset, err);
|
|
97
97
|
App.gui.config = jsonAsset.json as IConfig;
|
|
98
98
|
//console.error(App.gui.config)
|
|
99
99
|
resolve()
|
|
@@ -118,7 +118,7 @@ export class LanguageLabel extends Component {
|
|
|
118
118
|
const richtext = this.getComponent(RichText);
|
|
119
119
|
const font: TTFFont | null = LanguageData.font;
|
|
120
120
|
|
|
121
|
-
// Logger.debug('过呢更新', this.node.name, this.string, LanguageData.current)
|
|
121
|
+
// if (App.GetDebug()) Logger.debug('过呢更新', this.node.name, this.string, LanguageData.current)
|
|
122
122
|
if (label) {
|
|
123
123
|
if (font) {
|
|
124
124
|
label.font = font;
|
|
@@ -156,7 +156,7 @@ export class LanguageLabel extends Component {
|
|
|
156
156
|
|
|
157
157
|
let uuid = await Editor.Message.request("asset-db", "query-uuid", db_json);
|
|
158
158
|
assetManager.loadAny(uuid, (err, jsonAsset: JsonAsset) => {
|
|
159
|
-
// Logger.debug("加载表格", jsonAsset, err);
|
|
159
|
+
// if (App.GetDebug()) Logger.debug("加载表格", jsonAsset, err);
|
|
160
160
|
if (!jsonAsset) return;
|
|
161
161
|
let labelData = jsonAsset.json;
|
|
162
162
|
LanguageData.language.set(LanguageDataType.Json, jsonAsset.json);
|
|
@@ -60,7 +60,7 @@ export class LanguagePack {
|
|
|
60
60
|
return new Promise((resolve, reject) => {
|
|
61
61
|
const path = `${LanguageData.path_texture}/${lang}`;
|
|
62
62
|
App.LoadDir(bundleName, path, SpriteFrame, () => { }).then(() => {
|
|
63
|
-
Logger.debug(path, "下载语言包 textures 资源");
|
|
63
|
+
if (App.GetDebug()) Logger.debug(path, "下载语言包 textures 资源");
|
|
64
64
|
resolve();
|
|
65
65
|
});
|
|
66
66
|
});
|
|
@@ -73,7 +73,7 @@ export class LanguagePack {
|
|
|
73
73
|
const jsonAsset = await App.LoadAsset(bundleName, path, JsonAsset);
|
|
74
74
|
if (jsonAsset) {
|
|
75
75
|
LanguageData.language.set(LanguageDataType.Json, jsonAsset.json);
|
|
76
|
-
Logger.debug(path, "下载语言包 json 资源");
|
|
76
|
+
if (App.GetDebug()) Logger.debug(path, "下载语言包 json 资源");
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
79
|
resolve();
|
|
@@ -81,7 +81,7 @@ export class LanguagePack {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// App.LoadAsset(bundleName, path, TTFFont).then((font: TTFFont) => {
|
|
84
|
-
// Logger.debug(path, "下载语言包 ttf 资源");
|
|
84
|
+
// if (App.GetDebug()) Logger.debug(path, "下载语言包 ttf 资源");
|
|
85
85
|
// LanguageData.font = font;
|
|
86
86
|
// resolve();
|
|
87
87
|
// });
|
|
@@ -93,7 +93,7 @@ export class LanguagePack {
|
|
|
93
93
|
return new Promise(async (resolve, reject) => {
|
|
94
94
|
const path = `${LanguageData.path_spine}/${lang}`;
|
|
95
95
|
App.LoadDir(bundleName, path, sp.Skeleton, () => { }).then(() => {
|
|
96
|
-
Logger.debug(path, "下载语言包 spine 资源");
|
|
96
|
+
if (App.GetDebug()) Logger.debug(path, "下载语言包 spine 资源");
|
|
97
97
|
resolve();
|
|
98
98
|
});
|
|
99
99
|
});
|
|
@@ -115,7 +115,7 @@ export class LanguageSprite extends Component {
|
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
assetManager.loadAny(uuid, (err, imageAsset: ImageAsset) => {
|
|
118
|
-
//Logger.debug("加载图片", imageAsset, err);
|
|
118
|
+
//if (App.GetDebug()) Logger.debug("加载图片", imageAsset, err);
|
|
119
119
|
if (!imageAsset) return;
|
|
120
120
|
let spriteFrame = SpriteFrame.createWithImage(imageAsset);
|
|
121
121
|
com.updateSpriteEditor(spriteFrame)
|
|
@@ -58,9 +58,9 @@ export class MLogger {
|
|
|
58
58
|
//日志打印对象
|
|
59
59
|
private constructor(tag: string, level: ELoggerLevel = ELoggerLevel.Info) {
|
|
60
60
|
this.debug = globalLevel > ELoggerLevel.Debug || level > ELoggerLevel.Debug ?
|
|
61
|
-
none : Logger.debug.bind(console, `%c[${globalTag} ${tag} Debug]`, debugStyle);
|
|
61
|
+
none : if (App.GetDebug()) Logger.debug.bind(console, `%c[${globalTag} ${tag} Debug]`, debugStyle);
|
|
62
62
|
this.info = globalLevel > ELoggerLevel.Info || level > ELoggerLevel.Info ?
|
|
63
|
-
none : Logger.debug.bind(console, `%c[${globalTag} ${tag} Info]`, infoStyle);
|
|
63
|
+
none : if (App.GetDebug()) Logger.debug.bind(console, `%c[${globalTag} ${tag} Info]`, infoStyle);
|
|
64
64
|
this.warn = globalLevel > ELoggerLevel.Warn || level > ELoggerLevel.Warn ?
|
|
65
65
|
none : Logger.warn.bind(console, `%c[${globalTag} ${tag} Warn]`, warnStyle);
|
|
66
66
|
this.error = globalLevel > ELoggerLevel.Error || level > ELoggerLevel.Error ?
|
|
@@ -79,7 +79,7 @@ export class NetNode {
|
|
|
79
79
|
|
|
80
80
|
/********************** 网络相关处理 *********************/
|
|
81
81
|
init(socket: ISocket, protocol: IProtocolHelper, networkTips: INetworkTips | null = null, execFunc: ExecuterFunc | null = null) {
|
|
82
|
-
Logger.debug(`网络初始化`);
|
|
82
|
+
if (App.GetDebug()) Logger.debug(`网络初始化`);
|
|
83
83
|
this._socket = socket;
|
|
84
84
|
this._protocolHelper = protocol;
|
|
85
85
|
this._networkTips = networkTips;
|
|
@@ -136,7 +136,7 @@ export class NetNode {
|
|
|
136
136
|
*/
|
|
137
137
|
close(code?: number, reason?: string) {
|
|
138
138
|
if (this._state == NetNodeState.Closed) {
|
|
139
|
-
Logger.debug(`网络节点已断开`);
|
|
139
|
+
if (App.GetDebug()) Logger.debug(`网络节点已断开`);
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -193,7 +193,7 @@ export class NetNode {
|
|
|
193
193
|
|
|
194
194
|
/** 网络连接成功 */
|
|
195
195
|
protected onConnected(event: any) {
|
|
196
|
-
Logger.debug("网络已连接")
|
|
196
|
+
if (App.GetDebug()) Logger.debug("网络已连接")
|
|
197
197
|
this._isSocketOpen = true;
|
|
198
198
|
// 如果设置了鉴权回调,在连接完成后进入鉴权阶段,等待鉴权结束
|
|
199
199
|
if (this._connectedCallback !== null) {
|
|
@@ -203,18 +203,18 @@ export class NetNode {
|
|
|
203
203
|
else {
|
|
204
204
|
this.onChecked();
|
|
205
205
|
}
|
|
206
|
-
Logger.debug(`网络已连接当前状态为【${NetNodeStateStrs[this._state]}】`);
|
|
206
|
+
if (App.GetDebug()) Logger.debug(`网络已连接当前状态为【${NetNodeStateStrs[this._state]}】`);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
/** 连接验证成功,进入工作状态 */
|
|
210
210
|
protected onChecked() {
|
|
211
|
-
Logger.debug("连接验证成功,进入工作状态");
|
|
211
|
+
if (App.GetDebug()) Logger.debug("连接验证成功,进入工作状态");
|
|
212
212
|
this._state = NetNodeState.Working;
|
|
213
213
|
|
|
214
214
|
// 重发待发送信息
|
|
215
215
|
var requests = this._requests.concat();
|
|
216
216
|
if (requests.length > 0) {
|
|
217
|
-
Logger.debug(`请求【${this._requests.length}】个待发送的信息`);
|
|
217
|
+
if (App.GetDebug()) Logger.debug(`请求【${this._requests.length}】个待发送的信息`);
|
|
218
218
|
|
|
219
219
|
for (var i = 0; i < requests.length;) {
|
|
220
220
|
let req = requests[i];
|
|
@@ -236,7 +236,7 @@ export class NetNode {
|
|
|
236
236
|
|
|
237
237
|
/** 接收到一个完整的消息包 */
|
|
238
238
|
protected onMessage(msg: NetData): void {
|
|
239
|
-
// Logger.debug(`接受消息状态为【${NetNodeStateStrs[this._state]}】`);
|
|
239
|
+
// if (App.GetDebug()) Logger.debug(`接受消息状态为【${NetNodeStateStrs[this._state]}】`);
|
|
240
240
|
|
|
241
241
|
var iresp: IResponseProtocol = this._protocolHelper.decodeCommon(msg);
|
|
242
242
|
|
|
@@ -248,14 +248,14 @@ export class NetNode {
|
|
|
248
248
|
var id = iresp.id;
|
|
249
249
|
var cmd = iresp.cmd;
|
|
250
250
|
|
|
251
|
-
Logger.debug(`接受到命令【${cmd}】的消息`);
|
|
251
|
+
if (App.GetDebug()) Logger.debug(`接受到命令【${cmd}】的消息`);
|
|
252
252
|
|
|
253
253
|
// 触发请求队列中的回调函数
|
|
254
254
|
if (this._requests.length > 0) {
|
|
255
255
|
for (let reqIdx in this._requests) {
|
|
256
256
|
let ireqp = this._requests[reqIdx];
|
|
257
257
|
if (ireqp.id == id) {
|
|
258
|
-
Logger.debug(`触发请求命令【${cmd}】的回调`);
|
|
258
|
+
if (App.GetDebug()) Logger.debug(`触发请求命令【${cmd}】的回调`);
|
|
259
259
|
this._protocolHelper.decodeCustom(ireqp, iresp);
|
|
260
260
|
this._callbackExecuter(ireqp.callback, iresp);
|
|
261
261
|
this._requests.splice(parseInt(reqIdx), 1);
|
|
@@ -268,7 +268,7 @@ export class NetNode {
|
|
|
268
268
|
this.updateNetTips(NetTipsType.Requesting, false);
|
|
269
269
|
}
|
|
270
270
|
else {
|
|
271
|
-
Logger.debug(`请求队列中还有【${this._requests.length}】个请求在等待`);
|
|
271
|
+
if (App.GetDebug()) Logger.debug(`请求队列中还有【${this._requests.length}】个请求在等待`);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
|
|
@@ -276,7 +276,7 @@ export class NetNode {
|
|
|
276
276
|
let listeners = this._listener[cmd];
|
|
277
277
|
if (null != listeners) {
|
|
278
278
|
for (const ireqp of listeners) {
|
|
279
|
-
Logger.debug(`触发监听命令【${cmd}】的回调`);
|
|
279
|
+
if (App.GetDebug()) Logger.debug(`触发监听命令【${cmd}】的回调`);
|
|
280
280
|
this._protocolHelper.decodeCustom(ireqp, iresp);
|
|
281
281
|
this._callbackExecuter(ireqp.callback, iresp.data);
|
|
282
282
|
}
|
|
@@ -296,7 +296,7 @@ export class NetNode {
|
|
|
296
296
|
|
|
297
297
|
// 执行断线回调,返回false表示不进行重连
|
|
298
298
|
if (this._disconnectCallback && !this._disconnectCallback()) {
|
|
299
|
-
Logger.debug(`断开连接`);
|
|
299
|
+
if (App.GetDebug()) Logger.debug(`断开连接`);
|
|
300
300
|
return;
|
|
301
301
|
}
|
|
302
302
|
|
|
@@ -346,7 +346,7 @@ export class NetNode {
|
|
|
346
346
|
|
|
347
347
|
for (let i = 0; i < this._requests.length; ++i) {
|
|
348
348
|
if (this._requests[i].cmd == reqProtocol.cmd) {
|
|
349
|
-
Logger.debug(`命令【${reqProtocol.cmd}】重复请求`);
|
|
349
|
+
if (App.GetDebug()) Logger.debug(`命令【${reqProtocol.cmd}】重复请求`);
|
|
350
350
|
return false;
|
|
351
351
|
}
|
|
352
352
|
}
|
|
@@ -360,7 +360,7 @@ export class NetNode {
|
|
|
360
360
|
this._socket.send(reqProtocol.buffer!);
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
// Logger.debug(`队列命令为【${reqProtocol.cmd}】的请求,等待请求数据的回调`);
|
|
363
|
+
// if (App.GetDebug()) Logger.debug(`队列命令为【${reqProtocol.cmd}】的请求,等待请求数据的回调`);
|
|
364
364
|
|
|
365
365
|
// 进入发送缓存列表
|
|
366
366
|
this._requests.push(reqProtocol);
|
|
@@ -441,7 +441,7 @@ export class NetNode {
|
|
|
441
441
|
}
|
|
442
442
|
|
|
443
443
|
this._receiveMsgTimer = setTimeout(() => {
|
|
444
|
-
Logger.debug("接收消息定时器关闭网络连接");
|
|
444
|
+
if (App.GetDebug()) Logger.debug("接收消息定时器关闭网络连接");
|
|
445
445
|
this._socket.close();
|
|
446
446
|
}, this._receiveTime);
|
|
447
447
|
}
|
|
@@ -476,7 +476,7 @@ export class NetNode {
|
|
|
476
476
|
|
|
477
477
|
/** 接收到一个完整的消息包 */
|
|
478
478
|
protected onMessageCust(msg: NetData): void {
|
|
479
|
-
// Logger.debug(`接受消息状态为【${NetNodeStateStrs[this._state]}】`);
|
|
479
|
+
// if (App.GetDebug()) Logger.debug(`接受消息状态为【${NetNodeStateStrs[this._state]}】`);
|
|
480
480
|
|
|
481
481
|
var iresp: IResponseProtocol = this._protocolHelper.decodeCommon(msg);
|
|
482
482
|
const game_resp = message.GameResponse.decode(iresp.data);
|
|
@@ -493,7 +493,7 @@ export class NetNode {
|
|
|
493
493
|
if (cmd === command.CommandType.CMD_HEARTBEAT) {
|
|
494
494
|
|
|
495
495
|
} else {
|
|
496
|
-
Logger.debug(`接受到命令【${cmd}】的消息`);
|
|
496
|
+
if (App.GetDebug()) Logger.debug(`接受到命令【${cmd}】的消息`);
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
// 触发请求队列中的回调函数
|
|
@@ -502,7 +502,7 @@ export class NetNode {
|
|
|
502
502
|
let ireqp = this._requests[reqIdx];
|
|
503
503
|
const idd = ireqp.params.id;
|
|
504
504
|
if (idd == id) {
|
|
505
|
-
//Logger.debug(`触发请求命令【${cmd}】的回调`);
|
|
505
|
+
//if (App.GetDebug()) Logger.debug(`触发请求命令【${cmd}】的回调`);
|
|
506
506
|
// this._protocolHelper.decodeCustomPackage(ireqp.packageObj, ireqp, iresp);
|
|
507
507
|
this._callbackExecuter(ireqp.callback, iresp);
|
|
508
508
|
this._requests.splice(parseInt(reqIdx), 1);
|
|
@@ -515,7 +515,7 @@ export class NetNode {
|
|
|
515
515
|
this.updateNetTips(NetTipsType.Requesting, false);
|
|
516
516
|
}
|
|
517
517
|
else {
|
|
518
|
-
Logger.debug(`请求队列中还有【${this._requests.length}】个请求在等待`);
|
|
518
|
+
if (App.GetDebug()) Logger.debug(`请求队列中还有【${this._requests.length}】个请求在等待`);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
|
|
@@ -523,7 +523,7 @@ export class NetNode {
|
|
|
523
523
|
let listeners = this._listener[cmd];
|
|
524
524
|
if (null != listeners) {
|
|
525
525
|
for (const ireqp of listeners) {
|
|
526
|
-
//Logger.debug(`触发监听命令【${cmd}】的回调`);
|
|
526
|
+
//if (App.GetDebug()) Logger.debug(`触发监听命令【${cmd}】的回调`);
|
|
527
527
|
// this._protocolHelper.decodeCustomPackage(ireqp.packageObj, ireqp, iresp);
|
|
528
528
|
this._callbackExecuter(ireqp.callback, iresp.data);
|
|
529
529
|
}
|
|
@@ -28,7 +28,7 @@ export class WebSock implements ISocket {
|
|
|
28
28
|
connect(options: any) {
|
|
29
29
|
if (this._ws) {
|
|
30
30
|
if (this._ws.readyState === WebSocket.CONNECTING) {
|
|
31
|
-
Logger.debug("websocket connecting, wait for a moment...")
|
|
31
|
+
if (App.GetDebug()) Logger.debug("websocket connecting, wait for a moment...")
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
34
|
}
|