RetentionView.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-03-19 18:02:51
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-05-06 14:31:15
  6. * @Description: 隐私挽留弹窗
  7. */
  8. import { _decorator, game } from 'cc';
  9. import { oops } from 'db://oops-framework/core/Oops';
  10. import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil';
  11. import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
  12. import { AD_TYPE } from '../config/GameDefine';
  13. import { UIID } from '../config/GameUIConfig';
  14. import { ADHandler } from '../manager/ADHandler';
  15. import { LoginHandler } from '../manager/LoginHandler';
  16. import { DCHandler } from '../manager/DCHandler';
  17. import { ServerHandler } from '../manager/ServerHandler';
  18. const { ccclass, property } = _decorator;
  19. @ccclass('RetentionView')
  20. export class RetentionView extends GameComponent {
  21. start() {
  22. this.setButton();
  23. }
  24. private async btn_agree() {
  25. DCHandler.inst.reportData(3000002);
  26. //调用安卓给权限
  27. if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
  28. LoginHandler.inst.savePrivacyStatus(true);
  29. this.scheduleOnce(() => {
  30. ADHandler.inst.showAd(AD_TYPE.Start);
  31. // ServerHandler.inst.getAccountInfo();
  32. oops.gui.remove(UIID.Retention);
  33. }, 0.2)
  34. }
  35. }
  36. private btn_disagree() {
  37. DCHandler.inst.reportData(3000003);
  38. game.end();
  39. }
  40. }