mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { app } from "../App";
|
||||
import TimeUtil from "../../../extensions/ngame/assets/ngame/util/TimeUtil";
|
||||
import { TD, app } from "../App";
|
||||
import { API, EquipForgingBench, PetEquip } from "../consts/API";
|
||||
import { GUI } from "../ui/UIConfig";
|
||||
import BaseData from "./BaseData";
|
||||
@@ -19,6 +20,14 @@ export default class PetEquipData extends BaseData{
|
||||
//锻造台
|
||||
info:EquipForgingBench;
|
||||
|
||||
//锻造升级结束时间
|
||||
forgingBenchUpEnd:number;
|
||||
//获取升级剩余时间
|
||||
get forgingUpTimeExcess(){
|
||||
if(!this.forgingBenchUpEnd) return 0;
|
||||
return TimeUtil.remainder(this.forgingBenchUpEnd)
|
||||
}
|
||||
|
||||
//锻造台是否有宠物
|
||||
get isForgingBenchPet(){
|
||||
return !!PlayerPetData.getIns().petIdQueryPetInfo(this.info.forgingPetId);
|
||||
@@ -26,18 +35,23 @@ export default class PetEquipData extends BaseData{
|
||||
|
||||
async onInit() {
|
||||
this.equips = await API.PetEquipAll();
|
||||
this.info = await API.PetEquipForgingInfo();
|
||||
this.onUpdateInfo(await API.PetEquipForgingInfo())
|
||||
}
|
||||
|
||||
//更新锻造数据
|
||||
onUpdateInfo(info:EquipForgingBench){
|
||||
if(!info) return;
|
||||
this.info = info;
|
||||
this.forgingBenchUpEnd = Date.now() + this.info.forgingUpTimeExcess;
|
||||
console.log("this.forgingBenchUpEnd",this.forgingBenchUpEnd);
|
||||
app.event.emit(PetEquipDataEnum.UPDATE_FORGING_INFO);
|
||||
}
|
||||
|
||||
//锻造
|
||||
async forging(){
|
||||
return this.addEquip(await API.PetEquipForging());
|
||||
let info = await API.PetEquipForging();
|
||||
this.onUpdateInfo(info.info);
|
||||
return this.addEquip(info.equip);
|
||||
}
|
||||
|
||||
//添加装备
|
||||
@@ -79,5 +93,22 @@ export default class PetEquipData extends BaseData{
|
||||
return this.equips.filter(equip => (equip.equipPetId == petId && equip.equipPosition == position))[0];
|
||||
}
|
||||
|
||||
//升级锻造台
|
||||
async upForgingBench(){
|
||||
this.onUpdateInfo(await API.PetEquipForgingUp());
|
||||
}
|
||||
|
||||
//加速升级锻造台
|
||||
async useSpeedUpForgingBench(resType: number){
|
||||
this.onUpdateInfo(await API.PetEquipUseSpeed(resType));
|
||||
}
|
||||
|
||||
//获取指定宠物等级
|
||||
getForgingBenchPetLevel(petId:number = this.info.forgingPetId){
|
||||
let exp = this.info.forgingPetLevels[`${petId}`] || 0;
|
||||
let list = TD.TbGRoleEquipLevel.getDataList().filter(info => info.exp <= exp);
|
||||
return list[list.length - 1].id;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -8,7 +8,9 @@ export enum ResourceEvent{
|
||||
|
||||
//资源类型
|
||||
export enum ResourceType{
|
||||
Gold = 90001, //金币
|
||||
Gold = 90001, //金币
|
||||
ForgedStones = 90002, //锻造石
|
||||
SpeedUp = 90003, //加速卷
|
||||
}
|
||||
|
||||
//资源刷新类型
|
||||
|
Reference in New Issue
Block a user