From 034c98654ad1ab7f878e769718e6417b6358ff15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Sun, 21 Sep 2025 21:59:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=AD=A6=E5=99=A8=E7=B3=BB=E7=BB=9F):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=AD=A6=E5=99=A8=E5=88=87=E6=8D=A2=E6=97=B6?= =?UTF-8?q?UI=E7=8A=B6=E6=80=81=E4=B8=8D=E5=90=8C=E6=AD=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在武器切换时,同步更新UIState中的武器数组顺序并重建武器图标,确保UI与游戏状态一致 --- scripts/Structs/Weapon.gd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/Structs/Weapon.gd b/scripts/Structs/Weapon.gd index 3336b34..d023faf 100644 --- a/scripts/Structs/Weapon.gd +++ b/scripts/Structs/Weapon.gd @@ -77,6 +77,8 @@ func _ready(): var myIndex = get_index() var rightIndex = min(myIndex + 1, get_parent().get_child_count() - 1) get_parent().move_child(self, rightIndex) + ArrayTool.swap(UIState.player.weapons, myIndex, rightIndex) + UIState.player.rebuildWeaponIcons() ) for i in sounds.get_children(): i.process_mode = ProcessMode.PROCESS_MODE_ALWAYS