设备连接界面断开逻辑调整

This commit is contained in:
lishuo authored and CaiYanPeng committed 2022-06-08 17:25:02 +08:00
1 parent 46b6c7fa01
commit 6b3dd70c61
6 files changed
+58 -7

No files matched your search

@@ -129,14 +129,35 @@ public class RowerDeviceView : MonoBehaviour
UIManager.AddEvent(gameObject, EventTriggerType.PointerClick, b =>
{
if (!mPairButton.activeInHierarchy && !mDisconnectButton.activeInHierarchy) return;
connectButtonClick();
var device = GetDevice();
if (device != null && device.State == DeviceState.Connected)
{
UIManager.ShowConfirm("警告", "是否断开该设备?", () =>
{
device.Disconnect(false);
UIManager.CloseConfirm();
}, 2, () => {
UIManager.CloseConfirm();
});
}
else
{
connectButtonClick();
}
});
UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
//var device = GetDevice();
//if(device != null && device.State == DeviceState.Connected)
//{
// device.Disconnect();
//}
UIManager.ShowConfirm("警告", "是否断开该设备?", () =>
{
var device = GetDevice();
if (device != null && device.State == DeviceState.Connected)
{
device.Disconnect(false);
}
UIManager.CloseConfirm();
}, 2, () => {
UIManager.CloseConfirm();
});
return;
#if UNITY_IOS || UNITY_ANDROID
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");