| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /*
- * @Author: mojunshou 1637302775@qq.com
- * @Date: 2025-03-19 18:02:51
- * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-08 15:46:03
- * @Description: 隐私挽留弹窗
- */
- import { game } from 'cc';
- import { _decorator, Component, Node } from 'cc';
- import { oops } from 'db://oops-framework/core/Oops';
- import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil';
- import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
- import { AndroidEvent } from '../config/AndroidEvent';
- import { UIID } from '../config/GameUIConfig';
- import { CocosHandler } from '../manager/CocosHandler';
- const { ccclass, property } = _decorator;
- @ccclass('RetentionView')
- export class RetentionView extends GameComponent {
- start() {
- this.setButton();
- }
- private async btn_agree() {
- console.log("同意");
- //调用安卓给权限
- if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
- // 发送信息给安卓
- // sys.sendNativeEvent("agree");
- let result = await CocosHandler.inst.savePrivacyStatus(true);
- if (result.code == 0) {
- oops.message.dispatchEvent(AndroidEvent.AgreePrivacy);
- oops.gui.remove(UIID.Retention);
- } else {
- oops.gui.toast("保存失败")
- }
- }
- }
- private btn_disagree() {
- console.log("不同意");
- game.end();
- }
- }
|