提交升级

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-11-28 02:13:05 +08:00
parent 62959f80e4
commit 07db3912cc
46 changed files with 2482 additions and 961 deletions

View File

@@ -0,0 +1,78 @@
import { sp } from 'cc';
import { _decorator, Component, Node } from 'cc';
import { PlayerPetOV } from '../../../../consts/API';
import { app } from '../../../../App';
import { UIPetAnim } from '../../../../consts/GData';
import { Label } from 'cc';
import { PlayerPetEvent } from '../../../../data/PlayerPetData';
const { ccclass, property } = _decorator;
@ccclass('PetPreviewWindow')
export class PetPreviewWindow extends Component {
@property(Node)
starNode:Node; //星星节点
@property(Label)
levelLabel:Label; //等级
@property(sp.Skeleton)
spine:sp.Skeleton; //宠物Spine
info:PlayerPetOV;
onLoad(){
this.onUpdateInit();
//监听
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
protected onDestroy(): void {
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
//初始化
onUpdateInit(){
//隐藏
this.starNode.active = false;
this.levelLabel.node.active = false;
}
//刷新信息
onUpdateInfo(info:PlayerPetOV){
if(this.info && info.petId == this.info.petId){
this.onUpdateView(); //刷新页面
}
}
//刷新页面
onUpdateView(){
this.onUpdateInit();
//显示宠物
this.spine.skeletonData = app.battleRes.roleSpine[this.info.petTbId];
this.spine.setAnimation(0,UIPetAnim.std,true);
//等级
this.levelLabel.node.active = true;
this.levelLabel.string = `Lv ${this.info.petLevel}`;
//如果有星则显示星
if(this.info.petStar){
this.starNode.active = true;
this.starNode.getComponentInChildren(Label).string = `${this.info.petStar}`;
}
}
//绑定显示的宠物
bind(info:PlayerPetOV){
this.info = info;
this.onUpdateView();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "f423768a-7790-4a2f-b005-a40110aba905",
"files": [],
"subMetas": {},
"userData": {}
}