diff --git a/Assets/Scripts/Devices/Ble/BleDevice.cs b/Assets/Scripts/Devices/Ble/BleDevice.cs index 83ce9102..e281fce1 100644 --- a/Assets/Scripts/Devices/Ble/BleDevice.cs +++ b/Assets/Scripts/Devices/Ble/BleDevice.cs @@ -128,7 +128,7 @@ namespace Assets.Scripts.Devices.Ble Debug.Log("断开设备" + this.Name); //App.MainDeviceAdapter.PrintStatus(); - this.State = DeviceState.Disconnected; + //this.State = DeviceState.Disconnected; this.hwInterface.DisconnectPeripheral(this.peripheralInfo, () => { //App.MainDeviceAdapter.PrintStatus(); diff --git a/Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs b/Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs index d35ebd46..e3af36f0 100644 --- a/Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs +++ b/Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs @@ -240,6 +240,7 @@ namespace Assets.Scripts.Ble IsSuccess = true, Error = null }; + PeripheralDisconnected(address, info);//连接前断开 callback?.Invoke(self, info, s); this.callbacks.Remove(info); Debug.Log("连接成功!" + info.Name); @@ -341,8 +342,6 @@ namespace Assets.Scripts.Ble { characteristicsDiscoveredCallbacks.Remove(characteristicsDiscoveredCallback.First().Key); } - - peripheralDisconnectedEvent(this, info, null, false); } #endregion diff --git a/Assets/Scripts/UI/Control/PFUISlider.cs b/Assets/Scripts/UI/Control/PFUISlider.cs index 262dde8f..b24607ba 100644 --- a/Assets/Scripts/UI/Control/PFUISlider.cs +++ b/Assets/Scripts/UI/Control/PFUISlider.cs @@ -64,12 +64,14 @@ public class PFUISlider : MonoBehaviour text.text = $"{valueHandler(f):#0}"; this.ValueChangedHandler?.Invoke(f); } - public void SetValue(float a) + public void SetValue(float a,bool silent = false) { a = a > 1 ? 1 : a; a = a < 0 ? 0 : a; slider.value = a; - OnValueChanged(); + text.text = $"{valueHandler(a):#0}"; + if(!silent) + OnValueChanged(); } public float GetValue() diff --git a/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs b/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs index 7566a205..5d844e3f 100644 --- a/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs +++ b/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs @@ -751,7 +751,7 @@ public class RowerHomeScript : PFUIPanel { var origin = RowerData.ResistanceLevel; var wrapped = origin< 50 ? 50 : origin; - slider.GetComponent().SetValue((wrapped - 50) / 300f); + slider.GetComponent().SetValue((wrapped - 50) / 300f,false); } } @@ -827,7 +827,10 @@ public class RowerHomeScript : PFUIPanel }); return; } - if (interruptFlag) return; + if (interruptFlag) { + transform.Find("Stopped").gameObject.SetActive(false); + return; + } if (RowerData == null) return; //#endif //断线重连继续 @@ -853,9 +856,10 @@ public class RowerHomeScript : PFUIPanel } if (stopSeconds >= 2) { - if (UIManager.Instance.confirm != null && UIManager.Instance.confirm.IsActive()) + if (UIManager.Instance.confirm != null && UIManager.Instance.confirm.IsActive()) { + transform.Find("Stopped").gameObject.SetActive(false); return; - + } transform.Find("Stopped").gameObject.SetActive(true); //if (stopSeconds == 6) //{ @@ -1339,7 +1343,7 @@ public class RowerHomeScript : PFUIPanel } if (Rower != null) { - if (C2RowerData.IsEnabled == true && !openTimer && !isPause && C2RowerData.rowerType!=null) + if (C2RowerData.IsEnabled == true && !openTimer && !isPause && C2RowerData.rowerType!=null && rowerType!= null && !rowerType.EqualTo(C2RowerData.rowerType)) { rowerType = C2RowerData.rowerType; HandleSelectType(); diff --git a/Assets/Scripts/UI/Prefab/Rower/RowerTaskPanel.cs b/Assets/Scripts/UI/Prefab/Rower/RowerTaskPanel.cs index 34099b6e..a9d79643 100644 --- a/Assets/Scripts/UI/Prefab/Rower/RowerTaskPanel.cs +++ b/Assets/Scripts/UI/Prefab/Rower/RowerTaskPanel.cs @@ -22,6 +22,9 @@ public class RowerTaskPanel : PFUIPanel /// 里程:m 时间:s /// public float value { get; set; } + public bool EqualTo(RowerType rowerType) { + return this.type == rowerType.type && this.value == rowerType.value; + } } Transform selector, distance, time; public RowerType rowerType;