diff --git a/Assets/Scripts/Bluetooth/BLECommunicationManager.cs b/Assets/Scripts/Bluetooth/BLECommunicationManager.cs index 6d78dc1..d87ae9a 100644 --- a/Assets/Scripts/Bluetooth/BLECommunicationManager.cs +++ b/Assets/Scripts/Bluetooth/BLECommunicationManager.cs @@ -2505,6 +2505,7 @@ namespace Kill.Bluetooth if (BluetoothManager.Instance == null) { LogError("BluetoothManager.Instance 为 null"); + LoadingUI.Hide(); return false; } @@ -2513,6 +2514,7 @@ namespace Kill.Bluetooth { Log("蓝牙未初始化,尝试自动初始化..."); BluetoothManager.Instance.Initialize(); + LoadingUI.Hide(); return false; } @@ -2521,6 +2523,7 @@ namespace Kill.Bluetooth { LogError("蓝牙未连接"); ToastUI.Show("100081"); // "请先连接蓝牙设备" + LoadingUI.Hide(); // 未连接时立即隐藏Loading,避免一直转圈 return false; } diff --git a/Assets/Scripts/UI/Pages/DeviceInfoPage/FirmwareUpdatePage.cs b/Assets/Scripts/UI/Pages/DeviceInfoPage/FirmwareUpdatePage.cs index acf1317..fe9711d 100644 --- a/Assets/Scripts/UI/Pages/DeviceInfoPage/FirmwareUpdatePage.cs +++ b/Assets/Scripts/UI/Pages/DeviceInfoPage/FirmwareUpdatePage.cs @@ -172,11 +172,17 @@ namespace Kill.UI.Pages UpdateLoadingUI.Instance.Show(); uint firmwareVersion = ParseFirmwareVersion(otaData.version); OTAManager.Instance.OnTransferProgress += OnOTATransferProgress; + // OTA 传输期间清空返回事件,防止用户触发返回中断升级;传输结束恢复 + var otaBackAction = UIManager.Instance.GetBackAction(); + UIManager.Instance.ClearBackAction(); StartCoroutine(OTAManager.Instance.PerformFullUpgrade(_selectedFirmwareData, firmwareVersion, (success) => { Loom.QueueOnMainThread(() => { isUpdating = false; + // 恢复返回事件 + if (otaBackAction != null) + UIManager.Instance.RegisterBackAction(otaBackAction); if (success) { ToastUI.Show("100226"); diff --git a/Assets/Scripts/UI/Pages/HomePage/HomePageCtrl.cs b/Assets/Scripts/UI/Pages/HomePage/HomePageCtrl.cs index e9bbe89..46c632b 100644 --- a/Assets/Scripts/UI/Pages/HomePage/HomePageCtrl.cs +++ b/Assets/Scripts/UI/Pages/HomePage/HomePageCtrl.cs @@ -330,12 +330,16 @@ namespace Kill.UI.Pages isQueryingStatus = false; statusQueryQueue?.Clear(); UIManager.Instance?.ClearBackAction(); - // OpenPage 已移至 BluetoothManager.OnSelfDisconnected(全局监听 + 延迟) + // 刷新首页设备连接状态UI(延迟到主循环执行,与连接成功时保持一致) + pendingUIUpdates.Add(() => + { + deviceState?.UpdateDeviceState(hasBluetooth, hasWifi); + }); if(bluetoothDeviceInfoCoroutine!=null) { StopCoroutine(bluetoothDeviceInfoCoroutine); } - + UIManager.Instance?.OpenMainPage(UIManager.PageName.homePage); } private void OnBluetoothError(string error)