feat(talent): 引入天赋碎片系统替换通用天赋点
- 新增 TalentFragmentType 枚举和 TalentFragmentInfo 接口定义碎片类型 - 在 SingletonModuleComp 中新增 talent_fragments 字段存储碎片库存,talent_points 改为可选字段以兼容旧存档 - 为每个天赋配置 fragmentType 指定升级所需的具体碎片类型 - 修改 TalentsComp 升级逻辑,从消耗天赋点改为扣除对应类型的碎片 - 重置天赋功能现在返还已消耗的碎片而非天赋点 - 更新界面显示,展示碎片库存摘要和具体消耗
This commit is contained in:
@@ -8,7 +8,7 @@ import { WxCloudApi } from "../wx_clound_client_api/WxCloudApi";
|
||||
import { GameEvent } from "./config/GameEvent";
|
||||
import { GameScoreStats } from "./config/HeroAttrs";
|
||||
import { mLogger } from "./Logger";
|
||||
import { TalentType } from "./config/TalentSet";
|
||||
import { TalentFragmentType, TalentType } from "./config/TalentSet";
|
||||
import { gameDataSync } from "./GameDataSync";
|
||||
import { FightSet } from "./config/GameSet";
|
||||
|
||||
@@ -23,7 +23,8 @@ export interface GameDate{
|
||||
talents: Partial<Record<TalentType, number>>,
|
||||
player_level: number,
|
||||
player_exp: number,
|
||||
talent_points: number,
|
||||
talent_fragments: Partial<Record<TalentFragmentType, number>>,
|
||||
talent_points?: number,
|
||||
}
|
||||
}
|
||||
export interface CloudData {
|
||||
@@ -66,12 +67,14 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
talents: Partial<Record<TalentType, number>>;
|
||||
player_level: number;
|
||||
player_exp: number;
|
||||
talent_points: number;
|
||||
talent_fragments: Partial<Record<TalentFragmentType, number>>;
|
||||
talent_points?: number;
|
||||
} = {
|
||||
talents: {}, // 存储各个天赋的等级: { talent_id: level }
|
||||
player_level: 1, // 玩家等级
|
||||
player_exp: 0, // 玩家当前经验
|
||||
talent_points: 0, // 当前可用天赋点
|
||||
talent_fragments: {}, // 当前拥有的天赋碎片库存
|
||||
talent_points: 0, // 兼容旧存档的历史字段
|
||||
};
|
||||
|
||||
vmdata: any = {
|
||||
@@ -240,6 +243,7 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
if (remoteCol.talents) this.collection.talents = remoteCol.talents;
|
||||
if (typeof remoteCol.player_level === 'number') this.collection.player_level = remoteCol.player_level;
|
||||
if (typeof remoteCol.player_exp === 'number') this.collection.player_exp = remoteCol.player_exp;
|
||||
if (remoteCol.talent_fragments) this.collection.talent_fragments = remoteCol.talent_fragments;
|
||||
if (typeof remoteCol.talent_points === 'number') this.collection.talent_points = remoteCol.talent_points;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user