attributes_rotation.ts 780 B

1234567891011121314151617181920212223242526
  1. import { _decorator, Component, EditBox, Node } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('attributes_rotation')
  4. export class attributes_rotation extends Component {
  5. @property(Node) editBox:Node = null;
  6. private m_callback: Function = null;
  7. initView(callback:Function) {
  8. this.m_callback = callback
  9. }
  10. public update_att(rotation:number){
  11. if(rotation==undefined||rotation==null){ rotation = 0}
  12. this.editBox.getComponent(EditBox).string = rotation.toString()
  13. }
  14. public editBoxEditingDidEnded(editBox: EditBox) {
  15. if(this.m_callback != null) {
  16. if(editBox.string=='') {
  17. editBox.string = '0'
  18. }
  19. this.m_callback(parseInt(editBox.string))
  20. }
  21. }
  22. }