Эх сурвалжийг харах

feat:1、 UI适配 有刘海遮挡。 2、 接入他们的后台SDK ,群里有个聊天记录转发。 3、 游戏底部三个道具按钮 , 取掉二次确认弹框, 点击直接拉起广告 (这个 不知道将来微信合规不合规,能走CDN 开关,感觉好点)

zouwuqiang 2 жил өмнө
parent
commit
3d205f2e4d

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
assets/bundle/config/game/CheckpointLevel.json


+ 4 - 6
assets/bundle/game/prefab/man.prefab

@@ -369,11 +369,11 @@
     "_center": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 0.4,
-      "z": 0
+      "y": 0.46,
+      "z": 0.1
     },
     "_radius": 0.2,
-    "_cylinderHeight": 0.3,
+    "_cylinderHeight": 0.4,
     "_direction": 1,
     "_id": ""
   },
@@ -404,9 +404,7 @@
   },
   {
     "__type__": "cc.TargetOverrideInfo",
-    "source": {
-      "__id__": 22
-    },
+    "source": null,
     "sourceInfo": null,
     "propertyPath": [
       "ske"

+ 3 - 3
assets/bundle/game/prefab/man_balloon.prefab

@@ -490,11 +490,11 @@
     "_center": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 0.4,
-      "z": 0
+      "y": 0.46,
+      "z": 0.1
     },
     "_radius": 0.2,
-    "_cylinderHeight": 0.3,
+    "_cylinderHeight": 0.4,
     "_direction": 1,
     "_id": ""
   },

+ 3 - 3
assets/bundle/game/prefab/man_cane.prefab

@@ -430,11 +430,11 @@
     "_center": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 0.4,
-      "z": 0
+      "y": 0.46,
+      "z": 0.1
     },
     "_radius": 0.2,
-    "_cylinderHeight": 0.3,
+    "_cylinderHeight": 0.4,
     "_direction": 1,
     "_id": ""
   },

+ 2 - 2
assets/bundle/game/prefab/man_hat.prefab

@@ -396,8 +396,8 @@
     "_center": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 0.4,
-      "z": 0
+      "y": 0.5,
+      "z": 0.1
     },
     "_radius": 0.2,
     "_cylinderHeight": 0.5,

+ 0 - 2
assets/bundle/gui/game/game.prefab

@@ -3453,8 +3453,6 @@
       "__id__": 0
     },
     "fileId": "faWoQXg8pKZbx5Y0cHl+VU",
-    "instance": null,
-    "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
   {

+ 153 - 14
assets/bundle/gui/sidereward/sidereward.prefab

@@ -28,17 +28,17 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 38
+        "__id__": 44
       },
       {
-        "__id__": 40
+        "__id__": 46
       },
       {
-        "__id__": 42
+        "__id__": 48
       }
     ],
     "_prefab": {
-      "__id__": 44
+      "__id__": 50
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -282,22 +282,25 @@
       },
       {
         "__id__": 25
+      },
+      {
+        "__id__": 31
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 31
+        "__id__": 37
       },
       {
-        "__id__": 33
+        "__id__": 39
       },
       {
-        "__id__": 35
+        "__id__": 41
       }
     ],
     "_prefab": {
-      "__id__": 37
+      "__id__": 43
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -736,6 +739,142 @@
     "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
+  {
+    "__type__": "cc.Node",
+    "_name": "dyside",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 12
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 32
+      },
+      {
+        "__id__": 34
+      }
+    ],
+    "_prefab": {
+      "__id__": 36
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0.226,
+      "y": -37.261,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 31
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 33
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 561,
+      "height": 364
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "3eJVaGwypNZJJIg9Zp31cg"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 31
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 35
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "3fb87e9d-ccc8-4c69-84d3-c8b6e41fd1c1@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "47wd0a6nxEzJpkX2jVOyI8"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "35aNZcMBdB47sPptfqmHKF",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
   {
     "__type__": "cc.UITransform",
     "_name": "",
@@ -746,7 +885,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 32
+      "__id__": 38
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -774,7 +913,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 34
+      "__id__": 40
     },
     "_customMaterial": null,
     "_srcBlendFactor": 2,
@@ -819,7 +958,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 36
+      "__id__": 42
     },
     "_alignFlags": 18,
     "_target": null,
@@ -868,7 +1007,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 39
+      "__id__": 45
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -896,7 +1035,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 41
+      "__id__": 47
     },
     "_alignFlags": 45,
     "_target": null,
@@ -932,7 +1071,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 43
+      "__id__": 49
     },
     "_id": ""
   },

BIN
assets/bundle/gui/sidereward/texture/bg.png


BIN
assets/bundle/gui/sidereward/texture/dyside.png


+ 137 - 0
assets/bundle/gui/sidereward/texture/dyside.png.meta

@@ -0,0 +1,137 @@
+{
+  "ver": "1.0.26",
+  "importer": "image",
+  "imported": true,
+  "uuid": "3fb87e9d-ccc8-4c69-84d3-c8b6e41fd1c1",
+  "files": [
+    ".json",
+    ".png"
+  ],
+  "subMetas": {
+    "6c48a": {
+      "importer": "texture",
+      "uuid": "3fb87e9d-ccc8-4c69-84d3-c8b6e41fd1c1@6c48a",
+      "displayName": "dyside",
+      "id": "6c48a",
+      "name": "texture",
+      "userData": {
+        "wrapModeS": "clamp-to-edge",
+        "wrapModeT": "clamp-to-edge",
+        "minfilter": "linear",
+        "magfilter": "linear",
+        "mipfilter": "none",
+        "anisotropy": 0,
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "3fb87e9d-ccc8-4c69-84d3-c8b6e41fd1c1",
+        "visible": false
+      },
+      "ver": "1.0.22",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    },
+    "f9941": {
+      "importer": "sprite-frame",
+      "uuid": "3fb87e9d-ccc8-4c69-84d3-c8b6e41fd1c1@f9941",
+      "displayName": "dyside",
+      "id": "f9941",
+      "name": "spriteFrame",
+      "userData": {
+        "trimType": "auto",
+        "trimThreshold": 1,
+        "rotated": false,
+        "offsetX": 0,
+        "offsetY": 0,
+        "trimX": 0,
+        "trimY": 0,
+        "width": 561,
+        "height": 364,
+        "rawWidth": 561,
+        "rawHeight": 364,
+        "borderTop": 0,
+        "borderBottom": 0,
+        "borderLeft": 0,
+        "borderRight": 0,
+        "packable": true,
+        "pixelsToUnit": 100,
+        "pivotX": 0.5,
+        "pivotY": 0.5,
+        "meshType": 0,
+        "vertices": {
+          "rawPosition": [
+            -280.5,
+            -182,
+            0,
+            280.5,
+            -182,
+            0,
+            -280.5,
+            182,
+            0,
+            280.5,
+            182,
+            0
+          ],
+          "indexes": [
+            0,
+            1,
+            2,
+            2,
+            1,
+            3
+          ],
+          "uv": [
+            0,
+            364,
+            561,
+            364,
+            0,
+            0,
+            561,
+            0
+          ],
+          "nuv": [
+            0,
+            0,
+            1,
+            0,
+            0,
+            1,
+            1,
+            1
+          ],
+          "minPos": [
+            -280.5,
+            -182,
+            0
+          ],
+          "maxPos": [
+            280.5,
+            182,
+            0
+          ]
+        },
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "3fb87e9d-ccc8-4c69-84d3-c8b6e41fd1c1@6c48a",
+        "atlasUuid": ""
+      },
+      "ver": "1.0.12",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    }
+  },
+  "userData": {
+    "hasAlpha": true,
+    "type": "sprite-frame",
+    "fixAlphaTransparencyArtifacts": true,
+    "redirect": "3fb87e9d-ccc8-4c69-84d3-c8b6e41fd1c1@f9941",
+    "compressSettings": {
+      "useCompressTexture": false
+    }
+  }
+}

+ 3 - 0
assets/script/Main.ts

@@ -21,6 +21,7 @@ import { EcsVehicleSystem } from './game/vehicle/Vehicle';
 import { AdManager } from './platform/ad/AdManager';
 import { EcsSubwaySystem } from './game/subway/Subway';
 import { LaunchManager } from './platform/launch/LaunchManager';
+import { ttZtSdk } from './game/common/utils/ttztsdk';
 
 const { ccclass, property } = _decorator;
 
@@ -32,8 +33,10 @@ export class Main extends Root {
 
     protected run() {
         smc.initialize = ecs.getEntity<Initialize>(Initialize);
+        ttZtSdk.reportActive()
         AdManager.getInstance().initRewardVideoAd();
         LaunchManager.getInstance().onShow()
+   
     }
 
     protected initGui() {

+ 5 - 4
assets/script/game/checkpoint/bll/InitCheckpoint.ts

@@ -175,17 +175,18 @@ export class InitCheckpointSystem extends ecs.ComblockSystem implements ecs.IEnt
     distributePeopleToColorsByArray(totalPeople: number, colors: string[]) {
         // 验证输入
         if (totalPeople % 3 !== 0) {
-            return '给定的人数必须是3的倍数';
+           console.error('配置自动生成生成不是3的倍数,将去除余数')
         }
+        const adapTotalPeople = totalPeople - totalPeople % 3
 
         const colorCount = colors.length;
-        let baseDistribution = Math.floor(totalPeople / colorCount);
-        let remainder = totalPeople % colorCount;
+        let baseDistribution = Math.floor(adapTotalPeople / colorCount);
+        let remainder = adapTotalPeople % colorCount;
 
         // 确保基础分配是3的倍数
         if (baseDistribution % 3 !== 0) {
             baseDistribution -= baseDistribution % 3;
-            remainder += totalPeople - (baseDistribution * colorCount);
+            remainder += adapTotalPeople - (baseDistribution * colorCount);
         }
 
         // 初始化颜色分配对象

+ 50 - 4
assets/script/game/checkpoint/view/CheckpointMainViewComp.ts

@@ -6,13 +6,17 @@
  * @LastEditors: dgflash
  * @LastEditTime: 2022-09-20 17:18:29
  */
-import { EventTouch, Node, _decorator, sys } from "cc";
+import { EventTouch, Node, Widget, _decorator, sys, view } from "cc";
 import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
 import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
 import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
 import { UIID } from "../../common/config/GameUIConfig";
 import { SingletonModuleComp } from "../../common/SingletonModuleComp";
 import { CheckpointLevelItemViewComp } from "./CheckpointLevelItem";
+import { AdManager } from "../../../platform/ad/AdManager";
+import { ClearCellOperationComp } from "../bll/ClearCellOperation";
+import { AddCellOperationComp } from "../bll/AddCellOperation";
+import { FullVehicleOperationComp } from "../bll/FullVehicleOperation";
 
 
 const { ccclass, property } = _decorator;
@@ -37,6 +41,22 @@ export class CheckpointMainViewComp extends CCComp {
         const btnLeave = this.node.getChildByPath("bottom/btn_leave")
         const btnReward = this.node.getChildByPath("btn_reward")
         const btnSetting = this.node.getChildByPath("btn_setting")
+        const levelGroup = this.node.getChildByPath("level")
+        // console.log('当前平台',sys.os)
+        // if (sys.os === sys.OS.IOS || sys.os === sys.OS.ANDROID) {
+
+           
+        // }
+        const safeArea = sys.getSafeAreaRect();
+        const winSize = view.getVisibleSize();
+
+        // 调整其 Widget 组件来适配刘海
+        const widget = levelGroup.getComponent(Widget);
+        if (widget) {
+            widget.top = winSize.height - safeArea.height - safeArea.y;
+            // console.log('偏移高度',widget.top)
+            widget.updateAlignment(); // 立即更新 widget 对齐
+        }
         btnSkin.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
         btnAddCell.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
         btnClear.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
@@ -110,21 +130,47 @@ export class CheckpointMainViewComp extends CCComp {
                     oops.gui.toast('该关卡使用次数已满')
                     return
                 }
-                oops.gui.open(UIID.ClearCell);
+                if (sys.platform === sys.Platform.WECHAT_GAME) {
+                    oops.gui.open(UIID.ClearCell);
+                } else {
+                    AdManager.getInstance().showRewardVideoAd(() => {
+                        console.log('成功看完广告')
+                        ecs.getSingleton(SingletonModuleComp).account.checkpoint.add(ClearCellOperationComp)
+                        ecs.getSingleton(SingletonModuleComp).account.checkpoint.CheckpointModelBase.vm.clearCount += 1
+                    })
+                }
+
                 break;
             case "btn_add_cell":
                 if (checkpoint.CheckpointModelBase.vm.addCellCount >= 3) {
                     oops.gui.toast('该关卡使用次数已满')
                     return
                 }
-                oops.gui.open(UIID.AddCell);
+                if (sys.platform === sys.Platform.WECHAT_GAME) {
+                    oops.gui.open(UIID.AddCell);
+                } else {
+                    AdManager.getInstance().showRewardVideoAd(() => {
+                        console.log('成功看完广告')
+                        ecs.getSingleton(SingletonModuleComp).account.checkpoint.add(AddCellOperationComp)
+                        ecs.getSingleton(SingletonModuleComp).account.checkpoint.CheckpointModelBase.vm.addCellCount += 1
+                    })
+                }
+
                 break;
             case "btn_leave":
                 if (checkpoint.CheckpointModelBase.vm.leaveCount >= 3) {
                     oops.gui.toast('该关卡使用次数已满')
                     return
                 }
-                oops.gui.open(UIID.VehicleLeave);
+                if (sys.platform === sys.Platform.WECHAT_GAME) {
+                    oops.gui.open(UIID.VehicleLeave);
+                } else {
+                    AdManager.getInstance().showRewardVideoAd(() => {
+                        console.log('成功看完广告')
+                        ecs.getSingleton(SingletonModuleComp).account.checkpoint.add(FullVehicleOperationComp)
+                        ecs.getSingleton(SingletonModuleComp).account.checkpoint.CheckpointModelBase.vm.leaveCount += 1
+                    })
+                }
                 break;
             case "btn_reward":
                 oops.gui.open(UIID.SideReward);

+ 15 - 3
assets/script/game/checkpoint/view/CheckpointViewController.ts

@@ -36,8 +36,11 @@ export class CheckpointViewController extends Component {
         this.mainCamera?.screenPointToRay(event.getLocation().x, event.getLocation().y, this._ray);
         if (PhysicsSystem.instance.raycast(this._ray)) {
             const r = PhysicsSystem.instance.raycastResults;
-            for (let index = 0; index < r.length; index++) {
-                const element = r[index];
+            if (r.length > 0) {
+                let element = r.reduce((min, current) => {
+                    return !Number.isNaN(current.distance) && current.distance < min.distance ? current : min;
+                }, r[0]);
+
                 // console.log(this.node?.uuid)
                 const view = element.collider.node?.getComponent(PuppetViewComp) as PuppetViewComp
                 if (view) {
@@ -47,8 +50,17 @@ export class CheckpointViewController extends Component {
                         oops.message.dispatchEvent(GameEvent.PuppetClick, [puppet.PuppetModel.x, puppet.PuppetModel.y])
                     }
                 }
-                break
             }
+
+            // for (let index = 0; index < r.length; index++) {
+            //     const element = r[index];
+            //     if(Number.isNaN(element.distance)){
+            //         continue
+            //     }
+
+
+            //     break
+            // }
         }
     }
 

+ 69 - 0
assets/script/game/common/utils/ttztsdk.ts

@@ -0,0 +1,69 @@
+import { sys } from "cc";
+
+export class ttZtSdk {
+    private static SaveKey = "ttzt_ext"
+    private static ReportURL = "https://api.zt.y73s.cn/api/v1/conversion"
+
+    private static extend: { [k: string]: any } = {};
+    public static get openid() { return this.extend && this.extend.openid }
+    public static get clickid() { return this.extend && this.extend.clickid }
+
+    public static reportActive() {
+        if (typeof window.tt === 'undefined' || !tt) {
+            console.log("#### ttZtSdk #### 非字节平台不初始化")
+            return;
+        }
+        console.log("#### ttZtSdk #### 初始化")
+        // 加载历史记录
+        let savedata = sys.localStorage.getItem(this.SaveKey);
+        console.log("#### ttZtSdk #### 读取旧数据", savedata)
+        if (savedata) {
+            this.extend = JSON.parse(savedata)
+        }
+
+        // 如果已经激活, 不重复上报
+        if (ttZtSdk.openid) {
+            console.log("#### ttZtSdk #### 激活已经上报,不重复上报, openid:", ttZtSdk.openid, "clickid:", ttZtSdk.clickid)
+            return;
+        }
+
+        tt.login({
+            force: true,
+            success: (res: any) => {
+                console.debug(`#### ttZtSdk #### login 调用成功code:${res.code} a_code:${res.anonymousCode}`);
+                let options = tt.getLaunchOptionsSync();
+                let queryStr = JSON.stringify(options.query)
+                let appid = options.extra.appId || options.query.appId
+                console.debug("#### ttZtSdk #### appid:", appid, "query:", queryStr);
+                tt.request({
+                    url: ttZtSdk.ReportURL,
+                    data: {
+                        code: res.code,
+                        anonvmous_code: res.anonymousCode,
+                        appid: appid, // 请求来源:appid
+                        active_data: queryStr, // 激活相关数据 json字符串
+                    },
+                    header: { "content-type": "application/json" },
+                    method: "POST",
+                    success: (res: any) => {
+                        console.log("#### ttZtSdk #### 数据上报成功", res.data)
+                        if (res.data.code == 0) {
+                            ttZtSdk.extend = {}
+                            ttZtSdk.extend.openid = res.data.data.openid;
+                            ttZtSdk.extend.clickid = res.data.data.clickid;
+                            let extStr = JSON.stringify(ttZtSdk.extend)
+                            console.log("#### ttZtSdk #### ext:", extStr)
+                            sys.localStorage.setItem(this.SaveKey, extStr)
+                        }
+                    },
+                    fail: (res: any) => {
+                        console.log("#### ttZtSdk #### 数据上报失败", res.errMsg)
+                    },
+                })
+            },
+            fail: (res: any) => {
+                console.debug(`#### ttZtSdk #### login调用失败`, res);
+            },
+        });
+    }
+}

+ 9 - 0
assets/script/game/common/utils/ttztsdk.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "5b122bdc-6b29-4b09-8d64-c2a049ce2978",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 1 - 1
assets/script/platform/ad/AdManager.ts

@@ -10,7 +10,7 @@ export class AdManager {
 
     // 广告单元ID,请替换为你的实际广告单元ID
     private adUnitId: string = 'adunit-d8e3c2b4bcfdc32e';
-    private dyAdUnitId:string = 'adunit-d8e3c2b4bcfdc32e'
+    private dyAdUnitId:string = '3620da76lobm18tpb5'
 
     private constructor() {}
 

BIN
excel/CheckpointLevel.xlsx


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно