FailUI.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const { ccclass, property } = cc._decorator;
  2. import AudioPath from '../datas/AudioPath';
  3. import AudioMgr from '../manager/AudioMgr';
  4. import { DataMgr } from '../manager/DataMgr';
  5. import PrefabUtil from '../utils/manager/PrefabUtil';
  6. import Plat from '../utils/Palt';
  7. import UIbase from '../utils/UIbase';
  8. import GameUI from './GameUI';
  9. @ccclass
  10. export default class FailUI extends UIbase {
  11. private static _inst: FailUI;
  12. public static get inst() {
  13. if (this._inst == null) {
  14. let v = cc.instantiate(PrefabUtil.get("FailUI"));
  15. this._inst = v.getComponent(FailUI);
  16. }
  17. return this._inst;
  18. }
  19. @property(cc.Sprite)
  20. cat: cc.Sprite = null;
  21. public showUI(data?: any): void {
  22. super.showUI(data)
  23. const id = DataMgr.ins.getRandomId();
  24. // cc.resources.load("/cat/cat_skin_" + id, cc.SpriteFrame, (error, frame) => {
  25. // this.cat.spriteFrame = frame
  26. // })
  27. }
  28. protected onShow(): void {
  29. Plat.showBanner()
  30. Plat.showInterstitialAd()
  31. }
  32. protected onHide(): void {
  33. Plat.hideBanner()
  34. }
  35. public onClickStartGame() {
  36. this.hideUI();
  37. GameUI.inst.onStartGame();
  38. AudioMgr.playSound(AudioPath.CLICK);
  39. }
  40. public onClickShare() {
  41. Plat.shareAppMessage();
  42. AudioMgr.playSound(AudioPath.CLICK);
  43. }
  44. }