SelfInput.js 970 B

123456789101112131415161718192021222324252627282930313233343536
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. m_LabNum:cc.Label,
  5. },
  6. OnShowView:function(){
  7. this.m_Input = null;
  8. this.m_LabNum.string = '';
  9. },
  10. OnBtInputNum:function(Tag, Data){
  11. var add = parseInt(Data);
  12. if(this.m_Input == null) this.m_Input = 0;
  13. this.m_Input = this.m_Input*10 + add;
  14. this.m_LabNum.string = this.m_Input;
  15. },
  16. OnBtDel:function(){
  17. if(this.m_Input == null)return
  18. this.m_Input = parseInt(this.m_Input/10);
  19. if(this.m_Input == 0){
  20. this.m_Input = null;
  21. this.m_LabNum.string = ''
  22. } else {
  23. this.m_LabNum.string = this.m_Input
  24. }
  25. },
  26. OnBtReSet:function(){
  27. this.m_Input = null;
  28. this.m_LabNum.string = '';
  29. },
  30. OnBtSure:function(){
  31. if(this.m_Input != null)this.m_Hook.SetInput(this.m_Input);
  32. this.HideView();
  33. },
  34. });