attributes_animation.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { att_ani_data } from '../../../data/data';
  3. import { tools } from '../../tools';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('attributes_animation')
  6. export class attributes_animation extends Component {
  7. @property(Node) btn_add_animation:Node = null;
  8. @property(Node) lab_name:Node = null;
  9. private call_back = null;
  10. private _ani_list:att_ani_data[] = []
  11. protected start(): void {
  12. let self = this;
  13. this.btn_add_animation.on(Node.EventType.TOUCH_END,()=>{
  14. tools.show_add_animation(this._ani_list,(list:att_ani_data[])=>{
  15. self._ani_list = list;
  16. self.change()
  17. })
  18. })
  19. }
  20. public update_att(ani_list:att_ani_data[]){
  21. this._ani_list = ani_list;
  22. this.lab_name.getComponent(Label).string = this._ani_list.length>0?"添加动画":"空"
  23. }
  24. public initView(call){
  25. this.call_back = call;
  26. }
  27. change(){
  28. if(this.call_back!=null){
  29. this.call_back(this._ani_list)
  30. }
  31. }
  32. }