diff --git a/assets/script/game/initialize/Initialize.ts b/assets/script/game/initialize/Initialize.ts index 8da1161..16ecbb4 100644 --- a/assets/script/game/initialize/Initialize.ts +++ b/assets/script/game/initialize/Initialize.ts @@ -42,6 +42,7 @@ export class Initialize extends ecs.Entity { let lan = engine.storage.get("language"); if (lan == null) { // lan = SDKPlatform.getLanguage(); + lan = "zh"; engine.storage.set("language", lan!); } diff --git a/assets/script/game/role/model/attribute/RoleNumeric.ts b/assets/script/game/role/model/attribute/RoleNumeric.ts index 21cf7ca..eebf3f6 100644 --- a/assets/script/game/role/model/attribute/RoleNumeric.ts +++ b/assets/script/game/role/model/attribute/RoleNumeric.ts @@ -28,6 +28,16 @@ export class RoleNumeric { this.attributes = attributes; } + reset() { + this._base = 0; + this._job = 0; + this._level = 0; + this._equip = 0; + this._decorator = 0; + this._battle = 0; + this.update(); + } + protected _base: number = 0; /** 角色基础属性 */ get base(): number { diff --git a/assets/script/game/role/model/attribute/RoleNumericMap.ts b/assets/script/game/role/model/attribute/RoleNumericMap.ts index 99b77aa..20d9345 100644 --- a/assets/script/game/role/model/attribute/RoleNumericMap.ts +++ b/assets/script/game/role/model/attribute/RoleNumericMap.ts @@ -15,39 +15,13 @@ export class RoleNumericDecorator { value: number = 0; } -/** 单一类型角色属性集合 */ -export class RoleNumericMapSingle { - private attributes: Map = new Map(); - - /** 求和 */ - sum(type: RoleAttributeType, value: number) { - var source = this.attributes.get(type); - if (source == null) source = 0; - this.attributes.set(type, source + value); - } - - /** 重置属性值为零 */ - reset() { - this.attributes.forEach((value: number, key: RoleAttributeType, map: Map) => { - map.set(key, 0); - }); - } - - /** 清除属性值 */ - clear() { - this.attributes.clear(); - } - - /** 遍历每个属性执行指定回调函数 */ - forEach(callbackfn: (value: number, key: RoleAttributeType, map: Map) => void, thisArg?: any): void { - this.attributes.forEach(callbackfn, thisArg); - } -} - /** 所有模块角色属性集合 */ export class RoleNumericMap { + /** 角色属性 */ private attributes: Map = new Map(); + /** 角色属性修饰器 */ private decorators: Map = new Map(); + /** VM组件数据 */ private vm: any = null!; constructor(vm: any) { @@ -96,6 +70,14 @@ export class RoleNumericMap { forEach(callbackfn: (value: RoleNumeric, key: RoleAttributeType, map: Map) => void, thisArg?: any): void { this.attributes.forEach(callbackfn, thisArg); } + + /** 重置属性值为零 */ + reset() { + this.decorators.clear(); + this.attributes.forEach((value: RoleNumeric, key: RoleAttributeType, map: Map) => { + value.reset(); + }); + } } /** 力量属性 */