提交锻造装备

This commit is contained in:
PC-20230316NUNE\Administrator
2024-01-09 18:32:21 +08:00
parent 61767ea93f
commit 14f1059337
36 changed files with 4461 additions and 1280 deletions

View File

@@ -5,6 +5,7 @@ import { GUI } from '../../UIConfig';
import { API, PlayerPetOV } from '../../../consts/API';
import { PetIconSelectShow } from '../../Consts/Pet/PetIconSelectShow';
import PlayerPetData from '../../../data/PlayerPetData';
import { PetEquipIcon } from '../../Consts/PetEquip/icon/PetEquipIcon';
const { ccclass, property } = _decorator;
@@ -16,25 +17,41 @@ export class MainForgingBench extends Component {
@property(PetIconSelectShow)
petView:PetIconSelectShow;
//装备列表
@property(Node)
equips:Node;
onLoad(){
this.onUpdateView();
//监听锻造数据
app.event.on(PetEquipDataEnum.UPDATE_FORGING_INFO,this.onUpdateForging,this);
app.event.on(PetEquipDataEnum.UPDATE_EQUIP,this.onUpdateEquip,this);
this.onUpdateView();
}
protected onDestroy(): void {
app.event.off(PetEquipDataEnum.UPDATE_FORGING_INFO,this.onUpdateForging,this);
app.event.off(PetEquipDataEnum.UPDATE_EQUIP,this.onUpdateEquip,this);
}
onUpdateView(){
this.onUpdateForging();
this.onUpdateEquip();
}
//刷新装备
onUpdateEquip(){
this.equips.getComponentsInChildren(PetEquipIcon).forEach((equip,index) => {
equip.set(PetEquipData.getIns().getPetEquip(index + 1));
})
}
//刷新锻造数据
onUpdateForging(){
console.log("刷新锻造数据",PlayerPetData.getIns().petIdQueryPetInfo(PetEquipData.getIns().info.forgingPetId));
this.petView.set(PlayerPetData.getIns().petIdQueryPetInfo(PetEquipData.getIns().info.forgingPetId));
}