UIButtonBack.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import ChessMng, { ChessType } from "../Game/DiffSel/ChessMng";
  2. import AudioMng from "../gcommon/AudioMng";
  3. import { UIButton } from "../gcommon/UIButton";
  4. import ScenceMng from "../gcommon/ScenceMng";
  5. import { GameMng } from "../GameMng";
  6. import { _decorator,Component,director } from "cc";
  7. const {ccclass, property} = _decorator;
  8. @ccclass
  9. export default class UIButtonBack extends Component {
  10. start () {
  11. UIButton.BindClick(this.node,()=>{
  12. let sname=director.getScene().name;
  13. console.log(sname);
  14. if(sname=='ChessDiffSel'||sname=="ChessCanJuSel"){
  15. ScenceMng.Instance.load('GameLaunch');
  16. }
  17. else if(sname=="Chess"){
  18. AudioMng.Instance.PlayBGM(GameMng.Instance.mainbgm);
  19. ScenceMng.Instance.load('GameLaunch');
  20. // switch (ChessMng.Instance.chesstype) {
  21. // case ChessType.renjiboyi:
  22. // return ScenceMng.Instance.load('ChessDiffSel');
  23. // case ChessType.canju:
  24. // return ScenceMng.Instance.load('ChessCanJuSel');
  25. // }
  26. }
  27. },this);
  28. }
  29. // update (dt) {}
  30. }