1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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]);
- }
- }
|