@cc-component/cc-core 1.2.8 → 1.2.9

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 (157) hide show
  1. package/assets/core/config/CommonEnum.ts +8 -2
  2. package/assets/core/config/CommonEnum.ts.meta +1 -1
  3. package/assets/core/config/IConfig.ts +1 -1
  4. package/assets/core/config/IConfig.ts.meta +1 -1
  5. package/assets/core/config/LayerType.ts.meta +1 -1
  6. package/assets/core/config/LayerUI.ts +14 -12
  7. package/assets/core/config/LayerUI.ts.meta +1 -1
  8. package/assets/core/config.meta +1 -1
  9. package/assets/core/editor/LanguageManager.ts +5 -5
  10. package/assets/core/editor/LanguageManager.ts.meta +1 -1
  11. package/assets/core/editor/SpineRunner.ts.meta +1 -1
  12. package/assets/core/editor/i18nEditorComponent.ts +12 -12
  13. package/assets/core/editor/i18nEditorComponent.ts.meta +1 -1
  14. package/assets/core/editor.meta +1 -1
  15. package/assets/core/home/AudioUtil.ts +5 -11
  16. package/assets/core/home/AudioUtil.ts.meta +1 -1
  17. package/assets/core/home/BaseBoxView.ts +13 -16
  18. package/assets/core/home/BaseBoxView.ts.meta +1 -1
  19. package/assets/core/home/BaseLaunchComponent.ts.meta +1 -1
  20. package/assets/core/home/BaseLoading.ts +34 -18
  21. package/assets/core/home/BaseLoading.ts.meta +1 -1
  22. package/assets/core/home/BaseModuleConfig.ts +46 -0
  23. package/assets/core/home/{ProgessView.ts.meta → BaseModuleConfig.ts.meta} +9 -9
  24. package/assets/core/home/BaseSkeleton.ts +4 -4
  25. package/assets/core/home/BaseSkeleton.ts.meta +1 -1
  26. package/assets/core/home/CameraAngel.ts +41 -41
  27. package/assets/core/home/CameraAngel.ts.meta +1 -1
  28. package/assets/core/home/DouYinShow.ts +1 -1
  29. package/assets/core/home/DouYinShow.ts.meta +1 -1
  30. package/assets/core/home/EventManager.ts +2 -10
  31. package/assets/core/home/EventManager.ts.meta +1 -1
  32. package/assets/core/home/FollowCamera.ts +28 -29
  33. package/assets/core/home/FollowCamera.ts.meta +1 -1
  34. package/assets/core/home/InViewCenter.ts +1 -1
  35. package/assets/core/home/InViewCenter.ts.meta +1 -1
  36. package/assets/core/home/LoadingWindow.ts.meta +1 -1
  37. package/assets/core/home/ParabolaTween.ts.meta +1 -1
  38. package/assets/core/home/ProgessWindow.ts +109 -0
  39. package/assets/core/home/{ExView.ts.meta → ProgessWindow.ts.meta} +1 -1
  40. package/assets/core/home/Quaternion.ts.meta +1 -1
  41. package/assets/core/home/ResUtil.ts.meta +1 -1
  42. package/assets/core/home/ResourceManager.ts +13 -14
  43. package/assets/core/home/ResourceManager.ts.meta +1 -1
  44. package/assets/core/home/StateMachine.ts +9 -9
  45. package/assets/core/home/StateMachine.ts.meta +1 -1
  46. package/assets/core/home/StorageManager.ts +1 -1
  47. package/assets/core/home/StorageManager.ts.meta +1 -1
  48. package/assets/core/home/ThirdFreeLookCamera.ts +2 -2
  49. package/assets/core/home/ThirdFreeLookCamera.ts.meta +1 -1
  50. package/assets/core/home/TimeManager.ts +1 -1
  51. package/assets/core/home/TimeManager.ts.meta +1 -1
  52. package/assets/core/home/Tools.ts +209 -0
  53. package/assets/core/home/Tools.ts.meta +1 -1
  54. package/assets/core/home/util/EncryptUtil.ts.meta +1 -1
  55. package/assets/core/home/util/MathUtil.ts.meta +1 -1
  56. package/assets/core/home/util/Md5.ts.meta +1 -1
  57. package/assets/core/home/util/RandomUtil.ts +41 -41
  58. package/assets/core/home/util/RandomUtil.ts.meta +1 -1
  59. package/assets/core/home/util/ResUtil.ts.meta +1 -1
  60. package/assets/core/home/util/crypto-js.d.ts.meta +1 -1
  61. package/assets/core/home/util/crypto-js.js.meta +1 -1
  62. package/assets/core/home/util.meta +1 -1
  63. package/assets/core/home.meta +1 -1
  64. package/assets/core/interface/App.ts +545 -0
  65. package/assets/core/interface/{MainModule.ts.meta → App.ts.meta} +1 -1
  66. package/assets/core/interface/ISceneParam.ts.meta +1 -1
  67. package/assets/core/interface/Interface.ts +66 -77
  68. package/assets/core/interface/Interface.ts.meta +1 -1
  69. package/assets/core/interface.meta +1 -1
  70. package/assets/core/lib/language/Language.ts +3 -4
  71. package/assets/core/lib/language/Language.ts.meta +1 -1
  72. package/assets/core/lib/language/LanguageData.ts +4 -4
  73. package/assets/core/lib/language/LanguageData.ts.meta +1 -1
  74. package/assets/core/lib/language/LanguageLabel.ts +6 -6
  75. package/assets/core/lib/language/LanguageLabel.ts.meta +1 -1
  76. package/assets/core/lib/language/LanguagePack.ts +8 -9
  77. package/assets/core/lib/language/LanguagePack.ts.meta +1 -1
  78. package/assets/core/lib/language/LanguagePointLabel.ts.meta +1 -1
  79. package/assets/core/lib/language/LanguageSpine.ts +1 -1
  80. package/assets/core/lib/language/LanguageSpine.ts.meta +1 -1
  81. package/assets/core/lib/language/LanguageSprite.ts +7 -7
  82. package/assets/core/lib/language/LanguageSprite.ts.meta +1 -1
  83. package/assets/core/lib/language.meta +1 -1
  84. package/assets/core/lib/logger/ELoggerLevel.ts +0 -12
  85. package/assets/core/lib/logger/ELoggerLevel.ts.meta +1 -1
  86. package/assets/core/lib/logger/MLogger.ts +7 -8
  87. package/assets/core/lib/logger/MLogger.ts.meta +1 -1
  88. package/assets/core/lib/logger.meta +1 -1
  89. package/assets/core/lib/net/libs/proto/output/protobuf.d.ts.meta +1 -1
  90. package/assets/core/lib/net/libs/proto/output/protobuf.min.js.meta +1 -1
  91. package/assets/core/lib/net/libs/proto/output/protobuf_custom.d.ts.meta +1 -1
  92. package/assets/core/lib/net/libs/proto/output/protobuf_custom.js.meta +1 -1
  93. package/assets/core/lib/net/libs/proto/output.meta +1 -1
  94. package/assets/core/lib/net/libs/proto/source/Cmd.proto.meta +1 -1
  95. package/assets/core/lib/net/libs/proto/source/UserLogin.proto.meta +1 -1
  96. package/assets/core/lib/net/libs/proto/source/base.proto.meta +1 -1
  97. package/assets/core/lib/net/libs/proto/source/command.proto.meta +1 -1
  98. package/assets/core/lib/net/libs/proto/source/domain/boos_battle_info.proto.meta +1 -1
  99. package/assets/core/lib/net/libs/proto/source/domain/player_auth.proto.meta +1 -1
  100. package/assets/core/lib/net/libs/proto/source/domain.meta +1 -1
  101. package/assets/core/lib/net/libs/proto/source/message/game_push.proto.meta +1 -1
  102. package/assets/core/lib/net/libs/proto/source/message/game_request.proto.meta +1 -1
  103. package/assets/core/lib/net/libs/proto/source/message/game_response.proto.meta +1 -1
  104. package/assets/core/lib/net/libs/proto/source/message.meta +1 -1
  105. package/assets/core/lib/net/libs/proto/source/push/boss_battle_events.proto.meta +1 -1
  106. package/assets/core/lib/net/libs/proto/source/push.meta +1 -1
  107. package/assets/core/lib/net/libs/proto/source.meta +1 -1
  108. package/assets/core/lib/net/libs/proto.meta +1 -1
  109. package/assets/core/lib/net/libs.meta +1 -1
  110. package/assets/core/lib/net/net/HttpManager.ts +2 -2
  111. package/assets/core/lib/net/net/HttpManager.ts.meta +1 -1
  112. package/assets/core/lib/net/net/NetInterface.ts.meta +1 -1
  113. package/assets/core/lib/net/net/NetManager.ts.meta +1 -1
  114. package/assets/core/lib/net/net/NetNode.ts +16 -17
  115. package/assets/core/lib/net/net/NetNode.ts.meta +1 -1
  116. package/assets/core/lib/net/net/WebSock.ts +1 -2
  117. package/assets/core/lib/net/net/WebSock.ts.meta +1 -1
  118. package/assets/core/lib/net/net/custom/NetChannelManager.ts.meta +1 -1
  119. package/assets/core/lib/net/net/custom/NetConfig.ts.meta +1 -1
  120. package/assets/core/lib/net/net/custom/NetErrorCode.ts.meta +1 -1
  121. package/assets/core/lib/net/net/custom/NetGameTips.ts +8 -9
  122. package/assets/core/lib/net/net/custom/NetGameTips.ts.meta +1 -1
  123. package/assets/core/lib/net/net/custom/NetNodeGame.ts +1 -1
  124. package/assets/core/lib/net/net/custom/NetNodeGame.ts.meta +1 -1
  125. package/assets/core/lib/net/net/custom.meta +1 -1
  126. package/assets/core/lib/net/net/protocol/NetProtocolJson.ts.meta +1 -1
  127. package/assets/core/lib/net/net/protocol/NetProtocolProtobuf.ts.meta +1 -1
  128. package/assets/core/lib/net/net/protocol.meta +1 -1
  129. package/assets/core/lib/net/net.meta +1 -1
  130. package/assets/core/lib/net/prompt.meta +1 -1
  131. package/assets/core/lib/net.meta +1 -1
  132. package/assets/core/lib/old.meta +1 -1
  133. package/assets/core/lib/tabbar/TabBarComponent.ts.meta +1 -1
  134. package/assets/core/lib/tabbar/TabBarController.ts.meta +1 -1
  135. package/assets/core/lib/tabbar/TabBarItem.ts.meta +1 -1
  136. package/assets/core/lib/tabbar.meta +1 -1
  137. package/assets/core/lib.meta +1 -1
  138. package/assets/core.meta +1 -1
  139. package/assets.meta +1 -1
  140. package/index.ts +14 -0
  141. package/index.ts.meta +1 -1
  142. package/package.json +1 -1
  143. package/package.json.meta +1 -1
  144. package/assets/core/home/ExView.ts +0 -9
  145. package/assets/core/home/JsonUtil.ts +0 -102
  146. package/assets/core/home/JsonUtil.ts.meta +0 -9
  147. package/assets/core/home/ProgessView.ts +0 -96
  148. package/assets/core/home/prefabs.meta +0 -12
  149. package/assets/core/interface/MainModule.ts +0 -1019
  150. package/assets/core/lib/Logger.ts +0 -286
  151. package/assets/core/lib/Logger.ts.meta +0 -9
  152. package/assets/core/lib/old/VM2.ts +0 -619
  153. package/assets/core/lib/old/VM2.ts.meta +0 -9
  154. package/assets/core/lib/old/ViewModel.ts +0 -905
  155. package/assets/core/lib/old/ViewModel.ts.meta +0 -9
  156. package/assets/core/lib/old/ViewSearch.ts +0 -125
  157. package/assets/core/lib/old/ViewSearch.ts.meta +0 -9
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "9ca64a42-77ad-4ea2-a0bd-74b8ab2f6336",
5
+ "uuid": "1257be8f-ef7a-4251-8c29-2425e12b503d",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -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) {
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "9c8ac71f-a3fd-4a2f-9c60-dbce3c3bee0b",
5
+ "uuid": "881467d2-d92a-495a-a3b4-0a3bc6e95691",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -9,7 +9,7 @@ export class DouYinShow extends Component {
9
9
  isTip = false;
10
10
  protected onLoad(): void {
11
11
  if (BYTEDANCE) {
12
- if (!MainModule.IsDouYin() && !this.isTip) {
12
+ if (!App.IsDouYin() && !this.isTip) {
13
13
  this.node.active = false;
14
14
  } else {
15
15
  }
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "a4a32ee3-6149-4996-ba7b-a710f599ec40",
5
+ "uuid": "451fbb21-03ed-458c-a98d-a76ead2c9082",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -4,20 +4,12 @@ const { ccclass } = _decorator;
4
4
 
5
5
  @ccclass('EventManager')
6
6
  export class EventManager {
7
-
8
- private static instance: EventManager;
9
7
  private eventTarget: EventTarget;
10
-
11
- private constructor() {
8
+ constructor() {
12
9
  this.eventTarget = new EventTarget();
13
10
  }
14
11
 
15
- static get ins() {
16
- if (!this.instance) {
17
- this.instance = new EventManager();
18
- }
19
- return this.instance;
20
- }
12
+
21
13
 
22
14
  on(eventName: string, callback: any, target?: any) {
23
15
  this.eventTarget.on(eventName, callback, target);
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "b7d768ad-679b-4760-a895-453952c0f884",
5
+ "uuid": "e8e76955-760c-4fb2-9274-8e066c61b60e",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -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
  }
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "c9bd92e7-c01c-4515-8c8c-145663b2f03d",
5
+ "uuid": "124d2302-2f9b-4dfc-a9ca-d41b0f1d964b",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -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
  }
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "cca892ef-33a8-4132-bc31-14534cfa126b",
5
+ "uuid": "1482780d-fa13-4617-bd28-a67507cb3fd6",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "39159e5b-86c8-4e73-8fb2-83cbeb71ba38",
5
+ "uuid": "9b7ba854-4546-4b4f-9d06-1b51068b5383",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "3fd4c65e-d51d-46a4-a8d5-e77008afbca2",
5
+ "uuid": "7c0bc967-6d0c-4341-a6d4-1694b8e9c533",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -0,0 +1,109 @@
1
+
2
+ import { tween } from 'cc';
3
+ import { Label } from 'cc';
4
+ import { ProgressBar } from 'cc';
5
+ import { _decorator, Component, Node, game, find, director } from 'cc';
6
+ const { ccclass, property, menu } = _decorator;
7
+
8
+ /**
9
+ * Predefined variables
10
+ * Name = ProgessView
11
+ * DateTime = Wed Sep 28 2022 22:24:36 GMT+0800 (中国标准时间)
12
+ * Author = yf123mb
13
+ * FileBasename = ProgessView.ts
14
+ * FileBasenameNoExtension = ProgessView
15
+ * URL = db://assets/home/Home/ProgessView.ts
16
+ * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
17
+ *
18
+ */
19
+
20
+ @ccclass('ProgessWindow')
21
+ @menu('组件进度条/ProgessWindow')
22
+ export class ProgessWindow extends Component {
23
+
24
+ // static Ins:ProgessWindow;
25
+ @property({
26
+ type: ProgressBar,
27
+ displayName: "进度条"
28
+ })
29
+ pro_bar: ProgressBar;
30
+
31
+ @property({
32
+ type: Label,
33
+ displayName: "进度条文本"
34
+ })
35
+ pro_lb: Label;
36
+ /**监听进度
37
+ * pro:0-100
38
+ */
39
+ public onProgress: (pro: number) => void
40
+
41
+ protected onLoad(): void {
42
+
43
+ }
44
+
45
+ SHowPro(isShow: boolean) {
46
+ this.pro_bar.node.active = isShow
47
+ }
48
+
49
+ /***更新进度--假的进度 */
50
+ async ProgessValueAuto(param: { startTime: number, endTime: number }) {
51
+ await this.loadProgress(param.startTime, param.endTime, (pro: number) => { this.ProgessValue((pro)); })
52
+ }
53
+
54
+ /***更新进度 */
55
+ public ProgessValue(value: number, anim_time: number = 0.1) {
56
+ if (this.pro_bar) {
57
+ this.onProgress?.(value)
58
+ if (this.pro_lb) {
59
+ this.pro_lb.string = `${value}%`
60
+ }
61
+ this.pro(this.pro_bar, value, 100, anim_time);
62
+ }
63
+ }
64
+
65
+ Show() {
66
+ this.node.active = true;
67
+ }
68
+
69
+ Hide() {
70
+ this.node.active = false;
71
+ }
72
+
73
+
74
+ pro(proBar: ProgressBar, progress: number, max: number, anim_time?: number): void {
75
+ const com_max_pro = proBar.totalLength//getComponent(UITransform).width
76
+ const max_progress = com_max_pro;
77
+ const s = max_progress / max;
78
+ const pro = progress * s / max_progress;
79
+ if (anim_time) {
80
+ tween(proBar).to(anim_time, {
81
+ progress: pro
82
+ }).start();
83
+
84
+ } else {
85
+ proBar.progress = pro;
86
+ }
87
+ }
88
+
89
+ /** 模拟假加载进度(仅用于调试) */
90
+ loadProgress(startTime: number = 0, durationSeconds: number = 2, pro: (pro: number) => void): Promise<void> {
91
+ return new Promise((resolve) => {
92
+ let progress = startTime;
93
+ const step = 1; // 每次增加 1%
94
+ const intervalMs = (durationSeconds * 1000) / 100; // 总毫秒数 / 100 步
95
+ const timer = setInterval(() => {
96
+ progress += step;
97
+ if (progress >= 100) {
98
+ progress = 100;
99
+ clearInterval(timer);
100
+ pro?.(progress);
101
+ resolve();
102
+ } else {
103
+ pro?.(progress);
104
+ }
105
+ }, intervalMs);
106
+ });
107
+ }
108
+ }
109
+
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "d7ac4bd9-ab7f-434f-ad91-523ac5c49622",
5
+ "uuid": "7bad0c85-d2c6-4f19-a2f6-3c9b9894f87b",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "49a06417-7524-4309-a366-0f7261b05ed8",
5
+ "uuid": "0e05a5c6-8651-4ca6-a15b-523af7edaa35",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}
@@ -2,7 +2,7 @@
2
2
  "ver": "4.0.24",
3
3
  "importer": "typescript",
4
4
  "imported": true,
5
- "uuid": "02922e2c-51f4-411c-b344-f20c2e98489e",
5
+ "uuid": "b255a448-dea9-4aff-8efd-c529de1b5584",
6
6
  "files": [],
7
7
  "subMetas": {},
8
8
  "userData": {}