level_list_item.ts 579 B

123456789101112131415161718
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { level_list_item_data } from '../../data/data';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('level_list_item')
  5. export class level_list_item extends Component {
  6. @property(Node) lab_name:Node = null;
  7. private m_data:level_list_item_data = null;
  8. public initView(data:level_list_item_data,call_back){
  9. this.m_data = data;
  10. this.lab_name.getComponent(Label).string = data.name;
  11. this.node.on(Node.EventType.TOUCH_END,()=>{
  12. call_back(this.m_data)
  13. })
  14. }
  15. }