提交锻造系统

This commit is contained in:
PC-20230316NUNE\Administrator
2024-01-08 18:55:00 +08:00
parent e737a09828
commit e8a1cb9362
39 changed files with 9319 additions and 2035 deletions

View File

@@ -0,0 +1,33 @@
import { API, EquipForgingBench, PetEquip } from "../consts/API";
import BaseData from "./BaseData";
import PlayerPetData from "./PlayerPetData";
//宠物装备数据类
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();
}
//锻造
async forging(){
await API.PetEquipForging();
}
//设置锻造宠
async setForgingPetId(petId:number){
await API.PetEquipForgingPetId(petId);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "ea657593-8f6d-4713-addc-2d01393bf466",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,6 +1,7 @@
import { app } from "../App";
import { API, PlayerTacticalOV } from "../consts/API";
import BaseData from "./BaseData";
import PlayerPetData from "./PlayerPetData";
export enum PlayerTacticalEvent{
//更新上阵信息
@@ -31,7 +32,7 @@ export default class PlayerTacticalData extends BaseData{
}
this.info = {
...ov,
roles: JSON.parse(ov.tacticalData),
roles: JSON.parse(ov.tacticalData).map(id => PlayerPetData.getIns().petIdQueryPetInfo(id) ? id : 0),
}
//通知阵法信息已更新
@@ -56,6 +57,7 @@ export default class PlayerTacticalData extends BaseData{
//修改指定位置的上阵 上阵下标,上阵的宠物Id
async UpdateIndexTactical(index:number,petId:number){
this.info.roles = this.info.roles.map(id => petId == id ? 0 : id);
this.info.roles[index] = petId;
await this.UpdateTactical(this.info.roles);
}
@@ -65,6 +67,11 @@ export default class PlayerTacticalData extends BaseData{
return this.info.roles[index];
}
//获取宠物的阵法下标
getItemIndex(roleId:number){
return this.info.roles.indexOf(roleId);
}
//获取初始化上阵信息
getInitTacticalInfo():number[]{
return [0,0,0,0,0,0,0,0,0]