@cc-component/cc-core 1.2.1 → 1.2.3

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.
Files changed (32) hide show
  1. package/assets/core/config/LayerUI.ts +4 -6
  2. package/assets/core/editor/LanguageManager.ts +4 -4
  3. package/assets/core/editor/i18nEditorComponent.ts +7 -7
  4. package/assets/core/home/BaseBoxView.ts +1 -1
  5. package/assets/core/home/BaseLoading.ts +19 -22
  6. package/assets/core/home/BaseSkeleton.ts +4 -4
  7. package/assets/core/home/CameraAngel.ts +41 -41
  8. package/assets/core/home/FollowCamera.ts +28 -29
  9. package/assets/core/home/InViewCenter.ts +1 -1
  10. package/assets/core/home/ProgessWindow.ts +2 -2
  11. package/assets/core/home/ResourceManager.ts +12 -12
  12. package/assets/core/home/StateMachine.ts +9 -9
  13. package/assets/core/home/StorageManager.ts +1 -1
  14. package/assets/core/home/ThirdFreeLookCamera.ts +2 -2
  15. package/assets/core/home/TimeManager.ts +1 -1
  16. package/assets/core/home/util/RandomUtil.ts +41 -41
  17. package/assets/core/interface/MainModule.ts +27 -25
  18. package/assets/core/lib/language/Language.ts +3 -4
  19. package/assets/core/lib/language/LanguageData.ts +2 -2
  20. package/assets/core/lib/language/LanguageLabel.ts +2 -2
  21. package/assets/core/lib/language/LanguagePack.ts +4 -5
  22. package/assets/core/lib/language/LanguageSprite.ts +1 -1
  23. package/assets/core/lib/logger/ELoggerLevel.ts +0 -12
  24. package/assets/core/lib/logger/MLogger.ts +7 -8
  25. package/assets/core/lib/net/net/HttpManager.ts +2 -2
  26. package/assets/core/lib/net/net/NetNode.ts +16 -17
  27. package/assets/core/lib/net/net/WebSock.ts +1 -2
  28. package/assets/core/lib/net/net/custom/NetGameTips.ts +8 -9
  29. package/assets/core/lib/net/net/custom/NetNodeGame.ts +1 -1
  30. package/package.json +1 -1
  31. package/assets/core/lib/Logger.ts +0 -286
  32. package/assets/core/lib/Logger.ts.meta +0 -9
@@ -5,11 +5,11 @@ import { LayerType } from './LayerType';
5
5
  import { Canvas, director } from 'cc';
6
6
  import { ResourceManager } from '../home/ResourceManager';
7
7
  import { IInitConfig } from './CommonEnum';
8
- import { Logger, LogType } from '../lib/Logger';
9
8
  import { ISceneParam } from '../interface/ISceneParam';
10
9
  import { BlockInputEvents } from 'cc';
11
10
  import { BaseLaunchComponent } from '../home/BaseLaunchComponent';
12
11
  import { AssetManager } from 'cc';
12
+ import { assetManager } from 'cc';
13
13
 
14
14
  const { ccclass, property } = _decorator;
15
15
 
@@ -42,7 +42,8 @@ export class LayerUI {
42
42
  const parent = this.launch.node
43
43
  const data = await MainModule.loadAsset<JsonAsset>(params.bundleName, "config", JsonAsset)
44
44
  this.config = data.json as IConfig;
45
- console.log(this.config)
45
+ MainModule.releaseAssetPath('config', params.bundleName)
46
+ //Logger.debug(this.config)
46
47
 
47
48
  const config = this.config;
48
49
  config.gui.forEach(element => {
@@ -95,11 +96,8 @@ export class LayerUI {
95
96
  setBundleName(value: string) { this.bundleName = value; }
96
97
  initLog() {
97
98
  const debug = this.config.debug
98
- Logger.setTags(debug ? null : LogType.Close)
99
- Logger.logView(debug);
100
-
101
99
  if (debug) {
102
- console.log("是debug模式");
100
+ Logger.debug("是debug模式");
103
101
  } else {
104
102
  console.log("发布模式");
105
103
  console.log = function () { }; // 关闭普通日志输出
@@ -116,7 +116,7 @@
116
116
  // try {
117
117
  // let index = 0;
118
118
  // return value.replace(/d%/g, function () {
119
- // //console.log(`${index}个参数:${args[index]}`);
119
+ // //Logger.debug(`${index}个参数:${args[index]}`);
120
120
 
121
121
  // let str = args[index++] || "";
122
122
  // return str;
@@ -161,7 +161,7 @@
161
161
  // assetManager.loadBundle(bundleName, (err, bundle) => {
162
162
  // bundle.load(url, SpriteFrame, (err, spriteFrame: SpriteFrame) => {
163
163
  // if (err) {
164
- // if (DEBUG) console.warn(err);
164
+ // if (DEBUG) Logger.warn(err);
165
165
  // return cb(null);
166
166
  // }
167
167
  // cb(spriteFrame);
@@ -279,7 +279,7 @@
279
279
  // try {
280
280
  // let index = 0;
281
281
  // return value.replace(/d%/g, function () {
282
- // //console.log(`${index}个参数:${args[index]}`);
282
+ // //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
- // //console.log("bundleName:",bundleName);
318
+ // //Logger.debug("bundleName:",bundleName);
319
319
  // return bundleName;
320
320
  // }
321
321
  // }
@@ -29,7 +29,7 @@ export class i18nEditorComponent extends Component {
29
29
  await this.loadConfig()
30
30
  LanguageData.current = language
31
31
 
32
- console.log("编辑器语言设置成功", language);
32
+ Logger.debug("编辑器语言设置成功", language);
33
33
  // MainModule.language.setLanguage('', language)
34
34
  // this.node.children.forEach(child => {
35
35
  // console.error(child.name)
@@ -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
- // console.log("absoluteUrl11:", absoluteUrl, dbUrl);
63
+ // Logger.debug("absoluteUrl11:", absoluteUrl, dbUrl);
64
64
  //label
65
65
  return dbUrl
66
66
 
@@ -68,7 +68,7 @@ export class i18nEditorComponent extends Component {
68
68
  }
69
69
 
70
70
  public editorChangeBundle(language: string) {
71
- console.log("bundle", language);
71
+ Logger.debug("bundle", language);
72
72
  MainModule.language.setLanguage('', language)
73
73
  //i18nMgr.editorChangeBundle(language);
74
74
  }
@@ -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
- //console.log("加载表格", jsonAsset, err);
81
+ //Logger.debug("加载表格", jsonAsset, err);
82
82
  MainModule.gui.config = jsonAsset.json as IConfig;
83
83
  //console.error(MainModule.gui.config)
84
84
  resolve()
@@ -89,10 +89,10 @@ export class i18nEditorComponent extends Component {
89
89
  /**编辑器环境下改变多语言 */
90
90
  public async changeLabel(dbUrl: string, language?: string) {
91
91
  const db_json = dbUrl + `/${MainModule.gui.config.language.path.json}/${language}.json`
92
- console.log(db_json)
92
+ Logger.debug(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
- // console.log("加载表格", jsonAsset, err);
95
+ // 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
- //console.log("加载图片", imageAsset, err);
124
+ //Logger.debug("加载图片", imageAsset, err);
125
125
  if (!imageAsset) return;
126
126
  let spriteFrame = SpriteFrame.createWithImage(imageAsset);
127
127
  com.updateSpriteEditor(spriteFrame)
@@ -37,7 +37,7 @@ export class BaseBoxView extends Component {
37
37
  // const box2 = this.GetBox(this.target_enemy);
38
38
 
39
39
  // const ok = MainModule.Collision(box1, box2);
40
- // // console.log("碰撞了吗?", ok, this.node.name)
40
+ // // Logger.debug("碰撞了吗?", ok, this.node.name)
41
41
  // return ok
42
42
  // }
43
43
 
@@ -27,7 +27,6 @@ export abstract class BaseLoading extends Component {
27
27
  progress_ratio: number = 1
28
28
  /**总进度 值范围 0-100*/
29
29
  pro_total: number;
30
- is_init: boolean = false;
31
30
 
32
31
  sceneParam: ISceneParam = {
33
32
  param: null,
@@ -45,26 +44,24 @@ export abstract class BaseLoading extends Component {
45
44
  }
46
45
 
47
46
  async Init() {
48
- if (this.is_init) {
49
- await this.loadProgress(1)
50
- } else {
51
- const count = this.path_list.length;
52
- const ratio = 1 / count * this.progress_ratio;
53
- this.pro_total = 0;
54
- for (let index = 0; index < this.path_list.length; index++) {
55
- const key_path = this.path_list[index];
56
- let temp_pro = 0;
57
- await MainModule.loadDir(BundleConfig[key_path.bundleName], key_path.path, GetAssetType(key_path.type), (pro: number) => {
58
- temp_pro = pro * ratio
59
- const progess = (this.pro_total + pro * ratio)
60
- MainModule.gui.progess.progess?.(progess)//进度在OpenScene方法中先打开才可以 设置进度
61
- })
62
- this.pro_total = (this.pro_total + temp_pro)
63
- }
64
- console.log("完成", this.pro_total)
65
- // ✅ 先调用子类的 Finish(允许子类做自定义操作)
66
- await this.Finish(); // 支持异步
47
+ const count = this.path_list.length;
48
+ const ratio = 1 / count * this.progress_ratio;
49
+ this.pro_total = 0;
50
+ MainModule.gui.progess.progess?.(0)//进度在OpenScene方法中先打开才可以 设置进度
51
+ for (let index = 0; index < this.path_list.length; index++) {
52
+ const key_path = this.path_list[index];
53
+ let temp_pro = 0;
54
+ await MainModule.loadDir(BundleConfig[key_path.bundleName], key_path.path, GetAssetType(key_path.type), (pro: number) => {
55
+ temp_pro = pro * ratio
56
+ const progess = (this.pro_total + pro * ratio)
57
+ MainModule.gui.progess.progess?.(progess)//进度在OpenScene方法中先打开才可以 设置进度
58
+ })
59
+ this.pro_total = (this.pro_total + temp_pro)
67
60
  }
61
+ Logger.debug("完成", this.pro_total)
62
+ // ✅ 先调用子类的 Finish(允许子类做自定义操作)
63
+ await this.Finish(); // 支持异步
64
+
68
65
  this.FinishLoad()
69
66
  }
70
67
 
@@ -93,11 +90,11 @@ export abstract class BaseLoading extends Component {
93
90
  }
94
91
 
95
92
  /** 模拟假加载进度(仅用于调试) */
96
- loadProgress(durationSeconds: number = 2): Promise<void> {
93
+ loadProgress(durationSeconds: number = 2, max: number = 100): Promise<void> {
97
94
  return new Promise((resolve) => {
98
95
  let progress = 0;
99
96
  const step = 1; // 每次增加 1%
100
- const intervalMs = (durationSeconds * 1000) / 100; // 总毫秒数 / 100 步
97
+ const intervalMs = (durationSeconds * 1000) / max; // 总毫秒数 / 100 步
101
98
  const timer = setInterval(() => {
102
99
  progress += step;
103
100
  if (progress >= 100) {
@@ -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
- // console.log("1--事件", event.data.name, event.data.intValue, event.data)
31
- // console.log("2--事件", event.data.intValue)
32
- // console.log("2--事件", event.data.stringValue)
33
- // console.log("2--事件", event.data.floatValue,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)
34
34
  animations[index].event?.(event.data.name)
35
35
  });
36
36
  }
@@ -18,8 +18,8 @@ export class CameraAngel extends Component {
18
18
 
19
19
  distance = 50;
20
20
 
21
- touNode:Node;
22
- touNodeSize:UITransform;
21
+ touNode: Node;
22
+ touNodeSize: UITransform;
23
23
  start() {
24
24
 
25
25
  // this.node.on(Node.EventType.MOUSE_DOWN, this.MouseDown, this);
@@ -42,16 +42,16 @@ export class CameraAngel extends Component {
42
42
 
43
43
  }
44
44
 
45
- StartGame(targetCube:Node) {
45
+ StartGame(targetCube: Node) {
46
46
  this.targetCube = targetCube;
47
47
  this.followCamera = this.getComponent(FollowCamera)
48
- this.followCamera.StartGame(this.targetCube,this.distance)
48
+ this.followCamera.StartGame(this.targetCube, this.distance)
49
49
  }
50
50
 
51
-
51
+
52
52
  private MouseDown(e: Event) {
53
53
 
54
- console.log("222");
54
+ 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
- // console.log(fff);
62
+ // Logger.debug(fff);
63
63
  // this.targetCube.worldPosition = this.targetCube.worldPosition.add(fff)
64
64
  // this.UpdatePos(0, 0)
65
65
  // this.SetPos();
@@ -83,18 +83,18 @@ export class CameraAngel extends Component {
83
83
  private TouchStart(e: EventTouch) {
84
84
  this.isTouching = true;
85
85
  this.touchStartPos = this.GetPos(e);
86
- //å console.log("开始", this.touchStartPos)
86
+ //å Logger.debug("开始", this.touchStartPos)
87
87
 
88
88
  this.isHave = false
89
89
  this.f_x = v3(0)
90
90
 
91
91
  }
92
92
 
93
- GetPos(e:EventTouch){
93
+ GetPos(e: EventTouch) {
94
94
 
95
95
  let super_pos = this.touNode.parent.worldPosition
96
- let pos = v3(super_pos.x ,super_pos.y,0)//this.touNode.parent.position;
97
- return v3(e.getUILocation().x-pos.x, e.getUILocation().y-pos.y,0)
96
+ let pos = v3(super_pos.x, super_pos.y, 0)//this.touNode.parent.position;
97
+ return v3(e.getUILocation().x - pos.x, e.getUILocation().y - pos.y, 0)
98
98
 
99
99
 
100
100
  }
@@ -111,56 +111,56 @@ export class CameraAngel extends Component {
111
111
 
112
112
  let pos = this.GetPos(e);;
113
113
  this.UpdatePos(pos.x, pos.y);
114
-
114
+
115
115
 
116
116
  }
117
117
 
118
118
  private TouchEnd(e: EventTouch) {
119
119
 
120
120
  this.ResetPos();
121
- if( this.touNode){
122
- this.touNode.position = v3(75,75)
121
+ if (this.touNode) {
122
+ this.touNode.position = v3(75, 75)
123
123
 
124
124
  }
125
125
 
126
-
126
+
127
127
  }
128
128
 
129
129
 
130
- ResetPos(){
130
+ ResetPos() {
131
131
  this.followCamera.isMove = false;
132
132
  this.followCamera.resetPos();
133
133
  }
134
134
 
135
135
 
136
136
  UpdatePos(x, y) {
137
-
137
+
138
138
  if (this.followCamera.isUpdatePos) {
139
139
  return
140
140
  }
141
141
 
142
-
143
- if(this.touNode){
144
- this.touNode.position = v3(x,y)
145
-
142
+
143
+ if (this.touNode) {
144
+ this.touNode.position = v3(x, y)
145
+
146
146
 
147
147
  }
148
- // console.log(x,y)
149
- // console.log("ddd");
148
+ // Logger.debug(x,y)
149
+ // 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
- // console.log("转");
156
+ // Logger.debug("转");
157
157
  }
158
158
 
159
- //console.log(currentPos)
159
+ //Logger.debug(currentPos)
160
160
  this.f_x = currentPos.clone();
161
161
  // 根据 deltaX 进行旋转
162
- // console.log(delta);
163
- this.rotateByDeltaX(delta.x,delta.y);
162
+ // Logger.debug(delta);
163
+ this.rotateByDeltaX(delta.x, delta.y);
164
164
  //this.rotateAndLookAtTarget()
165
165
 
166
166
  this.touchStartPos.clone().set(currentPos);
@@ -231,11 +231,11 @@ export class CameraAngel extends Component {
231
231
  // 创建围绕X轴和Y轴旋转的两个四元数
232
232
  let rotationQuatX = this.fromRotation(v3(1, 1, 0), misc.radiansToDegrees(rotationAngleX));
233
233
  let rotationQuatY = this.fromRotation(v3(0, 1, 0), misc.radiansToDegrees(rotationAngleY));
234
- // let rotationQuatz = this.fromRotation(v3(0, 0, 1), misc.radiansToDegrees(rotationAngleY));
234
+ // let rotationQuatz = this.fromRotation(v3(0, 0, 1), misc.radiansToDegrees(rotationAngleY));
235
235
 
236
236
  let combinedQuat = rotationQuatY//this.multiplyQuaternions(rotationQuatX, rotationQuatY)
237
237
  // 将两个四元数相乘,以获得综合的旋转效果
238
- // let combinedQuat = math.Quat.multiply(rotationQuatX, rotationQuatY, rotationQuatX);
238
+ // let combinedQuat = math.Quat.multiply(rotationQuatX, rotationQuatY, rotationQuatX);
239
239
 
240
240
  // 计算从相机到targetCube的向量
241
241
  let cameraToTarget = this.node.worldPosition.clone().subtract(this.targetCube.worldPosition);
@@ -254,17 +254,17 @@ export class CameraAngel extends Component {
254
254
  this.node.lookAt(this.targetCube.worldPosition);
255
255
  }
256
256
 
257
- multiplyQuaternions(quat1: math.Quat, quat2: math.Quat): math.Quat {
258
- let result = new math.Quat();
257
+ multiplyQuaternions(quat1: math.Quat, quat2: math.Quat): math.Quat {
258
+ let result = new math.Quat();
259
259
 
260
- // Quaternion multiplication formula: result = quat2 * quat1
261
- result.x = quat2.x * quat1.w + quat2.y * quat1.z - quat2.z * quat1.y + quat2.w * quat1.x;
262
- result.y = -quat2.x * quat1.z + quat2.y * quat1.w + quat2.z * quat1.x + quat2.w * quat1.y;
263
- result.z = quat2.x * quat1.y - quat2.y * quat1.x + quat2.z * quat1.w + quat2.w * quat1.z;
264
- result.w = -quat2.x * quat1.x - quat2.y * quat1.y - quat2.z * quat1.z + quat2.w * quat1.w;
260
+ // Quaternion multiplication formula: result = quat2 * quat1
261
+ result.x = quat2.x * quat1.w + quat2.y * quat1.z - quat2.z * quat1.y + quat2.w * quat1.x;
262
+ result.y = -quat2.x * quat1.z + quat2.y * quat1.w + quat2.z * quat1.x + quat2.w * quat1.y;
263
+ result.z = quat2.x * quat1.y - quat2.y * quat1.x + quat2.z * quat1.w + quat2.w * quat1.z;
264
+ result.w = -quat2.x * quat1.x - quat2.y * quat1.y - quat2.z * quat1.z + quat2.w * quat1.w;
265
265
 
266
- return result;
267
- }
266
+ return result;
267
+ }
268
268
 
269
269
  rotateAndLookAtTarget() {
270
270
  if (!this.targetCube) {
@@ -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
- console.log(rotatedDirection.clone(), rotatedPos2)
286
+ Logger.debug(rotatedDirection.clone(), rotatedPos2)
287
287
  // 更新相机位置
288
288
  this.node.setWorldPosition(rotatedPos);
289
289
 
@@ -312,11 +312,11 @@ export class CameraAngel extends Component {
312
312
  this.targetCube.worldPosition = this.targetCube.worldPosition.add3f(this.speed * director.getDeltaTime(), 0, 0);
313
313
  break;
314
314
  }
315
-
315
+
316
316
 
317
317
  this.ResetPos()
318
318
 
319
- // this.targetCube_lastPos = this.targetCube.worldPosition.clone();
319
+ // this.targetCube_lastPos = this.targetCube.worldPosition.clone();
320
320
  }
321
321
 
322
322
  onKeyUp(event: EventKeyboard) {
@@ -39,37 +39,37 @@ export class FollowCamera extends Component {
39
39
  protected _targetWorldPos = new Vec3;
40
40
  protected _lastTargetPos = new Vec3;
41
41
 
42
- private static Deg2Rad:number=(Math.PI) / 180;
42
+ private static Deg2Rad: number = (Math.PI) / 180;
43
43
 
44
44
 
45
45
  isMove = false;
46
46
  start() {
47
47
 
48
- // let node = find("Canvas/yaogan")
48
+ // let node = find("Canvas/yaogan")
49
49
 
50
50
  // node.on(Node.EventType.TOUCH_START, this.TouchStart, this);
51
51
  // node.on(Node.EventType.TOUCH_MOVE, this.TouchMove, this);
52
52
  // node.on(Node.EventType.TOUCH_END, this.TouchEnd, this);
53
53
 
54
54
 
55
-
55
+
56
56
  }
57
57
 
58
- StartGame(focusTarget:Node,dis:number){
58
+ StartGame(focusTarget: Node, dis: number) {
59
+
59
60
 
60
-
61
61
  this.focusTarget = focusTarget;
62
62
  this._lastTargetPos.set(this.focusTarget.worldPosition.clone());
63
63
  this.distance = dis
64
64
  this._updateTargetWorldPos();
65
65
 
66
66
  tween(this.node)
67
- .to(0.5, { worldPosition: this._targetWorldPos })
68
- .start();
69
-
67
+ .to(0.5, { worldPosition: this._targetWorldPos })
68
+ .start();
69
+
70
70
  //this.node.setWorldPosition(this._targetWorldPos);
71
71
 
72
- // this.UpdatePos(0, 0)
72
+ // this.UpdatePos(0, 0)
73
73
  }
74
74
  protected _updateTargetWorldPos() {
75
75
  this._targetWorldPos.set(this.focusTarget.worldPosition.clone());
@@ -79,16 +79,16 @@ export class FollowCamera extends Component {
79
79
  }
80
80
 
81
81
  this._targetWorldPos.add(this.node.forward.multiplyScalar(this.distance * -1));
82
- // this._targetWorldPos.add3f(this._targetWorldPos.x,this._targetWorldPos.y,this._targetWorldPos.z);
82
+ // this._targetWorldPos.add3f(this._targetWorldPos.x,this._targetWorldPos.y,this._targetWorldPos.z);
83
83
  }
84
84
 
85
85
  update() {
86
86
  if (!this.focusTarget) {
87
87
  return
88
88
  }
89
- if(this.isMove){
89
+ if (this.isMove) {
90
90
 
91
- // console.log("阻止")
91
+ // Logger.debug("阻止")
92
92
  return;
93
93
  }
94
94
 
@@ -96,7 +96,7 @@ export class FollowCamera extends Component {
96
96
  }
97
97
 
98
98
  isUpdatePos = false;
99
- UpdateP(){
99
+ UpdateP() {
100
100
  if (!this._lastTargetPos.equals(this.focusTarget.worldPosition.clone())) {
101
101
  this._lastTargetPos.set(this.focusTarget.worldPosition.clone());
102
102
  this._updateTargetWorldPos();
@@ -111,17 +111,17 @@ 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
- //console.log('-----',this.node.worldPosition);
114
+ //Logger.debug('-----',this.node.worldPosition);
115
115
  //this.node.setWorldPosition(v3(ret.x,37,ret.z));
116
116
 
117
117
  this.isUpdatePos = true
118
- }else{
118
+ } else {
119
119
  this.isUpdatePos = false
120
120
  }
121
121
  }
122
122
 
123
123
 
124
- IsMovePos(){
124
+ IsMovePos() {
125
125
 
126
126
  v3_1.set(this._targetWorldPos);
127
127
  let diff = v3_1.subtract(this.node.worldPosition);
@@ -143,22 +143,21 @@ export class FollowCamera extends Component {
143
143
  * @param axis 旋转轴
144
144
  * @param angle 旋转角度
145
145
  */
146
- public static RotationAroundNode(self:Node,pos:Vec3,axis:Vec3,angle:number):Quat
147
- {
148
- let _quat=new Quat();
149
- let v1=new Vec3();
150
- let v2=new Vec3();
151
- let pos2:Vec3=self.position;
152
- let rad=angle* this.Deg2Rad;
146
+ public static RotationAroundNode(self: Node, pos: Vec3, axis: Vec3, angle: number): Quat {
147
+ let _quat = new Quat();
148
+ let v1 = new Vec3();
149
+ let v2 = new Vec3();
150
+ let pos2: Vec3 = self.position;
151
+ let rad = angle * this.Deg2Rad;
153
152
  //根据旋转轴和旋转弧度计算四元数
154
- Quat.fromAxisAngle(_quat,axis,rad);
153
+ Quat.fromAxisAngle(_quat, axis, rad);
155
154
  //相减,目标点与相机点之间的向量
156
- Vec3.subtract(v1,pos2,pos);
155
+ Vec3.subtract(v1, pos2, pos);
157
156
  //把向量dir根据计算到的四元数旋转,然后计算出旋转后的距离
158
- Vec3.transformQuat(v2,v1,_quat);
159
- self.position=Vec3.add(v2,pos,v2);
157
+ Vec3.transformQuat(v2, v1, _quat);
158
+ self.position = Vec3.add(v2, pos, v2);
160
159
  //根据轴和弧度绕世界空间下指定轴旋转四元数
161
- Quat.rotateAround(_quat,self.rotation,axis,rad);
160
+ Quat.rotateAround(_quat, self.rotation, axis, rad);
162
161
  return _quat;
163
162
  }
164
163
 
@@ -201,5 +200,5 @@ export class FollowCamera extends Component {
201
200
 
202
201
 
203
202
 
204
-
203
+
205
204
  }
@@ -44,7 +44,7 @@ export class InViewCenter {
44
44
 
45
45
  isPointInsideCanvas(point: Vec3): boolean {
46
46
  const canvasSize = this.screenSize;
47
- //console.log(this.width)
47
+ //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
  }
@@ -52,13 +52,13 @@ export class ProgessWindow extends Component {
52
52
  }
53
53
 
54
54
  /***更新进度 */
55
- public ProgessValue(value: number) {
55
+ public ProgessValue(value: number, anim_time: number = 0.1) {
56
56
  if (this.pro_bar) {
57
57
  this.onProgress?.(value)
58
58
  if (this.pro_lb) {
59
59
  this.pro_lb.string = `${value}%`
60
60
  }
61
- this.pro(this.pro_bar, value, 100, 0);
61
+ this.pro(this.pro_bar, value, 100, anim_time);
62
62
  }
63
63
  }
64
64