TimeOverUI.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
  7. import Plat from "../utils/Palt";
  8. import UIbase from "../utils/UIbase";
  9. import PrefabUtil from "../utils/manager/PrefabUtil";
  10. import FailUI from "./FailUI";
  11. import GameUI from "./GameUI";
  12. const {ccclass, property} = cc._decorator;
  13. @ccclass
  14. export default class TimeOverUI extends UIbase {
  15. private static _inst: TimeOverUI;
  16. public static get inst() {
  17. if (this._inst == null) {
  18. let v = cc.instantiate(PrefabUtil.get("TimeOverUI"));
  19. this._inst = v.getComponent(TimeOverUI);
  20. }
  21. return this._inst;
  22. }
  23. start () {
  24. }
  25. protected onShow(): void {
  26. Plat.showBanner()
  27. }
  28. protected onHide(): void {
  29. Plat.hideBanner()
  30. }
  31. onClickAdd(){
  32. Plat.showRewardVideo((success:boolean)=>{
  33. if(success){
  34. GameUI.inst.onClickAddTime()
  35. this.hideUI()
  36. }
  37. })
  38. }
  39. onClickCancel(){
  40. this.hideUI()
  41. FailUI.inst.showUI();
  42. }
  43. }