mirror of
https://gitee.com/dgflash/oops-framework.git
synced 2026-05-31 18:59:19 +08:00
.
This commit is contained in:
@@ -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!);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -15,39 +15,13 @@ export class RoleNumericDecorator {
|
||||
value: number = 0;
|
||||
}
|
||||
|
||||
/** 单一类型角色属性集合 */
|
||||
export class RoleNumericMapSingle {
|
||||
private attributes: Map<RoleAttributeType, number> = 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<RoleAttributeType, number>) => {
|
||||
map.set(key, 0);
|
||||
});
|
||||
}
|
||||
|
||||
/** 清除属性值 */
|
||||
clear() {
|
||||
this.attributes.clear();
|
||||
}
|
||||
|
||||
/** 遍历每个属性执行指定回调函数 */
|
||||
forEach(callbackfn: (value: number, key: RoleAttributeType, map: Map<RoleAttributeType, number>) => void, thisArg?: any): void {
|
||||
this.attributes.forEach(callbackfn, thisArg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 所有模块角色属性集合 */
|
||||
export class RoleNumericMap {
|
||||
/** 角色属性 */
|
||||
private attributes: Map<RoleAttributeType, RoleNumeric> = new Map();
|
||||
/** 角色属性修饰器 */
|
||||
private decorators: Map<RoleNumericDecorator, number> = 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<RoleAttributeType, RoleNumeric>) => void, thisArg?: any): void {
|
||||
this.attributes.forEach(callbackfn, thisArg);
|
||||
}
|
||||
|
||||
/** 重置属性值为零 */
|
||||
reset() {
|
||||
this.decorators.clear();
|
||||
this.attributes.forEach((value: RoleNumeric, key: RoleAttributeType, map: Map<RoleAttributeType, RoleNumeric>) => {
|
||||
value.reset();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** 力量属性 */
|
||||
|
||||
Reference in New Issue
Block a user