53 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-11-16 02:44:43 +08:00
import { _decorator, Component, Node } from 'cc';
2023-11-16 19:10:19 +08:00
import JNScrollViewItem from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
import { PlayerPetOV } from '../../consts/API';
2023-11-16 02:44:43 +08:00
import { sp } from 'cc';
2023-11-16 19:10:19 +08:00
import { app } from '../../App';
import { UIPetAnim } from '../../consts/GData';
2023-11-16 02:44:43 +08:00
const { ccclass, property } = _decorator;
2023-11-16 19:10:19 +08:00
@ccclass('IntoBattlePetIcon')
export class IntoBattlePetIcon extends JNScrollViewItem<PlayerPetOV> {
2023-11-16 02:44:43 +08:00
@property(sp.Skeleton)
spine:sp.Skeleton;
//选中节点
@property(Node)
select:Node;
2023-11-16 19:10:19 +08:00
//不可选中节点
@property(Node)
noselect:Node;
2023-11-16 02:44:43 +08:00
//是否被选中
isSelect:boolean = false;
2023-11-16 19:10:19 +08:00
//是否不可选中
isNoSelect:boolean = false;
2023-11-16 02:44:43 +08:00
onLoad(){
this.onUpdateSelect();
2023-11-16 19:10:19 +08:00
this.noselect.active = false;
this.select.active = false;
2023-11-16 02:44:43 +08:00
}
start(): void {
//显示角色
this.spine.skeletonData = app.battleRes.roleSpine[this.data.petTbId];
this.spine.setAnimation(0,UIPetAnim.std,true);
}
onUpdateSelect(){
this.select.active = this.isSelect;
2023-11-16 19:10:19 +08:00
this.noselect.active = this.isNoSelect;
2023-11-16 02:44:43 +08:00
}
}