|
|
@@ -153,6 +153,7 @@ public class BluetoothAim : MonoBehaviour
|
|
|
AimHandler.ins.OnDataReceived(bytes);
|
|
|
}
|
|
|
};
|
|
|
+ int scanCount = 0;
|
|
|
bluetoothHelper.OnScanEnded += (BluetoothHelper helper, LinkedList<BluetoothDevice> nearbyDevices) =>
|
|
|
{
|
|
|
scanLock = false;
|
|
|
@@ -167,9 +168,15 @@ public class BluetoothAim : MonoBehaviour
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- canConnect = true;
|
|
|
- Log("没有发现设备");
|
|
|
- SetStatus(BluetoothStatusEnum.ConnectFail);
|
|
|
+ if (scanCount < 3) { //如果没扫描到,则重新扫描,达到延迟提示失败的效果
|
|
|
+ scanCount++;
|
|
|
+ scanLock = true;
|
|
|
+ bluetoothHelper.ScanNearbyDevices();
|
|
|
+ } else {
|
|
|
+ canConnect = true;
|
|
|
+ Log("没有发现设备");
|
|
|
+ SetStatus(BluetoothStatusEnum.ConnectFail);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
bluetoothHelper.ScanNearbyDevices();
|