mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
40 lines
728 B
TypeScript
40 lines
728 B
TypeScript
import { API, PlayerInfoOV, PlayerPetOV } from "../consts/API";
|
|
import BaseData from "./BaseData";
|
|
|
|
|
|
//玩家宠物数据
|
|
export default class PlayerPetData extends BaseData{
|
|
|
|
//玩家宠物列表
|
|
datas:PlayerPetOV[] = [];
|
|
|
|
async onInit() {
|
|
|
|
//更新玩家宠物
|
|
await this.UpdatePlayerPet();
|
|
|
|
}
|
|
|
|
//获取全部宠物
|
|
getData(){
|
|
return this.datas;
|
|
}
|
|
|
|
//更新玩家宠物
|
|
async UpdatePlayerPet(){
|
|
//获取全部宠物
|
|
this.datas = await API.GetPlayerPets();
|
|
}
|
|
|
|
//选择宠物
|
|
async SelectNovicePet(petId:number){
|
|
await API.SelectNovicePet(petId);
|
|
//更新玩家宠物列表
|
|
await this.UpdatePlayerPet();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|