mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交锻造系统
This commit is contained in:
33
JisolGameCocos/assets/script/data/PetEquipData.ts
Normal file
33
JisolGameCocos/assets/script/data/PetEquipData.ts
Normal 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);
|
||||
}
|
||||
|
||||
}
|
9
JisolGameCocos/assets/script/data/PetEquipData.ts.meta
Normal file
9
JisolGameCocos/assets/script/data/PetEquipData.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "ea657593-8f6d-4713-addc-2d01393bf466",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -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]
|
||||
|
Reference in New Issue
Block a user