how_to_play_game.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import global_model from "./global_model";
  2. const { ccclass, property } = cc._decorator;
  3. @ccclass
  4. export default class how_to_play_game extends cc.Component {
  5. @property(cc.Node)
  6. node_box: cc.Node=null
  7. @property([cc.Node])
  8. showTiles: cc.Node[] = []
  9. oldPos: any = []
  10. @property(cc.Node)
  11. node_ui:cc.Node=null
  12. start() {
  13. this.node_ui.scale = 1
  14. this.node.opacity=255
  15. this.node_ui.opacity=0
  16. this.oldPos[0]=this.showTiles[0].position
  17. this.oldPos[1]=this.showTiles[1].position
  18. this.oldPos[2]=this.showTiles[2].position
  19. if(global_model.game.selectedLevel==1)
  20. {
  21. cc.tween(this.node_ui).to(0.25, { scale: 1,opacity:255 }, { easing: 'sineOut' }).start()
  22. this.playHelp()
  23. }
  24. else
  25. {
  26. this.node.active=false
  27. }
  28. }
  29. playHelp() {
  30. this.showTiles[0].scale=1
  31. this.showTiles[1].scale=1
  32. this.showTiles[2].scale=1
  33. this.showTiles[0].position=this.oldPos[0]
  34. this.showTiles[1].position=this.oldPos[1]
  35. this.showTiles[2].position=this.oldPos[2]
  36. cc.tween(this.showTiles[0]).delay(0.9).to(0.5,{x:-173.907,y:-231}).start()
  37. cc.tween(this.showTiles[1]).delay(1.3).to(0.5,{x:-86.697,y:-231}).start()
  38. cc.tween(this.showTiles[2]).delay(1.7).to(0.5,{x:1.942,y:-231}).delay(0.1).call(()=>
  39. {
  40. cc.tween(this.showTiles[0]).to(0.2,{scale:0}).start()
  41. cc.tween(this.showTiles[1]).to(0.2,{scale:0}).start()
  42. cc.tween(this.showTiles[2]).to(0.2,{scale:0}).delay(0.8).call(()=>
  43. {
  44. this.playHelp()
  45. }).start()
  46. }).start()
  47. }
  48. close(): void {
  49. this.node.active=false
  50. }
  51. }