Parcourir la source

【功能】1.添加关卡配置,2.完善登录流程

mojunshou il y a 8 mois
Parent
commit
dd5629c793

+ 4 - 1
.gitignore

@@ -9,8 +9,11 @@ oops_framework_remote/
 library/
 temp/
 local/
-build/
+#build/
 profiles/
+extensions/
+settings/
+preview-template/
 native
 #//////////////////////////
 # NPM

+ 98 - 0
assets/bundle/config/game/LevelConfig.json

@@ -0,0 +1,98 @@
+{
+    "1": {
+        "name": 100,
+        "frequency": 5.6
+    },
+    "2": {
+        "name": 200,
+        "frequency": 11.1
+    },
+    "3": {
+        "name": 300,
+        "frequency": 16.7
+    },
+    "4": {
+        "name": 400,
+        "frequency": 22.2
+    },
+    "5": {
+        "name": 500,
+        "frequency": 27.8
+    },
+    "6": {
+        "name": 600,
+        "frequency": 33.3
+    },
+    "7": {
+        "name": 700,
+        "frequency": 38.9
+    },
+    "8": {
+        "name": 800,
+        "frequency": 44.4
+    },
+    "9": {
+        "name": 1000,
+        "frequency": 55.6
+    },
+    "10": {
+        "name": 1200,
+        "frequency": 66.7
+    },
+    "11": {
+        "name": 1400,
+        "frequency": 77.8
+    },
+    "12": {
+        "name": 1600,
+        "frequency": 88.9
+    },
+    "13": {
+        "name": 1800,
+        "frequency": 100
+    },
+    "14": {
+        "name": 2000,
+        "frequency": 111.11
+    },
+    "15": {
+        "name": 2200,
+        "frequency": 133.33
+    },
+    "16": {
+        "name": 2400,
+        "frequency": 144.44
+    },
+    "17": {
+        "name": 2600,
+        "frequency": 162.956666666667
+    },
+    "18": {
+        "name": 2800,
+        "frequency": 179.621666666667
+    },
+    "19": {
+        "name": 3000,
+        "frequency": 196.286666666667
+    },
+    "20": {
+        "name": 3200,
+        "frequency": 212.951666666667
+    },
+    "21": {
+        "name": 3400,
+        "frequency": 229.616666666667
+    },
+    "22": {
+        "name": 3600,
+        "frequency": 246.281666666667
+    },
+    "23": {
+        "name": 3800,
+        "frequency": 262.946666666667
+    },
+    "24": {
+        "name": 4000,
+        "frequency": 279.611666666667
+    }
+}

+ 11 - 0
assets/bundle/config/game/LevelConfig.json.meta

@@ -0,0 +1,11 @@
+{
+  "ver": "2.0.1",
+  "importer": "json",
+  "imported": true,
+  "uuid": "d32e50e5-a78f-48d6-a6a2-bdd6403fbf31",
+  "files": [
+    ".json"
+  ],
+  "subMetas": {},
+  "userData": {}
+}

+ 152 - 12
assets/bundle/gui/eliminate/eliminate.prefab

@@ -28,17 +28,17 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 283
+        "__id__": 289
       },
       {
-        "__id__": 285
+        "__id__": 291
       },
       {
-        "__id__": 287
+        "__id__": 293
       }
     ],
     "_prefab": {
-      "__id__": 289
+      "__id__": 295
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -267,19 +267,22 @@
       },
       {
         "__id__": 274
+      },
+      {
+        "__id__": 278
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 278
+        "__id__": 284
       },
       {
-        "__id__": 280
+        "__id__": 286
       }
     ],
     "_prefab": {
-      "__id__": 282
+      "__id__": 288
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -6927,6 +6930,142 @@
     "nestedPrefabInstanceRoots": null
   },
   {
+    "__type__": "cc.Node",
+    "_name": "Sprite",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 10
+    },
+    "_children": [],
+    "_active": false,
+    "_components": [
+      {
+        "__id__": 279
+      },
+      {
+        "__id__": 281
+      }
+    ],
+    "_prefab": {
+      "__id__": 283
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 278
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 280
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 76,
+      "height": 74
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "58E03r5I9IpJghoZ/snUmz"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 278
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 282
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "1883e639-28b3-4d59-96db-57ffaa299715@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "06cqmmCZZEn6mzFsFXKUXx"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "92XNI0AzRNLpo6UR3ti7rm",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
     "__type__": "cc.UITransform",
     "_name": "",
     "_objFlags": 0,
@@ -6936,7 +7075,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 279
+      "__id__": 285
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -6964,7 +7103,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 281
+      "__id__": 287
     },
     "_alignFlags": 45,
     "_target": null,
@@ -7013,7 +7152,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 284
+      "__id__": 290
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -7041,7 +7180,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 286
+      "__id__": 292
     },
     "amountLb": {
       "__id__": 16
@@ -7108,6 +7247,7 @@
     "lab_addScore": {
       "__id__": 141
     },
+    "eliminateBaseScore": 10,
     "_id": ""
   },
   {
@@ -7124,7 +7264,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 288
+      "__id__": 294
     },
     "_alignFlags": 45,
     "_target": null,

+ 50 - 9
assets/bundle/gui/loading/loading.prefab

@@ -31,9 +31,6 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 96
-      },
-      {
         "__id__": 98
       },
       {
@@ -41,10 +38,13 @@
       },
       {
         "__id__": 102
+      },
+      {
+        "__id__": 104
       }
     ],
     "_prefab": {
-      "__id__": 104
+      "__id__": 106
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -1064,10 +1064,13 @@
     "_components": [
       {
         "__id__": 93
+      },
+      {
+        "__id__": 95
       }
     ],
     "_prefab": {
-      "__id__": 95
+      "__id__": 97
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -2169,6 +2172,44 @@
     "fileId": "b4QGwviIVKzZEMmXZbTmLX"
   },
   {
+    "__type__": "47052uw/Y5O1LXaLObj4ARx",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 48
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 96
+    },
+    "watchPath": "*.btn_show",
+    "foreachChildMode": false,
+    "condition": 0,
+    "foreachChildType": 0,
+    "valueA": 0,
+    "valueB": 0,
+    "valueAction": 0,
+    "valueActionOpacity": 0,
+    "valueActionColor": {
+      "__type__": "cc.Color",
+      "r": 155,
+      "g": 155,
+      "b": 155,
+      "a": 255
+    },
+    "valueComponentName": "",
+    "valueComponentProperty": "",
+    "valueComponentDefaultValue": "",
+    "valueComponentActionValue": "",
+    "watchNodes": [],
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "9cMyyKg+xESo4zPOOWOj2Y"
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -2191,7 +2232,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 97
+      "__id__": 99
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -2219,7 +2260,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 99
+      "__id__": 101
     },
     "_alignFlags": 45,
     "_target": null,
@@ -2255,7 +2296,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 101
+      "__id__": 103
     },
     "_id": ""
   },
@@ -2273,7 +2314,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 103
+      "__id__": 105
     },
     "_id": ""
   },

+ 8 - 3
assets/script/game/account/model/AccountModelComp.ts

@@ -3,8 +3,8 @@
 /*
  * @Author: dgflash
  * @Date: 2021-11-12 10:02:31
- * @LastEditors: dgflash
- * @LastEditTime: 2022-07-25 17:03:45
+ * @LastEditors: mojunshou 1637302775@qq.com
+ * @LastEditTime: 2025-03-31 15:35:26
  */
 import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
 
@@ -15,8 +15,13 @@ import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs
 export class AccountModelComp extends ecs.Comp {
     /** 账号名 */
     AccountName: string = null!;
-
+    /**玩家UID */
+    uid: number = -1;
+    /**玩家头像*/
+    head: string = null!
     reset() {
         this.AccountName = null!;
+        this.uid = -1;
+        this.head = null!;
     }
 }

+ 6 - 0
assets/script/game/common/manager/CocosHandler.ts

@@ -2,6 +2,9 @@ import { native } from 'cc';
 import { _decorator, Component, Node } from 'cc';
 import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil';
 import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
+import { smc } from '../SingletonModuleComp';
+import { ecs } from 'db://oops-framework/libs/ecs/ECS';
+import { Account } from '../../account/Account';
 const { ccclass, property } = _decorator;
 
 @ccclass('CocosHandler')
@@ -90,6 +93,9 @@ export class CocosHandler extends GameComponent {
             }
         }
         let result = await this.sendMessageToAndroid(obj);
+        // let account = ecs.getEntity<Account>(Account);
+        // account.AccountModel.AccountName
+        // smc.account.AccountModel.AccountName =
         return result;
     }
 

+ 27 - 0
assets/script/game/common/table/TableLevelConfig.ts

@@ -0,0 +1,27 @@
+
+import { JsonUtil } from "db://oops-framework/core/utils/JsonUtil";
+
+export class TableLevelConfig {
+    static TableName: string = "LevelConfig";
+
+    private data: any;
+
+    init(level_id: number) {
+        var table = JsonUtil.get(TableLevelConfig.TableName);
+        this.data = table[level_id];
+        this.level_id = level_id;
+    }
+
+    /** 编号【KEY】 */
+    level_id: number = 0;
+
+    /** 通关分数 */
+    get name(): number {
+        return this.data.name;
+    }
+    /** 消除次数 */
+    get frequency(): number {
+        return this.data.frequency;
+    }
+}
+    

+ 9 - 0
assets/script/game/common/table/TableLevelConfig.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.24",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "37af0157-817b-4d97-a1d0-8dff4594ae31",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 50 - 36
assets/script/game/initialize/view/LoadingViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-19 16:23:51
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-03-31 11:56:22
+ * @LastEditTime: 2025-03-31 15:06:48
  * @Description: loading界面
  */
 import { _decorator, sys } from "cc";
@@ -16,6 +16,7 @@ import { UIID } from "../../common/config/GameUIConfig";
 import { AndroidMessageCenter } from '../../common/manager/AndroidMessageCenter';
 import { smc } from "../../common/SingletonModuleComp";
 import { EliminateViewComp } from "../../eliminate/view/EliminateViewComp";
+import { CocosHandler } from "../../common/manager/CocosHandler";
 const { ccclass, property } = _decorator;
 
 /** 游戏资源加载 */
@@ -31,7 +32,9 @@ export class LoadingViewComp extends CCVMParentComp {
         /** 加载资源进度比例值 */
         progress: "0",
         /** 加载流程中提示文本 */
-        prompt: ""
+        prompt: "",
+        /**btn_show*/
+        btn_show: 0
     };
 
     private progress: number = 0;
@@ -46,37 +49,21 @@ export class LoadingViewComp extends CCVMParentComp {
 
     enter() {
         this.addEvent();
-        //查看缓存有没有同意过
-        if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
-
-
-
-
+        //查看缓存有没有同意过,也要向服务器发送登录请求,如果有过登录就直接拿数据登录,没有就显示微信登录
+        let data = oops.storage.get("agree");
+        if (data == null || data == "") {
+            //打开温馨提示
+            oops.gui.open(UIID.KindTips);
+            return;
         } else {
-            this.loadRes();
-        }
+            //同意过
+            if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
 
-        // let data = sys.localStorage.getItem("agree");
-        // if (!data) {
-        //     //打开温馨提示
-        //     oops.gui.open(UIID.KindTips);
-        //     return;
-        // }
-        // //有没有登录过
-        // let loginData = sys.localStorage.getItem("login");
-        // if (!loginData) {
-        //     //显示微信登录按钮
-        //     // this.showWxLogin();
-        // } else {
-        //     //登录了就--请求服务器,微信登录,成功再加载资源
-        //     this.loadRes();
-        // }
-        // if (!DeviceUtil.isNative) {
-        //     this.loadRes();
-        // } else {
-
-        // }
-        this.loadRes();
+            } else {
+                //非原生,网页的
+                this.loadRes();
+            }
+        }
     }
 
 
@@ -89,10 +76,14 @@ export class LoadingViewComp extends CCVMParentComp {
 
     private onAgreePrivacy() {
         console.log("同意隐私协议");
-        sys.localStorage.setItem("agree", "true");
+        oops.storage.set("agree", true);
         oops.gui.remove(UIID.KindTips);
         //如果是客户端就显示微信登录按钮
-        this.loadRes();
+        if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
+            this.showWxLogin();
+        } else {
+            this.loadRes();
+        }
     }
 
     /** 加载资源 */
@@ -132,7 +123,6 @@ export class LoadingViewComp extends CCVMParentComp {
         // 获取用户信息的多语言提示文本
         this.data.prompt = oops.language.getLangByID("loading_load_player");
         await ModuleUtil.addViewUiAsync(smc.account, EliminateViewComp, UIID.Eliminate);
-        // oops.gui.open(UIID.Game);
         ModuleUtil.removeViewUi(this.ent, LoadingViewComp, UIID.Loading);
     }
 
@@ -141,9 +131,23 @@ export class LoadingViewComp extends CCVMParentComp {
      * @description: 微信登录
      * @return {*}
      */
-    private btn_wxlogin() {
+    private async btn_wxlogin() {
         //跟安卓交互
+        //登录完要隐藏微信按钮然后加载进度
+        let result = await CocosHandler.getInstance().wechat_login();
+        if (result.code) {
+
+            //登录成功
+            //存数据
+            const wxNode = this.node.getChildByName("login_node");
+            if (wxNode) {
+                wxNode.active = false;
+            }
+            this.loadRes();
+        } else {
 
+            oops.gui.toast("登录失败,请重试")
+        }
     }
 
     /**
@@ -151,8 +155,18 @@ export class LoadingViewComp extends CCVMParentComp {
      * @return {*}
      */
     showWxLogin() {
-
+        const wxNode = this.node.getChildByName("login_node");
+        if (wxNode) {
+            wxNode.active = true;
+        }
     }
 
     reset(): void { }
+
+
+    /**
+     * 保存关卡,分数,目标分数
+     * 
+     * 
+    */
 }

BIN
excel/Grid.xlsx


BIN
excel/LevelConfig.xlsx


BIN
excel/~$Grid.xlsx


+ 2 - 2
settings/v2/packages/information.json

@@ -7,7 +7,7 @@
       "enable": true,
       "customSplash": {
         "complete": true,
-        "form": "https://creator-api.cocos.com/api/form/show?sid=356f6b4ee3d5f436f3ce0aeec233769a"
+        "form": "https://creator-api.cocos.com/api/form/show?sid=134cba5a7c08b1197316bc75b6126fba"
       }
     },
     "removeSplash": {
@@ -16,7 +16,7 @@
       "enable": true,
       "removeSplash": {
         "complete": true,
-        "form": "https://creator-api.cocos.com/api/form/show?sid=356f6b4ee3d5f436f3ce0aeec233769a"
+        "form": "https://creator-api.cocos.com/api/form/show?sid=134cba5a7c08b1197316bc75b6126fba"
       }
     }
   }

+ 17 - 0
update-oops-plugin-excel-to-json.bat

@@ -0,0 +1,17 @@
+md extensions
+cd extensions
+
+IF EXIST oops-plugin-excel-to-json (
+goto update
+) ELSE (
+goto clone
+)
+
+:clone
+git clone -b master https://gitee.com/dgflash/oops-plugin-excel-to-json.git
+
+:update
+cd oops-plugin-excel-to-json
+git pull
+
+npm install

+ 17 - 0
update-oops-plugin-framework.bat

@@ -0,0 +1,17 @@
+md extensions
+cd extensions
+
+IF EXIST oops-plugin-framework (
+goto update
+) ELSE (
+goto clone
+)
+
+:clone
+git clone -b master https://gitee.com/dgflash/oops-plugin-framework.git
+
+:update
+cd oops-plugin-framework
+git pull
+
+npm install

+ 15 - 0
update-oops-plugin-hot-update.bat

@@ -0,0 +1,15 @@
+md extensions
+cd extensions
+
+IF EXIST oops-plugin-hot-update (
+goto update
+) ELSE (
+goto clone
+)
+
+:clone
+git clone -b master https://gitee.com/dgflash/oops-plugin-hot-update.git
+
+:update
+cd oops-plugin-hot-update
+git pull