@cc-component/cc-core 1.0.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.
Files changed (194) hide show
  1. package/.cc-ex-component.md +12 -0
  2. package/assets/core/config/CommonEnum.ts +94 -0
  3. package/assets/core/config/CommonEnum.ts.meta +9 -0
  4. package/assets/core/config/IConfig.ts +89 -0
  5. package/assets/core/config/IConfig.ts.meta +9 -0
  6. package/assets/core/config/LayerType.ts +44 -0
  7. package/assets/core/config/LayerType.ts.meta +9 -0
  8. package/assets/core/config/LayerUI.ts +113 -0
  9. package/assets/core/config/LayerUI.ts.meta +9 -0
  10. package/assets/core/config.meta +9 -0
  11. package/assets/core/editor/LanguageManager.ts +323 -0
  12. package/assets/core/editor/LanguageManager.ts.meta +9 -0
  13. package/assets/core/editor/SpineRunner.ts +39 -0
  14. package/assets/core/editor/SpineRunner.ts.meta +9 -0
  15. package/assets/core/editor/i18nEditorComponent.ts +137 -0
  16. package/assets/core/editor/i18nEditorComponent.ts.meta +9 -0
  17. package/assets/core/editor.meta +9 -0
  18. package/assets/core/home/AudioUtil.ts +164 -0
  19. package/assets/core/home/AudioUtil.ts.meta +9 -0
  20. package/assets/core/home/BaseBoxView.ts +60 -0
  21. package/assets/core/home/BaseBoxView.ts.meta +9 -0
  22. package/assets/core/home/BaseLaunchComponent.ts +9 -0
  23. package/assets/core/home/BaseLaunchComponent.ts.meta +9 -0
  24. package/assets/core/home/BaseLoading.ts +136 -0
  25. package/assets/core/home/BaseLoading.ts.meta +9 -0
  26. package/assets/core/home/BaseSkeleton.ts +39 -0
  27. package/assets/core/home/BaseSkeleton.ts.meta +9 -0
  28. package/assets/core/home/CameraAngel.ts +326 -0
  29. package/assets/core/home/CameraAngel.ts.meta +9 -0
  30. package/assets/core/home/DouYinShow.ts +27 -0
  31. package/assets/core/home/DouYinShow.ts.meta +9 -0
  32. package/assets/core/home/EventManager.ts +39 -0
  33. package/assets/core/home/EventManager.ts.meta +9 -0
  34. package/assets/core/home/ExView.ts +9 -0
  35. package/assets/core/home/ExView.ts.meta +9 -0
  36. package/assets/core/home/FollowCamera.ts +205 -0
  37. package/assets/core/home/FollowCamera.ts.meta +9 -0
  38. package/assets/core/home/InViewCenter.ts +52 -0
  39. package/assets/core/home/InViewCenter.ts.meta +9 -0
  40. package/assets/core/home/JsonUtil.ts +102 -0
  41. package/assets/core/home/JsonUtil.ts.meta +9 -0
  42. package/assets/core/home/LoadingWindow.ts +44 -0
  43. package/assets/core/home/LoadingWindow.ts.meta +9 -0
  44. package/assets/core/home/ParabolaTween.ts +110 -0
  45. package/assets/core/home/ParabolaTween.ts.meta +9 -0
  46. package/assets/core/home/ProgessView.ts +96 -0
  47. package/assets/core/home/ProgessView.ts.meta +9 -0
  48. package/assets/core/home/Quaternion.ts +237 -0
  49. package/assets/core/home/Quaternion.ts.meta +9 -0
  50. package/assets/core/home/ResUtil.ts +132 -0
  51. package/assets/core/home/ResUtil.ts.meta +9 -0
  52. package/assets/core/home/ResourceManager.ts +430 -0
  53. package/assets/core/home/ResourceManager.ts.meta +9 -0
  54. package/assets/core/home/StateMachine.ts +93 -0
  55. package/assets/core/home/StateMachine.ts.meta +9 -0
  56. package/assets/core/home/StorageManager.ts +161 -0
  57. package/assets/core/home/StorageManager.ts.meta +9 -0
  58. package/assets/core/home/ThirdFreeLookCamera.ts +201 -0
  59. package/assets/core/home/ThirdFreeLookCamera.ts.meta +9 -0
  60. package/assets/core/home/TimeManager.ts +486 -0
  61. package/assets/core/home/TimeManager.ts.meta +9 -0
  62. package/assets/core/home/Tools.ts +103 -0
  63. package/assets/core/home/Tools.ts.meta +9 -0
  64. package/assets/core/home/prefabs.meta +12 -0
  65. package/assets/core/home/util/EncryptUtil.ts +60 -0
  66. package/assets/core/home/util/EncryptUtil.ts.meta +11 -0
  67. package/assets/core/home/util/MathUtil.ts +22 -0
  68. package/assets/core/home/util/MathUtil.ts.meta +9 -0
  69. package/assets/core/home/util/Md5.ts +202 -0
  70. package/assets/core/home/util/Md5.ts.meta +11 -0
  71. package/assets/core/home/util/RandomUtil.ts +61 -0
  72. package/assets/core/home/util/RandomUtil.ts.meta +9 -0
  73. package/assets/core/home/util/ResUtil.ts +129 -0
  74. package/assets/core/home/util/ResUtil.ts.meta +9 -0
  75. package/assets/core/home/util/crypto-js.d.ts +30 -0
  76. package/assets/core/home/util/crypto-js.d.ts.meta +11 -0
  77. package/assets/core/home/util/crypto-js.js +6030 -0
  78. package/assets/core/home/util/crypto-js.js.meta +9 -0
  79. package/assets/core/home/util.meta +12 -0
  80. package/assets/core/home.meta +12 -0
  81. package/assets/core/interface/ISceneParam.ts +11 -0
  82. package/assets/core/interface/ISceneParam.ts.meta +9 -0
  83. package/assets/core/interface/Interface.ts +160 -0
  84. package/assets/core/interface/Interface.ts.meta +1 -0
  85. package/assets/core/interface/MainModule.ts +1019 -0
  86. package/assets/core/interface/MainModule.ts.meta +9 -0
  87. package/assets/core/interface.meta +9 -0
  88. package/assets/core/lib/Logger.ts +286 -0
  89. package/assets/core/lib/Logger.ts.meta +9 -0
  90. package/assets/core/lib/language/.language.md +1 -0
  91. package/assets/core/lib/language/Language.ts +133 -0
  92. package/assets/core/lib/language/Language.ts.meta +13 -0
  93. package/assets/core/lib/language/LanguageData.ts +114 -0
  94. package/assets/core/lib/language/LanguageData.ts.meta +9 -0
  95. package/assets/core/lib/language/LanguageLabel.ts +172 -0
  96. package/assets/core/lib/language/LanguageLabel.ts.meta +13 -0
  97. package/assets/core/lib/language/LanguagePack.ts +126 -0
  98. package/assets/core/lib/language/LanguagePack.ts.meta +13 -0
  99. package/assets/core/lib/language/LanguagePointLabel.ts.meta +16 -0
  100. package/assets/core/lib/language/LanguageSpine.ts +60 -0
  101. package/assets/core/lib/language/LanguageSpine.ts.meta +9 -0
  102. package/assets/core/lib/language/LanguageSprite.ts +138 -0
  103. package/assets/core/lib/language/LanguageSprite.ts.meta +13 -0
  104. package/assets/core/lib/language.meta +9 -0
  105. package/assets/core/lib/logger/ELoggerLevel.ts +16 -0
  106. package/assets/core/lib/logger/ELoggerLevel.ts.meta +9 -0
  107. package/assets/core/lib/logger/MLogger.ts +118 -0
  108. package/assets/core/lib/logger/MLogger.ts.meta +9 -0
  109. package/assets/core/lib/logger.meta +9 -0
  110. package/assets/core/lib/net/libs/proto/output/protobuf.d.ts +2729 -0
  111. package/assets/core/lib/net/libs/proto/output/protobuf.d.ts.meta +9 -0
  112. package/assets/core/lib/net/libs/proto/output/protobuf.min.js +8 -0
  113. package/assets/core/lib/net/libs/proto/output/protobuf.min.js.meta +9 -0
  114. package/assets/core/lib/net/libs/proto/output/protobuf_custom.d.ts +102 -0
  115. package/assets/core/lib/net/libs/proto/output/protobuf_custom.d.ts.meta +9 -0
  116. package/assets/core/lib/net/libs/proto/output/protobuf_custom.js +222 -0
  117. package/assets/core/lib/net/libs/proto/output/protobuf_custom.js.meta +9 -0
  118. package/assets/core/lib/net/libs/proto/output.meta +9 -0
  119. package/assets/core/lib/net/libs/proto/source/Cmd.proto +6 -0
  120. package/assets/core/lib/net/libs/proto/source/Cmd.proto.meta +11 -0
  121. package/assets/core/lib/net/libs/proto/source/UserLogin.proto +12 -0
  122. package/assets/core/lib/net/libs/proto/source/UserLogin.proto.meta +11 -0
  123. package/assets/core/lib/net/libs/proto/source/base.proto +24 -0
  124. package/assets/core/lib/net/libs/proto/source/base.proto.meta +11 -0
  125. package/assets/core/lib/net/libs/proto/source/command.proto +31 -0
  126. package/assets/core/lib/net/libs/proto/source/command.proto.meta +11 -0
  127. package/assets/core/lib/net/libs/proto/source/domain/boos_battle_info.proto +13 -0
  128. package/assets/core/lib/net/libs/proto/source/domain/boos_battle_info.proto.meta +11 -0
  129. package/assets/core/lib/net/libs/proto/source/domain/player_auth.proto +26 -0
  130. package/assets/core/lib/net/libs/proto/source/domain/player_auth.proto.meta +11 -0
  131. package/assets/core/lib/net/libs/proto/source/domain.meta +9 -0
  132. package/assets/core/lib/net/libs/proto/source/message/game_push.proto +23 -0
  133. package/assets/core/lib/net/libs/proto/source/message/game_push.proto.meta +11 -0
  134. package/assets/core/lib/net/libs/proto/source/message/game_request.proto +24 -0
  135. package/assets/core/lib/net/libs/proto/source/message/game_request.proto.meta +11 -0
  136. package/assets/core/lib/net/libs/proto/source/message/game_response.proto +24 -0
  137. package/assets/core/lib/net/libs/proto/source/message/game_response.proto.meta +11 -0
  138. package/assets/core/lib/net/libs/proto/source/message.meta +9 -0
  139. package/assets/core/lib/net/libs/proto/source/push/boss_battle_events.proto +43 -0
  140. package/assets/core/lib/net/libs/proto/source/push/boss_battle_events.proto.meta +11 -0
  141. package/assets/core/lib/net/libs/proto/source/push.meta +9 -0
  142. package/assets/core/lib/net/libs/proto/source.meta +12 -0
  143. package/assets/core/lib/net/libs/proto.meta +9 -0
  144. package/assets/core/lib/net/libs.meta +9 -0
  145. package/assets/core/lib/net/net/HttpManager.ts +307 -0
  146. package/assets/core/lib/net/net/HttpManager.ts.meta +9 -0
  147. package/assets/core/lib/net/net/NetInterface.ts +114 -0
  148. package/assets/core/lib/net/net/NetInterface.ts.meta +9 -0
  149. package/assets/core/lib/net/net/NetManager.ts +77 -0
  150. package/assets/core/lib/net/net/NetManager.ts.meta +9 -0
  151. package/assets/core/lib/net/net/NetNode.ts +471 -0
  152. package/assets/core/lib/net/net/NetNode.ts.meta +9 -0
  153. package/assets/core/lib/net/net/WebSock.ts +81 -0
  154. package/assets/core/lib/net/net/WebSock.ts.meta +9 -0
  155. package/assets/core/lib/net/net/custom/NetChannelManager.ts +41 -0
  156. package/assets/core/lib/net/net/custom/NetChannelManager.ts.meta +9 -0
  157. package/assets/core/lib/net/net/custom/NetConfig.ts +11 -0
  158. package/assets/core/lib/net/net/custom/NetConfig.ts.meta +9 -0
  159. package/assets/core/lib/net/net/custom/NetErrorCode.ts +4 -0
  160. package/assets/core/lib/net/net/custom/NetErrorCode.ts.meta +9 -0
  161. package/assets/core/lib/net/net/custom/NetGameTips.ts +53 -0
  162. package/assets/core/lib/net/net/custom/NetGameTips.ts.meta +9 -0
  163. package/assets/core/lib/net/net/custom/NetNodeGame.ts +105 -0
  164. package/assets/core/lib/net/net/custom/NetNodeGame.ts.meta +9 -0
  165. package/assets/core/lib/net/net/custom.meta +9 -0
  166. package/assets/core/lib/net/net/protocol/NetProtocolJson.ts +39 -0
  167. package/assets/core/lib/net/net/protocol/NetProtocolJson.ts.meta +9 -0
  168. package/assets/core/lib/net/net/protocol/NetProtocolProtobuf.ts +85 -0
  169. package/assets/core/lib/net/net/protocol/NetProtocolProtobuf.ts.meta +9 -0
  170. package/assets/core/lib/net/net/protocol.meta +9 -0
  171. package/assets/core/lib/net/net.meta +9 -0
  172. package/assets/core/lib/net/prompt.meta +9 -0
  173. package/assets/core/lib/net.meta +9 -0
  174. package/assets/core/lib/old/VM2.ts +619 -0
  175. package/assets/core/lib/old/VM2.ts.meta +9 -0
  176. package/assets/core/lib/old/ViewModel.ts +905 -0
  177. package/assets/core/lib/old/ViewModel.ts.meta +9 -0
  178. package/assets/core/lib/old/ViewSearch.ts +125 -0
  179. package/assets/core/lib/old/ViewSearch.ts.meta +9 -0
  180. package/assets/core/lib/old.meta +9 -0
  181. package/assets/core/lib/tabbar/TabBarComponent.ts +113 -0
  182. package/assets/core/lib/tabbar/TabBarComponent.ts.meta +9 -0
  183. package/assets/core/lib/tabbar/TabBarController.ts +86 -0
  184. package/assets/core/lib/tabbar/TabBarController.ts.meta +9 -0
  185. package/assets/core/lib/tabbar/TabBarItem.ts +52 -0
  186. package/assets/core/lib/tabbar/TabBarItem.ts.meta +9 -0
  187. package/assets/core/lib/tabbar.meta +9 -0
  188. package/assets/core/lib.meta +12 -0
  189. package/assets/core.meta +9 -0
  190. package/assets.meta +9 -0
  191. package/index.ts +3 -0
  192. package/index.ts.meta +9 -0
  193. package/package.json +19 -0
  194. package/package.json.meta +11 -0
@@ -0,0 +1,12 @@
1
+ # 系统组件添加常用扩展方法
2
+
3
+ ## 前置条件
4
+ [游戏引擎](https://www.cocos.com/en/creator-download)
5
+ [开发框架](https://github.com/a1076559139/cocos-creator-frame-3d)
6
+
7
+ ## 使用案例
8
+ ```TS
9
+ import {} from 'db://pkg/@gamex/cc-ex-component';
10
+
11
+ ...
12
+ ```
@@ -0,0 +1,94 @@
1
+ import { Prefab, SpriteFrame, JsonAsset, sp } from "cc";
2
+ import { Enum } from "cc";
3
+ import { LayerType } from "./LayerType";
4
+ import { BaseLaunchComponent } from "../home/BaseLaunchComponent";
5
+ import { BufferAsset } from "cc";
6
+
7
+ export enum SystemMessage {
8
+ /**打开窗口 */
9
+ OpenWindow = "OpenWindow",
10
+ /**关闭窗口 */
11
+ CloseWindow = "OpenWindow"
12
+ }
13
+ export interface IExtData {
14
+ is_show_alert?: boolean
15
+ query: boolean;
16
+ }
17
+ export interface IHttpConfig { type: HttpType, url: string }
18
+
19
+ export enum HttpType {
20
+ GET,
21
+ POST,
22
+ }
23
+ export interface IBundleConfig {
24
+ layer: LayerType,
25
+ path: string;
26
+ bundle: BundleConfigName;
27
+ name?: string;
28
+ index?: number;
29
+ is_load_sub?: boolean;
30
+ /**是否记录-不记录可重复打开窗口 */
31
+ is_record?: boolean;
32
+
33
+ }
34
+ export enum BundleConfigName {
35
+ home = "home",
36
+ game = "game",
37
+ common = "common",
38
+ resources = "resources",
39
+ }
40
+ export enum BundleConfig {
41
+ home = 0,
42
+ game = 1,
43
+ tools = 2,
44
+ common = 3,
45
+ }
46
+ Enum(BundleConfig)
47
+ export enum AssetType {
48
+ spriteFrame = 0,
49
+ prefab = 1,
50
+ SpriteAtlas = 2,
51
+ jsonAsset = 3,
52
+ bufferAsset = 4,
53
+ spine = 5,
54
+ }
55
+ Enum(AssetType)
56
+
57
+ export const GetAssetType = function (type: AssetType) {
58
+ switch (type) {
59
+ case AssetType.prefab:
60
+ return Prefab
61
+ case AssetType.spriteFrame:
62
+ return SpriteFrame
63
+ case AssetType.jsonAsset:
64
+ return JsonAsset
65
+ case AssetType.jsonAsset:
66
+ return BufferAsset
67
+ case AssetType.spine:
68
+ return sp.SkeletonData
69
+ default:
70
+ return Prefab;
71
+ }
72
+ }
73
+ export enum DirectionScroll {
74
+ UP,
75
+ DOWN,
76
+ NONE,
77
+ }
78
+
79
+ export const ResConfig = {
80
+ DEBUG: true,
81
+ }
82
+
83
+
84
+ export interface IInitConfig {
85
+ /**游戏配置-bundle 名称 */
86
+ bundleName: string;
87
+ launchComponent: { new(): BaseLaunchComponent };
88
+ }
89
+
90
+
91
+ export interface IWindowParam {
92
+ callBack?: Function;
93
+ [key: string]: any;
94
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "4.0.24",
3
+ "importer": "typescript",
4
+ "imported": true,
5
+ "uuid": "5e1ba3c5-4a03-48a7-8c64-48cedbbceaff",
6
+ "files": [],
7
+ "subMetas": {},
8
+ "userData": {}
9
+ }
@@ -0,0 +1,89 @@
1
+
2
+ /**
3
+ * 应用程序主配置接口
4
+ */
5
+ export interface IConfig {
6
+ /**调试模式 */
7
+ debug: boolean;
8
+ /** 配置类型 (dev/test/prod) */
9
+ type: string;
10
+
11
+ /** 不同环境的配置 */
12
+ config: {
13
+ /** 开发环境配置 */
14
+ dev: EnvironmentConfig;
15
+ /** 测试环境配置 */
16
+ test: EnvironmentConfig;
17
+ /** 生产环境配置 */
18
+ prod: EnvironmentConfig;
19
+ };
20
+
21
+ /** GUI层级配置数组 */
22
+ gui: GuiLayer[];
23
+
24
+ /** 多语言配置 */
25
+ language: {
26
+ /** 默认语言 */
27
+ default: string;
28
+ /** 支持的语言类型列表 */
29
+ type: string[];
30
+ /** 各类资源路径配置 */
31
+ path: {
32
+ /** JSON语言包路径 */
33
+ json: string;
34
+ /** 纹理资源路径 */
35
+ texture: string;
36
+ /** Spine动画资源路径 */
37
+ spine: string;
38
+ };
39
+ };
40
+
41
+ /** Bundle配置 */
42
+ bundle: {
43
+ /** 默认bundle名称 */
44
+ default: string;
45
+ };
46
+ }
47
+
48
+ /**
49
+ * 环境配置接口
50
+ */
51
+ export interface EnvironmentConfig {
52
+ /** 版本号 */
53
+ version: string;
54
+ /** 本地数据加密密钥 */
55
+ localDataKey: string;
56
+ /** 本地数据加密初始向量 */
57
+ localDataIv: string;
58
+ /** 帧率设置 */
59
+ frameRate: number;
60
+ /** 加载超时GUI时间(ms) */
61
+ loadingTimeoutGui: number;
62
+ /** 移动设备安全区域适配开关 */
63
+ mobileSafeArea: boolean;
64
+ /** 性能统计显示开关 */
65
+ stats: boolean;
66
+ /** HTTP服务器地址 */
67
+ httpServer: string;
68
+ /** HTTP请求超时时间(ms) */
69
+ httpTimeout: number;
70
+ /** WebSocket服务器地址 */
71
+ webSocketServer: string;
72
+ /** WebSocket心跳间隔时间(ms) */
73
+ webSocketHeartTime: number;
74
+ /** WebSocket接收超时时间(ms) */
75
+ webSocketReceiveTime: number;
76
+ /** WebSocket重连超时时间(ms) */
77
+ webSocketReconnetTimeOut: number;
78
+ }
79
+
80
+ /**
81
+ * GUI层配置接口
82
+ */
83
+ export interface GuiLayer {
84
+ /** 层级名称 */
85
+ name: string;
86
+ /** 层级类型 */
87
+ type: string;
88
+ }
89
+
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "4.0.24",
3
+ "importer": "typescript",
4
+ "imported": true,
5
+ "uuid": "062b015d-781b-4b94-8fb1-7bdfc3566836",
6
+ "files": [],
7
+ "subMetas": {},
8
+ "userData": {}
9
+ }
@@ -0,0 +1,44 @@
1
+ export enum LayerType {
2
+ /**
3
+ * 游戏层 - 最底层,用于放置游戏主场景内容
4
+ */
5
+ LayerGame = "LayerGame",
6
+
7
+ /**
8
+ * UI层 - 用于放置基础UI元素
9
+ */
10
+ LayerUI = "LayerUI",
11
+
12
+ /**
13
+ * 弹窗层 - 用于放置普通弹窗界面
14
+ */
15
+ LayerPopUp = "LayerPopUp",
16
+
17
+ /**
18
+ * 对话框层 - 用于放置对话框界面
19
+ */
20
+ LayerDialog = "LayerDialog",
21
+
22
+ /**
23
+ * 系统层 - 用于放置系统级界面(如设置、系统提示等)
24
+ */
25
+ LayerSystem = "LayerSystem",
26
+
27
+ /**
28
+ * 通知层 - 用于放置通知、提示信息
29
+ */
30
+ LayerNotify = "LayerNotify",
31
+
32
+ /**
33
+ * 引导层 - 最顶层,用于放置新手引导相关元素
34
+ */
35
+ LayerGuide = "LayerGuide",
36
+ /**
37
+ * 事件阻挡层 - 最顶层-UI,
38
+ */
39
+ LayerBlockEventsUI = "LayerBlockEventsUI",
40
+ /**
41
+ * 事件阻挡层 - 最顶层-网络,
42
+ */
43
+ LayerBlockEventsNet = "LayerBlockEventsNet",
44
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "4.0.24",
3
+ "importer": "typescript",
4
+ "imported": true,
5
+ "uuid": "17d54914-8132-4395-bfde-58e0ff435ee1",
6
+ "files": [],
7
+ "subMetas": {},
8
+ "userData": {}
9
+ }
@@ -0,0 +1,113 @@
1
+ import { JsonAsset, Layers, Widget } from 'cc';
2
+ import { _decorator, Node } from 'cc';
3
+ import { EnvironmentConfig, IConfig } from './IConfig';
4
+ import { LayerType } from './LayerType';
5
+ import { LoadingWindow } from '../home/LoadingWindow';
6
+ import { Canvas, director } from 'cc';
7
+ import { ResourceManager } from '../home/ResourceManager';
8
+ import { BundleConfigName, IInitConfig } from './CommonEnum';
9
+ import { Logger, LogType } from '../lib/Logger';
10
+ import { ISceneParam } from '../interface/ISceneParam';
11
+ import { BlockInputEvents } from 'cc';
12
+ import { BaseLaunchComponent } from '../home/BaseLaunchComponent';
13
+ const { ccclass, property } = _decorator;
14
+
15
+ @ccclass('LayerUI')
16
+ export class LayerUI {
17
+ /**配置 */
18
+ public config: IConfig;
19
+ public get current_config(): EnvironmentConfig {
20
+ return this.config.config[this.config.type]
21
+ }
22
+ /**获取指定ui层 */
23
+ public GetLayer(type: LayerType) { return this.ui_map.get(type); }
24
+
25
+ /**加载转圈窗口 */
26
+ public loadingWindow: Node;
27
+ public LayerWindow: Node;
28
+
29
+
30
+ private ui_map: Map<string, Node> = new Map();
31
+ bundleName: string = "";
32
+
33
+ loading_call: { open: (finish: () => void) => void, close: () => void }
34
+ progess: { open: (finish: () => void) => void, close: () => void, progess: (progress: number) => void }
35
+
36
+ scene: ISceneParam
37
+ launch: BaseLaunchComponent;
38
+
39
+ async loadConfig(params: IInitConfig) {
40
+ this.launch = await this.LoadLayerWindow(params);
41
+ const parent = this.launch.node
42
+ const data = await MainModule.loadAsset<JsonAsset>(params.bundleName, "config", JsonAsset)
43
+ this.config = data.json as IConfig;
44
+ console.log(this.config)
45
+
46
+ const config = this.config;
47
+ config.gui.forEach(element => {
48
+ const node = LayerUI.CreateNnode(element.name);
49
+ node.parent = parent
50
+ this.ui_map.set(element.name, node);
51
+ });
52
+ this.initLog();
53
+
54
+ //事件阻挡层
55
+ [LayerType.LayerBlockEventsUI, LayerType.LayerBlockEventsNet].forEach(element => {
56
+ const node = LayerUI.CreateNnode(element);
57
+ node.addComponent(BlockInputEvents);
58
+ node.parent = parent
59
+ node.getComponent(Widget).updateAlignment()
60
+ node.active = false;
61
+ this.ui_map.set(element, node);
62
+ });
63
+
64
+ //加载配置bundle
65
+ const bundle = await ResourceManager.loadBundle(config.bundle.default);
66
+ this.launch.InitGame();
67
+ }
68
+
69
+ public static CreateNnode(name: string) {
70
+ const node = new Node(name);
71
+ node.layer = Layers.Enum.UI_2D;
72
+ const w: Widget = node.addComponent(Widget);
73
+ w.isAlignLeft = w.isAlignRight = w.isAlignTop = w.isAlignBottom = true;
74
+ w.left = w.right = w.top = w.bottom = 0;
75
+ w.alignMode = 2;
76
+ w.enabled = true;
77
+ return node;
78
+ }
79
+
80
+ async LoadLayerWindow(params: IInitConfig) {
81
+ return new Promise<BaseLaunchComponent>(async resolve => {
82
+ let prefabNode = LayerUI.CreateNnode("LayerWindow")
83
+ prefabNode.addComponent(Canvas)
84
+ const view = prefabNode.addComponent(params.launchComponent)
85
+ this.LayerWindow = prefabNode;
86
+ director.getScene().addChild(prefabNode);
87
+ director.addPersistRootNode(prefabNode);
88
+ resolve(view);
89
+ });
90
+ }
91
+ setBundleName(value: string) { this.bundleName = value; }
92
+ initLog() {
93
+ const debug = this.config.debug
94
+ Logger.setTags(debug ? null : LogType.Close)
95
+ Logger.logView(debug);
96
+
97
+ if (debug) {
98
+ console.log("是debug模式");
99
+ } else {
100
+ console.log("发布模式");
101
+ console.log = function () { }; // 关闭普通日志输出
102
+ console.warn = function () { }; // 关闭警告输出
103
+ // console.error = function () { }; // 关闭错误输出
104
+ console.info = function () { }
105
+ }
106
+ }
107
+
108
+
109
+
110
+
111
+ }
112
+
113
+
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "4.0.24",
3
+ "importer": "typescript",
4
+ "imported": true,
5
+ "uuid": "afbb2ae4-8ba4-45e8-b192-8d60f1ff5f5e",
6
+ "files": [],
7
+ "subMetas": {},
8
+ "userData": {}
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "1.2.0",
3
+ "importer": "directory",
4
+ "imported": true,
5
+ "uuid": "b202e4a4-fd9e-4be9-b2a1-520cd6ed16a7",
6
+ "files": [],
7
+ "subMetas": {},
8
+ "userData": {}
9
+ }