PayPage.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. PayPage: {
  5. default: null,
  6. type: cc.Node,
  7. serializable: true,
  8. },
  9. Tip_AfterPay: {
  10. default: null,
  11. type: cc.Node,
  12. serializable: true,
  13. },
  14. Tip_AfterPayText:'',
  15. KeyboardBG: {
  16. default: null,
  17. type: cc.Node,
  18. serializable: true,
  19. },
  20. NumKeysLayout: {
  21. default: null,
  22. type: cc.Node,
  23. serializable: true,
  24. },
  25. KeyboardIsOpened:true,
  26. OpenOrCloseIMG: {
  27. default: null,
  28. type: cc.Node,
  29. serializable: true,
  30. },
  31. PasswordLayout: {
  32. default: null,
  33. type: cc.Node,
  34. serializable: true,
  35. },
  36. SumOfKeys:0,
  37. },
  38. start () {
  39. },
  40. PayPageInit(Tip_AfterPayText,PayPrice){
  41. this.PayPage.getChildByName('Label_Price').getComponent(cc.Label).string = PayPrice.toString();
  42. this.Tip_AfterPayText = Tip_AfterPayText;
  43. this.KeyboardBG.active = true;
  44. this.NumKeysLayout.active = true;
  45. this.OpenOrCloseIMG.angle = -90;
  46. this.KeyboardIsOpened = true;
  47. this.SumOfKeys = 0;
  48. for(var i = 0;i<6;i++){
  49. this.PasswordLayout.children[i].active = false;
  50. }
  51. },
  52. PayPageCloseBtnOnClick(){
  53. this.PayPage.active = false;
  54. },
  55. KeyOnClick_OpenOrCloseBtn(){
  56. if(this.KeyboardIsOpened == true){
  57. this.KeyboardBG.active = false;
  58. this.NumKeysLayout.active = false;
  59. this.OpenOrCloseIMG.angle = 90;
  60. this.KeyboardIsOpened = false;
  61. }else{
  62. this.KeyboardBG.active = true;
  63. this.NumKeysLayout.active = true;
  64. this.OpenOrCloseIMG.angle = -90;
  65. this.KeyboardIsOpened = true;
  66. }
  67. },
  68. KeyOnClick_NumKey(){
  69. if(this.SumOfKeys<6){
  70. this.PasswordLayout.children[this.SumOfKeys].active = true;
  71. this.SumOfKeys += 1;
  72. if(this.SumOfKeys == 6){
  73. this.scheduleOnce(function() {
  74. this.PayPage.active = false;
  75. this.Tip_AfterPay.getChildByName('TipText').getComponent(cc.Label).string = this.Tip_AfterPayText;
  76. this.Tip_AfterPay.active = true;
  77. var animCtrl = this.Tip_AfterPay.getComponent(cc.Animation);
  78. animCtrl.play();
  79. }, 0.1);
  80. }
  81. }
  82. },
  83. KeyOnClick_RevokeKey(){
  84. if(this.SumOfKeys>0){
  85. this.SumOfKeys -= 1;
  86. this.PasswordLayout.children[this.SumOfKeys].active = false;
  87. }
  88. }
  89. });