TutorialPanel.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. var TutorialStep = require("TutorialStep");
  2. var TutorialPanel = cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. DesLbl:cc.Label,
  6. step:1, //记录引导步骤
  7. Finger:cc.Node,
  8. EffectCircle:cc.Node,
  9. TpObj:cc.Node,
  10. DesObj:cc.Node,
  11. //下面是引导点位置
  12. pos11:cc.Node,
  13. pos12:cc.Node,
  14. pos13:cc.Node,
  15. pos14:cc.Node,
  16. pos15:cc.Node,
  17. pos21:cc.Node,
  18. pos22:cc.Node,
  19. pos31:cc.Node,
  20. pos32:cc.Node,
  21. callFunc:null,
  22. },
  23. ShowPanel:function(dt)
  24. {
  25. this.step = dt.step;
  26. //cc.log("设定位置============" + this.step);
  27. var des = "tutorial_"+this.step;
  28. this.DesLbl.string = cc.Mgr.global.getTranslation(des);
  29. switch(this.step){
  30. case 11:
  31. this.SetTpObjPos(this.pos11.getPosition(),11);
  32. break;
  33. case 12:
  34. this.SetTpObjPos(this.pos12.getPosition(),12);
  35. break;
  36. case 13:
  37. this.SetTpObjPos(this.pos13.getPosition(),13);
  38. break;
  39. case 14:
  40. this.SetTpObjPos(this.pos14.getPosition(),14);
  41. break;
  42. case 15:
  43. this.SetTpObjPos(this.pos15.getPosition(), 15);
  44. break;
  45. case 21:
  46. this.SetTpObjPos(this.pos21.getPosition(),21);
  47. break;
  48. case 22:
  49. this.SetTpObjPos(this.pos22.getPosition(),22);
  50. break;
  51. case 31:
  52. this.SetTpObjPos(this.pos31.getPosition(), 31);
  53. break;
  54. case 32:
  55. this.SetTpObjPos(this.pos32.getPosition(), 32);
  56. break;
  57. case 41:
  58. this.SetTpObjPos(this.pos32.getPosition(), 41);
  59. break;
  60. case 51:
  61. this.SetTpObjPos(this.pos32.getPosition(), 51);
  62. break;
  63. default:
  64. this.ClosePanel();
  65. break;
  66. }
  67. },
  68. ClosePanel:function(){
  69. this.node.active = false;
  70. },
  71. SetCallFunc:function(func){
  72. this.callFunc = null;
  73. this.callFunc = func;
  74. },
  75. SetTpObjPos:function(pos, tutorrialId)
  76. {
  77. //cc.log("设定位置============");
  78. this.TpObj.setPosition(pos);
  79. if(tutorrialId == 12 || tutorrialId == 15)
  80. this.DesObj.setPosition(30,145);
  81. else
  82. this.DesObj.setPosition(-110,145);
  83. if(tutorrialId == TutorialStep.DateToMarry_1 || tutorrialId == TutorialStep.MateDate_2 || tutorrialId == TutorialStep.Business_2 || tutorrialId == TutorialStep.StockBonus_1)
  84. {
  85. this.Finger.active = false;
  86. this.EffectCircle.active = false;
  87. }
  88. else
  89. {
  90. this.Finger.active = true;
  91. this.EffectCircle.active = true;
  92. }
  93. },
  94. StartTutorialStep:function()
  95. {
  96. if(this.callFunc != null && typeof this.callFunc == "function")
  97. {
  98. this.callFunc();
  99. //cc.log("_________________________________________");
  100. }
  101. },
  102. StartSpNextTutorialStep:function()
  103. {
  104. if(this.step == TutorialStep.DateToMarry_1 || this.step == TutorialStep.MateDate_2 || this.step == TutorialStep.Business_2 || this.step == TutorialStep.StockBonus_1)
  105. {
  106. cc.Mgr.AudioMgr.playSFX("click");
  107. if(this.callFunc != null && typeof this.callFunc == "function")
  108. {
  109. this.callFunc();
  110. }
  111. }
  112. },
  113. });
  114. module.exports = TutorialPanel;