|
@@ -2,7 +2,8 @@ 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';
|
|
|
+import { HeroListItem, heroListItemData } from './HeroListItem';
|
|
|
+import { RoleManager } from '../../manager/RoleManager';
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@ccclass('HeroList')
|
|
@@ -13,35 +14,39 @@ export class HeroList extends BaseView {
|
|
|
@property({ type: List, tooltip: "滑动容器" })
|
|
|
sv: List = null;
|
|
|
|
|
|
- private _herosData = [];
|
|
|
+ private _herosData: Array<heroListItemData> = [];
|
|
|
protected onLoad() {
|
|
|
super.onLoad();
|
|
|
this.titleTx.string = StringUtil.getLanguageData('英雄列表');
|
|
|
+
|
|
|
+ let data = RoleManager.getRolesRaceGroup();
|
|
|
+
|
|
|
for (let index = 0; index < 4; index++) {
|
|
|
-
|
|
|
+ let t: heroListItemData = { race: index, heros: data[index + 1], equips: {} }
|
|
|
+ this._herosData.push(t);
|
|
|
}
|
|
|
- this.sv.numItems = 4;
|
|
|
+ this.sv.numItems = this._herosData.length;
|
|
|
}
|
|
|
|
|
|
protected onDestroy() {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//UI开打时会调用,如果有初始化代码应该放到此函数
|
|
|
onOpen() {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//UI关闭时会调用,该函数在onDestroy前调用
|
|
|
onClose() {
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//框架管理UI层级时会调用,可根据UI情况修改
|
|
|
onShow() {
|
|
|
super.onShow();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//框架管理UI层级时会调用,可根据UI情况修改
|
|
|
onHide() {
|
|
|
super.onHide();
|