Browse Source

【功能】config.json修改,字段用表格控制

mojunshou 11 months ago
parent
commit
61d68e932a

+ 1 - 0
assets/bundle/config/game/GameConfig.json

@@ -0,0 +1 @@
+{"1":{"gameName":"连赚方块","gameVersion":"当前版本 1.0.3","gameCompanyName":"阜阳亿顺传媒科技有限公司","gamePrivacyUrl":"https://doc.v8dashen.com/doc/fc3ae42ddf3b5734","gameProtocolUrl":"https://doc.v8dashen.com/doc/f692eedce36f7fb1","isLocalTest":0}}

+ 1 - 1
assets/bundle/config/game/Grid.json.meta

@@ -2,7 +2,7 @@
   "ver": "2.0.1",
   "importer": "json",
   "imported": true,
-  "uuid": "66c16627-13f0-4149-9160-ed238b3de592",
+  "uuid": "261270a5-dba4-41e6-8eaf-50456489e958",
   "files": [
     ".json"
   ],

+ 0 - 178
assets/bundle/config/game/Grid.json

@@ -1,178 +0,0 @@
-{
-    "Brick1": {
-        "name": "横条2方格",
-        "rotateTag": 0,
-        "gridConfig": [
-            0,
-            0
-        ]
-    },
-    "Brick2": {
-        "name": "田字",
-        "rotateTag": 1,
-        "gridConfig": [
-            [
-                0,
-                0
-            ],
-            [
-                0,
-                1
-            ]
-        ]
-    },
-    "BrickO": {
-        "name": "未定",
-        "rotateTag": 0,
-        "gridConfig": [
-            [
-                0,
-                0
-            ],
-            [
-                0,
-                1
-            ],
-            [
-                1,
-                0
-            ],
-            [
-                1,
-                1
-            ]
-        ]
-    },
-    "BrickI": {
-        "name": "横4方格",
-        "rotateTag": 1,
-        "gridConfig": [
-            [
-                0,
-                0
-            ],
-            [
-                1,
-                0
-            ],
-            [
-                2,
-                0
-            ],
-            [
-                3,
-                0
-            ]
-        ]
-    },
-    "BrickT": {
-        "name": "横T型",
-        "rotateTag": 1,
-        "gridConfig": [
-            [
-                0,
-                0
-            ],
-            [
-                1,
-                -1
-            ],
-            [
-                0,
-                1
-            ],
-            [
-                1,
-                0
-            ]
-        ]
-    },
-    "BrickS": {
-        "name": "S型",
-        "rotateTag": 1,
-        "gridConfig": [
-            [
-                0,
-                0
-            ],
-            [
-                0,
-                -1
-            ],
-            [
-                1,
-                0
-            ],
-            [
-                1,
-                1
-            ]
-        ]
-    },
-    "BrickZ": {
-        "name": "Z型",
-        "rotateTag": 1,
-        "gridConfig": [
-            [
-                0,
-                0
-            ],
-            [
-                0,
-                1
-            ],
-            [
-                1,
-                -1
-            ],
-            [
-                1,
-                0
-            ]
-        ]
-    },
-    "BrickL": {
-        "name": "L型",
-        "rotateTag": 1,
-        "gridConfig": [
-            [
-                0,
-                0
-            ],
-            [
-                1,
-                0
-            ],
-            [
-                2,
-                0
-            ],
-            [
-                0,
-                1
-            ]
-        ]
-    },
-    "BrickJ": {
-        "name": "J型",
-        "rotateTag": 1,
-        "gridConfig": [
-            [
-                0,
-                0
-            ],
-            [
-                1,
-                0
-            ],
-            [
-                2,
-                0
-            ],
-            [
-                0,
-                -1
-            ]
-        ]
-    }
-}

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

@@ -1,98 +0,0 @@
-{
-    "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
-    }
-}

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

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

+ 1 - 7
assets/resources/config.json

@@ -12,13 +12,7 @@
         "webSocketProt": "8081",
         "webSocketHeartTime": 6000,
         "webSocketReceiveTime": 10000,
-        "webSocketReconnetTimeOut": 3000,
-        "gameName": "连赚方块",
-        "gameVersion": "当前版本 1.0.2",
-        "gameCompanyName": "阜阳亿顺传媒科技有限公司",
-        "gamePrivacyUrl": "https://doc.v8dashen.com/doc/fc3ae42ddf3b5734",
-        "gameProtocolUrl": "https://doc.v8dashen.com/doc/f692eedce36f7fb1",
-        "isLocalTest": false
+        "webSocketReconnetTimeOut": 3000
     },
     "gui": [
         {

+ 11 - 4
assets/script/game/common/about/AboutViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-07 17:49:55
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-15 15:35:54
+ * @LastEditTime: 2025-05-16 11:30:03
  * @Description: 
  */
 import { _decorator } from "cc";
@@ -11,6 +11,7 @@ import { ecs } from "db://oops-framework/libs/ecs/ECS";
 import { CCComp } from "db://oops-framework/module/common/CCComp";
 import { UIID } from "../config/GameUIConfig";
 import { CCVMParentComp } from "db://oops-framework/module/common/CCVMParentComp";
+import { TableGameConfig } from "../table/TableGameConfig";
 
 const { ccclass, property } = _decorator;
 
@@ -24,13 +25,19 @@ export class aboutViewComp extends CCVMParentComp {
         companyName: "",
     }
 
+    private _tsGameConfig = new TableGameConfig();
+
     /** 视图层逻辑代码分离演示 */
     start() {
         // const entity = this.ent as ecs.Entity;         // ecs.Entity 可转为当前模块的具体实体对象
         this.setButton();
-        this.data.gameName = oops.config.game.gameName;
-        this.data.version = oops.config.game.gameVersion;
-        this.data.companyName = oops.config.game.gameCompanyName;
+        this._tsGameConfig.init(1);
+        console.log("game_config", this._tsGameConfig);
+
+
+        this.data.gameName = this._tsGameConfig.gameName;
+        this.data.version = this._tsGameConfig.gameVersion;
+        this.data.companyName = this._tsGameConfig.gameCompanyName;
     }
 
     /** 视图对象通过 ecs.Entity.remove(aboutUsViewComp) 删除组件是触发组件处理自定义释放逻辑 */

+ 11 - 2
assets/script/game/common/manager/LoginHandler.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-11 10:15:45
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-05-15 15:11:34
+ * @LastEditTime: 2025-05-16 11:32:34
  * @Description: 登录管理
  */
 // LoginHandler.ts
@@ -11,10 +11,12 @@ import { smc } from '../SingletonModuleComp';
 import { CocosHandler } from './CocosHandler';
 import { ServerHandler } from './ServerHandler';
 import { DCHandler } from './DCHandler';
+import { TableGameConfig } from '../table/TableGameConfig';
 
 export class LoginHandler {
     private static _inst: LoginHandler;
 
+    private _tsGameConfig = new TableGameConfig();
     public static get inst(): LoginHandler {
         if (!this._inst) {
             this._inst = new LoginHandler();
@@ -61,7 +63,14 @@ export class LoginHandler {
 
     openAgreement() {
         const type = smc.game.GameModel.protocolType;
-        const url = type === 1 ? oops.config.game.gamePrivacyUrl : oops.config.game.gameProtocolUrl;
+        let url = "";
+        this._tsGameConfig.init(1);
+        if (type === 1) {
+            url = this._tsGameConfig.gamePrivacyUrl;
+        } else {
+            url = this._tsGameConfig.gameProtocolUrl;
+        }
+        // const url = type === 1 ? oops.config.game.gamePrivacyUrl : oops.config.game.gameProtocolUrl;
         const data = {
             method: 'system.browser.open',
             param: JSON.stringify({ url })

+ 5 - 2
assets/script/game/common/manager/ServerHandler.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-11 10:16:41
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-05-15 15:11:26
+ * @LastEditTime: 2025-05-16 11:20:54
  * @Description: 
  */
 // ServerHandler.ts
@@ -12,10 +12,12 @@ import { oops } from 'db://oops-framework/core/Oops';
 import { CocosHandler, CocosHandlerType } from './CocosHandler';
 import { ProtocolEvent } from './ProtocolEvent';
 import { DCHandler } from './DCHandler';
+import { TableGameConfig } from '../table/TableGameConfig';
 
 export class ServerHandler {
     private static _inst: ServerHandler;
     private serverUrl: string = ""; // 存储服务器地址
+    private _tsGameConfig = new TableGameConfig();
 
     public static get inst(): ServerHandler {
         if (!this._inst) {
@@ -30,6 +32,7 @@ export class ServerHandler {
     }
 
     private initServerUrl() {
+        this._tsGameConfig.init(1);
         let isDebug = smc.game.GameModel.isRelease;
         // 设置服务器地址
         this.serverUrl = isDebug ?
@@ -37,7 +40,7 @@ export class ServerHandler {
             ProtocolEvent.ReleaseServer;
 
         //如果是本地测试,则使用本地测试地址
-        if (oops.config.game.isLocalTest) {
+        if (this._tsGameConfig.isLocalTest > 0) {
             this.serverUrl = ProtocolEvent.LocalTest;
         }
         // console.log("[ServerHandler] 当前服务器地址:", this.serverUrl);

+ 42 - 0
assets/script/game/common/table/TableGameConfig.ts

@@ -0,0 +1,42 @@
+
+import { JsonUtil } from "db://oops-framework/core/utils/JsonUtil";
+
+export class TableGameConfig {
+    static TableName: string = "GameConfig";
+
+    private data: any;
+
+    init(id: number) {
+        var table = JsonUtil.get(TableGameConfig.TableName);
+        this.data = table[id];
+        this.id = id;
+    }
+
+    /** 编号【KEY】 */
    id: number = 0;
+
+    /** 游戏名 */
+    get gameName(): string {
+        return this.data.gameName;
+    }
+    /** 游戏版本 */
+    get gameVersion(): string {
+        return this.data.gameVersion;
+    }
+    /** 游戏公司名 */
+    get gameCompanyName(): string {
+        return this.data.gameCompanyName;
+    }
+    /** 隐私政策 */
+    get gamePrivacyUrl(): string {
+        return this.data.gamePrivacyUrl;
+    }
+    /** 用户协议 */
+    get gameProtocolUrl(): string {
+        return this.data.gameProtocolUrl;
+    }
+    /** 是否开启本地调试 */
+    get isLocalTest(): number {
+        return this.data.isLocalTest;
+    }
+}
+    

+ 1 - 1
assets/script/game/common/table/TableGrid.ts.meta

@@ -2,7 +2,7 @@
   "ver": "4.0.24",
   "importer": "typescript",
   "imported": true,
-  "uuid": "6c651a65-7141-4c90-a33c-38488122927d",
+  "uuid": "1c8fbf70-b94e-4375-aa00-74c067df4f28",
   "files": [],
   "subMetas": {},
   "userData": {}

+ 0 - 31
assets/script/game/common/table/TableGrid.ts

@@ -1,31 +0,0 @@
-
-import { JsonUtil } from "db://oops-framework/core/utils/JsonUtil";
-
-export class TableGrid {
-    static TableName: string = "Grid";
-
-    private data: any;
-
-    init(id: number) {
-        var table = JsonUtil.get(TableGrid.TableName);
-        this.data = table[id];
-        this.id = id;
-    }
-
-    /** 编号【KEY】 */
-    id: number = 0;
-
-    /** 方块名 */
-    get name(): string {
-        return this.data.name;
-    }
-    /** 是否可以旋转 */
-    get rotateTag(): number {
-        return this.data.rotateTag;
-    }
-    /** 行 */
-    get gridConfig(): any {
-        return this.data.gridConfig;
-    }
-}
-    

+ 2 - 3
assets/script/game/common/table/TableLanguage.ts

@@ -6,14 +6,13 @@ export class TableLanguage {
 
     private data: any;
 
-    init(id: number) {
+    init(id: string) {
         var table = JsonUtil.get(TableLanguage.TableName);
         this.data = table[id];
         this.id = id;
     }
 
-    /** 编号【KEY】 */
-    id: number = 0;
+    /** 编号【KEY】 */
    id: string = null!;
 
     /** 简体中文 */
     get zh(): string {

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

@@ -1,27 +0,0 @@
-
-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;
-    }
-}
-    

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

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

+ 0 - 40
assets/script/game/common/table/TablePromptWindow.ts

@@ -1,40 +0,0 @@
-/*
- * @Author: dgflash
- * @Date: 2022-06-02 09:38:48
- * @LastEditors: dgflash
- * @LastEditTime: 2022-08-02 14:26:35
- */
-
-import { JsonUtil } from "../../../../../extensions/oops-plugin-framework/assets/core/utils/JsonUtil";
-
-/** 演示oops-plugin-excel-to-json插件生成的配置表数据结构(可删除) */
-export class TablePromptWindow {
-    static TableName: string = "PromptWindow";
-
-    private data: any;
-
-    init(id: number, id1: number, id2: number) {
-        var table = JsonUtil.get(TablePromptWindow.TableName);
-        this.data = table[id][id1][id2];
-        this.id = id;
-        this.id1 = id1;
-        this.id2 = id2;
-    }
-
-    id: number = 0;
-    id1: number = 0;
-    id2: number = 0;
-
-    get title(): string {
-        return this.data.title;
-    }
-    get describe(): string {
-        return this.data.describe;
-    }
-    get array(): any {
-        return this.data.array;
-    }
-    get hp(): number {
-        return this.data.hp;
-    }
-}

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

@@ -1,9 +0,0 @@
-{
-  "ver": "4.0.24",
-  "importer": "typescript",
-  "imported": true,
-  "uuid": "1e3d7b9a-9e7e-4c46-8900-2f6c142e6f72",
-  "files": [],
-  "subMetas": {},
-  "userData": {}
-}

+ 5 - 1
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-05-07 14:32:07
+ * @LastEditTime: 2025-05-16 11:46:19
  * @Description: loading界面
  */
 import { _decorator, Toggle } from "cc";
@@ -19,6 +19,8 @@ import { ADHandler } from "../../common/manager/ADHandler";
 import { LoginHandler } from "../../common/manager/LoginHandler";
 import { smc } from "../../common/SingletonModuleComp";
 import { EliminateViewComp } from "../../view/EliminateViewComp";
+import { JsonUtil } from "db://oops-framework/core/utils/JsonUtil";
+import { TableGameConfig } from "../../common/table/TableGameConfig";
 // import { EliminateView } from "../../view/eliminate/EliminateView";
 const { ccclass, property } = _decorator;
 
@@ -114,6 +116,8 @@ export class LoadingViewComp extends CCVMParentComp {
     private loadCustom() {
         // 加载游戏本地JSON数据的多语言提示文本
         this.data.prompt = oops.language.getLangByID("loading_load_json");
+        JsonUtil.loadAsync(TableGameConfig.TableName);
+
     }
 
     /** 加载初始游戏内容资源 */

+ 5 - 2
assets/script/game/view/popup/WechatTransfer.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-19 11:34:46
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-28 16:32:36
+ * @LastEditTime: 2025-05-16 11:32:47
  * @Description: 微信转账中界面
  */
 import { _decorator, Component, Node, Animation } from 'cc';
@@ -15,6 +15,7 @@ import { Format } from '../../utils/Format';
 import { DCHandler } from '../../common/manager/DCHandler';
 import { ServerHandler } from '../../common/manager/ServerHandler';
 import { GameEvent } from '../../common/config/GameEvent';
+import { TableGameConfig } from '../../common/table/TableGameConfig';
 const { ccclass, property } = _decorator;
 
 @ccclass('WechatTransfer')
@@ -44,6 +45,7 @@ export class WechatTransfer extends VMParent {
     @property(Node)  //微信打款中
     private showNode4: Node = null!;
 
+    private _tsGameConfig = new TableGameConfig();
 
     start() {
         oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
@@ -51,7 +53,8 @@ export class WechatTransfer extends VMParent {
         this.setButton();
         this.showNode1.active = true;
         this.showNode2.active = false;
-        this.data.gameName = oops.config.game.gameName;
+        this._tsGameConfig.init(1);
+        this.data.gameName = this._tsGameConfig.gameName;
         this.updateData();
     }
 

BIN
excel/GameConfig.xlsx


BIN
excel/Grid.xlsx


BIN
excel/LevelConfig.xlsx