Citrus 2 місяців тому
батько
коміт
dfcfd98863

+ 5 - 1
assets/Script/Loading.ts

@@ -45,6 +45,10 @@ export class Loading extends Component {
         SDKManager.getInstance().login((res) => {
 
         })
+
+        SDKManager.getInstance().showShareMenu()
+
+
     }
 
     init() {
@@ -119,7 +123,7 @@ export class Loading extends Component {
         AudioManager.Instance.playEffict(AudioManager.anniu)
 
 
-        
+
     }
     ///////////////////
 

+ 4 - 0
assets/Script/MyFrame/SDK/DouYinSDKManager.ts

@@ -8,4 +8,8 @@ export class DouYinSDKManager {
     showShareMenu() {
 
     }
+
+    show_video() {
+
+    }
 }

+ 8 - 0
assets/Script/MyFrame/SDK/KuaiShouSDKManager.ts

@@ -9,4 +9,12 @@ export class KuaiShouSDKManager {
     showShareMenu() {
 
     }
+
+
+    show_video() {
+
+    }
+
+     
+
 }

+ 9 - 0
assets/Script/MyFrame/SDK/SDKManager.ts

@@ -53,4 +53,13 @@ export class SDKManager {
         }
     }
 
+
+
+    public show_video(cb) {
+        if (this.currentSDKManager) {
+            this.currentSDKManager.show_video(cb);
+        }
+    }
+
+
 }

+ 59 - 1
assets/Script/MyFrame/SDK/WeChatSDKManager.ts

@@ -96,7 +96,7 @@ export class WeChatSDKManager {
                 console.error('999999999999');
                 console.error(resp);
 
-                HTTPS.Instance.token=resp.data.userinfo.token
+                HTTPS.Instance.token = resp.data.userinfo.token
             })
     }
 
@@ -122,4 +122,62 @@ export class WeChatSDKManager {
             })
         }
     }
+
+
+    ///////////////////
+    private rewardVideo2
+    public show_video(callback: Function) {
+        let wx = (window as any)["wx"];
+        let id = "adunit-36fec0fa8e78f37b"
+        if (id == '') {
+            callback(true);
+            return;
+        }
+
+        if (this.rewardVideo2 != null) {
+            this.rewardVideo2.offClose(fun);
+        }
+        let rewardedVideoAd = wx.createRewardedVideoAd({
+            adUnitId: id,
+        });
+        this.rewardVideo2 = rewardedVideoAd;
+        rewardedVideoAd.load().then(() => {
+            wx.showToast({
+                title: "加载中,请稍后",
+                icon: 'success',//图标,支持"success"、"loading" 
+                duration: 1500,//提示的延迟时间,单位毫秒,默认:1500 
+                mask: false,//是否显示透明蒙层,防止触摸穿透,默认:false 
+                success: function () { },
+                fail: function () { },
+                complete: function () { }
+            })
+            console.log('激励视频 广告加载成功');
+            rewardedVideoAd.show();
+        });
+        rewardedVideoAd.onError(err => {
+            console.log('激励视频 广告显示失败', err);
+            wx.showToast({
+                title: "请稍后再试",
+                icon: 'fail',//图标,支持"success"、"loading" 
+                duration: 1500,//提示的延迟时间,单位毫秒,默认:1500 
+                mask: false,//是否显示透明蒙层,防止触摸穿透,默认:false 
+                success: function () { },
+                fail: function () { },
+                complete: function () { }
+            })
+            callback(false);
+        })
+        var fun = function (res) {
+            if (res && res.isEnded) {
+                console.log('res:  ', res);
+                callback(true);
+                rewardedVideoAd.offClose(fun);
+            } else {
+                console.log('播放中途退出');
+                callback(false);
+            }
+        }
+        rewardedVideoAd.onClose(fun);
+    }
+
 }

+ 12 - 6
assets/Script/UI/UI.ts

@@ -1,6 +1,7 @@
 import { _decorator, Component, director, Label, Node } from 'cc';
 import { EventManager } from '../EventManager';
 import HTTPS, { NetPost } from '../MyFrame/HTTPS';
+import { SDKManager } from '../MyFrame/SDK/SDKManager';
 const { ccclass, property } = _decorator;
 
 @ccclass('UI')
@@ -54,8 +55,6 @@ export class UI extends Component {
             this.HomeNode.active = true;
         }, 3)
 
-
-
     }
 
 
@@ -84,10 +83,17 @@ export class UI extends Component {
 
 
     FuHuo() {
-        EventManager.instance.et.emit(EventManager.EventType.Add_haert, 3);
-        EventManager.instance.et.emit(EventManager.EventType.Set_Add_Score_BOOL, true);
-        EventManager.instance.et.emit(EventManager.EventType.Reset_Role);
-        this.close()
+
+        SDKManager.getInstance().show_video((data) => {
+            if (data == true) {
+                EventManager.instance.et.emit(EventManager.EventType.Add_haert, 3);
+                EventManager.instance.et.emit(EventManager.EventType.Set_Add_Score_BOOL, true);
+                EventManager.instance.et.emit(EventManager.EventType.Reset_Role);
+                this.close()
+            } else {
+ 
+            }
+        })
     }
 
     close() {

BIN
assets/image/UI/微信图片_20240828142928@3x.png


+ 134 - 0
assets/image/UI/微信图片_20240828142928@3x.png.meta

@@ -0,0 +1,134 @@
+{
+  "ver": "1.0.27",
+  "importer": "image",
+  "imported": true,
+  "uuid": "b73e0091-5ffe-4467-9334-10591425efe5",
+  "files": [
+    ".json",
+    ".png"
+  ],
+  "subMetas": {
+    "6c48a": {
+      "importer": "texture",
+      "uuid": "b73e0091-5ffe-4467-9334-10591425efe5@6c48a",
+      "displayName": "微信图片_20240828142928@3x",
+      "id": "6c48a",
+      "name": "texture",
+      "userData": {
+        "wrapModeS": "clamp-to-edge",
+        "wrapModeT": "clamp-to-edge",
+        "imageUuidOrDatabaseUri": "b73e0091-5ffe-4467-9334-10591425efe5",
+        "isUuid": true,
+        "visible": false,
+        "minfilter": "linear",
+        "magfilter": "linear",
+        "mipfilter": "none",
+        "anisotropy": 0
+      },
+      "ver": "1.0.22",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    },
+    "f9941": {
+      "importer": "sprite-frame",
+      "uuid": "b73e0091-5ffe-4467-9334-10591425efe5@f9941",
+      "displayName": "微信图片_20240828142928@3x",
+      "id": "f9941",
+      "name": "spriteFrame",
+      "userData": {
+        "trimType": "auto",
+        "trimThreshold": 1,
+        "rotated": false,
+        "offsetX": 0,
+        "offsetY": 0,
+        "trimX": 0,
+        "trimY": 0,
+        "width": 1446,
+        "height": 312,
+        "rawWidth": 1446,
+        "rawHeight": 312,
+        "borderTop": 0,
+        "borderBottom": 0,
+        "borderLeft": 0,
+        "borderRight": 0,
+        "packable": true,
+        "pixelsToUnit": 100,
+        "pivotX": 0.5,
+        "pivotY": 0.5,
+        "meshType": 0,
+        "vertices": {
+          "rawPosition": [
+            -723,
+            -156,
+            0,
+            723,
+            -156,
+            0,
+            -723,
+            156,
+            0,
+            723,
+            156,
+            0
+          ],
+          "indexes": [
+            0,
+            1,
+            2,
+            2,
+            1,
+            3
+          ],
+          "uv": [
+            0,
+            312,
+            1446,
+            312,
+            0,
+            0,
+            1446,
+            0
+          ],
+          "nuv": [
+            0,
+            0,
+            1,
+            0,
+            0,
+            1,
+            1,
+            1
+          ],
+          "minPos": [
+            -723,
+            -156,
+            0
+          ],
+          "maxPos": [
+            723,
+            156,
+            0
+          ]
+        },
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "b73e0091-5ffe-4467-9334-10591425efe5@6c48a",
+        "atlasUuid": ""
+      },
+      "ver": "1.0.12",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    }
+  },
+  "userData": {
+    "type": "sprite-frame",
+    "hasAlpha": true,
+    "fixAlphaTransparencyArtifacts": false,
+    "redirect": "b73e0091-5ffe-4467-9334-10591425efe5@6c48a"
+  }
+}

Різницю між файлами не показано, бо вона завелика
+ 244 - 131
assets/scene/loading.scene


Деякі файли не було показано, через те що забагато файлів було змінено