蓝牙断开重连相关逻辑优化

This commit is contained in:
lishuo 2022-06-13 18:59:02 +08:00
parent 87a0e7fb6d
commit f25d0b7b8c
11 changed files with 455 additions and 27 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -0,0 +1,128 @@
fileFormatVersion: 2
guid: 23324df2738e17840a880b3a6a667a98
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -823,6 +823,174 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &7779863355442684396
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7034836054261949127}
- component: {fileID: 6143368985754638542}
- component: {fileID: 5753665062704233989}
- component: {fileID: 1495845730394678308}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7034836054261949127
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7779863355442684396}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4661211349328450780}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: -16}
m_SizeDelta: {x: 192, y: 26}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6143368985754638542
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7779863355442684396}
m_CullTransparentMesh: 0
--- !u!114 &5753665062704233989
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7779863355442684396}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 1db9e217733971041be26b076fda6083, type: 3}
m_FontSize: 22
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: NO DEVICE
--- !u!114 &1495845730394678308
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7779863355442684396}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e47f6ee11b78f3247a0b474b6c36e2cd, type: 3}
m_Name:
m_EditorClassIdentifier:
key:
--- !u!1 &7796194410704820496
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4661211349328450780}
- component: {fileID: 5386702751970923277}
- component: {fileID: 6255635068988837825}
m_Layer: 5
m_Name: Error
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &4661211349328450780
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7796194410704820496}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7034836054261949127}
- {fileID: 1853356364457434975}
m_Father: {fileID: 5111540946519637648}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -4.600006, y: 25.800003}
m_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5386702751970923277
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7796194410704820496}
m_CullTransparentMesh: 0
--- !u!114 &6255635068988837825
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7796194410704820496}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 23324df2738e17840a880b3a6a667a98, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &7824156360689418142
GameObject:
m_ObjectHideFlags: 0
@ -1023,6 +1191,98 @@ MonoBehaviour:
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &8037773402551538084
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1853356364457434975}
- component: {fileID: 8162886766775582271}
- component: {fileID: 2416531608984966904}
- component: {fileID: 6648807303715948149}
m_Layer: 5
m_Name: Text (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1853356364457434975
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8037773402551538084}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4661211349328450780}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: -0.42, y: -42}
m_SizeDelta: {x: 487.94348, y: 24}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8162886766775582271
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8037773402551538084}
m_CullTransparentMesh: 0
--- !u!114 &2416531608984966904
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8037773402551538084}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.36078432, g: 0.36078432, b: 0.43137255, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 1db9e217733971041be26b076fda6083, type: 3}
m_FontSize: 16
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: Please make sure the device is powered on an awakened
--- !u!114 &6648807303715948149
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8037773402551538084}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e47f6ee11b78f3247a0b474b6c36e2cd, type: 3}
m_Name:
m_EditorClassIdentifier:
key:
--- !u!1 &8099950033695761744
GameObject:
m_ObjectHideFlags: 0
@ -1358,6 +1618,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2253444633616264453}
- {fileID: 4661211349328450780}
m_Father: {fileID: 8260988677505792498}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -367,7 +367,8 @@
"Please check the network status!": "请检查网络连接是否正常!",
"FINISH": "终点",
"Continue the game?": "有中断的划船记录,是否继续?",
"Save the game?": "有中断的划船记录,是否保存?"
"Save the game?": "有中断的划船记录,是否保存?",
"Please make sure the device is powered on an awakened": "请确保设备有电且已唤醒"
},
"en": {
"HOT ROUTES": "HOT ROUTES",
@ -729,6 +730,7 @@
"Please check the network status!": "Please check if the network connection is normal!",
"FINISH": "FINISH",
"Continue the game?": "Continue the game?",
"Save the game?": "Save the game?"
"Save the game?": "Save the game?",
"Please make sure the device is powered on an awakened": "Please make sure the device is powered on an awakened"
}
}

View File

@ -27,7 +27,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
_isEnabled = value;
if (EnableChanged != null)
{
EnableChanged(_isEnabled, new EventArgs());
EnableChanged(_isEnabled, null);
}
}
}
@ -46,7 +46,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
_pullValue = value;
if (this.PullChanged != null)
{
this.PullChanged(this, new EventArgs());
this.PullChanged(this, null);
}
}
}
@ -68,15 +68,15 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
else if (data[0] == 0x3d)
{
//老款表头不支持
List<ushort> r = new List<ushort>();
//List<ushort> r = new List<ushort>();
for (int i = 3; i < data.Length; i += 2)
{
ushort pull = data[i] < 5 ? (ushort)0 : Convert.ToUInt16(Math.Round(LbsToNewton(data[i], true)));
r.Add(pull);
//r.Add(pull);
PullValue = pull;
}
Debug.Log("拉力曲线:" + string.Join(",", r));
// Debug.Log("拉力曲线:" + string.Join(",", r));
}
else if (data[0] == 0x31)
{
@ -102,11 +102,12 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
var time = ((data[3] << 16) + (data[2] << 8) + data[1]) / 100;
Debug.Log("划船时间" + time);
isReadyStatus = data[9] == 0;
if (RowerResChanged != null)
{
RowerResChanged.Invoke(data[19], new EventArgs());
}
var hasChanged = data[19] != ResistanceLevel;
ResistanceLevel = data[19];
if (RowerResChanged != null && hasChanged)
{
RowerResChanged.Invoke(this, null);
}
//isReadyStatus = data[2] == 1 || data[2] == 129;
}
else if (data[0] == 0x32)
@ -163,7 +164,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
{
if (_totalDistance == 0 && value != 0 && StartEvent != null)
{
StartEvent.Invoke(null, new EventArgs());
StartEvent.Invoke(this, null);
}
_totalDistance = value;
}

View File

@ -38,7 +38,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
{
if (_instantaneousPace == 0 && value != 0 && StartEvent != null)
{
StartEvent.Invoke(null, new EventArgs());
StartEvent.Invoke(this, null);
}
_instantaneousPace = value;
}
@ -104,7 +104,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
_pullValue = value;
if (this.PullChanged != null)
{
this.PullChanged(this, new EventArgs());
this.PullChanged(this, null);
}
}
}
@ -200,7 +200,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected) && d.Sensor == SensorType.Rower);
if (resChanged && device != null && deviceNamePool.FirstOrDefault(x => device.Name.ToLower().Contains(x.ToLower())) == null && RowerResChanged != null)
{
RowerResChanged.Invoke(this.commonRes, null);
RowerResChanged.Invoke(this, null);
}
b += this.SizeOfDataForFlag(RowerDataFlag.ResistanceLevel);
}
@ -241,7 +241,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected) && d.Sensor == SensorType.Rower);
if (thinkResChanged && device != null && deviceNamePool.FirstOrDefault(x=>device.Name.ToLower().Contains(x.ToLower()))!=null && RowerResChanged != null)
{
RowerResChanged.Invoke(this.thinkRes, null);
RowerResChanged.Invoke(this, null);
}
b += this.SizeOfDataForFlag(RowerDataFlag.ThinkDragFactor);
}
@ -254,6 +254,8 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
tempPullList.Add(val);
PullValue = val;
}
Debug.Log("拉力列表:" + string.Join(",", tempPullList));
if (pullList == null) pullList = new List<ushort>();
foreach (var pull in tempPullList)
{
@ -269,7 +271,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
pullList.Add(pull);
}
tempPullList.Clear();
//Debug.Log("拉力:" + string.Join(",",list));
}
}
List<ushort> pullList { get; set; }

View File

@ -116,6 +116,10 @@ namespace Assets.Scripts.Ble
private void ManagerStatusChanged(BleMobileThread sender, WclBleManagerStatus status)
{
this.BleState = BleMobileInterface.StateFromNativeState(status);
if (this.BleState == BleState.Off)
{
ClearAllCallbacks();
}
}
private void WatcherScanInfoReceived(BleMobileThread sender, string address, string name, int rssi,string[] uuids)
@ -348,6 +352,7 @@ namespace Assets.Scripts.Ble
BluetoothLEHardwareInterface.DisconnectPeripheral(peripheral.Address, (address) =>
{
Debug.Log("断开回调"+ address);
PeripheralDisconnected(address,peripheral);
peripheralDisconnectedEvent(this, peripheral, null, true);
callback?.Invoke();
});
@ -374,6 +379,17 @@ namespace Assets.Scripts.Ble
{
bleMobileThread?.Stop();
}
public void ClearAllCallbacks()
{
callbacks?.Clear();
servicesCallbacks?.Clear();
characteristicNotificationCallbacks?.Clear();
characteristicReadCallbacks?.Clear();
characteristicsDiscoveredCallbacks?.Clear();
_discoveredCallback = null;
_pCache?.Clear();
}
//发现服务列表
public void DiscoverServices(BlePeripheralInfo peripheral, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse<List<BleServiceInfo>>> callback)

View File

@ -50,6 +50,8 @@ public class PFUISlider : MonoBehaviour
}
public void SetValue(float a)
{
a = a > 1 ? 1 : a;
a = a < 0 ? 0 : a;
slider.value = a;
slider.onValueChanged?.Invoke(a);
}

View File

@ -44,6 +44,7 @@ public class ConnectDeviceModal : PFUIPanel
private Dictionary<string, DeviceItem> deviceList;
private Text noDevice,Title;
private RectTransform searchIconRect;
private GameObject deviceNotFound;
protected override void Awake()
{
@ -52,6 +53,7 @@ public class ConnectDeviceModal : PFUIPanel
deviceList = new Dictionary<string, DeviceItem>();
var container = this.transform.Find("GameObject");
deviceNotFound = container.Find("Panel/Error").gameObject;
var closeBtn = container.Find("CloseBtn");
Logo = container.Find("Logo").GetComponent<Image>();
Title = container.Find("Title").GetComponent<Text>();
@ -259,6 +261,7 @@ public class ConnectDeviceModal : PFUIPanel
//如果没有可连接的设备按钮只读
connectBtn.mButton.enabled = deviceList.Count > 0;
connectBtn.mButton.interactable = deviceList.Count > 0;
deviceNotFound.SetActive(deviceList.Count <= 0);
}
}
//选中需要连接的设备

View File

@ -466,6 +466,10 @@ public class RowerHomeScript : PFUIPanel
int truelyTime = 0;
private void StartFunc(object sender, EventArgs e)
{
var rowdata = (IRowerCommonData)sender;
if (rowdata != RowerData)
return;
Debug.Log($"开始了:{openTimer}");
if (UIManager.Instance.confirm != null && UIManager.Instance.confirm.IsActive())
{
@ -626,6 +630,7 @@ public class RowerHomeScript : PFUIPanel
private void Init()
{
pointCount = 0;
print("初始化");
if (Rower != null)
{
@ -734,20 +739,18 @@ public class RowerHomeScript : PFUIPanel
transform.Find("ResBar/BtnSub").GetComponent<Button>().interactable = !(bool)sender;
transform.Find("ResBar/BtnAdd").GetComponent<Button>().interactable = !(bool)sender;
}
bool initRes = false;
private void ResChanged(object sender, EventArgs e)
{
Debug.Log(Convert.ToSingle(sender));
if (!initRes && slider)
var originData = (IRowerCommonData)sender;
if (slider && RowerData!= null && originData == RowerData)
{
var origin = Convert.ToSingle(sender);
var origin = RowerData.ResistanceLevel;
var wrapped = origin< 50 ? 50 : origin;
slider.GetComponent<PFUISlider>().SetValue((wrapped - 50) / 300f);
initRes = true;
}
}
public bool checkRowing()
{
if (seconds > 0)
@ -792,6 +795,7 @@ public class RowerHomeScript : PFUIPanel
private Text rmyAvgForceText { get; set; }
private Text PeakForceText { get; set; }
private Text rmyPeakForceText { get; set; }
private bool interruptFlag{ get; set; }
void TimerTicks()
{
@ -801,21 +805,26 @@ public class RowerHomeScript : PFUIPanel
PaintPullCurve((ushort)(a / 10));
if (RowerData == null) return;
#endif
#if !UNITY_EDITOR
//#if !UNITY_EDITOR
if (Rower == null)
{
interruptFlag = true;
//HandleDiscardDirect();
isPause = true;
UIManager.ShowConfirm(App.GetLocalString("Warning"), App.GetLocalString("Save the game?"), () =>
{
HandleSaveDirect();
UIManager.CloseConfirm();
interruptFlag = false;
}, 2, ()=> {
Init();
interruptFlag = false;
});
return;
}
if (interruptFlag) return;
if (RowerData == null) return;
#endif
//#endif
var heartRate = HeartRate ?? 0;
BPMText.text = heartRate.ToString();
//断线重连继续
@ -1087,7 +1096,10 @@ public class RowerHomeScript : PFUIPanel
void PaintPullCurve(object sender, EventArgs e)
{
//防止设备断开重连rowData对象发生变化事件重复触发
var ftms = (IRowerCommonData)sender;
if (RowerData != ftms)
return;
//Debug.Log(ftms.PullValue);
PaintPullCurve(ftms.PullValue);
}

View File

@ -58,7 +58,7 @@ public class RowerDeviceView : MonoBehaviour
/// </summary>
private Sprite sprite3;
private float timer = 1.0f;
private float timer = 0f;
private void Awake()
{
title = this.transform.Find("Title").GetComponent<Text>();
@ -274,7 +274,7 @@ public class RowerDeviceView : MonoBehaviour
logo.sprite = sprite0;
searchState.text = App.GetLocalString("CHOOSE DEVICE");
var hasDevice = false;
if (SensorType == SensorType.SpeedCadence)
{
@ -284,6 +284,7 @@ public class RowerDeviceView : MonoBehaviour
{
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
}
searchState.text = hasDevice ? App.GetLocalString("CHOOSE DEVICE") : App.GetLocalString("NO DEVICE");
noDevice.text = "";// App.GetLocalString("NOCONN DEVICE"); //hasDevice ? App.GetLocalString("CHOOSE DEVICE") : ;
if (hasDevice)
{