@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.
- 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 +545 -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 +66 -77
- 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
|
@@ -21,7 +21,8 @@ export enum HttpType {
|
|
|
21
21
|
POST,
|
|
22
22
|
}
|
|
23
23
|
export interface IBundleConfig {
|
|
24
|
-
|
|
24
|
+
module: string;
|
|
25
|
+
layer: LayerType;
|
|
25
26
|
path: string;
|
|
26
27
|
bundle: BundleConfigName;
|
|
27
28
|
name?: string;
|
|
@@ -36,12 +37,16 @@ export enum BundleConfigName {
|
|
|
36
37
|
game = "game",
|
|
37
38
|
common = "common",
|
|
38
39
|
resources = "resources",
|
|
40
|
+
table = "table",
|
|
41
|
+
video = "video",
|
|
39
42
|
}
|
|
40
43
|
export enum BundleConfig {
|
|
41
44
|
home = 0,
|
|
42
45
|
game = 1,
|
|
43
|
-
tools = 2,
|
|
44
46
|
common = 3,
|
|
47
|
+
resources,
|
|
48
|
+
table,
|
|
49
|
+
video
|
|
45
50
|
}
|
|
46
51
|
Enum(BundleConfig)
|
|
47
52
|
export enum AssetType {
|
|
@@ -84,6 +89,7 @@ export const ResConfig = {
|
|
|
84
89
|
export interface IInitConfig {
|
|
85
90
|
/**游戏配置-bundle 名称 */
|
|
86
91
|
bundleName: string;
|
|
92
|
+
/**自定义的启动类-必须继承BaseLaunchComponent */
|
|
87
93
|
launchComponent: { new(): BaseLaunchComponent };
|
|
88
94
|
}
|
|
89
95
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { JsonAsset, Layers, Widget } from 'cc';
|
|
1
|
+
import { JsonAsset, Layers, Widget, UITransform } from 'cc';
|
|
2
2
|
import { _decorator, Node } from 'cc';
|
|
3
3
|
import { EnvironmentConfig, IConfig } from './IConfig';
|
|
4
4
|
import { LayerType } from './LayerType';
|
|
5
|
-
import { LoadingWindow } from '../home/LoadingWindow';
|
|
6
5
|
import { Canvas, director } from 'cc';
|
|
7
6
|
import { ResourceManager } from '../home/ResourceManager';
|
|
8
|
-
import {
|
|
9
|
-
import { Logger, LogType } from '../lib/Logger';
|
|
7
|
+
import { IInitConfig } from './CommonEnum';
|
|
10
8
|
import { ISceneParam } from '../interface/ISceneParam';
|
|
11
9
|
import { BlockInputEvents } from 'cc';
|
|
12
10
|
import { BaseLaunchComponent } from '../home/BaseLaunchComponent';
|
|
11
|
+
import { AssetManager } from 'cc';
|
|
12
|
+
import { assetManager } from 'cc';
|
|
13
|
+
|
|
13
14
|
const { ccclass, property } = _decorator;
|
|
14
15
|
|
|
15
16
|
@ccclass('LayerUI')
|
|
@@ -39,9 +40,10 @@ export class LayerUI {
|
|
|
39
40
|
async loadConfig(params: IInitConfig) {
|
|
40
41
|
this.launch = await this.LoadLayerWindow(params);
|
|
41
42
|
const parent = this.launch.node
|
|
42
|
-
const data = await
|
|
43
|
+
const data = await App.LoadAsset<JsonAsset>(params.bundleName, "config", JsonAsset)
|
|
43
44
|
this.config = data.json as IConfig;
|
|
44
|
-
|
|
45
|
+
App.ReleaseAssetPath('config', params.bundleName)
|
|
46
|
+
//Logger.debug(this.config)
|
|
45
47
|
|
|
46
48
|
const config = this.config;
|
|
47
49
|
config.gui.forEach(element => {
|
|
@@ -62,8 +64,11 @@ export class LayerUI {
|
|
|
62
64
|
});
|
|
63
65
|
|
|
64
66
|
//加载配置bundle
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
+
const list: Promise<AssetManager.Bundle>[] = []
|
|
68
|
+
config.bundle.default.forEach(element => { list.push(ResourceManager.loadBundle(element)); });
|
|
69
|
+
Promise.all(list).then(() => {
|
|
70
|
+
this.launch.InitGame();
|
|
71
|
+
});
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
public static CreateNnode(name: string) {
|
|
@@ -91,11 +96,8 @@ export class LayerUI {
|
|
|
91
96
|
setBundleName(value: string) { this.bundleName = value; }
|
|
92
97
|
initLog() {
|
|
93
98
|
const debug = this.config.debug
|
|
94
|
-
Logger.setTags(debug ? null : LogType.Close)
|
|
95
|
-
Logger.logView(debug);
|
|
96
|
-
|
|
97
99
|
if (debug) {
|
|
98
|
-
|
|
100
|
+
Logger.debug("是debug模式");
|
|
99
101
|
} else {
|
|
100
102
|
console.log("发布模式");
|
|
101
103
|
console.log = function () { }; // 关闭普通日志输出
|
package/assets/core/config.meta
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
// try {
|
|
117
117
|
// let index = 0;
|
|
118
118
|
// return value.replace(/d%/g, function () {
|
|
119
|
-
// //
|
|
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)
|
|
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
|
-
// //
|
|
282
|
+
// //Logger.debug(`${index}个参数:${args[index]}`);
|
|
283
283
|
|
|
284
284
|
// let str = args[index++] || "d%";
|
|
285
285
|
// return str;
|
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
// if (this.totalBundles && this.totalBundles.length > 0) {
|
|
300
300
|
// return this.totalBundles;
|
|
301
301
|
// }
|
|
302
|
-
// this.totalBundles =
|
|
302
|
+
// this.totalBundles = App.Get_Bundles()
|
|
303
303
|
// return this.totalBundles;
|
|
304
304
|
// }
|
|
305
305
|
// /**检查路径是否是某个bundle包下 */
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
// break;
|
|
316
316
|
// }
|
|
317
317
|
// }
|
|
318
|
-
// //
|
|
318
|
+
// //Logger.debug("bundleName:",bundleName);
|
|
319
319
|
// return bundleName;
|
|
320
320
|
// }
|
|
321
321
|
// }
|
|
@@ -30,7 +30,7 @@ export class i18nEditorComponent extends Component {
|
|
|
30
30
|
LanguageData.current = language
|
|
31
31
|
|
|
32
32
|
console.log("编辑器语言设置成功", language);
|
|
33
|
-
//
|
|
33
|
+
// App.language.setLanguage('', language)
|
|
34
34
|
// this.node.children.forEach(child => {
|
|
35
35
|
// console.error(child.name)
|
|
36
36
|
// });
|
|
@@ -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
|
-
//
|
|
63
|
+
// Logger.debug("absoluteUrl11:", absoluteUrl, dbUrl);
|
|
64
64
|
//label
|
|
65
65
|
return dbUrl
|
|
66
66
|
|
|
@@ -69,7 +69,7 @@ export class i18nEditorComponent extends Component {
|
|
|
69
69
|
|
|
70
70
|
public editorChangeBundle(language: string) {
|
|
71
71
|
console.log("bundle", language);
|
|
72
|
-
|
|
72
|
+
App.language.setLanguage('', language)
|
|
73
73
|
//i18nMgr.editorChangeBundle(language);
|
|
74
74
|
}
|
|
75
75
|
/**编辑器环境下改变多语言 */
|
|
@@ -78,9 +78,9 @@ 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
|
-
//
|
|
82
|
-
|
|
83
|
-
//console.error(
|
|
81
|
+
//Logger.debug("加载表格", jsonAsset, err);
|
|
82
|
+
App.gui.config = jsonAsset.json as IConfig;
|
|
83
|
+
//console.error(App.gui.config)
|
|
84
84
|
resolve()
|
|
85
85
|
});
|
|
86
86
|
})
|
|
@@ -88,23 +88,23 @@ export class i18nEditorComponent extends Component {
|
|
|
88
88
|
|
|
89
89
|
/**编辑器环境下改变多语言 */
|
|
90
90
|
public async changeLabel(dbUrl: string, language?: string) {
|
|
91
|
-
const db_json = dbUrl + `/${
|
|
91
|
+
const db_json = dbUrl + `/${App.gui.config.language.path.json}/${language}.json`
|
|
92
92
|
console.log(db_json)
|
|
93
93
|
let uuid = await Editor.Message.request("asset-db", "query-uuid", db_json);
|
|
94
94
|
assetManager.loadAny(uuid, (err, jsonAsset: JsonAsset) => {
|
|
95
|
-
//
|
|
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);
|
|
99
|
-
|
|
99
|
+
App.language.labelArr.forEach((com) => {
|
|
100
100
|
com.updateContent()
|
|
101
101
|
})
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
public async changeSprite(dbUrl: string, language?: string) {
|
|
105
|
-
const db_json = dbUrl + `/${
|
|
105
|
+
const db_json = dbUrl + `/${App.gui.config.language.path.texture}/${language}/`
|
|
106
106
|
// console.error('-----', db_json)
|
|
107
|
-
|
|
107
|
+
App.language.spriteArr.forEach(async (com) => {
|
|
108
108
|
const path_jpg = db_json + com.dataID + ".jpg"
|
|
109
109
|
const path_png = db_json + com.dataID + ".png"
|
|
110
110
|
const path_wep = db_json + com.dataID + ".webp"
|
|
@@ -121,7 +121,7 @@ export class i18nEditorComponent extends Component {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
assetManager.loadAny(uuid, (err, imageAsset: ImageAsset) => {
|
|
124
|
-
//
|
|
124
|
+
//Logger.debug("加载图片", imageAsset, err);
|
|
125
125
|
if (!imageAsset) return;
|
|
126
126
|
let spriteFrame = SpriteFrame.createWithImage(imageAsset);
|
|
127
127
|
com.updateSpriteEditor(spriteFrame)
|
package/assets/core/editor.meta
CHANGED
|
@@ -9,13 +9,7 @@ import { BundleConfigName } from '../config/CommonEnum';
|
|
|
9
9
|
* 这是一个用于播放音频的单件类,可以很方便地在项目的任何地方调用。
|
|
10
10
|
*/
|
|
11
11
|
export class AudioUtil {
|
|
12
|
-
|
|
13
|
-
public static get inst(): AudioUtil {
|
|
14
|
-
if (this._inst == null) {
|
|
15
|
-
this._inst = new AudioUtil();
|
|
16
|
-
}
|
|
17
|
-
return this._inst;
|
|
18
|
-
}
|
|
12
|
+
|
|
19
13
|
|
|
20
14
|
private _audioSource: AudioSource;
|
|
21
15
|
private _audioSource2: AudioSource;
|
|
@@ -75,20 +69,20 @@ export class AudioUtil {
|
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
get sound_volume(): number {
|
|
78
|
-
const v =
|
|
72
|
+
const v = App.storage.getNumber('sound_volume', 1)
|
|
79
73
|
return v
|
|
80
74
|
}
|
|
81
75
|
set sound_volume(value: number) {
|
|
82
|
-
|
|
76
|
+
App.storage.set('sound_volume', value)
|
|
83
77
|
}
|
|
84
78
|
|
|
85
79
|
get music_volume(): number {
|
|
86
|
-
const v =
|
|
80
|
+
const v = App.storage.getNumber('music_volume', 1)
|
|
87
81
|
return v
|
|
88
82
|
}
|
|
89
83
|
set music_volume(value: number) {
|
|
90
84
|
this._audioSource.volume = value;
|
|
91
|
-
|
|
85
|
+
App.storage.set('music_volume', value)
|
|
92
86
|
}
|
|
93
87
|
/**
|
|
94
88
|
* @en
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { _decorator, Component, Node, Size, UITransform, v2, Vec2 } from 'cc';
|
|
2
|
-
import { ViewSearch, vsearch } from '../lib/old/ViewSearch';
|
|
3
2
|
const { ccclass, property } = _decorator;
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
|
|
6
5
|
@ccclass('BaseBoxView')
|
|
7
6
|
export class BaseBoxView extends Component {
|
|
8
7
|
box_size: any = { width: 100, height: 100 };//获取碰撞盒大小
|
|
9
|
-
@vsearch(Node)
|
|
10
8
|
box_node: Node;
|
|
11
|
-
@vsearch(Node)
|
|
12
9
|
box_center: Node;
|
|
13
10
|
box_node_ut: UITransform;
|
|
14
11
|
|
|
@@ -24,23 +21,23 @@ export class BaseBoxView extends Component {
|
|
|
24
21
|
|
|
25
22
|
|
|
26
23
|
UpdateBox(target: Node) {
|
|
27
|
-
const data = CommonModule.Get_MapCenter().map_view.GetMapModel(0, 0)
|
|
28
|
-
target = data.node;
|
|
29
|
-
if (this.box_node) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
24
|
+
// const data = CommonModule.Get_MapCenter().map_view.GetMapModel(0, 0)
|
|
25
|
+
// target = data.node;
|
|
26
|
+
// if (this.box_node) {
|
|
27
|
+
// this.box_node.scale = target.scale;
|
|
28
|
+
// const targetUT = target.getComponent(UITransform);
|
|
29
|
+
// this.box_node_ut.anchorPoint = v2(0.5, 0);
|
|
30
|
+
// this.box_node_ut.contentSize = new Size(targetUT.contentSize.width, targetUT.contentSize.height);
|
|
31
|
+
// this.box_size.width = this.box_node_ut.width;
|
|
32
|
+
// this.box_size.height = this.box_node_ut.height;
|
|
33
|
+
// }
|
|
37
34
|
}
|
|
38
35
|
// Collision(target_enemy: BoxView) {
|
|
39
36
|
// const box1 = this.GetBox(this);
|
|
40
37
|
// const box2 = this.GetBox(this.target_enemy);
|
|
41
38
|
|
|
42
|
-
// const ok =
|
|
43
|
-
// //
|
|
39
|
+
// const ok = App.Collision(box1, box2);
|
|
40
|
+
// // Logger.debug("碰撞了吗?", ok, this.node.name)
|
|
44
41
|
// return ok
|
|
45
42
|
// }
|
|
46
43
|
|
|
@@ -3,7 +3,6 @@ import { _decorator, CCString, Component, Enum, instantiate, Node, Prefab } from
|
|
|
3
3
|
import { ISceneParam } from '../interface/ISceneParam';
|
|
4
4
|
import { DEBUG } from 'cc/env';
|
|
5
5
|
import { ResourceManager } from './ResourceManager';
|
|
6
|
-
import { ProgessView } from './ProgessView';
|
|
7
6
|
import { AssetType, BundleConfig, BundleConfigName, GetAssetType } from '../config/CommonEnum';
|
|
8
7
|
import { LanguageData } from '../lib/language/LanguageData';
|
|
9
8
|
const { ccclass, property } = _decorator;
|
|
@@ -36,12 +35,11 @@ export abstract class BaseLoading extends Component {
|
|
|
36
35
|
error: null
|
|
37
36
|
}
|
|
38
37
|
protected onLoad(): void {
|
|
39
|
-
this.sceneParam =
|
|
38
|
+
this.sceneParam = App.scenesParm
|
|
40
39
|
const first = this.path_list[this.path_list.length - 1]
|
|
41
40
|
const bundleName = BundleConfig[first?.bundleName] ?? BundleConfigName.home
|
|
42
|
-
|
|
41
|
+
App.gui.setBundleName(bundleName)
|
|
43
42
|
this.setLanguage()
|
|
44
|
-
MainModule.RegisterModule(this.RegisterModule())
|
|
45
43
|
this.Init();
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -49,34 +47,35 @@ export abstract class BaseLoading extends Component {
|
|
|
49
47
|
const count = this.path_list.length;
|
|
50
48
|
const ratio = 1 / count * this.progress_ratio;
|
|
51
49
|
this.pro_total = 0;
|
|
52
|
-
|
|
50
|
+
App.gui.progess.progess?.(0)//进度在OpenScene方法中先打开才可以 设置进度
|
|
53
51
|
for (let index = 0; index < this.path_list.length; index++) {
|
|
54
52
|
const key_path = this.path_list[index];
|
|
55
53
|
let temp_pro = 0;
|
|
56
|
-
await
|
|
54
|
+
await App.LoadDir(BundleConfig[key_path.bundleName], key_path.path, GetAssetType(key_path.type), (pro: number) => {
|
|
57
55
|
temp_pro = pro * ratio
|
|
58
56
|
const progess = (this.pro_total + pro * ratio)
|
|
59
|
-
|
|
57
|
+
App.gui.progess.progess?.(progess)//进度在OpenScene方法中先打开才可以 设置进度
|
|
60
58
|
})
|
|
61
59
|
this.pro_total = (this.pro_total + temp_pro)
|
|
62
60
|
}
|
|
63
|
-
|
|
61
|
+
Logger.debug("完成", this.pro_total)
|
|
64
62
|
// ✅ 先调用子类的 Finish(允许子类做自定义操作)
|
|
65
63
|
await this.Finish(); // 支持异步
|
|
64
|
+
|
|
66
65
|
this.FinishLoad()
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
|
|
70
69
|
setLanguage() {
|
|
71
|
-
LanguageData.path_json =
|
|
72
|
-
LanguageData.path_texture =
|
|
73
|
-
LanguageData.path_spine =
|
|
74
|
-
|
|
70
|
+
LanguageData.path_json = App.gui.config.language.path.json;
|
|
71
|
+
LanguageData.path_texture = App.gui.config.language.path.texture;
|
|
72
|
+
LanguageData.path_spine = App.gui.config.language.path.spine;
|
|
73
|
+
App.language.setLanguage(App.bundleName, App.gui.config.language.default)
|
|
75
74
|
}
|
|
76
75
|
/**刷新进度 */
|
|
77
76
|
addProgess(progess: number): void {
|
|
78
77
|
const pro = this.getRemainingProgress()
|
|
79
|
-
|
|
78
|
+
App.gui.progess.progess?.(this.pro_total + (pro * progess))
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
/**获取剩余进度 */
|
|
@@ -84,19 +83,36 @@ export abstract class BaseLoading extends Component {
|
|
|
84
83
|
return (1 - this.progress_ratio) * 100
|
|
85
84
|
}
|
|
86
85
|
FinishLoad() {
|
|
87
|
-
|
|
86
|
+
App.gui.progess.close?.()
|
|
88
87
|
if (DEBUG) {
|
|
89
88
|
ResourceManager.instance.LogAssetsAll()
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
|
|
92
|
+
/** 模拟假加载进度(仅用于调试) */
|
|
93
|
+
loadProgress(durationSeconds: number = 2, max: number = 100): Promise<void> {
|
|
94
|
+
return new Promise((resolve) => {
|
|
95
|
+
let progress = 0;
|
|
96
|
+
const step = 1; // 每次增加 1%
|
|
97
|
+
const intervalMs = (durationSeconds * 1000) / max; // 总毫秒数 / 100 步
|
|
98
|
+
const timer = setInterval(() => {
|
|
99
|
+
progress += step;
|
|
100
|
+
if (progress >= 100) {
|
|
101
|
+
progress = 100;
|
|
102
|
+
clearInterval(timer);
|
|
103
|
+
App.gui.progess.progess?.(progress);
|
|
104
|
+
resolve();
|
|
105
|
+
} else {
|
|
106
|
+
App.gui.progess.progess?.(progress);
|
|
107
|
+
}
|
|
108
|
+
}, intervalMs);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
93
112
|
|
|
94
113
|
// 抽象方法:子类实现自己的逻辑
|
|
95
114
|
abstract Finish(): Promise<void>; // 推荐加 async/await 支持
|
|
96
115
|
|
|
97
|
-
/**注册模块,返回你的模块 构造函数 */
|
|
98
|
-
abstract RegisterModule(): any
|
|
99
|
-
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
|
|
@@ -132,5 +148,5 @@ export abstract class BaseLoading extends Component {
|
|
|
132
148
|
// }))
|
|
133
149
|
|
|
134
150
|
// //进度更新
|
|
135
|
-
// await
|
|
151
|
+
// await App.PromiseQueue(list, (completed, total) => { this.addProgess(completed / total) })
|
|
136
152
|
// }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export class BaseModuleConfig {
|
|
4
|
+
public modules = new Map<string, any>();
|
|
5
|
+
public getModule<T>(name: string, factory: () => T): T {
|
|
6
|
+
if (!this.modules.has(name)) {
|
|
7
|
+
this.modules.set(name, factory());
|
|
8
|
+
}
|
|
9
|
+
return this.modules.get(name);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ExIWindow {
|
|
14
|
+
Register(delegate: any);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export abstract class WindowHandler {
|
|
18
|
+
constructor(configMap: any, moduleName: string, funcList: string[]) {
|
|
19
|
+
Object.keys(configMap).forEach(key => {
|
|
20
|
+
const cof = configMap[key];
|
|
21
|
+
if (cof.module === moduleName) {
|
|
22
|
+
(this as any)[key] = async (params: any) => {
|
|
23
|
+
return await App.OpenWindow(configMap[key], params);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
this._impl = null
|
|
28
|
+
this.funcList = funcList
|
|
29
|
+
}
|
|
30
|
+
private _impl: any = null;
|
|
31
|
+
private funcList: string[] = [];
|
|
32
|
+
// 新增 Register 方法:自动将 impl 的方法挂到 this 上
|
|
33
|
+
public Register(impl: any) {
|
|
34
|
+
this._impl = impl;
|
|
35
|
+
// 遍历接口所有方法名
|
|
36
|
+
const methods: string[] = this.funcList;
|
|
37
|
+
for (const method of methods) {
|
|
38
|
+
if (typeof impl[method] === 'function') {
|
|
39
|
+
// 使用箭头函数保持 this 指向 impl
|
|
40
|
+
(this as any)[method] = (...args: any[]) => {
|
|
41
|
+
return impl[method].apply(impl, args);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"ver": "4.0.24",
|
|
3
|
-
"importer": "typescript",
|
|
4
|
-
"imported": true,
|
|
5
|
-
"uuid": "
|
|
6
|
-
"files": [],
|
|
7
|
-
"subMetas": {},
|
|
8
|
-
"userData": {}
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"ver": "4.0.24",
|
|
3
|
+
"importer": "typescript",
|
|
4
|
+
"imported": true,
|
|
5
|
+
"uuid": "be82897c-95e5-4d69-9c19-4ff84d7f02eb",
|
|
6
|
+
"files": [],
|
|
7
|
+
"subMetas": {},
|
|
8
|
+
"userData": {}
|
|
9
|
+
}
|
|
@@ -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
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
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
|
}
|