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

@ccclass('view_not_have_interact')
export class view_not_have_interact extends Component {
    @property(Node) bg:Node = null;
    @property(SpriteFrame) sf_bg_default:SpriteFrame = null;
    private m_data:not_have_interact_data = null;
    public updateView(data:not_have_interact_data){
        if(data===null){
            data = new not_have_interact_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()
        if(this.m_data.bg.res.length==0||this.m_data.bg.res_name.length==0) {
            this.bg.getComponent(view_ui_att_item).getComponent(Sprite).spriteFrame = this.sf_bg_default
        }
    }

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


