strike.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // Learn cc.Class:
  2. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. // foo: {
  14. // // ATTRIBUTES:
  15. // default: null, // The default value will be used only when the component attaching
  16. // // to a node for the first time
  17. // type: cc.SpriteFrame, // optional, default is typeof default
  18. // serializable: true, // optional, default is true
  19. // },
  20. // bar: {
  21. // get () {
  22. // return this._bar;
  23. // },
  24. // set (value) {
  25. // this._bar = value;
  26. // }
  27. // },
  28. },
  29. // LIFE-CYCLE CALLBACKS:
  30. onLoad () {
  31. utils.isMobile(function () {
  32. manager_android_js.strike = this;
  33. }.bind(this));
  34. this.left = UtilsNode.getNode("left",this.node);
  35. this.mid = UtilsNode.getNode("mid",this.node);
  36. this.right = UtilsNode.getNode("right",this.node);
  37. utils.isMobile(function () {
  38. this.node.active = false;
  39. }.bind(this));
  40. UtilsNode.setOn(this.left,function () {
  41. let data = {
  42. der: 1,
  43. pianyi: 50,
  44. power: 40,
  45. ballSpeed: 20,
  46. kitTime: 20,
  47. ATime: 20
  48. }
  49. this.getMyDishuPoolfortype(0,data);
  50. }.bind(this));
  51. UtilsNode.setOn(this.mid,function () {
  52. let data = {
  53. der: 4,
  54. pianyi: 50,
  55. power: 40,
  56. ballSpeed: 20,
  57. kitTime: 20,
  58. ATime: 20
  59. }
  60. this.getMyDishuPoolfortype(1,data);
  61. }.bind(this));
  62. UtilsNode.setOn(this.right,function () {
  63. let data = {
  64. der: 2,
  65. pianyi: 50,
  66. power: 40,
  67. ballSpeed: 20,
  68. kitTime: 20,
  69. ATime: 20
  70. }
  71. this.getMyDishuPoolfortype(2,data);
  72. }.bind(this));
  73. app.myDishuPool = []
  74. },
  75. start () {
  76. },
  77. strike_dishu : function (data) {
  78. },
  79. getMyDishuPoolfortype : function (index,datas) {
  80. // console.log("当前地鼠 打击", app.myDishuPool,"index ",index);
  81. // let data = {
  82. // der: der,
  83. // pianyi: pianyi,
  84. // power: power,
  85. // ballSpeed: ballSpeed,
  86. // kitTime: kitTime,
  87. // ATime: ATime
  88. // }
  89. UserInfo.PlayerGameData.everypowerdata.push(datas);
  90. // console.log("当前地鼠 打击", app.myDishuPool,"index ",index);
  91. if (app.myDishuPool[index] !=null) {
  92. app.myDishuPool[index].toclick(datas);
  93. UserInfo.PlayerGameData.everypowerdataOK.push(datas);
  94. }else{
  95. Statistics.addmiss(0);
  96. }
  97. //显示测试 击打ui
  98. if (testUI) {
  99. testUI.showDa(index);
  100. }
  101. //
  102. if (tip) {
  103. tip.tiplayoutc.daplayOut();
  104. }
  105. }
  106. // update (dt) {},
  107. });