mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { _decorator, Component, Node } from 'cc';
|
|
import { JNGLayerBase } from '../../../components/JNComponent';
|
|
import JNScrollView from '../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
|
import GOnHookData from '../../../data/GOnHookData';
|
|
import { TD } from '../../../App';
|
|
import { NodeEventType } from 'cc';
|
|
import { TablePetIconSelectScroll } from '../../Consts/Pet/table/TablePetIconSelectScroll';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('MainOnHookView')
|
|
export class MainOnHookView extends JNGLayerBase {
|
|
|
|
//野怪列表
|
|
@property(JNScrollView)
|
|
views:JNScrollView;
|
|
|
|
onJNLoad(){
|
|
|
|
super.onJNLoad();
|
|
|
|
this.onUpdateView();
|
|
|
|
//向子节点添加点击事件
|
|
this.views.addItemEvent(NodeEventType.TOUCH_START,this.onClickItem.bind(this));
|
|
|
|
}
|
|
|
|
onUpdateView(){
|
|
|
|
//显示当前地图可出现的所有宠物
|
|
|
|
let mapInfo = TD.TbGOnHookMaps.get(GOnHookData.getIns().info.onHookMap);
|
|
let pets = mapInfo.petIds.map(petId => TD.TbGRole.get(petId));
|
|
this.views.refreshData(pets);
|
|
|
|
}
|
|
|
|
//点击Item
|
|
onClickItem(index:number){
|
|
|
|
let datas = this.views.getItems<TablePetIconSelectScroll>();
|
|
datas[index].select.isSelect = !datas[index].select.isSelect;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|