mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交捕捉
This commit is contained in:
@@ -1,50 +1,17 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import JNScrollViewItem from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { PlayerPetOV } from '../../consts/API';
|
||||
import { sp } from 'cc';
|
||||
import { app } from '../../App';
|
||||
import { UIPetAnim } from '../../consts/GData';
|
||||
import JNScrollViewItem from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { PetIconSelect } from '../Consts/Pet/PetIconSelect';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('IntoBattlePetIcon')
|
||||
export class IntoBattlePetIcon extends JNScrollViewItem<PlayerPetOV> {
|
||||
|
||||
@property(sp.Skeleton)
|
||||
spine:sp.Skeleton;
|
||||
|
||||
//选中节点
|
||||
@property(Node)
|
||||
select:Node;
|
||||
|
||||
//不可选中节点
|
||||
@property(Node)
|
||||
noselect:Node;
|
||||
|
||||
//是否被选中
|
||||
isSelect:boolean = false;
|
||||
|
||||
//是否不可选中
|
||||
isNoSelect:boolean = false;
|
||||
|
||||
onLoad(){
|
||||
this.onUpdateSelect();
|
||||
this.noselect.active = false;
|
||||
this.select.active = false;
|
||||
}
|
||||
|
||||
start(): void {
|
||||
|
||||
//显示角色
|
||||
this.spine.skeletonData = app.battleRes.roleSpine[this.data.petTbId];
|
||||
this.spine.setAnimation(0,UIPetAnim.std,true);
|
||||
|
||||
}
|
||||
|
||||
onUpdateSelect(){
|
||||
|
||||
this.select.active = this.isSelect;
|
||||
this.noselect.active = this.isNoSelect;
|
||||
@property(PetIconSelect)
|
||||
select:PetIconSelect;
|
||||
|
||||
protected start(): void {
|
||||
this.select.setIcon(this.data.petTbId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "7c6657dc-bcb4-460e-ace3-860bd4238a0d",
|
||||
"uuid": "0d7f0c4b-80b2-49fb-baab-f4c7131b9dda",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
|
@@ -21,9 +21,6 @@ export class IntoBattleView extends JNLayerBase {
|
||||
@property(JNScrollView)
|
||||
views:JNScrollView; //宠物列表
|
||||
|
||||
@property(Prefab)
|
||||
petIconPrefab; //宠物Icon预制体
|
||||
|
||||
@property(sp.Skeleton)
|
||||
spine:sp.Skeleton; //当前选中的宠物
|
||||
|
||||
@@ -58,7 +55,7 @@ export class IntoBattleView extends JNLayerBase {
|
||||
//设置不可选中
|
||||
this.views.getItems<IntoBattlePetIcon>().forEach(item => {
|
||||
if(PlayerTacticalData.getIns().getTacticalInfo().indexOf(item.data.petId) != -1)
|
||||
item.isNoSelect = true; //如果在阵法里则不可选中
|
||||
item.select.isNoSelect = true; //如果在阵法里则不可选中
|
||||
})
|
||||
|
||||
//向子节点添加点击事件
|
||||
@@ -73,15 +70,13 @@ export class IntoBattleView extends JNLayerBase {
|
||||
|
||||
//默认都不选中
|
||||
this.views.getItems<IntoBattlePetIcon>().forEach(item => {
|
||||
item.isSelect = false;
|
||||
item.onUpdateSelect();
|
||||
item.select.isSelect = false;
|
||||
})
|
||||
|
||||
//设置选中
|
||||
if(this.index != -1){
|
||||
let current = this.views.getItems<IntoBattlePetIcon>()[this.index]
|
||||
current.isSelect = true;
|
||||
current.onUpdateSelect();
|
||||
current.select.isSelect = true;
|
||||
|
||||
//显示选中宠物
|
||||
this.spine.skeletonData = app.battleRes.roleSpine[this.pets[this.index].petTbId];
|
||||
@@ -94,7 +89,7 @@ export class IntoBattleView extends JNLayerBase {
|
||||
onClickItem(index:number){
|
||||
|
||||
//判断是否不可选中
|
||||
if(this.views.getItems<IntoBattlePetIcon>()[index].isNoSelect) {
|
||||
if(this.views.getItems<IntoBattlePetIcon>()[index].select.isNoSelect) {
|
||||
app.layer.Open(GUI.Tips,{text:"当前宠物已上阵"})
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user