import { _decorator, Component, Node } from 'cc';
import { wei_chi_pointer_data } from '../../../data/data';
import { view_ui_att_item } from './view_ui_att_item';
const { ccclass, property } = _decorator;

@ccclass('view_wei_chi_pointer')
export class view_wei_chi_pointer extends Component {
    @property(Node) bg:Node = null;
    @property(Node) img_hand:Node = null;
    @property(Node) img_bar:Node = null;
    @property(Node) img_pointer:Node = null;
    @property(Node) img_text_bing_zhu_hu_xi:Node = null;
    @property(Node) btn_bingxi:Node = null;
    private m_data:wei_chi_pointer_data = null;

    public updateView(data:wei_chi_pointer_data){

        if(data===null){
            data = new wei_chi_pointer_data;
        }

        this.m_data = data;

        this.bg.getComponent(view_ui_att_item).updateAtt(data.bg)
        data.bg = this.bg.getComponent(view_ui_att_item).getData()

        this.img_hand.getComponent(view_ui_att_item).updateAtt(data.img_hand)
        data.img_hand = this.img_hand.getComponent(view_ui_att_item).getData()

        this.img_bar.getComponent(view_ui_att_item).updateAtt(data.img_bar)
        data.img_bar = this.img_bar.getComponent(view_ui_att_item).getData()

        this.img_pointer.getComponent(view_ui_att_item).updateAtt(data.img_pointer)
        data.img_pointer = this.img_pointer.getComponent(view_ui_att_item).getData()

        this.img_text_bing_zhu_hu_xi.getComponent(view_ui_att_item).updateAtt(data.img_text_bing_zhu_hu_xi)
        data.img_text_bing_zhu_hu_xi = this.img_text_bing_zhu_hu_xi.getComponent(view_ui_att_item).getData()

        this.btn_bingxi.getComponent(view_ui_att_item).updateAtt(data.btn_bingxi)
        data.btn_bingxi = this.btn_bingxi.getComponent(view_ui_att_item).getData()
    }

    public getData(){
        return this.m_data;
    }
}


