zouyong 5 anni fa
parent
commit
a829d951ee

+ 0 - 15
mk_framework/.vscode/launch.json

@@ -1,15 +0,0 @@
-{
-    // 使用 IntelliSense 了解相关属性。 
-    // 悬停以查看现有属性的描述。
-    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
-    "version": "0.2.0",
-    "configurations": [
-        {
-            "type": "pwa-chrome",
-            "request": "launch",
-            "name": "Launch Chrome against localhost",
-            "url": "http://localhost:8080",
-            "webRoot": "${workspaceFolder}"
-        }
-    ]
-}

+ 0 - 20
mk_framework/.vscode/tasks.json

@@ -1,20 +0,0 @@
-{
-    // See https://go.microsoft.com/fwlink/?LinkId=733558
-    // for the documentation about the tasks.json format
-    "version": "2.0.0",
-    "tasks": [
-        {
-            "label": "compile",
-            "command": "curl",
-            "args": ["http://localhost:7456/update-db"],
-            "type":"shell",
-            // "isShellCommand": true,
-            "isBackground": true,
-            "group": "build",
-            "presentation": {
-                // Reveal the output only if unrecognized errors occur.
-                "reveal": "always"
-            },
-        }    
-    ]
-}

+ 2 - 2
mk_framework/assets/scene/MainScene.fire

@@ -275,7 +275,7 @@
     "_id": "29zXboiXFBKoIV4PQ2liTe"
     "_id": "29zXboiXFBKoIV4PQ2liTe"
   },
   },
   {
   {
-    "__type__": "f0038hKHC9Nf5+ipaUV9rc5",
+    "__type__": "ca47c5VYotGv4F867baLZGr",
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
@@ -283,6 +283,6 @@
     },
     },
     "_enabled": true,
     "_enabled": true,
     "mainfestUrl": null,
     "mainfestUrl": null,
-    "_id": "c4ULP9xvJHFrQ1rqZQ7y7B"
+    "_id": "6fbJRZsUhE4p90rFOw/XX3"
   }
   }
 ]
 ]

+ 13 - 0
mk_framework/assets/script/Main.ts

@@ -0,0 +1,13 @@
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class main extends cc.Component {
+    @property({
+        type: cc.Asset,
+    })
+    mainfestUrl: cc.Asset = null;
+    
+    start() {
+        console.log(mk.time.format(12345));   
+    }
+}

+ 1 - 1
mk_framework/assets/script/game/module/main/MainUI.ts.meta → mk_framework/assets/script/Main.ts.meta

@@ -1,6 +1,6 @@
 {
 {
   "ver": "1.0.8",
   "ver": "1.0.8",
-  "uuid": "691fe835-df53-4382-8a08-bfe59ee3e0b0",
+  "uuid": "ca47ce55-628b-46bf-817c-ebb6da2d91ab",
   "isPlugin": false,
   "isPlugin": false,
   "loadPluginInWeb": true,
   "loadPluginInWeb": true,
   "loadPluginInNative": true,
   "loadPluginInNative": true,

+ 1 - 1
mk_framework/assets/script/game/module/main.meta → mk_framework/assets/script/game/module/game.meta

@@ -1,6 +1,6 @@
 {
 {
   "ver": "1.1.2",
   "ver": "1.1.2",
-  "uuid": "845995d2-76bb-4b7a-bb41-4a3803506559",
+  "uuid": "811dc117-6663-40a3-bbfe-0d735a27abc7",
   "isBundle": false,
   "isBundle": false,
   "bundleName": "",
   "bundleName": "",
   "priority": 1,
   "priority": 1,

+ 15 - 0
mk_framework/assets/script/game/module/game/GameUI.ts

@@ -0,0 +1,15 @@
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class GameUI extends cc.Component {
+
+    onLoad(){
+        
+    }
+
+    start() {
+        
+        
+    }
+}
+

+ 9 - 0
mk_framework/assets/script/game/module/game/GameUI.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "587105f5-634e-4457-8278-79815eeae4ac",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
mk_framework/assets/script/game/module/game/Test.ts

@@ -0,0 +1,12 @@
+
+export default class Test  {
+    constructor(){
+        this.init();
+    }
+    
+    init(){
+        
+        
+    }
+}
+

+ 9 - 0
mk_framework/assets/script/game/module/game/Test.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "b0941a02-c4d4-470e-91a5-4f40ca0ca442",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 0 - 0
mk_framework/assets/script/game/module/load/1.txt


+ 0 - 5
mk_framework/assets/script/game/module/load/1.txt.meta

@@ -1,5 +0,0 @@
-{
-  "ver": "2.0.0",
-  "uuid": "4816ebb0-f5dc-4357-ad21-b0b14d5b43d7",
-  "subMetas": {}
-}

+ 9 - 0
mk_framework/assets/script/game/module/load/LoadingUI.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "4c5c2129-1f75-46cd-8fe6-196785af6eb5",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 0 - 24
mk_framework/assets/script/game/module/main/MainUI.ts

@@ -1,24 +0,0 @@
-const { ccclass, property } = cc._decorator;
-
-@ccclass
-export default class MainUI extends cc.Component {
-
-    onLoad(){
-        
-    }
-
-    start() {
-        
-        this.initSystem();
-    }
-
-    private initSystem(){
-        //工具
-
-
-        //sdk
-
-        
-    }
-}
-

+ 17 - 16
mk_framework/assets/script/mk/system/MKSystem.ts

@@ -3,37 +3,38 @@ import TimeUtil from "../utils/TimeUtil";
 import LoaderSystem from "./LoaderSystem";
 import LoaderSystem from "./LoaderSystem";
 
 
 
 
-const { ccclass, property } = cc._decorator;
+class MKSystem {
+    constructor(){
+        this.init();
+    }
 
 
-@ccclass
-export default class MKSystem extends cc.Component {
-    @property({
-        type: cc.Asset,
-    })
-    mainfestUrl: cc.Asset = null;
+    /** 工具 */
+    time:TimeUtil;
+    file:FileUtil;
 
 
-    time: TimeUtil;
-    public loader: LoaderSystem;
-    public file: FileUtil;
+    /** SDK */
 
 
-    start() {
+    /** 系统管理 */
+    loader:LoaderSystem;
 
 
+    init() {
         this.initSystem();
         this.initSystem();
     }
     }
 
 
-    private initSystem() {
+    initSystem() {
         //工具
         //工具
         this.time = new TimeUtil();
         this.time = new TimeUtil();
-        this.loader = new LoaderSystem();
         this.file = new FileUtil();
         this.file = new FileUtil();
-        //sdk
-
 
 
+        //sdk
+        
+        //system
+        this.loader = new LoaderSystem();
     }
     }
 }
 }
 
 
 declare global {
 declare global {
-    const mk: MKSystem;
+    const mk: MKSystem 
 }
 }
 window['mk'] = new MKSystem();
 window['mk'] = new MKSystem();
 
 

+ 42 - 76
mk_framework/assets/script/mk/utils/TimeUtil.ts

@@ -1,97 +1,63 @@
+/**
+ * @description 时间工具类
+ * @author zy
+ */
 export default class TimeUtil {
 export default class TimeUtil {
     constructor() {
     constructor() {
 
 
     }
     }
-    /**
-         * 获取当前日期
-         * @param replace 间隔符,默认'-',则返回2020-10-10
-         * @returns 当前时间字符串
-         */
-    public getNowDay(replace: string = '-'): string {
-        // let day = new Date().toLocaleDateString().replace(/\//g, replace);// 这东西每种设备返回的格式不一样,不要用!
-        let str = new Date();
-        let day = str.getFullYear() + replace + (str.getMonth() + 1) + replace + str.getDate();
-        return day;
-    }
-    /**
-     * 计算日期之差【要求两日期格式相同】
-     * @param strDateStart 开始时间
-     * @param strDateEnd 结束时间
-     * @param replace 日期分隔符,默认-
-     * @returns <number>两日期之间相差多少天
-     */
-    public getDaysCount(strDateStart: string, strDateEnd: string, replace: string = '-'): number {
-        var replace = "-"; //日期分隔符
-        var oDate1;
-        var oDate2;
-        var iDays;
-        oDate1 = strDateStart.split(replace);
-        oDate2 = strDateEnd.split(replace);
-        var strDateS = new Date(oDate1[0], oDate1[1] - 1, oDate1[2]) as any;
-        var strDateE = new Date(oDate2[0], oDate2[1] - 1, oDate2[2]) as any;
-        let temp_num = Math.abs(strDateS - strDateE) as any || 0;
-        temp_num = temp_num / 1000 / 60 / 60 / 24;
-        iDays = parseInt(temp_num)//把相差的毫秒数转换为天数 
 
 
-        return iDays;
-    }
     /**
     /**
-     * 是否是第二个月
-     * @param strDateStart 开始时间
-     * @param strDateEnd 结束时间
-     * @param replace 日期分隔符,默认-
-     * @returns <boolean>
+     * 获取当前日期
+     * @param replace 间隔符,默认'-',则返回2020-10-10
+     * @returns 当前时间字符串
      */
      */
-    public isNextMonth(strDateStart: string, strDateEnd: string, replace: string = '-'): boolean {
-        let oDate1 = strDateStart.split(replace);
-        let oDate2 = strDateEnd.split(replace);
-        if (parseInt(oDate1[1]) < parseInt(oDate2[1])) {
-            return true;
-        }
-        return false;
+    public getNowDayString(replace: string = '-'): string {
+        let date = new Date();
+        return date.getFullYear() + replace + (date.getMonth() + 1) + replace + date.getDate();
     }
     }
+
     /**
     /**
-     * 将秒转换成 时分秒 格式 
-     * @param value <string>秒
-     * @param complement <number>补位,1补位到分,>1补位到时
-     * @returns <string>时分秒 格式的时间
+     * 倒计时转换为时间格式(h:m:s) ,可自定义
+     * @param t 时间(秒)
+     * @param f 格式
      */
      */
-    public formatSeconds(value: string, complement: number = 0): string {
-        let theTime = parseInt(value);// 秒
-        let middle = 0;// 分
-        let hour = 0;// 小时
+    public format(t: number, f: string = "h:m:s"): string {
+        let d: number = Math.floor(t / 24 / 3600);
+        let h: number = Math.floor((t / 3600) % 24);
+        let m: number = Math.floor((t % 3600) / 60);
+        let s: number = (t % 3600) % 60;
 
 
-        if (theTime > 60) {
-            middle = parseInt((theTime / 60) as any);
-            theTime = parseInt((theTime % 60) as any);
-            if (middle > 60) {
-                hour = parseInt((middle / 60) as any);
-                middle = parseInt((middle % 60) as any);
+        function parse_format(t: number): string {
+            let s: string = t.toString();
+            if (t < 10) {
+                s = "0" + t;
             }
             }
+            return s;
+        }
+        if (f.indexOf("d") != -1) {
+            f = f.replace(/d/g, parse_format(d));
         }
         }
-        let second = parseInt(theTime as any) as any;
-        if (complement) {
-            second = second < 10 ? '0' + second : second;// 补位加0
+        else {
+            h += d * 24;
         }
         }
-        let result = "" + second + "";//秒
-        if (middle > 0) {
-            let str_middle = parseInt(middle as any) as any;
-            str_middle = str_middle < 10 ? '0' + str_middle : str_middle;// 补位加0
-            result = "" + str_middle + ":" + result;//分
+        if (f.indexOf("h") != -1) {
+            f = f.replace(/h/g, parse_format(h));
         } else {
         } else {
-            if (complement) {
-                result = "00" + ":" + result;//分
-            }
+            m += h * 60;
         }
         }
-        if (hour > 0) {
-            let str_hour = parseInt(hour as any) as any;
-            str_hour = str_hour < 10 ? '0' + str_hour : str_hour;// 补位加0
-            result = "" + str_hour + ":" + result;//小时
+        if (f.indexOf("m") != -1) {
+            f = f.replace(/m/g, parse_format(m));
         } else {
         } else {
-            if (complement > 1) {
-                result = "00" + ":" + result;// 时
+            if (f.indexOf("h") != -1) {
+                s += m * 60;
+            } else {
+                s = t;
             }
             }
         }
         }
-        return result;
+        if (f.indexOf("s") != -1) {
+            f = f.replace(/s/g, parse_format(s));
+        }
+        return f;
     }
     }
 }
 }