import { _decorator, Component, instantiate, Node, Prefab } from 'cc'; import { config } from '../../config'; import { show_select_z_index_item } from './show_select_z_index_item'; const { ccclass, property } = _decorator; @ccclass('show_select_z_index') export class show_select_z_index extends Component { protected m_call_back = null; @property(Prefab) item_prefab:Prefab = null; @property(Node) content:Node = null; public show(call){ this.m_call_back = call; config.Zindex_type_map.forEach((v,k)=>{ let item = instantiate(this.item_prefab) item.parent = this.content; item.getComponent(show_select_z_index_item).initView(k,v,this.onItemClick.bind(this)) }) } public showDir(call){ this.m_call_back = call; config.widget_scale_dir_map.forEach((v,k)=>{ let item = instantiate(this.item_prefab) item.parent = this.content; item.getComponent(show_select_z_index_item).initView(k,v,this.onItemClick.bind(this)) }) } close(){ this.node.removeFromParent() } onItemClick(z:number){ if(this.m_call_back!=null){ this.m_call_back(z) } this.close() } }