view_not_have_interact.ts 1023 B

12345678910111213141516171819202122232425262728
  1. import { _decorator, Component, Node, Sprite, SpriteFrame } from 'cc';
  2. import { view_ui_att_item } from './view_ui_att_item';
  3. import { not_have_interact_data } from '../../../data/data';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('view_not_have_interact')
  6. export class view_not_have_interact extends Component {
  7. @property(Node) bg:Node = null;
  8. @property(SpriteFrame) sf_bg_default:SpriteFrame = null;
  9. private m_data:not_have_interact_data = null;
  10. public updateView(data:not_have_interact_data){
  11. if(data===null){
  12. data = new not_have_interact_data;
  13. }
  14. this.m_data = data;
  15. this.bg.getComponent(view_ui_att_item).updateAtt(data.bg)
  16. data.bg = this.bg.getComponent(view_ui_att_item).getData()
  17. if(this.m_data.bg.res.length==0||this.m_data.bg.res_name.length==0) {
  18. this.bg.getComponent(view_ui_att_item).getComponent(Sprite).spriteFrame = this.sf_bg_default
  19. }
  20. }
  21. public getData(){
  22. return this.m_data;
  23. }
  24. }