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

@ccclass('view_pointer_ding_wei')
export class view_pointer_ding_wei extends Component {
    @property(Node) bg:Node = null;
    @property(Node) pointer_bar:Node = null;
    @property(Node) pointer_bar_point:Node = null;
    @property(Node) img_text:Node = null;
    @property(Node) img_eye_1:Node = null;
    @property(Node) img_eye_2:Node = null;
    @property(Node) btn_pointer_ding_wei_sure:Node = null;
    private m_data:pointer_ding_wei_data = null;
    public updateView(data:pointer_ding_wei_data){
        if(data===null){
            data = new pointer_ding_wei_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.pointer_bar.getComponent(view_ui_att_item).updateAtt(data.pointer_bar)
        data.pointer_bar = this.pointer_bar.getComponent(view_ui_att_item).getData()

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

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

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

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

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

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


