mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 03:14:47 +00:00
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { app } from "../App";
|
|
import { API, EquipForgingBench, PetEquip } from "../consts/API";
|
|
import BaseData from "./BaseData";
|
|
import PlayerPetData from "./PlayerPetData";
|
|
|
|
export enum PetEquipDataEnum{
|
|
//更新锻造数据
|
|
UPDATE_FORGING_INFO = "PetEquipDataEnum_UPDATE_FORGING_INFO"
|
|
}
|
|
|
|
//宠物装备数据类
|
|
export default class PetEquipData extends BaseData{
|
|
|
|
//装备
|
|
equips:PetEquip[];
|
|
//锻造台
|
|
info:EquipForgingBench;
|
|
|
|
//锻造台是否有宠物
|
|
get isForgingBenchPet(){
|
|
return !!PlayerPetData.getIns().petIdQueryPetInfo(this.info.forgingPetId);
|
|
}
|
|
|
|
async onInit() {
|
|
this.equips = await API.PetEquipAll();
|
|
this.info = await API.PetEquipForgingInfo();
|
|
}
|
|
|
|
//更新锻造数据
|
|
onUpdateInfo(info:EquipForgingBench){
|
|
this.info = info;
|
|
app.event.emit(PetEquipDataEnum.UPDATE_FORGING_INFO);
|
|
}
|
|
|
|
//锻造
|
|
async forging(){
|
|
return await API.PetEquipForging();
|
|
}
|
|
|
|
//设置锻造宠
|
|
async setForgingPetId(petId:number){
|
|
this.onUpdateInfo(await API.PetEquipForgingPetId(petId));
|
|
}
|
|
|
|
|
|
} |