ClubAndroidInput.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. // LIFE-CYCLE CALLBACKS:
  6. // onLoad () {},
  7. // start () {
  8. // },
  9. // update (dt) {},
  10. OnShowView:function(){
  11. this.$('num@Label').string = '';
  12. },
  13. onSetType:function(type,hook){
  14. this._type = type;
  15. this.m_Hook = hook;
  16. this.$('btNode/-').active = type == 1;
  17. this.$('btNode/reset').active = type == 0;
  18. cc.gPreLoader.LoadRes('Image_AndroidInput_t'+type,'ClubAndroid',function(sprFrame){
  19. this.$('Title@Sprite').spriteFrame = sprFrame;
  20. }.bind(this));
  21. },
  22. OnBtInput:function(_,data){
  23. var strNum = this.$('num@Label').string;
  24. strNum+=data;
  25. this.$('num@Label').string = strNum;
  26. },
  27. OnBtDel:function(){
  28. var strNum = this.$('num@Label').string;
  29. strNum = strNum.substr(0,strNum.length-1);
  30. this.$('num@Label').string = strNum;
  31. },
  32. OnBtReset:function(){
  33. this.$('num@Label').string = '';
  34. },
  35. OnBtSure:function(){
  36. if(this._type == 0)this.m_Hook.onCreatAndroid(parseInt(this.$('num@Label').string));
  37. if(this._type == 1)this.m_Hook.onSetAndroidScore(parseInt(this.$('num@Label').string));
  38. },
  39. });