提交升级

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

@@ -3,6 +3,9 @@ import { _decorator, Component, Node } from 'cc';
import { app } from '../../../App';
import { UIPetAnim } from '../../../consts/GData';
import { v3 } from 'cc';
import { PlayerPetOV } from '../../../consts/API';
import { Label } from 'cc';
import { PlayerPetEvent } from '../../../data/PlayerPetData';
const { ccclass, property } = _decorator;
@ccclass('PetIcon')
@@ -11,13 +14,54 @@ export class PetIcon extends Component {
@property(sp.Skeleton)
spine:sp.Skeleton;
//设置icon
setIcon(petTbId:number){
@property(Node)
starNode:Node; //星星
this.spine.skeletonData = app.battleRes.roleSpine[petTbId];
info:PlayerPetOV;
onLoad(){
this.reset();
//监听
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
protected onDestroy(): void {
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
//初始化
reset(){
this.starNode.active = false;
}
//信息更新
onUpdateInfo(info:PlayerPetOV){
if(this.info && info.petId == this.info.petId){
this.onUpdateView(); //刷新页面
}
}
//刷新页面
onUpdateView(){
this.spine.skeletonData = app.battleRes.roleSpine[this.info.petTbId];
this.spine.setAnimation(0,UIPetAnim.std,true);
if(this.info.petStar){
this.starNode.active = true;
this.starNode.getComponentInChildren(Label).string = `${this.info.petStar}`;
}
}
//设置icon
set(info:PlayerPetOV){
this.reset();
this.info = info;
this.onUpdateView();
}
}

View File

@@ -1,5 +1,6 @@
import { _decorator, Component, Node } from 'cc';
import { PetIcon } from './PetIcon';
import { PlayerPetOV } from '../../../consts/API';
const { ccclass, property } = _decorator;
@ccclass('PetIconSelect')
@@ -43,10 +44,10 @@ export class PetIconSelect extends Component {
}
//设置icon
setIcon(petTbId:number){
//设置
set(info:PlayerPetOV){
this.petIcon.setIcon(petTbId);
this.petIcon.set(info);
}

View File

@@ -11,7 +11,7 @@ export class PetIconSelectScroll extends JNScrollViewItem<PlayerPetOV> {
select:PetIconSelect;
protected start(): void {
this.select.setIcon(this.data.petTbId);
this.select.set(this.data);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c1b92428-4724-4f3e-b2c6-416af802434c",
"files": [],
"subMetas": {},
"userData": {}
}

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": {}
}