薛鸿潇 5 лет назад
Родитель
Сommit
21b62ef7b1

+ 3 - 3
mk_framework/assets/script/game/AudioManager.ts

@@ -1,6 +1,6 @@
 /**
 /**
  * 音频模块
  * 音频模块
- * @author xhx
+ * @author 薛鸿潇
  */
  */
 export default class AudioManager {
 export default class AudioManager {
 
 
@@ -51,7 +51,7 @@ export default class AudioManager {
     public async playMusic(audio_name: AUDIO_NAME, loop: boolean = true) {
     public async playMusic(audio_name: AUDIO_NAME, loop: boolean = true) {
         let asset = this._map_audio.get(audio_name);
         let asset = this._map_audio.get(audio_name);
         if (!asset) {
         if (!asset) {
-            asset = await mk.loader.loadAssetByType(AUDIO_PATH + audio_name, cc.AudioClip);
+            // asset = await mk.loader.loadAssetByType(AUDIO_PATH + audio_name, cc.AudioClip);
             this._map_audio.set(audio_name, asset);
             this._map_audio.set(audio_name, asset);
         }
         }
         mk.audio.playMusic(asset, loop);
         mk.audio.playMusic(asset, loop);
@@ -66,7 +66,7 @@ export default class AudioManager {
         if (this._switchEffect && this._switchTempEffect) {
         if (this._switchEffect && this._switchTempEffect) {
             let asset = this._map_audio.get(audio_name);
             let asset = this._map_audio.get(audio_name);
             if (!asset) {
             if (!asset) {
-                asset = await mk.loader.loadAssetByType(AUDIO_PATH + audio_name, cc.AudioClip);
+                // asset = await mk.loader.loadAssetByType(AUDIO_PATH + audio_name, cc.AudioClip);
                 this._map_audio.set(audio_name, asset);
                 this._map_audio.set(audio_name, asset);
             }
             }
             mk.audio.playEffect(asset, loop);
             mk.audio.playEffect(asset, loop);

+ 12 - 0
mk_framework/assets/script/game/component.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "8f1fc1ec-3edc-4f71-b5de-891eea4c9f62",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 49 - 0
mk_framework/assets/script/game/component/OpenWindow.ts

@@ -0,0 +1,49 @@
+/**
+ * 窗口打开模式
+ */
+enum WindowOpenMode {
+    /**
+     * 对当前打开的窗口不作处理并添加新的窗口
+     */
+    NotCloseAndAdd,
+    /**
+     * 如果新的窗口和当前打开的窗口路径一致则传递参数且不打开,否则为NotCloseAndAdd模式
+     */
+    NotCloseAndCover,
+    /**
+     * 关闭当前打开的窗口并添加新的窗口
+     */
+    CloseAndAdd,
+    /**
+     * 如果新的窗口和当前打开的窗口路径一致则传递参数且不打开,否则为CloseAndCover模式
+     */
+    CloseAndCover
+}
+
+const { ccclass, property } = cc._decorator;
+/**
+ * 打开窗口组件,定义窗口的参数、窗口的打开等
+ * @author 薛鸿潇
+ */
+@ccclass
+export default class OpenWindow extends cc.Component {
+
+    @property({ tooltip: "要加载的预制体对象相对于resources的路径" })
+    public prefabPath: string = '';
+    @property({ tooltip: "窗口打开的模式", type: cc.Enum(WindowOpenMode) })
+    public openMode: WindowOpenMode = WindowOpenMode.NotCloseAndAdd;
+    @property({ tooltip: "自定义参数" })
+    public params: string[] = [];
+    @property({ tooltip: "窗口打开触发的节点,不填则无触发", type: [cc.Node] })
+    public openFroms: cc.Node[] = [];
+    onLoad() {
+
+    }
+
+    start() {
+
+    }
+    private async open() {
+
+    }
+}

+ 9 - 0
mk_framework/assets/script/game/component/OpenWindow.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "7d3b9a5b-f60e-4981-aec4-dcf0abc9bc65",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 37 - 0
mk_framework/assets/script/game/component/UIMask.ts

@@ -0,0 +1,37 @@
+
+const TopEdgeDistance = 0;
+const BottomEdgeDistance = 0;
+const { ccclass, property } = cc._decorator;
+/**
+ * 窗口遮罩
+ * @author 薛鸿潇
+ */
+@ccclass//('UIMask')
+export class UIMask extends cc.Component {
+    @property({ type: cc.Node, tooltip: '遮罩节点' })
+    private node_mask: cc.Node = null;
+
+    start() {
+        this.node.zIndex = -10000;
+        this.adaptTopAndBottomBox();
+        this.node.getComponent(cc.Widget).updateAlignment();
+        this.node_mask.getComponent(cc.Widget).updateAlignment();
+    }
+    /**
+     * 全面屏适配
+     */
+    private adaptTopAndBottomBox() {
+        let widget = this.node.getComponent(cc.Widget);
+        widget.top = TopEdgeDistance;
+        widget.bottom = BottomEdgeDistance;
+    }
+
+    /**
+     * 设置遮罩显示 or 隐藏
+     * @param bVisible {boolen} 显示或隐藏
+     */
+    public setMaskVisible(bVisible: boolean) {
+        this.node_mask.active = bVisible;
+    }
+
+}

+ 9 - 0
mk_framework/assets/script/game/component/UIMask.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "58495feb-24e0-4d1a-8c44-2c54a9f06d9a",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 2 - 2
mk_framework/assets/script/mk/system/AudioSystem.ts

@@ -1,6 +1,6 @@
 /**
 /**
  * 音频模块
  * 音频模块
- * @author xhx
+ * @author 薛鸿潇
  */
  */
 export default class AudioSystem {
 export default class AudioSystem {
 
 
@@ -13,7 +13,7 @@ export default class AudioSystem {
     public playMusic(clip: cc.AudioClip, loop: boolean = false): number {
     public playMusic(clip: cc.AudioClip, loop: boolean = false): number {
         return cc.audioEngine.playMusic(clip, loop);
         return cc.audioEngine.playMusic(clip, loop);
     }
     }
-    
+
     /**
     /**
      * 播放音效文件
      * 播放音效文件
      * @param clip 
      * @param clip 

+ 6 - 0
mk_framework/assets/script/mk/system/GuideSystem.ts

@@ -0,0 +1,6 @@
+/**
+ * 新手引导模块
+ */
+export default class GuideSystem {
+
+}

+ 9 - 0
mk_framework/assets/script/mk/system/GuideSystem.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "ccad71d5-5e9a-4ec3-ab39-e6e75538da07",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 1 - 1
mk_framework/assets/script/mk/system/LoaderSystem.ts

@@ -18,7 +18,7 @@ export default class LoaderSystem {
      * @param complete_callback 完成回调【选填】
      * @param complete_callback 完成回调【选填】
      * @returns 对应的资源
      * @returns 对应的资源
      */
      */
-    public loadAssetByType(relative_path: string, asset_type, complete_callback?: Function) {
+    public loadAssetByType<T extends typeof cc.Asset>(relative_path: string, asset_type: T, complete_callback?: Function): Promise<InstanceType<T>> {
         return new Promise((resolve: (data) => void, reject) => {
         return new Promise((resolve: (data) => void, reject) => {
             this.getBundle().load(relative_path, asset_type, (error, asset) => {
             this.getBundle().load(relative_path, asset_type, (error, asset) => {
                 if (error) {
                 if (error) {

+ 1 - 1
mk_framework/assets/script/mk/system/MKSystem.ts

@@ -4,7 +4,7 @@ import TimeUtil from "../utils/TimeUtil";
 import AudioSystem from "./AudioSystem";
 import AudioSystem from "./AudioSystem";
 import DataSystem from "./DataSystem";
 import DataSystem from "./DataSystem";
 import HttpSystem from "./HttpSystem";
 import HttpSystem from "./HttpSystem";
-import LoaderSystem from "./LoaderSystem";
+import LoaderSystem from "../utils/LoadResUtil";
 
 
 
 
 class MKSystem {
 class MKSystem {

+ 6 - 3
mk_framework/assets/script/mk/utils/StringUtil.ts

@@ -1,10 +1,12 @@
 /**
 /**
  * 字符串工具类
  * 字符串工具类
- * @author xhx
+ * @author 薛鸿潇
  */
  */
 export default class StringUtil {
 export default class StringUtil {
 
 
-    /** 颜色表 */
+    /** 
+     * 颜色表
+     */
     private str_color = {
     private str_color = {
         /** 红色1 */
         /** 红色1 */
         red1: '#be2c1d',
         red1: '#be2c1d',
@@ -12,7 +14,8 @@ export default class StringUtil {
         bro1: '#4E301B',
         bro1: '#4E301B',
     }
     }
 
 
-    /** 将数据表里的字符串转成相对颜色
+    /** 
+     * 将数据表里的字符串转成相对颜色
      * @param 需要转换的字符串 比如  "你好[red中国]" 其中“中国”为红色...你好[red{s40}中国]
      * @param 需要转换的字符串 比如  "你好[red中国]" 其中“中国”为红色...你好[red{s40}中国]
      * @return 返回一个富文本字符串
      * @return 返回一个富文本字符串
      * @author xhx
      * @author xhx