import { _decorator, Component, instantiate, Node, Prefab } from 'cc'; import { Attributes } from '../Attributes'; import { config } from '../../config'; import { widget_item } from '../widget_item'; import { att_click_data, att_container, widget_item_data } from '../../../data/data'; const { ccclass, property } = _decorator; @ccclass('attributes_container') export class attributes_container extends Component { @property(Node) btn_add_image:Node = null; @property(Node) btn_add_animation:Node = null; @property(Node) btn_add_drop:Node = null; @property(Node) btn_add_click:Node = null; @property(Node) btn_add_slide:Node = null; @property(Prefab) item_prefab:Prefab = null; private cur_att_manager:Attributes = null private call_back = null; public initView(call,att_manager:Attributes){ this.cur_att_manager = att_manager this.call_back = call; } addWidgetByType(type:number){ // let node = instantiate(this.item_prefab) let node = this.cur_att_manager.getMain().control_view.getWidgetByType(type) // let temp_data = node.getComponent(widget_item).getData(); // node.getComponent(widget_item).initWidgetByScene(data) let att = Attributes.Singleton.get_cur_att_data() // if(att.container_layer==null){ // att.container_layer = new att_container // } // let data = new widget_item_data(temp_data.name,temp_data.type) // data.att = temp_data.att; // att.container_layer.widget_list.push(data) // if(this.call_back){ // this.call_back() // } this.cur_att_manager.getMain().onPushEndWidget(node,att.id,type) } start() { this.btn_add_animation.on(Node.EventType.TOUCH_END,()=>{ this.addWidgetByType(config.Widget_Type_List.ACTION_TYPE) }) this.btn_add_image.on(Node.EventType.TOUCH_END,()=>{ this.addWidgetByType(config.Widget_Type_List.IMG_TYPE) }) this.btn_add_drop.on(Node.EventType.TOUCH_END,()=>{ this.addWidgetByType(config.Widget_Type_List.DRAG_TYPE) }) this.btn_add_click.on(Node.EventType.TOUCH_END,()=>{ this.addWidgetByType(config.Widget_Type_List.CLICK_TYPE) }) this.btn_add_slide.on(Node.EventType.TOUCH_END,()=>{ this.addWidgetByType(config.Widget_Type_List.SLIDE_TYPE) }) } update(deltaTime: number) { } }