Explorar o código

关闭按钮适配

薛鸿潇 %!s(int64=5) %!d(string=hai) anos
pai
achega
c41d2a4978

+ 3 - 0
assets/resources/game/prefab/game.prefab

@@ -5637,6 +5637,9 @@
     "icon_zb": {
       "__id__": 129
     },
+    "node_top_ui": {
+      "__id__": 102
+    },
     "_id": ""
   },
   {

+ 3 - 0
assets/script/before/GamePlay.ts

@@ -218,6 +218,9 @@ export default class GamePlay extends cc.Component {
         //背景适配
         this.node_bg.setContentSize(new cc.Size(cc.winSize.width, cc.winSize.height));
         // this.node_top.y = (cc.winSize.height - this.node_top.height) * 0.5 + 5;
+        const world_pos = gData.gameData.gameStyle.node_top_ui.parent.convertToWorldSpaceAR(gData.gameData.gameStyle.node_top_ui.getPosition());
+        const node_pos = this.node_top.parent.convertToNodeSpaceAR(world_pos);
+        this.node_top.y = node_pos.y - 20;
     }
 
     update(dt) {

+ 3 - 0
assets/script/game/game/Game.ts

@@ -32,6 +32,9 @@ export default class Game extends cc.Component {
     icon_hb: cc.Node = null;
     @property({ type: cc.Node, displayName: "金猪币图标" })
     icon_zb: cc.Node = null;
+
+    @property({ type: cc.Node, displayName: "顶部ui组" })
+    node_top_ui: cc.Node = null;
  
 
     onLoad() {