task.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. // Log.info("现在有没有",Games)
  32. Games.setStartLishen(function () {
  33. // Log.info("应该会掉到了吧",Games)
  34. tip.tiplayoutc.playIn();
  35. }.bind(this))
  36. tip.setTaskChangeLishen(function (task) {
  37. Log.info("现在任务索引进行了改变",task)
  38. switch (task) {
  39. case 2:
  40. this.shows(0,task);
  41. break;
  42. case 3:
  43. this.shows(1,task);
  44. break;
  45. case 4:
  46. this.shows(2,task);
  47. break;
  48. case 5:
  49. this.shows(1,task);
  50. break;
  51. case 6:
  52. spotlamp.setPandShowAll(false);
  53. this.shows(3,task);
  54. break;
  55. case 7:
  56. spotlamp.setPandShowAll(false);
  57. this.shows(4,task);
  58. break;
  59. }
  60. //教程结束
  61. if (task == 8) {
  62. tip.tipendc.myShow();
  63. spotlamp.setPandShowAll(false);
  64. }
  65. }.bind(this));
  66. Games.setBeAttackedLishen(function () {
  67. spotlamp.setPandShowAll(false);
  68. }.bind(this));
  69. },
  70. shows(index,task){
  71. if (task == 5) {
  72. Games.随机生成ZD(index,Games.我方,app.myDishuPool);
  73. spotlamp.setPandShow(index,true);
  74. return
  75. }
  76. if (index >= 3) {
  77. spotlamp.setPandShow(index,true);
  78. return
  79. }
  80. Games.随机生成(index,Games.我方,app.myDishuPool);
  81. spotlamp.setPandShow(index,true);
  82. },
  83. start () {
  84. },
  85. // update (dt) {},
  86. });