Bläddra i källkod

【BUG】修改预约弹窗显示BUG

mojunshou 7 månader sedan
förälder
incheckning
5b98b9b355

+ 153 - 11
assets/bundle/gui/eliminate/prefab/gameOver.prefab

@@ -28,17 +28,17 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 104
+        "__id__": 110
       },
       {
-        "__id__": 106
+        "__id__": 112
       },
       {
-        "__id__": 108
+        "__id__": 114
       }
     ],
     "_prefab": {
-      "__id__": 110
+      "__id__": 116
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -272,16 +272,19 @@
       },
       {
         "__id__": 83
+      },
+      {
+        "__id__": 101
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 101
+        "__id__": 107
       }
     ],
     "_prefab": {
-      "__id__": 103
+      "__id__": 109
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -2449,6 +2452,145 @@
     "nestedPrefabInstanceRoots": null
   },
   {
+    "__type__": "cc.Node",
+    "_name": "Node-001",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 10
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 102
+      },
+      {
+        "__id__": 104
+      }
+    ],
+    "_prefab": {
+      "__id__": 106
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 330.825,
+      "y": -534.217,
+      "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__": 101
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 103
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 120,
+      "height": 130
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "65+i+PCYZCk7K1zyQkkj9H"
+  },
+  {
+    "__type__": "dragonBones.ArmatureDisplay",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 101
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 105
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "playTimes": -1,
+    "premultipliedAlpha": false,
+    "_defaultArmatureIndexValue": 0,
+    "_dragonAsset": {
+      "__uuid__": "3bb38972-7753-4c70-a62a-eef56011c90a",
+      "__expectedType__": "dragonBones.DragonBonesAsset"
+    },
+    "_dragonAtlasAsset": {
+      "__uuid__": "bb8091c7-c86b-43aa-a918-7106553e4736",
+      "__expectedType__": "dragonBones.DragonBonesAtlasAsset"
+    },
+    "_armatureName": "Armature",
+    "_animationName": "newAnimation",
+    "_animationIndexValue": 1,
+    "_defaultCacheModeValue": 0,
+    "_timeScale": 1,
+    "_playTimes": -1,
+    "_debugBones": false,
+    "_enableBatch": false,
+    "_sockets": [],
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "82Rvo3lB1AlI3Rwv6Xaa/b"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "82+5b01zNDSKr44j/U3oWp",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
     "__type__": "cc.UITransform",
     "_name": "",
     "_objFlags": 0,
@@ -2458,7 +2600,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 102
+      "__id__": 108
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -2499,12 +2641,12 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 105
+      "__id__": 111
     },
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 720,
-      "height": 1600
+      "height": 1600.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -2527,7 +2669,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 107
+      "__id__": 113
     },
     "_id": ""
   },
@@ -2545,7 +2687,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 109
+      "__id__": 115
     },
     "_alignFlags": 45,
     "_target": null,

+ 2 - 2
assets/bundle/gui/eliminate/prefab/popup/ReservePopup.prefab

@@ -4087,7 +4087,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 720,
-      "height": 1600
+      "height": 1600.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -4164,7 +4164,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 720,
-      "height": 1600
+      "height": 1600.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 7 - 1
assets/script/game/utils/Format.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-18 10:57:07
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-18 11:04:59
+ * @LastEditTime: 2025-04-28 15:21:30
  * @Description: 工具类
  */
 
@@ -30,6 +30,12 @@ export class Format {
         //再保留3位小数
         return wxCoin.toFixed(3).replace(/(\d)(?=(\d{3})+\.)/g, '$1')
     }
+
+    static truncateCustom(str: string, maxLen = 5, suffix = "***"): string {
+        return str.length > maxLen
+            ? `${str.substring(0, maxLen)}${suffix}`
+            : str;
+    }
 }
 
 

+ 1 - 10
assets/script/game/view/EliminateViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:01:09
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-28 14:43:41
+ * @LastEditTime: 2025-04-28 14:59:42
  * @Description: 消除游戏主场景
  */
 import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, v3, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
@@ -2402,15 +2402,6 @@ export class EliminateViewComp extends CCComp {
         oops.message.off(GameEvent.resumeGame, this.resumeGame, this);
     }
 
-
-
-
-
-
-
-
-
-
     btn_text() {
         const param = {
             "code": 0,

+ 3 - 2
assets/script/game/view/WechatWithdrawalViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 17:00:12
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-24 18:44:51
+ * @LastEditTime: 2025-04-28 15:23:16
  * @Description: 微信提现页面
  */
 import { _decorator, ImageAsset, Label, Node, RichText, Size, Sprite, SpriteFrame, Texture2D, tween, UITransform, Vec3 } from "cc";
@@ -67,7 +67,8 @@ export class WechatWithdrawalViewComp extends CCVMParentComp {
     //设置数据
     setData() {
         // const curLevel = smc.account.AccountModel.curLevel;
-        this.data.nickName = smc.account.AccountModel.accountName;
+        let name = smc.account.AccountModel.accountName
+        this.data.nickName = Format.truncateCustom(name);
         this.data.headUrl = smc.account.AccountModel.headUrl;
         // this.richText_tips.string = this.str_list[curLevel > 12 ? 1 : 0];
         this.data.money = smc.game.GameModel.wechat_tx_info.money;

+ 26 - 10
assets/script/game/view/popup/ReservePopup.ts

@@ -1,4 +1,11 @@
-import { _decorator, Component, Node } from 'cc';
+/*
+ * @Author: mojunshou 1637302775@qq.com
+ * @Date: 2025-04-19 11:04:19
+ * @LastEditors: mojunshou 1637302775@qq.com
+ * @LastEditTime: 2025-04-28 15:25:52
+ * @Description: 
+ */
+import { _decorator } from 'cc';
 import { oops } from 'db://oops-framework/core/Oops';
 import VMParent from 'db://oops-framework/libs/model-view/VMParent';
 import { UIID } from '../../common/config/GameUIConfig';
@@ -11,13 +18,11 @@ const { ccclass, property } = _decorator;
 
 @ccclass('ReservePopup')
 export class ReservePopup extends VMParent {
-
-
     data: any = {
         nickName: "小白",
         time: "2025-04-28",
         money: 1000,
-        goldNum: 10
+        goldNum: 1
     }
 
 
@@ -28,15 +33,14 @@ export class ReservePopup extends VMParent {
     }
 
     //更新数据
-
-
     updateData() {
         if (DeviceUtil.isAndroid && DeviceUtil.isNative) {
-            this.data.nickName = smc.account.AccountModel.accountName;
+            let name = smc.account.AccountModel.accountName
+            //超过五位数就用***代替
+            this.data.nickName = Format.truncateCustom(name);
             this.data.money = Format.formatWxCoin(smc.account.AccountModel.wxCoin);
-            this.data.goldNum = smc.account.AccountModel.goldCoin;
             //当前时间的后三天,只要年月日
-            // this.data.time = 
+            this.data.time = this.getThreeDaysLater();
         }
     }
 
@@ -44,7 +48,6 @@ export class ReservePopup extends VMParent {
 
     async btn_confirm() {
         //加载微信转账中
-        // await oops.gui.open(UIID.WechaatTransfer);
         oops.gui.remove(UIID.ReservePopup);
         this.updateState();
     }
@@ -57,6 +60,19 @@ export class ReservePopup extends VMParent {
         })
 
     }
+
+    // 获取当前日期后三天的日期(格式:YYYY-MM-DD)
+    getThreeDaysLater(): string {
+        const date = new Date();
+        date.setDate(date.getDate() + 3); // 自动处理跨月/年逻辑[5](@ref)
+
+        // 补零处理
+        const year = date.getFullYear();
+        const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始需+1[4](@ref)
+        const day = date.getDate().toString().padStart(2, '0'); // 日期补零[2](@ref)
+
+        return `${year}-${month}-${day}`;
+    }
 }