MenuAction.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { _decorator, Component, director, Node, tween } from 'cc';
  2. import { Global } from './Global';
  3. import { Clips } from './Enums';
  4. import { AudioMgr } from './AudioMgr';
  5. import { BasePage } from './BasePage';
  6. import { AdManger } from './ad/AdManger';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('MenuAction')
  9. export class MenuAction extends BasePage {
  10. @property({ type: Node })
  11. xxx_node: Node
  12. start() {
  13. super.start();
  14. }
  15. update(deltaTime: number) {
  16. }
  17. private set_xxx() {
  18. this.xxx_node.active = !Global.sound_switch;
  19. }
  20. on_off_sound() {
  21. AudioMgr.ins.playSound(Clips.btn_1);
  22. Global.sound_switch = !Global.sound_switch;
  23. this.set_xxx();
  24. }
  25. //show menu plant
  26. open() {
  27. super.open();
  28. //show interstial
  29. AdManger.show_interstial();
  30. this.set_xxx();
  31. }
  32. btn_go_home() {
  33. this.close();
  34. director.loadScene("home");
  35. }
  36. btn_continue_game() {
  37. this.close();
  38. }
  39. btn_restart_game() {
  40. this.close();
  41. Global.main_action.restart_game();
  42. }
  43. }