diff --git a/extensions/pixelhero-config-editor/src/shared/schema/field.ts b/extensions/pixelhero-config-editor/src/shared/schema/field.ts new file mode 100644 index 00000000..c96d0543 --- /dev/null +++ b/extensions/pixelhero-config-editor/src/shared/schema/field.ts @@ -0,0 +1,14 @@ +import { TableSchema } from './types'; +export const fieldSchema: TableSchema = { + id: 'field', label: '驻场技能', + sourceFile: 'SkillSet.ts', exportName: 'FieldSkillSet', + idSegments: [{ label: '驻场技能', min: 7000, max: 7999 }], + fields: [ + { key: 'uuid', label: 'UUID', type: 'number', required: true, group: '基础' }, + { key: 'name', label: '名称', type: 'string', required: true, group: '基础' }, + { key: 'icon', label: '图标', type: 'string', required: true, group: '基础' }, + { key: 'type', label: '类型', type: 'enum', enumRef: 'FieldSkillType', required: true, group: '效果' }, + { key: 'value', label: '数值', type: 'number', required: true, group: '效果' }, + { key: 'info', label: '描述', type: 'string', required: true, group: '基础' }, + ], +}; diff --git a/extensions/pixelhero-config-editor/src/shared/schema/hero.ts b/extensions/pixelhero-config-editor/src/shared/schema/hero.ts new file mode 100644 index 00000000..b6fadad8 --- /dev/null +++ b/extensions/pixelhero-config-editor/src/shared/schema/hero.ts @@ -0,0 +1,33 @@ +import { TableSchema } from './types'; +export const heroSchema: TableSchema = { + id: 'hero', label: '英雄/怪物', + sourceFile: 'heroSet.ts', exportName: 'HeroInfo', listExportName: 'HeroList', + idSegments: [ + { label: '英雄', min: 5000, max: 5999 }, + { label: '怪物', min: 6000, max: 6999 }, + ], + fields: [ + { key: 'uuid', label: 'UUID', type: 'number', required: true, group: '基础' }, + { key: 'name', label: '名称', type: 'string', required: true, group: '基础' }, + { key: 'path', label: '资源路径', type: 'string', required: true, group: '基础' }, + { key: 'icon', label: '图标', type: 'string', group: '基础' }, + { key: 'fac', label: '阵营', type: 'enum', enumRef: 'FacSet', required: true, group: '基础' }, + { key: 'pool_lv', label: '卡片等级', type: 'number', group: '基础' }, + { key: 'lv', label: '英雄等级', type: 'number', required: true, default: 1, group: '基础' }, + { key: 'type', label: '攻击定位', type: 'enum', enumRef: 'HType', required: true, group: '基础' }, + { key: 'hp', label: '生命上限', type: 'number', required: true, group: '基础' }, + { key: 'ap', label: '攻击力', type: 'number', required: true, group: '基础' }, + { key: 'dis', label: '攻击距离', type: 'number', group: '基础' }, + { key: 'speed', label: '移动速度', type: 'number', group: '基础' }, + { key: 'skills', label: '携带技能', type: 'skillMap', required: true, group: '技能' }, + { key: 'call', label: '召唤触发', type: 'triggerSlots', group: '触发技能' }, + { key: 'dead', label: '死亡触发', type: 'triggerSlots', group: '触发技能' }, + { key: 'fstart', label: '战斗开始触发', type: 'triggerSlots', group: '触发技能' }, + { key: 'fend', label: '战斗结束触发', type: 'triggerSlots', group: '触发技能' }, + { key: 'atking', label: '攻击触发', type: 'triggerSlots', group: '触发技能' }, + { key: 'atked', label: '受击触发', type: 'triggerSlots', group: '触发技能' }, + { key: 'field', label: '驻场技能', type: 'fieldList', group: '触发技能' }, + { key: 'revive', label: '复活触发', type: 'reviveSlot', group: '触发技能' }, + { key: 'info', label: '描述文案', type: 'string', required: true, group: '基础' }, + ], +}; diff --git a/extensions/pixelhero-config-editor/src/shared/schema/registry.ts b/extensions/pixelhero-config-editor/src/shared/schema/registry.ts new file mode 100644 index 00000000..c395febc --- /dev/null +++ b/extensions/pixelhero-config-editor/src/shared/schema/registry.ts @@ -0,0 +1,10 @@ +import { TableId, TableSchema } from './types'; +import { heroSchema } from './hero'; +import { skillSchema } from './skill'; +import { fieldSchema } from './field'; + +export const REGISTRY: Record = { + hero: heroSchema, skill: skillSchema, field: fieldSchema, +}; +export function getSchema(id: TableId): TableSchema { return REGISTRY[id]; } +export function allSchemas(): TableSchema[] { return Object.values(REGISTRY); } diff --git a/extensions/pixelhero-config-editor/src/shared/schema/skill.ts b/extensions/pixelhero-config-editor/src/shared/schema/skill.ts new file mode 100644 index 00000000..d453ca80 --- /dev/null +++ b/extensions/pixelhero-config-editor/src/shared/schema/skill.ts @@ -0,0 +1,41 @@ +import { TableSchema } from './types'; +export const skillSchema: TableSchema = { + id: 'skill', label: '技能', + sourceFile: 'SkillSet.ts', exportName: 'SkillSet', + idSegments: [{ label: '技能', min: 6000, max: 6999 }], + fields: [ + { key: 'uuid', label: 'UUID', type: 'number', required: true, group: '基础' }, + { key: 'name', label: '名称', type: 'string', required: true, group: '基础' }, + { key: 'sp_name', label: '特效名', type: 'string', required: true, group: '基础' }, + { key: 'icon', label: '图标ID', type: 'string', required: true, group: '基础' }, + { key: 'act', label: '执行动画', type: 'string', required: true, group: '基础' }, + { key: 'TGroup', label: '目标群体', type: 'enum', enumRef: 'TGroup', required: true, group: '目标' }, + { key: 'DTType', label: '伤害类型', type: 'enum', enumRef: 'DTType', required: true, group: '目标' }, + { key: 'IType', label: '技能类型', type: 'enum', enumRef: 'IType', required: true, group: '目标' }, + { key: 'RType', label: '运行类型', type: 'enum', enumRef: 'RType', required: true, group: '目标' }, + { key: 'EType', label: '结束条件', type: 'enum', enumRef: 'EType', required: true, group: '目标' }, + { key: 'kind', label: '主效果', type: 'enum', enumRef: 'SkillKind', group: '目标' }, + { key: 'ap', label: 'ap(伤害%/护盾次)', type: 'number', required: true, group: '数值' }, + { key: 'gold', label: '金币值', type: 'number', group: '数值' }, + { key: 'hit_count', label: '可命中次数', type: 'number', required: true, group: '数值' }, + { key: 'hitcd', label: '伤害间隔', type: 'number', required: true, group: '数值' }, + { key: 'speed', label: '移动速度', type: 'number', required: true, group: '数值' }, + { key: 'ready', label: '前摇时间', type: 'number', required: true, group: '数值' }, + { key: 'with', label: '宽度', type: 'number', default: 0, group: '数值' }, + { key: 'readyAnm', label: '前摇动画', type: 'string', group: '动画' }, + { key: 'endAnm', label: '结束动画', type: 'string', group: '动画' }, + { key: 'DAnm', label: '命中动画ID', type: 'string', group: '动画' }, + { key: 'EAnm', label: '结束动画ID', type: 'number', group: '动画' }, + { key: 'crt', label: '额外暴击率', type: 'number', group: '高级' }, + { key: 'stun', label: '额外击晕概率', type: 'number', group: '高级' }, + { key: 'frz', label: '额外冰冻概率', type: 'number', group: '高级' }, + { key: 'bck', label: '额外击退概率', type: 'number', group: '高级' }, + { key: 'buff_type', label: 'Buff类型', type: 'enum', enumRef: 'Attrs', group: '高级' }, + { key: 'call_hero', label: '召唤英雄', type: 'ref', refTable: 'hero', group: '高级' }, + { key: 'time', label: '持续时间', type: 'number', group: '高级' }, + { key: 'bezier_start_y', label: '贝塞尔起始Y', type: 'number', group: '高级' }, + { key: 'bezier_mid_y', label: '贝塞尔中点Y', type: 'number', group: '高级' }, + { key: 'bezier_arc', label: '贝塞尔弧度', type: 'number', group: '高级' }, + { key: 'info', label: '描述', type: 'string', required: true, group: '基础' }, + ], +}; diff --git a/extensions/pixelhero-config-editor/src/shared/schema/types.ts b/extensions/pixelhero-config-editor/src/shared/schema/types.ts new file mode 100644 index 00000000..6664717d --- /dev/null +++ b/extensions/pixelhero-config-editor/src/shared/schema/types.ts @@ -0,0 +1,31 @@ +export type TableId = 'hero' | 'skill' | 'field'; + +export type FieldType = + | 'number' | 'string' | 'boolean' + | 'enum' // 下拉,选项来自 enumRef + | 'ref' // 引用另一表 uuid + | 'speedExpr' // 攻速符号表达式 + | 'skillMap' | 'triggerSlots' | 'fieldList' | 'reviveSlot' | 'overrides'; + +export interface FieldSchema { + key: string; + label: string; + type: FieldType; + required?: boolean; + default?: unknown; + group?: string; + enumRef?: string; // type='enum' + refTable?: TableId; // type='ref' +} + +export interface IdSegment { label: string; min: number; max: number; } + +export interface TableSchema { + id: TableId; + label: string; + sourceFile: string; // 相对 assets/script/game/common/config/ + exportName: string; // 'HeroInfo' | 'SkillSet' | 'FieldSkillSet' + listExportName?: string; // 'HeroList'(仅 hero) + idSegments: IdSegment[]; + fields: FieldSchema[]; +}