소스 검색

优化登录逻辑

mojunshou 1 년 전
부모
커밋
eb73e144cf

+ 72 - 14
assets/script/game/account/model/AccountModelComp.ts

@@ -4,37 +4,95 @@
  * @Author: dgflash
  * @Author: dgflash
  * @Date: 2021-11-12 10:02:31
  * @Date: 2021-11-12 10:02:31
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-01 18:49:12
+ * @LastEditTime: 2025-04-09 14:12:47
  */
  */
 import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
 import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
 
 
 /** 
 /** 
  * 游戏账号数据 
  * 游戏账号数据 
  */
  */
+
+interface CurLevelInfo {
+    level: number;
+    score: number;
+}
+
+
+
+interface CurLevelConfig {
+    level: number;        //当前关卡    
+    score: number;        //当前关卡目标分数
+    skipCount: number;    //当前关卡跳过次数
+    eliminateScope: [];   //消除配置
+    eventType: string      //消除配置
+}
+
+//费用配置
+interface CostInfo {
+    handlingCharge: number; //处理费
+    giftNum: number;         //赠送金
+}
+
+
+
 @ecs.register('AccountModel')
 @ecs.register('AccountModel')
 export class AccountModelComp extends ecs.Comp {
 export class AccountModelComp extends ecs.Comp {
     /** 账号名 */
     /** 账号名 */
-    AccountName: string = null!;
+    accountName: string = null!;
     /**玩家UID */
     /**玩家UID */
-    Uid: number = -1;
+    uid: number = -1;
     /**玩家头像*/
     /**玩家头像*/
-    HeadUrl: string = null!
+    headUrl: string = null!
     /**当前关卡--默认从0开始*/
     /**当前关卡--默认从0开始*/
-    CurLevel: number = 0;
+    curLevel: number = 0;
     /**游戏币*/
     /**游戏币*/
-    GameCoin: number = 0;
+    gameCoin: number = 0;
     /**红包币*/
     /**红包币*/
-    CashCoin: number = 0;
+    cashCoin: number = 0;
+    /**目标分数*/
+    targetScore: number = 0;
     /**协议类型 1隐私 2用户*/
     /**协议类型 1隐私 2用户*/
-    ProtocolType: number = 1;
+    protocolType: number = 1;
+    //当前关卡信息
+    curLevelInfo: CurLevelInfo = null!;
+    /**当前关卡配置*/
+    curLevelConfig: CurLevelConfig = null!;
+    /**游戏费用配置*/
+    costInfo: CostInfo = null!;
+    /**是否登录过*/
+    isLogined: boolean = false;
+
+
 
 
     reset() {
     reset() {
-        this.AccountName = null!;
-        this.Uid = -1;
-        this.HeadUrl = null!;
-        this.CurLevel = 0;
-        this.GameCoin = 0;
-        this.CashCoin = 0;
+        this.accountName = null!;
+        this.uid = -1;
+        this.headUrl = null!;
+        this.curLevel = 0;
+        this.gameCoin = 0;
+        this.cashCoin = 0;
+        this.protocolType = 1;
+        this.curLevelInfo = null!;
+        this.curLevelConfig = null!;
+        this.costInfo = null!;
     }
     }
 
 
+
+    //保存微信数据
+    setWechatInfo(data: any) {
+        this.accountName = data.nickname;
+        this.uid = data.uid;
+        this.headUrl = data.headImgUrl;
+    }
+
+
+    //设置账号数据
+    setAccountInfo(data: any) {
+        // this.AccountName = data.accountName;
+        this.uid = data.uid;
+        this.curLevelInfo = data.currentLevelInfo;
+        this.curLevelConfig = data.currentLevelConfig;
+        this.costInfo = data.handlingChargeConf;
+        this.isLogined = data.logined;
+    }
 }
 }

+ 3 - 1
assets/script/game/common/config/GameEvent.ts

@@ -18,5 +18,7 @@ export enum GameEvent {
     /**微信登录成功*/
     /**微信登录成功*/
     WechatLoginSuss = "WechatLoginSuss",
     WechatLoginSuss = "WechatLoginSuss",
     /**二倍速开启成功*/
     /**二倍速开启成功*/
-    DoubleSpeedOpenSuccess = "DoubleSpeedOpenSuccess"
+    DoubleSpeedOpenSuccess = "DoubleSpeedOpenSuccess",
+    /**用户登录*/
+    UserLogin = "UserLogin"
 }
 }

+ 0 - 143
assets/script/game/common/manager/AndroidMessageCenter.ts

@@ -1,143 +0,0 @@
-import { _decorator } from 'cc';
-import { oops } from 'db://oops-framework/core/Oops';
-import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil';
-import { AndroidEvent } from '../config/AndroidEvent';
-
-/**
- * 安卓消息处理中心
- * 负责集中处理安卓平台相关的消息和事件
- */
-export class AndroidMessageCenter {
-    private static _instance: AndroidMessageCenter | null = null;
-
-    private isInitialized: boolean = false;
-
-    private constructor() {
-        // 私有构造函数,确保单例模式
-    }
-
-    /**
-     * 获取单例实例
-     */
-    public static getInstance(): AndroidMessageCenter {
-        if (!this._instance) {
-            this._instance = new AndroidMessageCenter();
-        }
-        return this._instance;
-    }
-
-    /**
-     * 初始化安卓消息处理中心
-     */
-    public init(): void {
-        if (this.isInitialized) return;
-
-        oops.log.logConfig("AndroidMessageCenter", "初始化安卓消息处理中心");
-
-        // 只在安卓平台注册事件监听
-        if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
-            this.registerEventListeners();
-        }
-
-        this.isInitialized = true;
-    }
-
-    /**
-     * 注册事件监听器
-     */
-    private registerEventListeners(): void {
-        // 监听返回按键事件
-        // oops.message.on(AndroidEvent.BACK_PRESSED, this.onBackPressed, this);
-
-        // // 监听应用暂停事件
-        // oops.message.on(AndroidEvent.APP_PAUSE, this.onAppPause, this);
-
-        // // 监听应用恢复事件
-        // oops.message.on(AndroidEvent.APP_RESUME, this.onAppResume, this);
-
-        // // 监听网络状态变化事件
-        // oops.message.on(AndroidEvent.NETWORK_CHANGE, this.onNetworkChange, this);
-
-        // 可以根据需要添加更多事件监听
-
-        oops.log.logConfig("AndroidMessageCenter", "注册安卓事件监听器成功");
-    }
-
-    // /**
-    //  * 处理返回按键事件
-    //  * @param data 事件数据
-    //  */
-    // private onBackPressed(data: any): void {
-    //     oops.log.logConfig("AndroidMessageCenter", "处理返回按键事件");
-    //     // 处理返回按键逻辑
-    //     // 例如:判断当前UI栈,决定是返回上一级还是弹出退出确认框
-    // }
-
-    // /**
-    //  * 处理应用暂停事件
-    //  * @param data 事件数据
-    //  */
-    // private onAppPause(data: any): void {
-    //     oops.log.logConfig("AndroidMessageCenter", "处理应用暂停事件");
-    //     // 处理应用暂停逻辑
-    //     // 例如:暂停游戏、保存数据等
-    // }
-
-    // /**
-    //  * 处理应用恢复事件
-    //  * @param data 事件数据
-    //  */
-    // private onAppResume(data: any): void {
-    //     oops.log.logConfig("AndroidMessageCenter", "处理应用恢复事件");
-    //     // 处理应用恢复逻辑
-    //     // 例如:恢复游戏状态、检查网络连接等
-    // }
-
-    // /**
-    //  * 处理网络状态变化事件
-    //  * @param data 事件数据
-    //  */
-    // private onNetworkChange(data: any): void {
-    //     oops.log.logConfig("AndroidMessageCenter", "处理网络状态变化事件");
-    //     // 处理网络状态变化逻辑
-    //     // 例如:显示网络断开提示、重新连接服务器等
-    // }
-
-    /**
-     * 向原生层发送消息
-     * @param eventName 事件名称
-     * @param data 事件数据
-     */
-    public sendToNative(eventName: string, data?: any): void {
-        if (!(DeviceUtil.isNative && DeviceUtil.isAndroid)) {
-            oops.log.logConfig("AndroidMessageCenter", "当前不是安卓平台,无法发送原生消息");
-            return;
-        }
-
-        const jsonData = data ? JSON.stringify(data) : "{}";
-        oops.log.logConfig("AndroidMessageCenter", `发送消息到原生端: ${eventName}, 数据: ${jsonData}`);
-
-        // 这里添加实际发送到原生端的代码
-        // 例如通过 JSB 调用原生方法
-    }
-
-    /**
-     * 清除所有事件监听(在游戏结束时调用)
-     */
-    public destroy(): void {
-        if (!this.isInitialized) return;
-
-        if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
-            // 移除所有事件监听
-            // oops.message.off(AndroidEvent.BACK_PRESSED, this.onBackPressed, this);
-            // oops.message.off(AndroidEvent.APP_PAUSE, this.onAppPause, this);
-            // oops.message.off(AndroidEvent.APP_RESUME, this.onAppResume, this);
-            // oops.message.off(AndroidEvent.NETWORK_CHANGE, this.onNetworkChange, this);
-
-            // 移除其他可能添加的事件监听
-        }
-
-        this.isInitialized = false;
-        oops.log.logConfig("AndroidMessageCenter", "销毁安卓消息处理中心");
-    }
-} 

+ 0 - 9
assets/script/game/common/manager/AndroidMessageCenter.ts.meta

@@ -1,9 +0,0 @@
-{
-  "ver": "4.0.24",
-  "importer": "typescript",
-  "imported": true,
-  "uuid": "2fcd4970-521d-4aed-8f29-2fd99a3eb2ee",
-  "files": [],
-  "subMetas": {},
-  "userData": {}
-}

+ 126 - 117
assets/script/game/common/manager/CocosHandler.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-31 10:45:44
  * @Date: 2025-03-31 10:45:44
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-08 17:33:14
+ * @LastEditTime: 2025-04-09 14:33:13
  * @Description: CocosHandler 处理类负责与安卓交互
  * @Description: CocosHandler 处理类负责与安卓交互
  */
  */
 import { native } from 'cc';
 import { native } from 'cc';
@@ -41,27 +41,6 @@ export class CocosHandler {
         }
         }
     }
     }
 
 
-    //微信登录
-    async wechat_login() {
-        const param = {
-            "appId": "wx1234567890",  //这个ID没申请下来
-            "callback":
-            {
-                "onSuccess": "CocosHandler.inst.wechat_login_success",
-                "onFaile": "CocosHandler.inst.wechat_login_fail"
-            }
-        }
-
-        const data: CocosHandlerType = {
-            method: "auth.wechat",
-            param: JSON.stringify(param)
-        }
-
-        let result = await this.sendMessageToAndroid(data);
-        console.log("微信登录结果>>>>>>>>>>", result);
-        // smc.account.AccountModel.
-        return result;
-    }
 
 
     //获取隐私授权状态
     //获取隐私授权状态
     async getPrivacyStatus() {
     async getPrivacyStatus() {
@@ -90,8 +69,7 @@ export class CocosHandler {
 
 
     //打开隐私协议或者用户协议
     //打开隐私协议或者用户协议
     openAgreement() {
     openAgreement() {
-        const type = smc.account.AccountModel.ProtocolType;
-        console.log(">>>>>协议类型>>>>>>>>>>>>>>>>>>", type)
+        const type = smc.account.AccountModel.protocolType;
         const param = {
         const param = {
             "url": type == 1 ? oops.config.game.gamePrivacyUrl : oops.config.game.gameProtocolUrl
             "url": type == 1 ? oops.config.game.gamePrivacyUrl : oops.config.game.gameProtocolUrl
         }
         }
@@ -102,40 +80,131 @@ export class CocosHandler {
         this.sendMessageToAndroid(data);
         this.sendMessageToAndroid(data);
     }
     }
 
 
-    //方法請求
-    async methodRequest(type: number) {
 
 
-        let param = {};
 
 
-        switch (type) {
-            case 1:
-                break;
-            case 2:
-                break;
+    //微信登录
+    async wechat_login() {
+        const param = {
+            "callback":
+            {
+                "onSuccess": "CocosHandler.inst.wechat_login_success",
+                "onFaile": "CocosHandler.inst.wechat_login_fail"
+            }
+        }
 
 
+        const data: CocosHandlerType = {
+            method: "auth.wechat",
+            param: JSON.stringify(param)
         }
         }
+        this.sendMessageToAndroid(data);
+    }
 
 
-        param = {
-            "url": "",
-            "callback":
-            {
-                "onSuccess": "CocosHandler.inst.methodRequest_success",
-                "onFaile": "CocosHandler.inst.methodRequest_fail"
-            },
-            " param": {
+
+    //微信登录成功回调
+    wechat_login_success(str: string) {
+        console.log("微信登录成功回调", str);
+        //保存数据
+        // oops.message.dispatchEvent(GameEvent.WechatLoginSuss);
+        // 获取用户信息
+        //然后就是和服务器通信
+        this.wx_login(str);
+    }
+
+    //微信登录失败回调
+    wechat_login_fail(str: string) {
+        console.log("微信登录失败回调", str);
+        oops.gui.toast("微信登录失败");
+    }
+
+    //==================跟服务器交互======================
+    //微信登录
+    async wx_login(code: string) {
+        const param = {
+            "code": code,
+            "url": ProtocolEvent.WechatLogin
+        }
+
+        const data: CocosHandlerType = {
+            method: "request.post",
+            param: JSON.stringify(param)
+        }
+
+        let result = await this.sendMessageToAndroid(data);
+        console.log("微信登录结果", result);
+        if (result.data) {
+            smc.account.AccountModel.setWechatInfo(result.data);
+            //然后登录获取用户信息
+            this.getAccountInfo();
+        }
+    }
 
 
 
 
+    //获取账号信息
+    getAccountInfo() {
+        const param = {
+            "url": ProtocolEvent.AccountInfo,
+            "callback": {
+                "onSuccess": "CocosHandler.inst.getAccountInfo_success",
+                "onFail": "CocosHandler.inst.getAccountInfo_fail"
             }
             }
+
+        }
+        const data: CocosHandlerType = {
+            method: "request.post",
+            param: JSON.stringify(param)
         }
         }
+        this.sendMessageToAndroid(data);
+    }
+
+    //获取账号信息成功回调
+    getAccountInfo_success(str: string) {
+        console.log("获取账号信息成功回调", str);
+        //保存账号信息
+        let result = JSON.parse(str);
+        smc.account.AccountModel.setAccountInfo(result);
+        oops.message.dispatchEvent(GameEvent.UserLogin);
+    }
+
+    //获取账号信息失败回调
+    getAccountInfo_fail(code: number, str: string) {
+        console.log("获取账号信息失败回调", str);
+    }
+
 
 
+    //领取每日奖励
+    getDailyReward(level: number) {
+        const param = {
+            "url": ProtocolEvent.GetDailyReward,
+            "param": {
+                "level": level
+            },
+            "callback": {
+                "onSuccess": "CocosHandler.inst.getDailyReward_success",
+                "onFail": "CocosHandler.inst.request_fail"
+            }
+        }
         const data: CocosHandlerType = {
         const data: CocosHandlerType = {
             method: "request.post",
             method: "request.post",
             param: JSON.stringify(param)
             param: JSON.stringify(param)
         }
         }
+        this.sendMessageToAndroid(data);
+    }
 
 
+    //领取每日奖励成功回调
+    getDailyReward_success(str: string) {
+        console.log("领取每日奖励成功回调", str);
     }
     }
 
 
 
 
+
+    request_fail(code: number, str: string) {
+        console.log("请求失败回调", code, str);
+    }
+
+
+
+
+
     //=================================以下是广告方法====================
     //=================================以下是广告方法====================
     //每次启动都加载一次启屏广告
     //每次启动都加载一次启屏广告
     async ad_interstitial_start() {
     async ad_interstitial_start() {
@@ -157,14 +226,18 @@ export class CocosHandler {
 
 
 
 
     //启屏广告关闭时回调
     //启屏广告关闭时回调
-    ad_splash_close() {
+    async ad_splash_close() {
         if (oops.gui.has(UIID.KindTips)) {
         if (oops.gui.has(UIID.KindTips)) {
             oops.gui.remove(UIID.KindTips);
             oops.gui.remove(UIID.KindTips);
         }
         }
         if (oops.gui.has(UIID.Retention)) {
         if (oops.gui.has(UIID.Retention)) {
             oops.gui.remove(UIID.Retention);
             oops.gui.remove(UIID.Retention);
         }
         }
-        oops.message.dispatchEvent(AndroidEvent.AgreePrivacy);
+        let result = await CocosHandler.inst.savePrivacyStatus(true);
+        if (result.code == 0) {
+            //广告结束后调用登录
+            this.getAccountInfo();
+        }
     }
     }
 
 
 
 
@@ -212,93 +285,29 @@ export class CocosHandler {
         console.log("广告显示失败回调");
         console.log("广告显示失败回调");
     }
     }
 
 
-    //
-
-
-
-
-
-    //===================安卓回调Cocos======================
-    //微信登录成功回调
-    wechat_login_success(str: string) {
-        console.log("微信登录成功回调", str);
-        //保存数据
-        // oops.message.dispatchEvent(GameEvent.WechatLoginSuss);
-
-
-        // 获取用户信息
-        //然后就是和服务器通信
-    }
-
-    //微信登录失败回调
-    wechat_login_fail(str: string) {
-        console.log("微信登录失败回调", str);
-        oops.gui.toast("微信登录失败");
-    }
-
-
-
-
-    //安卓直接调用广告回调,显示失败还是成功,成功提供什么奖励,失败又怎么做
-    async ad_callback(ad_type: string, ad_status: string, ad_reward: string) {
-
-
-    }
-
-
-
-
-    //==================跟服务器交互======================
-    //微信登录
-    async wx_login(code: string) {
+    //广告请求--激励视频广告
+    async ad_reward(id: number) {
         const param = {
         const param = {
-            "code": code,
-            "url": ProtocolEvent.WechatLogin
+            "funcId": `${id}`,
+            "callback":
+            {
+                "onClose": "CocosHandler.inst.ad_reward_close"
+            }
         }
         }
-
         const data: CocosHandlerType = {
         const data: CocosHandlerType = {
-            method: "request.post",
+            method: "ad.reward",
             param: JSON.stringify(param)
             param: JSON.stringify(param)
         }
         }
-
         let result = await this.sendMessageToAndroid(data);
         let result = await this.sendMessageToAndroid(data);
-        console.log("微信登录结果", result);
         return result;
         return result;
     }
     }
 
 
 
 
-    //获取账号信息
-    getAccountInfo() {
-        const param = {
-            "url": ProtocolEvent.AccountInfo,
-            "param": {
-                "authToken": "123456"
-            },
-            "callback": {
-                "onSuccess": "CocosHandler.inst.getAccountInfo_success",
-                "onFail": "CocosHandler.inst.getAccountInfo_fail"
-            }
-
-        }
-        const data: CocosHandlerType = {
-            method: "request.post",
-            param: JSON.stringify(param)
-        }
-        this.sendMessageToAndroid(data);
+    //激励视频广告关闭回调
+    ad_reward_close(str: string) {
+        console.log("激励视频广告关闭回调", str);
     }
     }
 
 
-
-    //获取账号信息成功回调
-    getAccountInfo_success(str: string) {
-        console.log("获取账号信息成功回调", str);
-    }
-
-    //获取账号信息失败回调
-    getAccountInfo_fail(str: string) {
-        console.log("获取账号信息失败回调", str);
-    }
-
-
 }
 }
 window['CocosHandler'] = CocosHandler;
 window['CocosHandler'] = CocosHandler;
 
 

+ 3 - 3
assets/script/game/common/setting/SettingViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:40:20
  * @Date: 2025-03-20 15:40:20
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-03 16:31:43
+ * @LastEditTime: 2025-04-09 11:53:23
  * @Description:设置界面 
  * @Description:设置界面 
  */
  */
 import { _decorator } from "cc";
 import { _decorator } from "cc";
@@ -110,8 +110,8 @@ export class SettingViewComp extends CCVMParentComp {
     //更新头像
     //更新头像
     private updateHead() {
     private updateHead() {
         let account = ecs.getEntity<Account>(Account);
         let account = ecs.getEntity<Account>(Account);
-        this.data.uid = account.AccountModel.Uid;
-        let url = account.AccountModel.HeadUrl;
+        this.data.uid = account.AccountModel.uid;
+        let url = account.AccountModel.headUrl;
         // let sprite = this.node.getChildByPath("Bg/btn_head/sp_head")!.uiSprite;
         // let sprite = this.node.getChildByPath("Bg/btn_head/sp_head")!.uiSprite;
         // let url = "http://www.kuaipng.com/Uploads/pic/w/2020/07-16/89010/water_89010_698_698_.png"
         // let url = "http://www.kuaipng.com/Uploads/pic/w/2020/07-16/89010/water_89010_698_698_.png"
         // var opt: IRemoteOptions = { ext: ".png" };
         // var opt: IRemoteOptions = { ext: ".png" };

+ 3 - 3
assets/script/game/common/tips/ClickEventHandler.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-19 17:46:09
  * @Date: 2025-03-19 17:46:09
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-07 16:09:01
+ * @LastEditTime: 2025-04-09 11:36:11
  * @Description: 用户协议和隐私协议点击事件
  * @Description: 用户协议和隐私协议点击事件
  */
  */
 import { sys } from 'cc';
 import { sys } from 'cc';
@@ -24,11 +24,11 @@ export class ClickEventHandler extends GameComponent {
             case "User Agreement":
             case "User Agreement":
                 // 在游戏内打开用户协议
                 // 在游戏内打开用户协议
                 // sys.openURL("https://store.cocos.com/app/detail/3814");
                 // sys.openURL("https://store.cocos.com/app/detail/3814");
-                smc.account.AccountModel.ProtocolType = 2;
+                smc.account.AccountModel.protocolType = 2;
                 break;
                 break;
             case "Privacy Policy":
             case "Privacy Policy":
                 // 在游戏内打开隐私协议
                 // 在游戏内打开隐私协议
-                smc.account.AccountModel.ProtocolType = 1;
+                smc.account.AccountModel.protocolType = 1;
                 // sys.openURL("https://store.cocos.com/app/detail/3814");
                 // sys.openURL("https://store.cocos.com/app/detail/3814");
                 break;
                 break;
         }
         }

+ 3 - 10
assets/script/game/common/tips/KindTipsView.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-19 18:02:51
  * @Date: 2025-03-19 18:02:51
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-08 17:12:37
+ * @LastEditTime: 2025-04-09 10:26:25
  * @Description: 温馨提示弹窗
  * @Description: 温馨提示弹窗
  */
  */
 import { _decorator, Component, Node } from 'cc';
 import { _decorator, Component, Node } from 'cc';
@@ -23,16 +23,9 @@ export class KindTipsView extends GameComponent {
 
 
     private async btn_agree() {
     private async btn_agree() {
         console.log("同意");
         console.log("同意");
-
         if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
         if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
-            let result = await CocosHandler.inst.savePrivacyStatus(true);
-            console.log("返回状态>>>>>>>>>>>>>>>>>", result)
-            if (result.code == 0) {
-                CocosHandler.inst.ad_interstitial_start();
-                oops.gui.remove(UIID.KindTips);
-            } else {
-                oops.gui.toast("保存失败")
-            }
+            CocosHandler.inst.ad_interstitial_start();
+            oops.gui.remove(UIID.KindTips);
         }
         }
     }
     }
 
 

+ 2 - 7
assets/script/game/common/tips/RetentionView.ts

@@ -25,13 +25,8 @@ export class RetentionView extends GameComponent {
         console.log("同意");
         console.log("同意");
         //调用安卓给权限
         //调用安卓给权限
         if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
         if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
-            let result = await CocosHandler.inst.savePrivacyStatus(true);
-            if (result.code == 0) {
-                CocosHandler.inst.ad_interstitial_start();
-                oops.gui.remove(UIID.Retention);
-            } else {
-                oops.gui.toast("保存失败")
-            }
+            CocosHandler.inst.ad_interstitial_start();
+            oops.gui.remove(UIID.Retention);
         }
         }
     }
     }
 
 

+ 3 - 1
assets/script/game/eliminate/view/DoubleSpeedViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-21 11:17:22
  * @Date: 2025-03-21 11:17:22
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-02 18:13:24
+ * @LastEditTime: 2025-04-09 11:17:27
  * @Description: 二倍速弹窗
  * @Description: 二倍速弹窗
  */
  */
 import { _decorator, Node } from "cc";
 import { _decorator, Node } from "cc";
@@ -13,6 +13,7 @@ import { UIID } from "../../common/config/GameUIConfig";
 import { Label } from "cc";
 import { Label } from "cc";
 import { RichText } from "cc";
 import { RichText } from "cc";
 import { UICallbacks } from "db://oops-framework/core/gui/layer/Defines";
 import { UICallbacks } from "db://oops-framework/core/gui/layer/Defines";
+import { CocosHandler } from "../../common/manager/CocosHandler";
 
 
 const { ccclass, property } = _decorator;
 const { ccclass, property } = _decorator;
 
 
@@ -78,5 +79,6 @@ export class DoubleSpeedViewComp extends CCComp {
     private btn_close() {
     private btn_close() {
         oops.gui.remove(UIID.DoubleSpeed);
         oops.gui.remove(UIID.DoubleSpeed);
         //播放插屏广告
         //播放插屏广告
+        CocosHandler.inst.ad_interstitial();
     }
     }
 }
 }

+ 4 - 1
assets/script/game/eliminate/view/EliminateViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:01:09
  * @Date: 2025-03-20 15:01:09
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-02 19:24:30
+ * @LastEditTime: 2025-04-09 12:03:13
  * @Description: 消除游戏主场景
  * @Description: 消除游戏主场景
  */
  */
 import { _decorator, Color, EventTouch, instantiate, JsonAsset, Label, Node, Prefab, randomRangeInt, Sprite, Toggle, tween, UITransform, Vec2, Vec3, Widget } from "cc";
 import { _decorator, Color, EventTouch, instantiate, JsonAsset, Label, Node, Prefab, randomRangeInt, Sprite, Toggle, tween, UITransform, Vec2, Vec3, Widget } from "cc";
@@ -14,6 +14,7 @@ import { CCComp } from "db://oops-framework/module/common/CCComp";
 import { GameEvent } from "../../common/config/GameEvent";
 import { GameEvent } from "../../common/config/GameEvent";
 import { UIID } from "../../common/config/GameUIConfig";
 import { UIID } from "../../common/config/GameUIConfig";
 import { Button } from "cc";
 import { Button } from "cc";
+import { smc } from "../../common/SingletonModuleComp";
 
 
 const { ccclass, property } = _decorator;
 const { ccclass, property } = _decorator;
 
 
@@ -154,6 +155,7 @@ export class EliminateViewComp extends CCComp {
     private score: number = 0;      //本局分数
     private score: number = 0;      //本局分数
     private money: number = 0;      //左边金钱
     private money: number = 0;      //左边金钱
     private cash: number = 0;       //右边红包钱数
     private cash: number = 0;       //右边红包钱数
+    private targetScore: number = 0; //目标分数
 
 
     private totalNum: number = 0;   //累计消除次数,断了就是又从0开始
     private totalNum: number = 0;   //累计消除次数,断了就是又从0开始
 
 
@@ -261,6 +263,7 @@ export class EliminateViewComp extends CCComp {
     private initData() {
     private initData() {
         // this.gameMode = GameMode.MANUAL;
         // this.gameMode = GameMode.MANUAL;
         this.score = 0;
         this.score = 0;
+        this.targetScore = smc.account.AccountModel.curLevelConfig.score;
         this.money = 0;
         this.money = 0;
         this.cash = 0;
         this.cash = 0;
         this.totalNum = 0;
         this.totalNum = 0;

+ 34 - 36
assets/script/game/initialize/view/LoadingViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-19 16:23:51
  * @Date: 2025-03-19 16:23:51
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-08 17:21:30
+ * @LastEditTime: 2025-04-09 14:40:34
  * @Description: loading界面
  * @Description: loading界面
  */
  */
 import { _decorator, Toggle } from "cc";
 import { _decorator, Toggle } from "cc";
@@ -41,31 +41,28 @@ export class LoadingViewComp extends CCVMParentComp {
 
 
     start() {
     start() {
         this.enter();
         this.enter();
+        this.addEvent();
         this.setButton();
         this.setButton();
         this.updateToggleState();
         this.updateToggleState();
     }
     }
 
 
+    private addEvent() {
+        this.on(AndroidEvent.AgreePrivacy, this.onAgreePrivacy, this);
+        this.on(GameEvent.WechatLoginSuss, this.loginSuss, this)
+        this.on(GameEvent.UserLogin, this.userLogin, this);
+    }
+
+
+
+
     async enter() {
     async enter() {
-        this.addEvent();
         if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
         if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
             const state = await CocosHandler.inst.getPrivacyStatus();
             const state = await CocosHandler.inst.getPrivacyStatus();
             console.log("隐私状态>>>>>>>>>>>>>>>>", state);
             console.log("隐私状态>>>>>>>>>>>>>>>>", state);
             if (state.data.result) {
             if (state.data.result) {
                 //同意之后都加载一次启屏广告
                 //同意之后都加载一次启屏广告
-                const isWxLogin = oops.storage.getBoolean("isWxLogin");
-                if (isWxLogin) {
-                    //直接登录
-                    let result = await CocosHandler.inst.wechat_login();
-                    if (result.code) {
-                        this.setWxLoginBtnState(false);
-                        this.loadRes();
-                    } else {
-                        oops.gui.toast("登录失败,请重试")
-                    }
-                } else {
-                    console.log("缓存没有,需要显示登录按钮")
-                    this.setWxLoginBtnState(true);
-                }
+                CocosHandler.inst.ad_interstitial_start();
+                // CocosHandler.inst.getAccountInfo();
             } else {
             } else {
                 oops.gui.open(UIID.KindTips);
                 oops.gui.open(UIID.KindTips);
             }
             }
@@ -78,16 +75,27 @@ export class LoadingViewComp extends CCVMParentComp {
 
 
 
 
 
 
-    private addEvent() {
-        this.on(AndroidEvent.AgreePrivacy, this.onAgreePrivacy, this);
-        this.on(GameEvent.WechatLoginSuss, this.loginSuss, this)
+    private userLogin() {
+        const isLogin = smc.account.AccountModel.isLogined;
+        console.log("登录状态>>>>>>>>>>>>>>>>", isLogin);
+
+        //暂时隐藏
+        // if (isLogin) {
+        //     //登录过
+        //     this.setWxLoginBtnState(false);
+        //     this.loadRes();
+        // } else {
+        //     this.setWxLoginBtnState(true);
+        // }
+
+        this.loadRes();
+
     }
     }
 
 
+
     private loginSuss() {
     private loginSuss() {
-        //关闭按钮
         this.setWxLoginBtnState(false);
         this.setWxLoginBtnState(false);
         this.loadRes();
         this.loadRes();
-        //加载资源
     }
     }
 
 
     private onAgreePrivacy() {
     private onAgreePrivacy() {
@@ -96,7 +104,9 @@ export class LoadingViewComp extends CCVMParentComp {
         oops.gui.remove(UIID.KindTips);
         oops.gui.remove(UIID.KindTips);
         //如果是客户端就显示微信登录按钮
         //如果是客户端就显示微信登录按钮
         if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
         if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
+            //const show
             this.setWxLoginBtnState(true);
             this.setWxLoginBtnState(true);
+            //
         } else {
         } else {
             this.loadRes();
             this.loadRes();
         }
         }
@@ -155,21 +165,9 @@ export class LoadingViewComp extends CCVMParentComp {
             oops.gui.toast("请同意隐私政策")
             oops.gui.toast("请同意隐私政策")
             return;
             return;
         }
         }
-
-
-
-        //登录完要隐藏微信按钮然后加载进度
-        // let result = await CocosHandler.inst.wechat_login();
-        // if (result.code) {
-        //     this.setWxLoginBtnState(false);
-        //     this.loadRes();
-        // } else {
-
-        //     oops.gui.toast("登录失败,请重试")
-        // }
-
-
-        //先跳过,直接进行第二步
+        //暂时跳过这个登录
+        // CocosHandler.inst.wechat_login();
+        //直接获取信息
         CocosHandler.inst.getAccountInfo();
         CocosHandler.inst.getAccountInfo();
     }
     }