From a588716b30c1ab5c2d5da54a0e640e3054b17ef3 Mon Sep 17 00:00:00 2001 From: lishuo Date: Thu, 14 Jul 2022 13:37:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3io=E8=AE=BE=E5=A4=87=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5&android=E5=8D=A1=E9=A1=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Assets/FacebookSDK/SDK/Resources.meta | 8 -------- Assets/Plugins/Android/AndroidManifest.xml | 2 +- Assets/Plugins/BluetoothHardwareInterface.cs | 2 +- Assets/Scripts/Devices/Ble/BleDevice.cs | 9 --------- Assets/Scripts/Devices/Ble/BleDeviceAdapter.cs | 16 +--------------- .../Scripts/Scenes/Ride/Network/TcpService1.cs | 12 +++++++----- .../Scenes/Ride/Scripts/PlayerController.cs | 4 ++-- 8 files changed, 13 insertions(+), 41 deletions(-) delete mode 100644 Assets/FacebookSDK/SDK/Resources.meta diff --git a/.gitignore b/.gitignore index 0a64a005..e3855763 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,4 @@ Assets/AVProVideo.meta Packages Assets/Tree_Textures.meta Packages +Assets/FacebookSDK/SDK/Resources.meta diff --git a/Assets/FacebookSDK/SDK/Resources.meta b/Assets/FacebookSDK/SDK/Resources.meta deleted file mode 100644 index 4cda13d7..00000000 --- a/Assets/FacebookSDK/SDK/Resources.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 43702c51e269ba844b251a6b0dc2c3ee -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/AndroidManifest.xml b/Assets/Plugins/Android/AndroidManifest.xml index d537954a..86386996 100644 --- a/Assets/Plugins/Android/AndroidManifest.xml +++ b/Assets/Plugins/Android/AndroidManifest.xml @@ -3,7 +3,7 @@ - + diff --git a/Assets/Plugins/BluetoothHardwareInterface.cs b/Assets/Plugins/BluetoothHardwareInterface.cs index 93c85514..f5583255 100644 --- a/Assets/Plugins/BluetoothHardwareInterface.cs +++ b/Assets/Plugins/BluetoothHardwareInterface.cs @@ -477,7 +477,7 @@ public class BluetoothLEHardwareInterface #endif } - public static void ScanForPeripheralsWithServices (string[] serviceUUIDs, Action action = null, Action actionAdvertisingInfo = null, bool rssiOnly = false, bool clearPeripheralList = true, int recordType = 0xFF) + public static void ScanForPeripheralsWithServices (string[] serviceUUIDs, Action action = null, Action actionAdvertisingInfo = null, bool rssiOnly = false, bool clearPeripheralList = false, int recordType = 0xFF) { #if !UNITY_EDITOR_OSX || !EXPERIMENTAL_MACOS_EDITOR if (!Application.isEditor) diff --git a/Assets/Scripts/Devices/Ble/BleDevice.cs b/Assets/Scripts/Devices/Ble/BleDevice.cs index e281fce1..009e16eb 100644 --- a/Assets/Scripts/Devices/Ble/BleDevice.cs +++ b/Assets/Scripts/Devices/Ble/BleDevice.cs @@ -126,15 +126,8 @@ namespace Assets.Scripts.Devices.Ble if (this.State != DeviceState.Disconnected) { Debug.Log("断开设备" + this.Name); - - //App.MainDeviceAdapter.PrintStatus(); - //this.State = DeviceState.Disconnected; - this.hwInterface.DisconnectPeripheral(this.peripheralInfo, () => { - //App.MainDeviceAdapter.PrintStatus(); - this.State = DeviceState.Disconnected; - }); } } @@ -247,8 +240,6 @@ namespace Assets.Scripts.Devices.Ble public override void Disconnect(bool save = true) { - //throw new NotImplementedException(); - //this.hwInterface.DisconnectPeripheral(this.peripheralInfo, null); this.Disconnect(); } diff --git a/Assets/Scripts/Devices/Ble/BleDeviceAdapter.cs b/Assets/Scripts/Devices/Ble/BleDeviceAdapter.cs index fa91bacc..ea10a1d4 100644 --- a/Assets/Scripts/Devices/Ble/BleDeviceAdapter.cs +++ b/Assets/Scripts/Devices/Ble/BleDeviceAdapter.cs @@ -30,7 +30,6 @@ namespace Assets.Scripts.Devices.Ble private void HwInterface_BluetoothStateChangedEvent(IBleWinHwInterface hwInterface, BleState bleState) { - //Debug.Log("22222222222222" + bleState); if(bleState == BleState.Off) { discoveredDevices.Clear(); @@ -136,20 +135,7 @@ namespace Assets.Scripts.Devices.Ble //TODO:取消注释,自动连接设备 //Debug.Log("自动连接" + device111.Id); - if (App.IsRowerMode == true) - { - if (device111.Sensor == Ant.SensorType.Rower || device111.Sensor == Ant.SensorType.HeartRate) - { - device111.Connect(); - } - } - else if(App.IsRowerMode == false) - { - if (device111.Sensor != Ant.SensorType.Rower) - { - device111.Connect(); - } - } + device111.Connect(); } } diff --git a/Assets/Scripts/Scenes/Ride/Network/TcpService1.cs b/Assets/Scripts/Scenes/Ride/Network/TcpService1.cs index b522dad2..841d35f2 100644 --- a/Assets/Scripts/Scenes/Ride/Network/TcpService1.cs +++ b/Assets/Scripts/Scenes/Ride/Network/TcpService1.cs @@ -146,23 +146,25 @@ namespace Assets.Scenes.Ride.Scripts.Network return Encoding.UTF8.GetString(buffer); } - private string temp = ""; + private StringBuilder temp = new StringBuilder(); protected override void OnReceived(byte[] buffer, long offset, long size) { //base.OnReceived(buffer, offset, size); var returnData = Encoding.UTF8.GetString(buffer, (int)offset, (int)size); + //*sdfsd#*sdfsd#*sdfsd#*sdfsd# foreach (var item in returnData) { + if (item != '*' && item != '#') { - temp += item; + temp.Append(item); } - + if (item == '#') { //解压 temp - var uncompressStr = Decompress(Convert.FromBase64String(temp)); + var uncompressStr = Decompress(Convert.FromBase64String(temp.ToString())); #if UNITY_EDITOR Console.WriteLine(uncompressStr); #endif @@ -176,7 +178,7 @@ namespace Assets.Scenes.Ride.Scripts.Network { var l = t.Replace("l{", "").Replace("}", ""); var itemList = l.Split('|'); - temp = ""; + temp.Clear(); foreach (var obj in itemList) { diff --git a/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs b/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs index 11f72da3..85ae3549 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs @@ -61,9 +61,9 @@ namespace Assets.Scenes.Ride.Scripts cadance = mainController.UpdateCadence(); weight = App.CurrentUser.Weight; bicycleWeight = App.CurrentUser.BicycleWeight; -#if UNITY_EDITOR +//#if UNITY_EDITOR power = 300; -#endif +//#endif mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100); } catch (Exception ex)