mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import PetEquipData from '../../../data/PetEquipData';
|
||||
import PetEquipData, { PetEquipDataEnum } from '../../../data/PetEquipData';
|
||||
import { app } from '../../../App';
|
||||
import { GUI } from '../../UIConfig';
|
||||
import { API, PlayerPetOV } from '../../../consts/API';
|
||||
import { PetIconSelectShow } from '../../Consts/Pet/PetIconSelectShow';
|
||||
import PlayerPetData from '../../../data/PlayerPetData';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@@ -9,19 +12,52 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('MainForgingBench')
|
||||
export class MainForgingBench extends Component {
|
||||
|
||||
//锻造宠
|
||||
@property(PetIconSelectShow)
|
||||
petView:PetIconSelectShow;
|
||||
|
||||
onLoad(){
|
||||
this.onUpdateView();
|
||||
|
||||
//监听锻造数据
|
||||
app.event.on(PetEquipDataEnum.UPDATE_FORGING_INFO,this.onUpdateForging,this);
|
||||
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
|
||||
app.event.off(PetEquipDataEnum.UPDATE_FORGING_INFO,this.onUpdateForging,this);
|
||||
}
|
||||
|
||||
onUpdateView(){
|
||||
this.onUpdateForging();
|
||||
}
|
||||
|
||||
//刷新锻造数据
|
||||
onUpdateForging(){
|
||||
this.petView.set(PlayerPetData.getIns().petIdQueryPetInfo(PetEquipData.getIns().info.forgingPetId));
|
||||
}
|
||||
|
||||
//点击锻造
|
||||
async onClickForging(){
|
||||
if(!PetEquipData.getIns().isForgingBenchPet){
|
||||
app.layer.Open(GUI.Tips,{text:"请选择锻造宠"});
|
||||
return;
|
||||
}
|
||||
PetEquipData.getIns().forging();
|
||||
app.layer.Open(GUI.PetEquipForgingPopupView);
|
||||
let equip = await PetEquipData.getIns().forging();
|
||||
equip && app.layer.Open(GUI.PetEquipForgingPopupView,equip);
|
||||
}
|
||||
|
||||
//点击锻造宠
|
||||
async onClickForgingPet(){
|
||||
app.layer.Open(GUI.PetRadioView);
|
||||
let info:PlayerPetOV = await (new Promise(resolve => {
|
||||
app.layer.Open(GUI.PetRadioView,{resolve});
|
||||
}))
|
||||
if(!info) return;
|
||||
|
||||
//设置锻造宠
|
||||
await PetEquipData.getIns().setForgingPetId(info.petId);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user