@cc-component/cc-core 1.2.8 → 1.3.0
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/CommonEnum.ts +8 -2
- package/assets/core/config/CommonEnum.ts.meta +1 -1
- package/assets/core/config/IConfig.ts +1 -1
- package/assets/core/config/IConfig.ts.meta +1 -1
- package/assets/core/config/LayerType.ts.meta +1 -1
- package/assets/core/config/LayerUI.ts +14 -12
- package/assets/core/config/LayerUI.ts.meta +1 -1
- package/assets/core/config.meta +1 -1
- package/assets/core/editor/LanguageManager.ts +5 -5
- package/assets/core/editor/LanguageManager.ts.meta +1 -1
- package/assets/core/editor/SpineRunner.ts.meta +1 -1
- package/assets/core/editor/i18nEditorComponent.ts +12 -12
- package/assets/core/editor/i18nEditorComponent.ts.meta +1 -1
- package/assets/core/editor.meta +1 -1
- package/assets/core/home/AudioUtil.ts +5 -11
- package/assets/core/home/AudioUtil.ts.meta +1 -1
- package/assets/core/home/BaseBoxView.ts +13 -16
- package/assets/core/home/BaseBoxView.ts.meta +1 -1
- package/assets/core/home/BaseLaunchComponent.ts.meta +1 -1
- package/assets/core/home/BaseLoading.ts +34 -18
- package/assets/core/home/BaseLoading.ts.meta +1 -1
- package/assets/core/home/BaseModuleConfig.ts +46 -0
- package/assets/core/home/{ProgessView.ts.meta → BaseModuleConfig.ts.meta} +9 -9
- package/assets/core/home/BaseSkeleton.ts +4 -4
- package/assets/core/home/BaseSkeleton.ts.meta +1 -1
- package/assets/core/home/CameraAngel.ts +41 -41
- package/assets/core/home/CameraAngel.ts.meta +1 -1
- package/assets/core/home/DouYinShow.ts +1 -1
- package/assets/core/home/DouYinShow.ts.meta +1 -1
- package/assets/core/home/EventManager.ts +2 -10
- package/assets/core/home/EventManager.ts.meta +1 -1
- package/assets/core/home/FollowCamera.ts +28 -29
- package/assets/core/home/FollowCamera.ts.meta +1 -1
- package/assets/core/home/InViewCenter.ts +1 -1
- package/assets/core/home/InViewCenter.ts.meta +1 -1
- package/assets/core/home/LoadingWindow.ts.meta +1 -1
- package/assets/core/home/ParabolaTween.ts.meta +1 -1
- package/assets/core/home/ProgessWindow.ts +109 -0
- package/assets/core/home/{ExView.ts.meta → ProgessWindow.ts.meta} +1 -1
- package/assets/core/home/Quaternion.ts.meta +1 -1
- package/assets/core/home/ResUtil.ts.meta +1 -1
- package/assets/core/home/ResourceManager.ts +13 -14
- package/assets/core/home/ResourceManager.ts.meta +1 -1
- package/assets/core/home/StateMachine.ts +9 -9
- package/assets/core/home/StateMachine.ts.meta +1 -1
- package/assets/core/home/StorageManager.ts +1 -1
- package/assets/core/home/StorageManager.ts.meta +1 -1
- package/assets/core/home/ThirdFreeLookCamera.ts +2 -2
- package/assets/core/home/ThirdFreeLookCamera.ts.meta +1 -1
- package/assets/core/home/TimeManager.ts +1 -1
- package/assets/core/home/TimeManager.ts.meta +1 -1
- package/assets/core/home/Tools.ts +209 -0
- package/assets/core/home/Tools.ts.meta +1 -1
- package/assets/core/home/util/EncryptUtil.ts.meta +1 -1
- package/assets/core/home/util/MathUtil.ts.meta +1 -1
- package/assets/core/home/util/Md5.ts.meta +1 -1
- package/assets/core/home/util/RandomUtil.ts +41 -41
- package/assets/core/home/util/RandomUtil.ts.meta +1 -1
- package/assets/core/home/util/ResUtil.ts.meta +1 -1
- package/assets/core/home/util/crypto-js.d.ts.meta +1 -1
- package/assets/core/home/util/crypto-js.js.meta +1 -1
- package/assets/core/home/util.meta +1 -1
- package/assets/core/home.meta +1 -1
- package/assets/core/interface/App.ts +548 -0
- package/assets/core/interface/{MainModule.ts.meta → App.ts.meta} +1 -1
- package/assets/core/interface/ISceneParam.ts.meta +1 -1
- package/assets/core/interface/Interface.ts +65 -76
- package/assets/core/interface/Interface.ts.meta +1 -1
- package/assets/core/interface.meta +1 -1
- package/assets/core/lib/language/Language.ts +3 -4
- package/assets/core/lib/language/Language.ts.meta +1 -1
- package/assets/core/lib/language/LanguageData.ts +4 -4
- package/assets/core/lib/language/LanguageData.ts.meta +1 -1
- package/assets/core/lib/language/LanguageLabel.ts +6 -6
- package/assets/core/lib/language/LanguageLabel.ts.meta +1 -1
- package/assets/core/lib/language/LanguagePack.ts +8 -9
- package/assets/core/lib/language/LanguagePack.ts.meta +1 -1
- package/assets/core/lib/language/LanguagePointLabel.ts.meta +1 -1
- package/assets/core/lib/language/LanguageSpine.ts +1 -1
- package/assets/core/lib/language/LanguageSpine.ts.meta +1 -1
- package/assets/core/lib/language/LanguageSprite.ts +7 -7
- package/assets/core/lib/language/LanguageSprite.ts.meta +1 -1
- package/assets/core/lib/language.meta +1 -1
- package/assets/core/lib/logger/ELoggerLevel.ts +0 -12
- package/assets/core/lib/logger/ELoggerLevel.ts.meta +1 -1
- package/assets/core/lib/logger/MLogger.ts +7 -8
- package/assets/core/lib/logger/MLogger.ts.meta +1 -1
- package/assets/core/lib/logger.meta +1 -1
- package/assets/core/lib/net/libs/proto/output/protobuf.d.ts.meta +1 -1
- package/assets/core/lib/net/libs/proto/output/protobuf.min.js.meta +1 -1
- package/assets/core/lib/net/libs/proto/output/protobuf_custom.d.ts.meta +1 -1
- package/assets/core/lib/net/libs/proto/output/protobuf_custom.js.meta +1 -1
- package/assets/core/lib/net/libs/proto/output.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/Cmd.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/UserLogin.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/base.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/command.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/domain/boos_battle_info.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/domain/player_auth.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/domain.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/message/game_push.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/message/game_request.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/message/game_response.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/message.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/push/boss_battle_events.proto.meta +1 -1
- package/assets/core/lib/net/libs/proto/source/push.meta +1 -1
- package/assets/core/lib/net/libs/proto/source.meta +1 -1
- package/assets/core/lib/net/libs/proto.meta +1 -1
- package/assets/core/lib/net/libs.meta +1 -1
- package/assets/core/lib/net/net/HttpManager.ts +2 -2
- package/assets/core/lib/net/net/HttpManager.ts.meta +1 -1
- package/assets/core/lib/net/net/NetInterface.ts.meta +1 -1
- package/assets/core/lib/net/net/NetManager.ts.meta +1 -1
- package/assets/core/lib/net/net/NetNode.ts +16 -17
- package/assets/core/lib/net/net/NetNode.ts.meta +1 -1
- package/assets/core/lib/net/net/WebSock.ts +1 -2
- package/assets/core/lib/net/net/WebSock.ts.meta +1 -1
- package/assets/core/lib/net/net/custom/NetChannelManager.ts.meta +1 -1
- package/assets/core/lib/net/net/custom/NetConfig.ts.meta +1 -1
- package/assets/core/lib/net/net/custom/NetErrorCode.ts.meta +1 -1
- package/assets/core/lib/net/net/custom/NetGameTips.ts +8 -9
- package/assets/core/lib/net/net/custom/NetGameTips.ts.meta +1 -1
- package/assets/core/lib/net/net/custom/NetNodeGame.ts +1 -1
- package/assets/core/lib/net/net/custom/NetNodeGame.ts.meta +1 -1
- package/assets/core/lib/net/net/custom.meta +1 -1
- package/assets/core/lib/net/net/protocol/NetProtocolJson.ts.meta +1 -1
- package/assets/core/lib/net/net/protocol/NetProtocolProtobuf.ts.meta +1 -1
- package/assets/core/lib/net/net/protocol.meta +1 -1
- package/assets/core/lib/net/net.meta +1 -1
- package/assets/core/lib/net/prompt.meta +1 -1
- package/assets/core/lib/net.meta +1 -1
- package/assets/core/lib/old.meta +1 -1
- package/assets/core/lib/tabbar/TabBarComponent.ts.meta +1 -1
- package/assets/core/lib/tabbar/TabBarController.ts.meta +1 -1
- package/assets/core/lib/tabbar/TabBarItem.ts.meta +1 -1
- package/assets/core/lib/tabbar.meta +1 -1
- package/assets/core/lib.meta +1 -1
- package/assets/core.meta +1 -1
- package/assets.meta +1 -1
- package/index.ts +14 -0
- package/index.ts.meta +1 -1
- package/package.json +1 -1
- package/package.json.meta +1 -1
- package/assets/core/home/ExView.ts +0 -9
- package/assets/core/home/JsonUtil.ts +0 -102
- package/assets/core/home/JsonUtil.ts.meta +0 -9
- package/assets/core/home/ProgessView.ts +0 -96
- package/assets/core/home/prefabs.meta +0 -12
- package/assets/core/interface/MainModule.ts +0 -1019
- package/assets/core/lib/Logger.ts +0 -286
- package/assets/core/lib/Logger.ts.meta +0 -9
- package/assets/core/lib/old/VM2.ts +0 -619
- package/assets/core/lib/old/VM2.ts.meta +0 -9
- package/assets/core/lib/old/ViewModel.ts +0 -905
- package/assets/core/lib/old/ViewModel.ts.meta +0 -9
- package/assets/core/lib/old/ViewSearch.ts +0 -125
- package/assets/core/lib/old/ViewSearch.ts.meta +0 -9
|
@@ -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
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
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
|
|
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(
|
|
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
|
-
|
|
149
|
-
|
|
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
|
-
//
|
|
156
|
+
// Logger.debug("转");
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
//
|
|
159
|
+
//Logger.debug(currentPos)
|
|
160
160
|
this.f_x = currentPos.clone();
|
|
161
161
|
// 根据 deltaX 进行旋转
|
|
162
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
258
|
-
|
|
257
|
+
multiplyQuaternions(quat1: math.Quat, quat2: math.Quat): math.Quat {
|
|
258
|
+
let result = new math.Quat();
|
|
259
259
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
319
|
+
// this.targetCube_lastPos = this.targetCube.worldPosition.clone();
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
onKeyUp(event: EventKeyboard) {
|
|
@@ -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
|
-
|
|
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);
|
|
@@ -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
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
.to(0.5, { worldPosition: this._targetWorldPos })
|
|
68
|
+
.start();
|
|
69
|
+
|
|
70
70
|
//this.node.setWorldPosition(this._targetWorldPos);
|
|
71
71
|
|
|
72
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
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
|
|
149
|
-
let
|
|
150
|
-
let
|
|
151
|
-
let
|
|
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
|
-
//
|
|
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
|
}
|
|
@@ -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
|
+
|