| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- /** 可生产产品列表 */
- import TableView from "../../../game/component/TableView";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class PlantPanel extends cc.Component {
- @property({ type: TableView, displayName: '滚动视图' })
- private tableView: TableView = null;
- private list_data = null;
- start() {
- gData.plantData.init_itemIndex = -1;
- gData.plantData.init_lock = -1;
- this.initScollView();
- }
- getItemDataByID(id) {
- let len = this.list_data.length;
- for (var i = 0; i < len; i++) {
- if (this.list_data[i].picture == id) {
- return i;
- }
- }
- return 0;
- }
- /**
- * 初始化滚动视图
- */
- private initScollView() {
- this.list_data = gData.plantData.productArr;
- this.tableView.node.emit('srollview-init', this.list_data)
- }
- onDestroy() {
- // this.tableView.clearItem();
- }
- }
|