mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -12,6 +12,7 @@ import { GUI } from '../UIConfig';
|
||||
import PlayerTacticalData from '../../data/PlayerTacticalData';
|
||||
import { PetIconSelectScroll } from '../Consts/Pet/PetIconSelectScroll';
|
||||
import { PetPreviewWindow } from '../Consts/Pet/info/PetPreviewWindow';
|
||||
import { Label } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//上阵页面
|
||||
@@ -25,6 +26,9 @@ export class IntoBattleView extends JNLayerBase {
|
||||
@property(PetPreviewWindow)
|
||||
petPreview:PetPreviewWindow; //宠物显示窗口
|
||||
|
||||
@property(Label)
|
||||
tacticalLabel:Label;//上阵文本
|
||||
|
||||
//宠物数据
|
||||
pets:PlayerPetOV[] = [];
|
||||
|
||||
@@ -51,6 +55,14 @@ export class IntoBattleView extends JNLayerBase {
|
||||
|
||||
//获取所有玩家宠物
|
||||
this.pets = PlayerPetData.getIns().getData();
|
||||
|
||||
//获取当前阵法下标是否存在宠物
|
||||
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
|
||||
if(petId){
|
||||
//如果存在则默认选中
|
||||
this.index = this.pets.indexOf(PlayerPetData.getIns().petIdQueryPetInfo(petId));
|
||||
}
|
||||
|
||||
this.views.refreshData(this.pets);
|
||||
|
||||
//设置不可选中
|
||||
@@ -83,6 +95,14 @@ export class IntoBattleView extends JNLayerBase {
|
||||
this.petPreview.bind(this.pets[this.index]);
|
||||
}
|
||||
|
||||
this.onUpdateTactical();
|
||||
}
|
||||
|
||||
//刷新上阵
|
||||
onUpdateTactical(){
|
||||
//获取当前阵法下标是否存在宠物
|
||||
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
|
||||
this.tacticalLabel.string = `${petId ? "下阵" : "上阵"}`
|
||||
}
|
||||
|
||||
//点击Item
|
||||
@@ -102,13 +122,21 @@ export class IntoBattleView extends JNLayerBase {
|
||||
app.layer.Open(GUI.Tips,{text:"请选择要上阵的宠物."})
|
||||
return;
|
||||
}
|
||||
if(this.views.getItems<PetIconSelectScroll>()[this.index].select.isNoSelect) {
|
||||
app.layer.Open(GUI.Tips,{text:"当前宠物已上阵"})
|
||||
//获取当前阵法下标是否存在宠物
|
||||
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
|
||||
|
||||
if(petId) {
|
||||
//下阵
|
||||
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);
|
||||
|
Reference in New Issue
Block a user