提交锻造系统

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

@@ -15,6 +15,10 @@ import { PetPreviewWindow } from '../Consts/Pet/info/PetPreviewWindow';
import { Label } from 'cc';
const { ccclass, property } = _decorator;
export enum IntoBattleState{
= "请选择", = "下阵", = "替阵", = "上阵"
}
//上阵页面
@ccclass('IntoBattleView')
export class IntoBattleView extends JNLayerBase {
@@ -100,9 +104,35 @@ export class IntoBattleView extends JNLayerBase {
//刷新上阵
onUpdateTactical(){
//获取当前阵法下标是否存在宠物
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
this.tacticalLabel.string = `${petId ? "下阵" : "上阵"}`
//选择的宠物
this.tacticalLabel.string = `${this.getIntoBattleState()}`;
}
//获取当前状态
getIntoBattleState():IntoBattleState{
//选择的宠物
let selectPet = this.pets[this.index];
if(this.index == -1 || !selectPet) {
return IntoBattleState.
}
//判断选中的宠物是否存在阵法里 存在则下阵
let selectIndex = PlayerTacticalData.getIns().getItemIndex(selectPet.petId);
if(selectIndex >= 0){
//存在 如果存在的下标是当前下标则下阵 不是 则替换
if(selectIndex == this.tIndex)
return IntoBattleState.
else return IntoBattleState.;
}else{
//不存在则上阵
return IntoBattleState.;
}
}
//点击Item
@@ -118,26 +148,21 @@ export class IntoBattleView extends JNLayerBase {
//点击上阵
async onClickTactical(){
if(this.index < 0){
let state = this.getIntoBattleState();
if(state == IntoBattleState.){
app.layer.Open(GUI.Tips,{text:"请选择要上阵的宠物."})
return;
}
//获取当前阵法下标是否存在宠物
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
if(petId) {
//下阵
}else if(state == IntoBattleState. || state == IntoBattleState.){
//修改上阵信息
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,this.pets[this.index].petId);
app.layer.Open(GUI.Tips,{text:"上阵成功"});
}else if(state == IntoBattleState.){
//修改上阵信息
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,0);
app.layer.Open(GUI.Tips,{text:"下阵成功"});
//上阵完 关闭页面
app.layer.CloseNode(this.node);
return;
}
//修改上阵信息
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,this.pets[this.index].petId);
app.layer.Open(GUI.Tips,{text:"上阵成功"});
//上阵完 关闭页面
app.layer.CloseNode(this.node);