import { _decorator, Label, Node } from 'cc'; import { BaseView } from '../../../framework/layer/BaseView'; import List from '../../../framework/list/List'; import { StringUtil } from '../../../framework/util/StringUtil'; import { HeroListItem } from './HeroListItem'; const { ccclass, property } = _decorator; @ccclass('HeroList') export class HeroList extends BaseView { @property({ type: Label, tooltip: "标题" }) titleTx: Label = null; @property({ type: List, tooltip: "滑动容器" }) sv: List = null; private _herosData = []; protected onLoad() { super.onLoad(); this.titleTx.string = StringUtil.getLanguageData('英雄列表'); for (let index = 0; index < 4; index++) { } this.sv.numItems = 4; } protected onDestroy() { } //UI开打时会调用,如果有初始化代码应该放到此函数 onOpen() { } //UI关闭时会调用,该函数在onDestroy前调用 onClose() { } //框架管理UI层级时会调用,可根据UI情况修改 onShow() { super.onShow(); } //框架管理UI层级时会调用,可根据UI情况修改 onHide() { super.onHide(); } //UI事件处理 private onTouchButton(event: Event) { //Framework.audio.playEffect(AudioID.Click); let target: any = event.target; } onEventList(item, idx) { item.getComponent(HeroListItem).refreshItem(this._herosData[idx]); } }