From b7bd2c612bab41cb54d428ddd5c65ae620376e73 Mon Sep 17 00:00:00 2001 From: panw Date: Tue, 28 Apr 2026 16:27:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E8=8B=B1=E9=9B=84=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 清理 SingletonModuleComp 中的英雄数组和出战英雄字段,以及相关接口定义。 同时更新 USAGE.md 中的示例代码以反映数据结构变化。 --- assets/script/game/common/SingletonModuleComp.ts | 16 ---------------- assets/script/game/wx_clound_client_api/USAGE.md | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index c65fced1..3bba3940 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -17,16 +17,12 @@ import { gameDataSync } from "./GameDataSync"; */ export interface GameDate{ gold:number, - heros:any, - fight_hero:number, timestamp?: number, // 用于比对本地与云端数据的最新状态 collection?: { talents: Partial>, player_level: number, player_exp: number, talent_points: number, - skills?: {uuid:0,count:0}, - friend?: {uuid:0,count:0}, } } export interface CloudData { @@ -64,8 +60,6 @@ export class SingletonModuleComp extends ecs.Comp { guides:any=[0,0,0,0,0] current_guide:number=0 - fight_hero: number = 5001; // 单个出战英雄 - heros:any= [5001] collection: { talents: Partial>; @@ -239,14 +233,6 @@ export class SingletonModuleComp extends ecs.Comp { if (data.gold !== undefined) { this.vmdata.gold = data.gold; } - // 同步英雄 - if (data.heros && Array.isArray(data.heros)) { - this.heros = data.heros; - } - // 同步出战英雄 - if (data.fight_hero !== undefined) { - this.fight_hero = data.fight_hero; - } // 恢复收集记录 if (data.collection) { const remoteCol = data.collection; @@ -267,8 +253,6 @@ export class SingletonModuleComp extends ecs.Comp { getGameDate(){ let data: GameDate = { gold: this.vmdata.gold, - heros: this.heros, - fight_hero: this.fight_hero, collection: this.collection, timestamp: Date.now() // 每次获取当前数据结构时都附带最新的时间戳 }; diff --git a/assets/script/game/wx_clound_client_api/USAGE.md b/assets/script/game/wx_clound_client_api/USAGE.md index c09da119..51479787 100644 --- a/assets/script/game/wx_clound_client_api/USAGE.md +++ b/assets/script/game/wx_clound_client_api/USAGE.md @@ -20,7 +20,7 @@ if (loginResult.result.code === 200) { const userData = loginResult.result.data; console.log("用户ID:", userData.user_id); console.log("金币:", userData.data.gold); - console.log("出战英雄:", userData.fight_heros); + console.log("用户金币:", userData.gold); } ```