GameOverMediator.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { _decorator, Component, Node } from 'cc';
  2. import { GUIManager } from '../../../engines/gui/GUIManager';
  3. import { GUIMediator } from '../../../engines/gui/GUIMediator';
  4. import { SceneManager } from '../../../engines/scenes/SceneManager';
  5. import { GameController } from '../fightings/GameController';
  6. import { UIConst } from '../UIConst';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('GameOverMediator')
  9. export class GameOverMediator extends GUIMediator {
  10. @property(Node)
  11. WinGroup:Node=null;
  12. @property(Node)
  13. DefeatedGroup:Node=null;
  14. onLoad(){
  15. }
  16. OnShow(data?:any):void{
  17. super.OnShow(data);
  18. let isWin:boolean=data;
  19. this.WinGroup.active=isWin;
  20. this.DefeatedGroup.active=!isWin;
  21. //胜利
  22. if(data==true){
  23. }else{//失败
  24. }
  25. }
  26. /**
  27. * 开始下一关
  28. */
  29. PlayNextLevel():void{
  30. this.HideSelf();
  31. GameController.single.PlayNextLevel();
  32. }
  33. /**
  34. * 重玩
  35. */
  36. Replay():void{
  37. this.HideSelf();
  38. GameController.single.Replay();
  39. }
  40. /**
  41. * 返回主界面
  42. */
  43. BackToMain():void{
  44. SceneManager.single.Swicth("PrepareScene");
  45. GUIManager.single.Hide(UIConst.FIGHTING_UI);
  46. //关闭自身
  47. this.HideSelf();
  48. }
  49. OnHide():void{
  50. }
  51. }