LeaseGrantInfo.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. grantName: {
  5. default: null,
  6. type: cc.Label,
  7. serializable: true,
  8. },
  9. amount: {
  10. default: null,
  11. type: cc.Label,
  12. serializable: true,
  13. },
  14. //介绍
  15. describe: {
  16. default: null,
  17. type: cc.Label,
  18. serializable: true,
  19. },
  20. inputInviteValue: {
  21. default: 1,
  22. visible: false
  23. },
  24. //当前操作的果实信息
  25. fruitInfo:{
  26. default: null,
  27. serializable: true,
  28. visible:false
  29. },
  30. upTarget: {
  31. default: null,
  32. type: cc.Node,
  33. tooltip: "把当前操作的ui按钮传进来"
  34. },
  35. },
  36. // LIFE-CYCLE CALLBACKS:
  37. // onLoad () {},
  38. start () {
  39. },
  40. /**
  41. * 赠送
  42. */
  43. onGrant(){
  44. },
  45. setInfo(grantName,amount){
  46. this.grantName.string = grantName;
  47. this.amount.string = amount;
  48. },
  49. inputValue(value, e) {
  50. var numberTemp = new RegExp("^[A-Za-z0-9]+$");
  51. if (numberTemp.test(value)) {
  52. if(Number(value)>=1){
  53. this.inputInviteValue = Number(value);
  54. }else{
  55. this.inputInviteValue = 1;
  56. this.inputContainer.getComponent(cc.EditBox).string = this.inputInviteValue;
  57. }
  58. } else {
  59. this.inputInviteValue = 1;
  60. this.inputContainer.getComponent(cc.EditBox).string = this.inputInviteValue;
  61. console.log("请输入整数的倍数", this.inputInviteValue);
  62. }
  63. },
  64. onclose(){
  65. this.node.destroy();
  66. }
  67. });