Result.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. BG: {
  5. default: null,
  6. type: cc.Node,
  7. serializable: true,
  8. },
  9. BgSpFrame: [cc.SpriteFrame],
  10. WinNode: {
  11. default: null,
  12. type: cc.Node,
  13. serializable: true,
  14. },
  15. FailNode: {
  16. default: null,
  17. type: cc.Node,
  18. serializable: true,
  19. },
  20. },
  21. ShowResult(bWin)
  22. {
  23. this.BG.getComponent(cc.Sprite).spriteFrame = this.BgSpFrame[1];
  24. if(bWin)
  25. {
  26. this.WinNode.active = true;
  27. let animation = this.WinNode.getComponent(cc.Animation);
  28. animation.play();
  29. }
  30. else
  31. {
  32. this.FailNode.active = true;
  33. let animation = this.FailNode.getComponent(cc.Animation);
  34. animation.play();
  35. }
  36. },
  37. ShutDown()
  38. {
  39. this.BG.getComponent(cc.Sprite).spriteFrame = this.BgSpFrame[0];
  40. this.WinNode.active = false;
  41. this.FailNode.active = false;
  42. }
  43. });