From a972605e1cf8122330de5b6ff53857be130972be Mon Sep 17 00:00:00 2001
From: Spring774 <337905794@qq.com>
Date: Thu, 30 Oct 2025 11:59:53 +0800
Subject: [PATCH] 添加华为广告,界面还需要去除不需要华为的地方

---
 assets/Script/Logo.ts |   98 +++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 90 insertions(+), 8 deletions(-)

diff --git a/assets/Script/Logo.ts b/assets/Script/Logo.ts
index baab158..476ce5c 100644
--- a/assets/Script/Logo.ts
+++ b/assets/Script/Logo.ts
@@ -12,12 +12,23 @@
     @property(cc.String)
     nextSceneName: string = null;
 
+    @property(cc.Node)
+    ppNode: cc.Node = null;//PrivacyPolicy
+    @property(cc.Button)
+    buttonAgree: cc.Button = null;
+    @property(cc.Button)
+    buttonCancel: cc.Button = null;
+
     onLoad() {
         cc.game.setFrameRate(60.01);
+
+        this.ppNode.active = false;
     }
 
     start() {
         if (Sdk.isToutiao) {
+            this.loadNextScene();
+        } else if (Sdk.isHuawei) {
             this.loadNextScene();
         } else {
             Sdk.ins.startGame(() => {
@@ -50,35 +61,40 @@
                                 tt.showToast({
                                     title: "同步数据成功!",
                                     duration: 2000
-                                  });
+                                });
                             } else {//没有数据同步全部数据到服务器
                                 if (data.anonymous_openid && Userdata.Stars > 0) {
-                                    DataTool.setAsync(data.anonymous_openid, Userdata.getAllToutiaoData(), (res)=>{
-                                        if (res){
+                                    DataTool.setAsync(data.anonymous_openid, Userdata.getAllToutiaoData(), (res) => {
+                                        if (res) {
                                             tt.showToast({
                                                 title: "进度保存成功!",
                                                 duration: 2000
-                                              });
+                                            });
                                         }
                                     });
                                 }
                             }
-                        }else{
+                        } else {
                             console.log('result = ', result);
                             console.log('data = ', data);
                             tt.showToast({
                                 title: "同步数据失败!",
                                 duration: 2000
-                              });
+                            });
                         }
                         this.toutiaoGoNext();
                     });
                 });
             });
-        } else {
+        } else if (Sdk.isHuawei) {
             Userdata.loadUserdata(() => {
-                cc.director.loadScene(this.nextSceneName);
+                this.scheduleOnce(() => {
+                    this.openPrivacyPolicy();
+                }, 1);
+
             });
+        } else {
+            this.startGame();
         }
     }
 
@@ -90,4 +106,70 @@
         SdkToutiao.openShareMenu();
         SdkToutiao.showFavoriteGuide();
     }
+
+    openPrivacyPolicy() {
+        //如果privacy_policy值不为true,则弹出隐私政策提示框
+        if ((cc.sys.localStorage.getItem("privacy_policy")) !== "true") {
+            this.ppNode.active = true;
+        } else {
+            this.startGame();
+        }
+    }
+
+    startGame() {
+        if (Sdk.isHuawei) {
+            Sdk.ins.startGame(() => {
+                cc.director.loadScene(this.nextSceneName);
+            });
+        } else {
+            cc.director.loadScene(this.nextSceneName);
+        }
+    }
+
+    onUserProtocolLinkClicked() {
+        qg && qg.openDeeplink({
+            uri: 'https://www.yujigames.com/userdata_cn.html',
+            params: {
+                ___PARAM_LAUNCH_NATIVE_FLAG___: 'newTask'
+            }
+        });
+    }
+
+    onPrivacyPolicyLinkClicked() {
+        qg && qg.openDeeplink({
+            uri: 'https://www.yujigames.com/privacy_cn.html',
+            params: {
+                ___PARAM_LAUNCH_NATIVE_FLAG___: 'newTask'
+            }
+        });
+    }
+
+    onPPCancel() {
+        this.buttonCancel.enabled = false;
+        this.buttonAgree.enabled = false;
+        cc.sys.localStorage.removeItem("privacy_policy");
+        cc.sys.localStorage.setItem("privacy_policy", "false");
+        setTimeout(function () {
+            qg && qg.exitApplication({
+                success: function () {
+                    console.log("exitApplication success");
+                },
+                fail: function () {
+                    console.log("exitApplication fail");
+                },
+                complete: function () {
+                    console.log("exitApplication complete");
+                }
+            });
+        }, 500);
+    }
+
+    onPPAgree() {
+        this.buttonCancel.enabled = false;
+        this.buttonAgree.enabled = false;
+        cc.sys.localStorage.removeItem("privacy_policy");
+        cc.sys.localStorage.setItem("privacy_policy", "true");
+
+        this.startGame();
+    }
 }

--
Gitblit v1.9.1