@cc-component/cc-core 1.2.6 → 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.
- package/assets/core/config/CommonEnum.ts +1 -0
- package/assets/core/config/CommonEnum.ts.meta +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 +2 -2
- package/assets/core/config/LayerUI.ts.meta +1 -1
- package/assets/core/config.meta +1 -1
- package/assets/core/editor/LanguageManager.ts +1 -1
- package/assets/core/editor/LanguageManager.ts.meta +1 -1
- package/assets/core/editor/SpineRunner.ts.meta +1 -1
- package/assets/core/editor/i18nEditorComponent.ts +8 -8
- 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 +1 -1
- package/assets/core/home/BaseBoxView.ts.meta +1 -1
- package/assets/core/home/BaseLaunchComponent.ts.meta +1 -1
- package/assets/core/home/BaseLoading.ts +14 -14
- package/assets/core/home/BaseLoading.ts.meta +1 -1
- package/assets/core/home/BaseModuleConfig.ts +24 -3
- package/assets/core/home/BaseModuleConfig.ts.meta +1 -1
- package/assets/core/home/BaseSkeleton.ts.meta +1 -1
- 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.meta +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.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.meta +1 -1
- package/assets/core/home/StateMachine.ts.meta +1 -1
- package/assets/core/home/StorageManager.ts.meta +1 -1
- package/assets/core/home/ThirdFreeLookCamera.ts.meta +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.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 +545 -0
- package/assets/core/{home/ExView.ts.meta → interface/App.ts.meta} +1 -1
- package/assets/core/interface/ISceneParam.ts.meta +1 -1
- package/assets/core/interface/Interface.ts +58 -77
- package/assets/core/interface/Interface.ts.meta +1 -1
- package/assets/core/interface.meta +1 -1
- package/assets/core/lib/language/Language.ts.meta +1 -1
- package/assets/core/lib/language/LanguageData.ts +2 -2
- package/assets/core/lib/language/LanguageData.ts.meta +1 -1
- package/assets/core/lib/language/LanguageLabel.ts +4 -4
- package/assets/core/lib/language/LanguageLabel.ts.meta +1 -1
- package/assets/core/lib/language/LanguagePack.ts +4 -4
- 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 +6 -6
- 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.meta +1 -1
- 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.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.meta +1 -1
- 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.meta +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.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/prefabs.meta +0 -12
- package/assets/core/interface/MainModule.ts +0 -1029
- package/assets/core/interface/MainModule.ts.meta +0 -9
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
|
|
2
|
+
import { Vec3, v3 } from 'cc';
|
|
2
3
|
import { Button, Toggle, PageView, ToggleContainer, EventHandler, js } from 'cc';
|
|
3
4
|
import { _decorator, Component, Node } from 'cc';
|
|
5
|
+
import { BYTEDANCE } from 'cc/env';
|
|
6
|
+
import { ParabolaTween } from './ParabolaTween';
|
|
4
7
|
const { ccclass, property } = _decorator;
|
|
5
8
|
|
|
6
9
|
/**
|
|
@@ -35,6 +38,211 @@ export class Tools {
|
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
41
|
+
|
|
42
|
+
//#region 工具
|
|
43
|
+
/**任务进度队列 */
|
|
44
|
+
static PromiseQueue<T>(promises: Promise<T>[], onProgress: (completed: number, total: number) => void): Promise<T[]> {
|
|
45
|
+
const total = promises.length;
|
|
46
|
+
let completed = 0;
|
|
47
|
+
|
|
48
|
+
// 包装每个 Promise,以便在完成时触发进度更新
|
|
49
|
+
const trackedPromises = promises.map(promise =>
|
|
50
|
+
promise.then(result => {
|
|
51
|
+
completed++;
|
|
52
|
+
onProgress(completed, total); // 更新进度
|
|
53
|
+
return result;
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// 返回一个新的 Promise.all,确保所有任务完成后返回结果
|
|
58
|
+
return Promise.all(trackedPromises);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
GetListPos(objectCount: number, circleRadius: number, startPos: Vec3) {
|
|
62
|
+
let list: Vec3[] = []
|
|
63
|
+
// 生成指定数量的物体,并按照圆形排列
|
|
64
|
+
for (let i = 0; i < objectCount; i++) {
|
|
65
|
+
// 计算每个物体在圆周上的角度
|
|
66
|
+
let angle = (i / objectCount) * 2 * Math.PI;
|
|
67
|
+
|
|
68
|
+
// 计算每个物体在圆周上的位置
|
|
69
|
+
let x = startPos.x + circleRadius * Math.cos(angle);
|
|
70
|
+
let z = startPos.z + circleRadius * Math.sin(angle);
|
|
71
|
+
|
|
72
|
+
// 创建物体
|
|
73
|
+
const pos = v3(x, 15, z);
|
|
74
|
+
list.push(pos)
|
|
75
|
+
}
|
|
76
|
+
return list
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//抛物线
|
|
80
|
+
//计算贝塞尔曲线坐标函数
|
|
81
|
+
static twoBezier(k3, startPos, controlPos, endPos) {
|
|
82
|
+
let twoBezier = (t: number, p1: Vec3, cp: Vec3, p2: Vec3) => {
|
|
83
|
+
let x = (1 - t) * (1 - t) * p1.x + 2 * t * (1 - t) * cp.x + t * t * p2.x;
|
|
84
|
+
let y = (1 - t) * (1 - t) * p1.y + 2 * t * (1 - t) * cp.y + t * t * p2.y;
|
|
85
|
+
return new Vec3(x, y, 0);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
let result_pos = twoBezier(k3, startPos, controlPos, endPos)
|
|
89
|
+
return result_pos
|
|
90
|
+
}
|
|
91
|
+
static customEaseOutInWithSpeed(t) {
|
|
92
|
+
let speedFactor = 0.6
|
|
93
|
+
if (t < 0.5) {
|
|
94
|
+
return 0.5 * Tools.customEaseOut(2 * t, speedFactor);
|
|
95
|
+
} else {
|
|
96
|
+
return 0.5 * Tools.customEaseIn(2 * t - 1, speedFactor) + 0.5;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static customEaseOut(t, speedFactor) {
|
|
101
|
+
return 1 - Math.pow(1 - t, 2 * speedFactor);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static customEaseIn(t, speedFactor) {
|
|
105
|
+
return Math.pow(t, 2 * speedFactor);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
//检测碰撞
|
|
109
|
+
static Collision(box1: { x1: number, y1: number, x2: number, y2: number },
|
|
110
|
+
box2: { x1: number, y1: number, x2: number, y2: number }): boolean {
|
|
111
|
+
// 碰撞检测逻辑
|
|
112
|
+
return !(box1.x2 <= box2.x1 || box1.x1 >= box2.x2 ||
|
|
113
|
+
box1.y2 <= box2.y1 || box1.y1 >= box2.y2);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
//朝向
|
|
117
|
+
static CalculateAngle(pointA: Vec3, pointB: Vec3): number {
|
|
118
|
+
// const dx = pointB.x - pointA.x;
|
|
119
|
+
// const dy = pointB.y - pointA.y;
|
|
120
|
+
// return Math.atan2(dy, dx) * (180 / Math.PI);
|
|
121
|
+
|
|
122
|
+
const dx = pointB.x - pointA.x;
|
|
123
|
+
const dy = pointB.y - pointA.y;
|
|
124
|
+
let angle = Math.atan2(dy, dx)
|
|
125
|
+
angle = angle * (180 / Math.PI);
|
|
126
|
+
return angle
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static LookAtTarget(self: Vec3, target: Vec3) {
|
|
130
|
+
if (target == null) { return }
|
|
131
|
+
// //计算朝向
|
|
132
|
+
let angle = Tools.CalculateAngle(self, target);
|
|
133
|
+
//物体朝向
|
|
134
|
+
return v3(0, 0, angle);
|
|
135
|
+
}
|
|
136
|
+
/**向量的新的位置 */
|
|
137
|
+
static DirectionPosition(start: Vec3, endPos: Vec3, scalar: number) {
|
|
138
|
+
const direction = endPos.clone().subtract(start);
|
|
139
|
+
const pos = direction.normalize().multiplyScalar(scalar);
|
|
140
|
+
return pos
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 开始抛物线缓动
|
|
145
|
+
* @param item 运动节点
|
|
146
|
+
* @param target_postion 目标位置
|
|
147
|
+
* @param update 更新 运动中回调
|
|
148
|
+
* @param offset_ratio 最高点 的偏移量
|
|
149
|
+
* @param time 动画时间
|
|
150
|
+
*/
|
|
151
|
+
static RunParabolaTween(item: Node, target_postion: Vec3, update: (ratio: number) => void, param?: { offset_ratio?: number, is_random: boolean, time?: number, start_position?: Vec3 }) {
|
|
152
|
+
new ParabolaTween().RunParabolaTween(item, target_postion, update, param);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
public static IsTT() {
|
|
156
|
+
if (BYTEDANCE) {
|
|
157
|
+
//@ts-ignore
|
|
158
|
+
const info = tt.getSystemInfoSync();
|
|
159
|
+
Logger.debug('-------抖音', info.appName);
|
|
160
|
+
const appName = info.appName;
|
|
161
|
+
if (appName.toUpperCase() === "DOUYIN") {//抖音
|
|
162
|
+
// do something
|
|
163
|
+
return true
|
|
164
|
+
}
|
|
165
|
+
else if (appName.toUpperCase() === "TOUTIAO") {//今日头条
|
|
166
|
+
// do something
|
|
167
|
+
}
|
|
168
|
+
else if (appName.toUpperCase() === "TOUTIAO_PRO") {//今日头条专业版
|
|
169
|
+
// do something
|
|
170
|
+
}
|
|
171
|
+
else if (appName.toUpperCase() === 'NEWS_ARTICLE_LITE') {//今日头条极速版
|
|
172
|
+
// do something
|
|
173
|
+
}
|
|
174
|
+
else if (appName.toUpperCase() === "DOUYIN_LITE") {//抖音极速版
|
|
175
|
+
// do something
|
|
176
|
+
return true
|
|
177
|
+
}
|
|
178
|
+
else if (appName.toUpperCase() === "LIVE_STREAM") {//抖音火山版
|
|
179
|
+
// do something
|
|
180
|
+
return true
|
|
181
|
+
}
|
|
182
|
+
else if (appName.toUpperCase() === "TIKTOK") {//TikTok
|
|
183
|
+
// do something
|
|
184
|
+
return true
|
|
185
|
+
}
|
|
186
|
+
else if (appName.toUpperCase() === "MUSICALLY") {//TikTok.M
|
|
187
|
+
// do something
|
|
188
|
+
return true
|
|
189
|
+
}
|
|
190
|
+
else if (appName.toUpperCase() === "XiGua") {//西瓜视频
|
|
191
|
+
// do something
|
|
192
|
+
}
|
|
193
|
+
else if (appName.toUpperCase() === "PPX") {//皮皮虾
|
|
194
|
+
// do something
|
|
195
|
+
}
|
|
196
|
+
else if (appName.toUpperCase() === "automobile") {//懂车帝
|
|
197
|
+
// do something
|
|
198
|
+
}
|
|
199
|
+
else if (appName.toUpperCase() === "DeliverManager") {//巨量
|
|
200
|
+
// do something
|
|
201
|
+
}
|
|
202
|
+
else if (appName.toUpperCase() === "Reading") {//番茄小说
|
|
203
|
+
// do something
|
|
204
|
+
}
|
|
205
|
+
else if (appName.toUpperCase() === "xiaohe") {//小河
|
|
206
|
+
// do something
|
|
207
|
+
}
|
|
208
|
+
return false
|
|
209
|
+
}
|
|
210
|
+
return false
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
//抖音排行榜数据
|
|
216
|
+
public static UpdatePlayerRankData_tt(count: number) {
|
|
217
|
+
const isdy = Tools.IsTT()
|
|
218
|
+
// console.error('抖音22==', isdy)
|
|
219
|
+
if (!isdy) { return }
|
|
220
|
+
// const playerLevel = MeCenter.Ins.player.playerLevel;
|
|
221
|
+
// const levelName = MeCenter.Ins.player.levelName;
|
|
222
|
+
// const levelScore = MeCenter.Ins.player.levelScore;
|
|
223
|
+
// const count = MeCenter.Ins.player.levelScore;
|
|
224
|
+
// const value = `【${levelName}】x${levelScore}星` + ' 大逃杀:' + count + '块'
|
|
225
|
+
const value = '【大逃杀】' + count + '块'
|
|
226
|
+
|
|
227
|
+
if (BYTEDANCE) {
|
|
228
|
+
//一个moba游戏,想要对用户的段位进行排序
|
|
229
|
+
//@ts-ignore
|
|
230
|
+
tt.setImRankData({
|
|
231
|
+
dataType: 1, //成绩为枚举类型,因为段位不是一个数字
|
|
232
|
+
value: value, //该用户段位为白银
|
|
233
|
+
priority: count, //dataType为 1,需要权重,该游戏排序为 青铜(1)、白银(2)、黄金(3)、王者(4),因此此处传2
|
|
234
|
+
extra: "extra",
|
|
235
|
+
zoneId: "default",
|
|
236
|
+
success(res) {
|
|
237
|
+
Logger.debug(`排行榜设置成功: ${res}`);
|
|
238
|
+
},
|
|
239
|
+
fail(res) {
|
|
240
|
+
Logger.debug(`排行榜设置失败: ${res.errMsg}`);
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
}
|
|
38
246
|
}
|
|
39
247
|
|
|
40
248
|
|
|
@@ -100,4 +308,5 @@ export function BindEventClick(target: Node, delegate: Component, func_name?: st
|
|
|
100
308
|
comp.clickEvents.push(clickEventHandler);
|
|
101
309
|
//comp.clickEvents.push(clickEventHandler_sound);
|
|
102
310
|
}
|
|
311
|
+
|
|
103
312
|
}
|