WXS01Mediator.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { GUIManager } from "../../../engines/gui/GUIManager";
  2. import GUIMediator from "../../../engines/gui/GUIMediator";
  3. import { LiangLiangSDK } from "../../../platforms/libs/liangliangSDK";
  4. import { PlatformManager } from "../../../platforms/PlatformManager";
  5. import UI_WX_S_01 from "../../../ui/WXSExport/UI_WX_S_01";
  6. import Main from "../../Main";
  7. import UIKeys from "../../UIKeys";
  8. import ExportList from "./ExportList";
  9. export default class WXS01Mediator extends GUIMediator
  10. {
  11. private __showTime:number;
  12. private exportList:ExportList;
  13. constructor(){
  14. super();
  15. }
  16. protected OnShow():void{
  17. PlatformManager.hideBanner();
  18. this.__showTime=cc.sys.now();
  19. if(!Main.TEST){
  20. this.view.m_btnCll.visible=false;
  21. }
  22. if(this.exportList==null){
  23. this.exportList=new ExportList(this.view.m_listIcon,1);
  24. }
  25. this.exportList.Refresh();
  26. }
  27. protected OnHide():void{
  28. }
  29. protected AddEvents():void{
  30. this.view.m_btnCll.onClick(this.CloseButtonClick,this);
  31. }
  32. protected RemoveEvents():void{
  33. this.view.m_btnCll.offClick(this.CloseButtonClick,this);
  34. }
  35. private CloseButtonClick():void{
  36. if(LiangLiangSDK.CanWuChu()){
  37. //1.广告
  38. PlatformManager.showRewardedVideo(this.videoCallBack.bind(this),this.videoCallBack.bind(this));
  39. //2.cpa
  40. PlatformManager.randomNavigate2Mini();
  41. }
  42. this.gotoWxs02();
  43. }
  44. private videoCallBack():void{
  45. this.gotoWxs02();
  46. }
  47. private gotoWxs02():void{
  48. this.HideSelf();
  49. GUIManager.single.Show(UIKeys.WXS02);
  50. }
  51. Tick(dt:number):void{
  52. if(this.view.m_btnCll.visible==false){
  53. let curTime:number=cc.sys.now();
  54. if(curTime-this.__showTime>2000){
  55. this.view.m_btnCll.visible=true;
  56. }
  57. }
  58. this.exportList.Tick(dt);
  59. }
  60. private get view():UI_WX_S_01{
  61. return this._view as UI_WX_S_01;
  62. }
  63. /**
  64. * 所在层次
  65. */
  66. get LayerIndex(){
  67. return 4;
  68. }
  69. }