import { _decorator, Component, instantiate, Node, Prefab, Sprite } from 'cc'; import { config } from '../config'; import { slide_dir_select_item } from './slide_dir_select_item'; import { att_click_data } from '../../data/data'; const { ccclass, property } = _decorator; @ccclass('slide_dir_select') export class slide_dir_select extends Component { @property(Node) content:Node = null; @property(Node) btn_close:Node = null; @property(Prefab) item_prefab:Prefab = null; private call_back = null; public show(call){ this.call_back = call; config.slide_type_map.forEach((v,k)=>{ let item = instantiate(this.item_prefab) item.parent = this.content; item.getComponent(slide_dir_select_item).initView(k,this.onItemClick.bind(this)) }) this.btn_close.on(Node.EventType.TOUCH_END,()=>{ this.close() }) } onItemClick(dir:number){ if(this.call_back!=null){ this.call_back(dir) } this.close() } close(){ this.node.destroy() } }