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

@ccclass('view_boss_info')
export class view_boss_info extends Component {
    @property(Node) bg:Node = null;
    @property(Node) bg_bar:Node = null;
    @property(Node) bar:Node = null;
    @property(Node) head:Node = null;
    private m_data:boss_info_data = null;

    public updateView(data:boss_info_data){

        if(data===null){
            data = new boss_info_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.bg_bar.getComponent(view_ui_att_item).updateAtt(data.bg_bar)
        data.bg_bar = this.bg_bar.getComponent(view_ui_att_item).getData()

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

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

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


