Merge branch 'dev_lishuo' into dev_mobile

This commit is contained in:
lishuo 2021-08-19 18:11:12 +08:00
commit f6740d31bb
34 changed files with 1171 additions and 109 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 762994a6a0b398c49b038120301bf5de
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: 2048
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: 2048
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

@ -124,6 +124,84 @@ MonoBehaviour:
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &486928665351942900
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6098493334929419579}
- component: {fileID: 8367125415035570718}
- component: {fileID: 3434730319805254204}
m_Layer: 5
m_Name: MapId
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6098493334929419579
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 486928665351942900}
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: 6558498177448486125}
m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 606.7, y: -179}
m_SizeDelta: {x: 83.693054, y: 28}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8367125415035570718
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 486928665351942900}
m_CullTransparentMesh: 0
--- !u!114 &3434730319805254204
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 486928665351942900}
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: 20
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 6
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 0
--- !u!1 &568794585315016799
GameObject:
m_ObjectHideFlags: 0
@ -515,7 +593,7 @@ RectTransform:
m_Children:
- {fileID: 7308942387469008178}
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 27
m_RootOrder: 29
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -851,7 +929,7 @@ RectTransform:
- {fileID: 5698108039784919937}
- {fileID: 7832561499842500791}
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 33
m_RootOrder: 35
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -1223,7 +1301,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 32
m_RootOrder: 34
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -1301,7 +1379,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 17
m_RootOrder: 19
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -1673,7 +1751,7 @@ RectTransform:
- {fileID: 7508488585840996723}
- {fileID: 804126381881165943}
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 35
m_RootOrder: 37
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -1808,7 +1886,7 @@ RectTransform:
- {fileID: 9050330319599987492}
- {fileID: 4958187996342670554}
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 37
m_RootOrder: 39
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -2336,7 +2414,7 @@ RectTransform:
- {fileID: 6558498177838812408}
- {fileID: 6558498178609268828}
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 38
m_RootOrder: 40
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -2468,7 +2546,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 26
m_RootOrder: 28
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -2930,6 +3008,8 @@ RectTransform:
- {fileID: 6558498178970650012}
- {fileID: 6558498179157108068}
- {fileID: 6558498179321791264}
- {fileID: 169318638442674245}
- {fileID: 6098493334929419579}
- {fileID: 7411107261559440790}
- {fileID: 6558498177678574344}
- {fileID: 6558498178512125495}
@ -3150,7 +3230,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 18
m_RootOrder: 20
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -3228,7 +3308,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 25
m_RootOrder: 27
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -3513,7 +3593,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 30
m_RootOrder: 32
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -3593,7 +3673,7 @@ RectTransform:
- {fileID: 5276663987612575157}
- {fileID: 6558498178766627004}
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 28
m_RootOrder: 30
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -3672,7 +3752,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 29
m_RootOrder: 31
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -3988,7 +4068,7 @@ RectTransform:
- {fileID: 6558498178642912254}
- {fileID: 6558498177739491041}
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 34
m_RootOrder: 36
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -4203,7 +4283,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 22
m_RootOrder: 24
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -4562,7 +4642,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 19
m_RootOrder: 21
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -4714,7 +4794,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 39
m_RootOrder: 41
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -4999,7 +5079,7 @@ RectTransform:
- {fileID: 6558498178369272025}
- {fileID: 6558498178957397887}
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 36
m_RootOrder: 38
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -5821,7 +5901,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 23
m_RootOrder: 25
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -5977,7 +6057,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 21
m_RootOrder: 23
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -6025,6 +6105,80 @@ MonoBehaviour:
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 0000 - 00-00 00:00:00
--- !u!1 &6967565870765060030
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 169318638442674245}
- component: {fileID: 8954508495726212577}
- component: {fileID: 7439621176865291513}
m_Layer: 5
m_Name: MapIcon
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &169318638442674245
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6967565870765060030}
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: 6558498177448486125}
m_RootOrder: 17
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 544.8535, y: -181}
m_SizeDelta: {x: 16, y: 16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8954508495726212577
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6967565870765060030}
m_CullTransparentMesh: 0
--- !u!114 &7439621176865291513
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6967565870765060030}
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: 762994a6a0b398c49b038120301bf5de, 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 &6980510087908380503
GameObject:
m_ObjectHideFlags: 0
@ -6131,7 +6285,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 31
m_RootOrder: 33
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -6583,7 +6737,7 @@ RectTransform:
- {fileID: 4513700211969794283}
- {fileID: 4980171126590156168}
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 24
m_RootOrder: 26
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -6811,7 +6965,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6558498177448486125}
m_RootOrder: 20
m_RootOrder: 22
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}

View File

@ -34,7 +34,7 @@ RectTransform:
- {fileID: 145307034357954014}
- {fileID: 3327674566083090465}
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 27
m_RootOrder: 29
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -169,7 +169,7 @@ RectTransform:
- {fileID: 145307034124314502}
- {fileID: 3327674565846436473}
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 28
m_RootOrder: 30
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -984,6 +984,84 @@ MonoBehaviour:
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &2769541347924689023
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 756218096192378214}
- component: {fileID: 5327673503896133289}
- component: {fileID: 7601601580800100336}
m_Layer: 5
m_Name: MapId
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &756218096192378214
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2769541347924689023}
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: 3007624749581944593}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 153.85, y: -344.3}
m_SizeDelta: {x: 83.693054, y: 28}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5327673503896133289
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2769541347924689023}
m_CullTransparentMesh: 0
--- !u!114 &7601601580800100336
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2769541347924689023}
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: 20
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 6
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 0
--- !u!1 &3007624748289717559
GameObject:
m_ObjectHideFlags: 0
@ -1014,11 +1092,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 12
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 92, y: -429}
m_AnchoredPosition: {x: 92, y: -457.69998}
m_SizeDelta: {x: 16, y: 16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3007624748289717560
@ -1088,7 +1166,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 6
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -1159,11 +1237,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 13
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 153.8465, y: -427}
m_AnchoredPosition: {x: 153.8465, y: -455.69998}
m_SizeDelta: {x: 83.693054, y: 28}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3007624748526063404
@ -1237,11 +1315,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 15
m_RootOrder: 17
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 153.84656, y: -389}
m_AnchoredPosition: {x: 153.84656, y: -417.69998}
m_SizeDelta: {x: 83.693054, y: 28}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3007624748546083608
@ -1413,11 +1491,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 10
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 92, y: -353}
m_AnchoredPosition: {x: 92, y: -381.69998}
m_SizeDelta: {x: 16, y: 16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3007624748693613234
@ -1487,7 +1565,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 29
m_RootOrder: 31
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1640,7 +1718,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 5
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -1947,7 +2025,7 @@ RectTransform:
m_Children:
- {fileID: 3007624749716399586}
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 9
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -2034,11 +2112,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 14
m_RootOrder: 16
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 92, y: -391}
m_AnchoredPosition: {x: 92, y: -419.69998}
m_SizeDelta: {x: 16, y: 16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3007624749186584481
@ -2108,7 +2186,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 25
m_RootOrder: 27
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
@ -2184,7 +2262,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 8
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -2255,11 +2333,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 17
m_RootOrder: 19
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 153.8465, y: -465}
m_AnchoredPosition: {x: 153.8465, y: -493.69998}
m_SizeDelta: {x: 83.693054, y: 28}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3007624749335273309
@ -2411,7 +2489,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 21
m_RootOrder: 23
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -2494,6 +2572,8 @@ RectTransform:
- {fileID: 3007624748601755783}
- {fileID: 2322716380738134732}
- {fileID: 3007624748799085429}
- {fileID: 5324006962730904505}
- {fileID: 756218096192378214}
- {fileID: 3007624748807431534}
- {fileID: 3007624748412546457}
- {fileID: 3007624750289242273}
@ -2610,7 +2690,7 @@ RectTransform:
- {fileID: 3007624749338625854}
- {fileID: 3007624749010474861}
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 26
m_RootOrder: 28
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -2742,7 +2822,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 18
m_RootOrder: 20
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -2904,7 +2984,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 23
m_RootOrder: 25
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -2983,7 +3063,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 19
m_RootOrder: 21
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -3067,7 +3147,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 20
m_RootOrder: 22
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -3243,7 +3323,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 24
m_RootOrder: 26
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
@ -3321,11 +3401,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 16
m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 92, y: -466}
m_AnchoredPosition: {x: 92, y: -494.69998}
m_SizeDelta: {x: 16, y: 16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3007624750146435812
@ -3396,7 +3476,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 22
m_RootOrder: 24
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -3486,11 +3566,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 11
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 153.84656, y: -351}
m_AnchoredPosition: {x: 153.84656, y: -379.69998}
m_SizeDelta: {x: 83.693054, y: 28}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3007624750243088003
@ -3564,7 +3644,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3007624749581944593}
m_RootOrder: 7
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -3887,3 +3967,77 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 0
--- !u!1 &8110328268474125505
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5324006962730904505}
- component: {fileID: 7943435336564939480}
- component: {fileID: 6981647137641869650}
m_Layer: 5
m_Name: MapIcon
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5324006962730904505
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8110328268474125505}
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: 3007624749581944593}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 92, y: -346.3}
m_SizeDelta: {x: 16, y: 16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7943435336564939480
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8110328268474125505}
m_CullTransparentMesh: 0
--- !u!114 &6981647137641869650
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8110328268474125505}
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: 0.40392157, g: 0.40392157, b: 0.4745098, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 762994a6a0b398c49b038120301bf5de, 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

View File

@ -336,7 +336,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Search Road
m_Text: Search Route
--- !u!1 &1394950112273882093
GameObject:
m_ObjectHideFlags: 0

View File

@ -1502,7 +1502,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: bf6cef625b150984384b02d2e94b91ff, type: 3}
m_Sprite: {fileID: 21300000, guid: 998c9c31435c99f498b189bcc65c5650, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1

View File

@ -59,7 +59,12 @@ namespace Assets.Scripts.Apis
/// <returns></returns>
public Task<JsonResult<List<MapRoute>>> GetList(int pageIndex, int pageSize, string name, string distance="", string hands="", bool is3D=false, string sort="", string sortDire = "", bool isFav = false)
{
var url = $"Map/GetRoute?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&distance={ distance }&hands={ hands }&is3D={ is3D }&sort={ sort }&sortDire={ sortDire }&isFav={isFav}";
string lngLat = "";
if (sort.Equals("Near"))
{
lngLat = $"{App.longitude},{App.latitude}";
}
var url = $"Map/GetRoute?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&distance={ distance }&hands={ hands }&is3D={ is3D }&sort={ sort }&sortDire={ sortDire }&isFav={isFav}&lngLat={lngLat}";
return GetAsync<JsonResult<List<MapRoute>>>(url);
}

View File

@ -17,7 +17,7 @@ namespace Assets.Scripts.Devices.Ble
public abstract class BleDevice : AbstractDevice
{
protected BleWinHwInterface hwInterface;
protected IBleWinHwInterface hwInterface;
protected BlePeripheralInfo peripheralInfo;
private readonly HashSet<BleService> services = new HashSet<BleService>();
@ -32,7 +32,7 @@ namespace Assets.Scripts.Devices.Ble
}
public List<ICharacteristic> Characteristics { get; protected set; } = new List<ICharacteristic>();
public BleDevice(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface, SensorType sensor) : base(peripheralInfo.Address, NetworkType.BLE)
public BleDevice(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface, SensorType sensor) : base(peripheralInfo.Address, NetworkType.BLE)
{
this.hwInterface = bleWinHwInterface;
this.hwInterface.BluetoothStateChangedEvent += BluetoothStateChangedEvent;
@ -50,7 +50,7 @@ namespace Assets.Scripts.Devices.Ble
Characteristics.Add(new ModelNumberCharacteristic());
}
private void HwInterface_PeripheralDisconnectedEvent(BleWinHwInterface hwInterface, BlePeripheralInfo peripheral, BleResponse response, bool manualDisconnect)
private void HwInterface_PeripheralDisconnectedEvent(IBleWinHwInterface hwInterface, BlePeripheralInfo peripheral, BleResponse response, bool manualDisconnect)
{
if (!peripheral.MatchAddress(this.peripheralInfo.Address))
{
@ -93,7 +93,7 @@ namespace Assets.Scripts.Devices.Ble
}
}
private void PeripheralConnectedAction(BleWinHwInterface hwInterface, BlePeripheralInfo sender, BleResponse response)
private void PeripheralConnectedAction(IBleWinHwInterface hwInterface, BlePeripheralInfo sender, BleResponse response)
{
Debug.Log($"连接{ this.Name }"+response.IsSuccess);
if (response.IsSuccess)
@ -136,7 +136,7 @@ namespace Assets.Scripts.Devices.Ble
private void ServicesDiscoveredAction(BleWinHwInterface hwInterface, BlePeripheralInfo sender, BleResponse<List<BleServiceInfo>> response)
private void ServicesDiscoveredAction(IBleWinHwInterface hwInterface, BlePeripheralInfo sender, BleResponse<List<BleServiceInfo>> response)
{
//Debug.Log("搜索service");
if(!response.IsSuccess || !response.Data.Any())
@ -211,7 +211,7 @@ namespace Assets.Scripts.Devices.Ble
{
}
private void BluetoothStateChangedEvent(BleWinHwInterface hwInterface, BleState state)
private void BluetoothStateChangedEvent(IBleWinHwInterface hwInterface, BleState state)
{
switch (state)
{

View File

@ -1,6 +1,7 @@
using Assets.Scripts.Ble;
using Assets.Scripts.Ble.Service;
using Assets.Scripts.Devices.Ble.Devices;
using Assets.Scripts.Devices.Ble.Interfaces;
using Assets.Scripts.UI.Prefab.Device;
using System;
using System.Collections.Generic;
@ -17,15 +18,16 @@ namespace Assets.Scripts.Devices.Ble
private IDictionary<string, BleDevice> discoveredDevices = new Dictionary<string, BleDevice>();
private BleWinHwInterface hwInterface;
public BleDeviceAdapter()
private IBleWinHwInterface hwInterface { get; set; }
public BleDeviceAdapter(IBleWinHwInterface bleWinHwInterface)
{
hwInterface = BleWinHwInterface.GetInterface();
hwInterface = bleWinHwInterface;// BleWinHwInterface.GetInterface();
hwInterface.BluetoothStateChangedEvent += HwInterface_BluetoothStateChangedEvent;
}
private void HwInterface_BluetoothStateChangedEvent(BleWinHwInterface hwInterface, BleState bleState)
private void HwInterface_BluetoothStateChangedEvent(IBleWinHwInterface hwInterface, BleState bleState)
{
//Debug.Log("22222222222222" + bleState);
if(bleState == BleState.Off)

View File

@ -1,4 +1,5 @@
using System;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -6,6 +7,6 @@ using System.Threading.Tasks;
namespace Assets.Scripts.Ble
{
public delegate void BluetoothStateChangedCallback(BleWinHwInterface hwInterface, BleState bleState);
public delegate void BluetoothStateChangedCallback(IBleWinHwInterface hwInterface, BleState bleState);
}

View File

@ -1,4 +1,5 @@
using Assets.Scripts.Devices.Ble;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@ -7,5 +8,5 @@ using System.Threading.Tasks;
namespace Assets.Scripts.Ble
{
public delegate void CharacteristicReadCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response);
public delegate void CharacteristicReadCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response);
}

View File

@ -1,4 +1,5 @@
using Assets.Scripts.Devices.Ble;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@ -7,5 +8,5 @@ using System.Threading.Tasks;
namespace Assets.Scripts.Ble
{
public delegate void CharacteristicsDiscoveredCallback(BleWinHwInterface hwInterface, BleServiceInfo service, BleResponse<List<BleCharacteristicInfo>> response);
public delegate void CharacteristicsDiscoveredCallback(IBleWinHwInterface hwInterface, BleServiceInfo service, BleResponse<List<BleCharacteristicInfo>> response);
}

View File

@ -1,6 +1,7 @@
using Assets.Scripts.Ble;
using Assets.Scripts.Devices.Ant.Interfaces;
using Assets.Scripts.Devices.Ble.Characteristic;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@ -14,7 +15,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
{
private List<BleServiceInfo> Services;
private CyclingPowerMeasurement cyclingPowerMeasurement;
public CyclingPower(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Power)
public CyclingPower(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Power)
{
Priority = 2;
cyclingPowerMeasurement = new CyclingPowerMeasurement(1920);
@ -49,7 +50,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
}
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
//Debug.Log("power main call" + string.Join(",", response.Data));

View File

@ -1,6 +1,7 @@
using Assets.Scripts.Ble;
using Assets.Scripts.Devices.Ant.Interfaces;
using Assets.Scripts.Devices.Ble.Characteristic;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@ -21,7 +22,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
private List<BleServiceInfo> Services;
private BleCharacteristicInfo controlPointCharacteristic;
public Ftms(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) :base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Trainer)
public Ftms(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) :base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Trainer)
{
this._ftmsIndoorBikeData = new FtmsIndoorBikeData();
base.Characteristics.Add(this._ftmsIndoorBikeData);
@ -60,7 +61,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
}
}
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
foreach (var item in base.Characteristics)
{

View File

@ -1,6 +1,7 @@
using Assets.Scripts.Ble;
using Assets.Scripts.Devices.Ant.Interfaces;
using Assets.Scripts.Devices.Ble.Characteristic;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@ -16,7 +17,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
private List<BleServiceInfo> Services;
private HeartRateMeasurement heartRateMeasurement;
public HeartRate(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.HeartRate)
public HeartRate(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.HeartRate)
{
Priority = 2;
heartRateMeasurement = new HeartRateMeasurement();
@ -73,7 +74,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
});
}
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
//Debug.Log("heart rate main call" + string.Join(",", response.Data));

View File

@ -1,6 +1,7 @@
using Assets.Scripts.Ble;
using Assets.Scripts.Devices.Ant.Interfaces;
using Assets.Scripts.Devices.Ble.Characteristic;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@ -18,7 +19,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
private double _wheelCircumference;
private List<BleServiceInfo> Services;
public SpeedCadence(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.SpeedCadence)
public SpeedCadence(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.SpeedCadence)
{
Debug.Log("创建速度踏频设备");
Priority = 1;
@ -81,7 +82,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
}
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
//Debug.Log("power main call" + string.Join(",", response.Data));

View File

@ -2,6 +2,7 @@
using Assets.Scripts.Devices.Ant;
using Assets.Scripts.Devices.Ant.Interfaces;
using Assets.Scripts.Devices.Ble.Characteristic;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@ -30,7 +31,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
/// </summary>
private double _grade = 0;
public Tacx(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Trainer)
public Tacx(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Trainer)
{
tacxFecNotify = new TacxFecNotify();
base.Characteristics.Add(tacxFecNotify);
@ -75,7 +76,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
}
}
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
foreach (var item in base.Characteristics)
{

View File

@ -2,6 +2,7 @@
using Assets.Scripts.Ble.Service;
using Assets.Scripts.Commands;
using Assets.Scripts.Devices.Ble;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@ -36,12 +37,12 @@ namespace Assets.Scripts.Ble.HeartRate
}
}
private void HrmCharacteristicSubscribed(BleWinHwInterface winHwInterface, BleCharacteristicInfo characteristic, BleResponse response)
private void HrmCharacteristicSubscribed(IBleWinHwInterface winHwInterface, BleCharacteristicInfo characteristic, BleResponse response)
{
}
private void HrmCharacteristicRead(BleWinHwInterface winHwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
private void HrmCharacteristicRead(IBleWinHwInterface winHwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
HeartRateMeasurementValue heartRateMeasurementValue;
if(base.CheckCharacteristicResponse<HeartRateMeasurementValue>(characteristic, response, (BleCharacteristicInfo info, BleResponse<byte[]> bleResponse) => new HeartRateMeasurementValue(bleResponse.Data), out heartRateMeasurementValue) != CommandResponseCode.Success)

View File

@ -0,0 +1,28 @@
using Assets.Scripts.Ble;
using Assets.Scripts.Ble.Scan;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Devices.Ble.Interfaces
{
public interface IBleWinHwInterface
{
void StartScan(Action<BleAdvertisementInfo> discoveredCallBack);
void ConnectPeripheral(BlePeripheralInfo info, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse> callback);
void DisconnectPeripheral(BlePeripheralInfo peripheral, Action callback);
void DiscoverServices(BlePeripheralInfo peripheral, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse<List<BleServiceInfo>>> callback);
void DiscoverCharacteristic(BleServiceInfo service, CharacteristicsDiscoveredCallback callback);
void SubscribeCharacteristic(BleCharacteristicInfo characteristic, Action<IBleWinHwInterface, BleCharacteristicInfo, BleResponse> callback);
void WriteCharacteristic(BleCharacteristicInfo characteristic, byte[] data);
void ReadCharacteristic(BleCharacteristicInfo characteristic, CharacteristicReadCallback callback);
void Dispose();
BleState BleState { get; set; }
Dictionary<string, BleAdvertisementInfo> pCache { get; set; }
event BluetoothStateChangedCallback BluetoothStateChangedEvent;
event CharacteristicReadCallback CharacteristicReadEvent;
event PeripheralDisconnectedCallback PeripheralDisconnectedEvent;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 86216427171ac784296ca577b921b2e7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +1,5 @@
using Assets.Scripts.Ble;
using Assets.Scripts.Devices.Ble.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@ -7,5 +8,5 @@ using System.Threading.Tasks;
namespace Assets.Scripts.Devices.Ble
{
public delegate void PeripheralDisconnectedCallback(BleWinHwInterface hwInterface, BlePeripheralInfo peripheral, BleResponse response, bool manualDisconnect);
public delegate void PeripheralDisconnectedCallback(IBleWinHwInterface hwInterface, BlePeripheralInfo peripheral, BleResponse response, bool manualDisconnect);
}

View File

@ -8,6 +8,7 @@ using Assets.Scripts.Ble.Commands;
using Assets.Scripts.Commands;
using Assets.Scripts.Devices.Ble;
using Assets.Scripts.Devices.Ble.Extension;
using Assets.Scripts.Devices.Ble.Interfaces;
using UnityEngine;
namespace Assets.Scripts.Ble.Service
@ -18,7 +19,7 @@ namespace Assets.Scripts.Ble.Service
private BleServiceInfo serviceInfo;
private List<BleCharacteristicInfo> characteristics;
private readonly Dictionary<Guid, Action<BleWinHwInterface, BleCharacteristicInfo, BleResponse<byte[]>>> registeredCharacteristicReadEvents = new Dictionary<Guid, Action<BleWinHwInterface, BleCharacteristicInfo, BleResponse<byte[]>>>();
private readonly Dictionary<Guid, Action<IBleWinHwInterface, BleCharacteristicInfo, BleResponse<byte[]>>> registeredCharacteristicReadEvents = new Dictionary<Guid, Action<IBleWinHwInterface, BleCharacteristicInfo, BleResponse<byte[]>>>();
public IReadOnlyList<BleCharacteristicInfo> Characteristics
{
@ -58,7 +59,7 @@ namespace Assets.Scripts.Ble.Service
this.hwInterface.CharacteristicReadEvent += CharacteristicReadMainCallback;
}
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
//Debug.Log("read main callback");
if (this.registeredCharacteristicReadEvents.ContainsKey(characteristic.Id) && characteristic.Service.Equals(this.serviceInfo))
@ -79,7 +80,7 @@ namespace Assets.Scripts.Ble.Service
this.CheckCharacteristicDiscoveredResponse(this.hwInterface, this.serviceInfo, scanCharacteristicsResponse);
}
private void CheckCharacteristicDiscoveredResponse(BleWinHwInterface hwInterface, BleServiceInfo service, BleResponse<List<BleCharacteristicInfo>> response)
private void CheckCharacteristicDiscoveredResponse(IBleWinHwInterface hwInterface, BleServiceInfo service, BleResponse<List<BleCharacteristicInfo>> response)
{
if (!service.Equals(this.serviceInfo))
{
@ -98,8 +99,8 @@ namespace Assets.Scripts.Ble.Service
protected abstract void CharacteristicsDiscovered(BleResponse<List<BleCharacteristicInfo>> response);
protected void SubscribeCharacteristic(BleCharacteristicInfo characteristic, Action<BleWinHwInterface, BleCharacteristicInfo, BleResponse> notificationCallback,
Action<BleWinHwInterface, BleCharacteristicInfo, BleResponse<byte[]>> readCallback)
protected void SubscribeCharacteristic(BleCharacteristicInfo characteristic, Action<IBleWinHwInterface, BleCharacteristicInfo, BleResponse> notificationCallback,
Action<IBleWinHwInterface, BleCharacteristicInfo, BleResponse<byte[]>> readCallback)
{
this.hwInterface.SubscribeCharacteristic(characteristic, (hw, info, response) =>
{

View File

@ -2,6 +2,7 @@
using Assets.Scripts.Ble.Win;
using Assets.Scripts.Devices.Ant;
using Assets.Scripts.Devices.Ble;
using Assets.Scripts.Devices.Ble.Interfaces;
using Assets.Scripts.Devices.Ble.Win;
using System;
using System.Collections.Generic;
@ -12,13 +13,24 @@ using UnityEngine;
namespace Assets.Scripts.Ble
{
public sealed class BleWinHwInterface
public sealed class BleWinHwInterface: IBleWinHwInterface
{
private static BleWinHwInterface hwInterface;
private WclBleMainThread wclBleMainThread;
public readonly Dictionary<string, BleAdvertisementInfo> pCache = new Dictionary<string, BleAdvertisementInfo>();
private Dictionary<string, BleAdvertisementInfo> _pCache;
public Dictionary<string, BleAdvertisementInfo> pCache
{
get
{
if (_pCache == null)
{
_pCache = new Dictionary<string, BleAdvertisementInfo>();
}
return _pCache;
}
set { _pCache = value; }
}
private Action<BleAdvertisementInfo> _discoveredCallback;
private Dictionary<BlePeripheralInfo, Action<BleWinHwInterface, BlePeripheralInfo, BleResponse>> callbacks = new Dictionary<BlePeripheralInfo, Action<BleWinHwInterface, BlePeripheralInfo, BleResponse>>();
@ -43,6 +55,7 @@ namespace Assets.Scripts.Ble
}
}
private BluetoothStateChangedCallback bluetoothStateChanged;
public event BluetoothStateChangedCallback BluetoothStateChangedEvent
{
@ -55,7 +68,7 @@ namespace Assets.Scripts.Ble
this.bluetoothStateChanged -= value;
}
}
private BleState nativeState;
public BleState BleState
{
@ -63,7 +76,7 @@ namespace Assets.Scripts.Ble
{
return this.nativeState;
}
private set
set
{
if(this.nativeState != value)
{
@ -201,7 +214,7 @@ namespace Assets.Scripts.Ble
return wclBleGattThread;
}
internal void ConnectPeripheral(BlePeripheralInfo info, Action<BleWinHwInterface, BlePeripheralInfo, BleResponse> callback)
public void ConnectPeripheral(BlePeripheralInfo info, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse> callback)
{
this.callbacks.Add(info, callback);
WclBleGattThread wclBleGattThread = this.wclBleMainThread.GetGattThread(info);
@ -229,8 +242,8 @@ namespace Assets.Scripts.Ble
//});
}
internal void DisconnectPeripheral(BlePeripheralInfo peripheral, Action callback)
public void DisconnectPeripheral(BlePeripheralInfo peripheral, Action callback)
{
var gattThread = this.wclBleMainThread.GetGattThread(peripheral);
if(gattThread != null && gattThread.CanLoadWork)
@ -372,7 +385,7 @@ namespace Assets.Scripts.Ble
}
}
public void DiscoverServices(BlePeripheralInfo peripheral, Action<BleWinHwInterface, BlePeripheralInfo, BleResponse<List<BleServiceInfo>>> callback)
public void DiscoverServices(BlePeripheralInfo peripheral, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse<List<BleServiceInfo>>> callback)
{
WclBleGattThread gattThread = this.wclBleMainThread.GetGattThread(peripheral);
if(gattThread == null)
@ -420,7 +433,7 @@ namespace Assets.Scripts.Ble
this.GattCharacteristicsDiscovered(gattThread, service, response);
}
public void SubscribeCharacteristic(BleCharacteristicInfo characteristic, Action<BleWinHwInterface, BleCharacteristicInfo, BleResponse> callback)
public void SubscribeCharacteristic(BleCharacteristicInfo characteristic, Action<IBleWinHwInterface, BleCharacteristicInfo, BleResponse> callback)
{
WclBleGattThread gattThread = this.wclBleMainThread.GetGattThread(characteristic.Peripheral);

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9fa2f8906f5360c47b807eaef8d42263
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,525 @@
using Assets.Scripts.Ble.Scan;
using Assets.Scripts.Ble.Win;
using Assets.Scripts.Devices.Ant;
using Assets.Scripts.Devices.Ble;
using Assets.Scripts.Devices.Ble.Interfaces;
using Assets.Scripts.Devices.Ble.Win;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Assets.Scripts.Ble
{
public sealed class BleMobileInterface: IBleWinHwInterface
{
private static BleMobileInterface hwInterface;
private WclBleMainThread wclBleMainThread;
private Dictionary<string, BleAdvertisementInfo> _pCache;
public Dictionary<string, BleAdvertisementInfo> pCache
{
get
{
if (_pCache == null)
{
_pCache = new Dictionary<string, BleAdvertisementInfo>();
}
return _pCache;
}
set { _pCache = value; }
}
private Action<BleAdvertisementInfo> _discoveredCallback;
private Dictionary<BlePeripheralInfo, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse>> callbacks = new Dictionary<BlePeripheralInfo, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse>>();
private Dictionary<BlePeripheralInfo, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse<List<BleServiceInfo>>>> servicesCallbacks = new Dictionary<BlePeripheralInfo, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse<List<BleServiceInfo>>>>();
//private Dictionary<BlePeripheralInfo, Action<BleWinHwInterface, BleServiceInfo, BleResponse<List<BleCharacteristicInfo>>>> characteristicsCallbacks = new Dictionary<BlePeripheralInfo, Action<BleWinHwInterface, BleServiceInfo, BleResponse<List<BleCharacteristicInfo>>>>();
private Dictionary<BlePeripheralInfo, Action<IBleWinHwInterface, BleCharacteristicInfo, BleResponse>> characteristicNotificationCallbacks = new Dictionary<BlePeripheralInfo, Action<IBleWinHwInterface, BleCharacteristicInfo, BleResponse>>();
private Dictionary<BleCharacteristicInfo, CharacteristicReadCallback> characteristicReadCallbacks = new Dictionary<BleCharacteristicInfo, CharacteristicReadCallback>();
private Dictionary<BleServiceInfo, CharacteristicsDiscoveredCallback> characteristicsDiscoveredCallbacks = new Dictionary<BleServiceInfo, CharacteristicsDiscoveredCallback>();
private Dictionary<BlePeripheralInfo, Action> disconnectedCallback = new Dictionary<BlePeripheralInfo, Action>();
private CharacteristicReadCallback characteristicReadEvent;
public event CharacteristicReadCallback CharacteristicReadEvent
{
add
{
this.characteristicReadEvent += value;
}
remove
{
this.characteristicReadEvent -= value;
}
}
private BluetoothStateChangedCallback bluetoothStateChanged;
public event BluetoothStateChangedCallback BluetoothStateChangedEvent
{
add
{
this.bluetoothStateChanged += value;
}
remove
{
this.bluetoothStateChanged -= value;
}
}
private BleState nativeState;
public BleState BleState
{
get
{
return this.nativeState;
}
set
{
if(this.nativeState != value)
{
this.nativeState = value;
this.bluetoothStateChanged?.Invoke(this, this.nativeState);
}
}
}
private PeripheralDisconnectedCallback peripheralDisconnectedEvent;
public event PeripheralDisconnectedCallback PeripheralDisconnectedEvent
{
add
{
this.peripheralDisconnectedEvent += value;
}
remove
{
this.peripheralDisconnectedEvent -= value;
}
}
private BleMobileInterface()
{
wclBleMainThread = new WclBleMainThread();
wclBleMainThread.ManagerStatusChanged += ManagerStatusChanged;
wclBleMainThread.ScanInfoReceived += WatcherScanInfoReceived;
//wclBleMainThread.gatt
wclBleMainThread.Start();
}
private void WatcherScanInfoReceived(WclBleMainThread sender, long address, string name, int rssi, CPPBridge.WclBleAdvertisementType packetType, Guid? service)
{
//if(address != 224160707349234)
//{
//return;
//}
//Debug.Log($"address:{ address }, name:{ name }, service:{ (service == null ? "" : service.Value.ToString()) }");
SensorType sensor = SensorType.None;
List<Guid> services = new List<Guid>();
if (service != null)
{
services = new List<Guid> { service.Value };
foreach(var item in ServiceUuids.Services)
{
if(item.IdGuid != service.Value)
{
continue;
}
if(item.IdByteArray == ServiceUuids.Ftms)
{
sensor = SensorType.Trainer;
}
else if(item.IdByteArray == ServiceUuids.HeartRate)
{
sensor = SensorType.HeartRate;
}
else if(item.IdByteArray == ServiceUuids.CyclingPower)
{
sensor = SensorType.Power;
//sensor = SensorType.Trainer;
}
else if(item.IdByteArray == ServiceUuids.CyclingSpeedCadence)
{
sensor = SensorType.SpeedCadence;
}
else if(item.IdByteArray == ServiceUuids.TacxBle)
{
sensor = SensorType.Trainer;
}
}
};
var addressStr = address.ToString("X12");
if (!pCache.ContainsKey(addressStr))
{
var device = new BleAdvertisementInfo(new WinBlePeripheralInfo(addressStr, name), rssi, true, services, null, sensor);
pCache.Add(addressStr, device);
//WclBleGattThread gattClient = this.SetUpGattClient(device.Peripheral);
//this.ConnectInternal(gattClient);
}
if (!string.IsNullOrWhiteSpace(name))
{
(pCache[addressStr].Peripheral as WinBlePeripheralInfo).SetName(name);
}
if(sensor == SensorType.None)
{
return;
}
pCache[addressStr].SensorType = sensor;
pCache[addressStr].Rssi = rssi;
//Debug.Log(sensor);
//pCache[address.ToString()].SensorType = sensor;
foreach (var item in services)
{
pCache[addressStr].TryAddService(item);
}
pCache[addressStr].Index++;
if(pCache[addressStr].SensorType == SensorType.Power && pCache[addressStr].Services.Any(s=> s.Equals(ServiceUuids.Get(ServiceUuids.TacxBle).IdGuid)))
{
pCache[addressStr].SensorType = SensorType.Trainer;
//Debug.Log("纠正为trainer, "+ pCache[address.ToString()].Index);
}
if (pCache[addressStr].SensorType == SensorType.Power)
{
if (pCache[addressStr].Index > 4)
{
_discoveredCallback?.Invoke(pCache[addressStr]);
}
}
else if(pCache[addressStr].SensorType != SensorType.None)
{
_discoveredCallback?.Invoke(pCache[addressStr]);
}
}
private WclBleGattThread SetUpGattClient(BlePeripheralInfo peripheral)
{
WclBleGattThread wclBleGattThread = this.wclBleMainThread.CreateGattThread(peripheral);
wclBleGattThread.GattConnected += this.GattConnected;
wclBleGattThread.GattDisconnected += this.GattDisconnected;
wclBleGattThread.GattServicesDiscovered += this.GattServicesDiscovered;
wclBleGattThread.GattCharacteristicsDiscovered += this.GattCharacteristicsDiscovered;
wclBleGattThread.GattCharacteristicSubscribed += this.GattCharacteristicSubscribed;
wclBleGattThread.GattCharacteristicRead += this.GattCharacteristicRead;
wclBleGattThread.GattCharacteristicWrote += this.GattCharacteristicWrote;
wclBleGattThread.GattCharacteristicChanged += this.GattCharacteristicChanged;
wclBleGattThread.Start();
return wclBleGattThread;
}
public void ConnectPeripheral(BlePeripheralInfo info, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse> callback)
{
this.callbacks.Add(info, callback);
WclBleGattThread wclBleGattThread = this.wclBleMainThread.GetGattThread(info);
if(wclBleGattThread == null)
{
wclBleGattThread = this.SetUpGattClient(info);
this.ConnectInternal(wclBleGattThread);
return;
}
else
{
this.ConnectInternal(wclBleGattThread);
}
}
private void ConnectInternal(WclBleGattThread gattClient)
{
//Task.Run(() =>
//{
int num = gattClient.Connect();
Debug.Log("连接设备返回" + num);
//});
}
public void DisconnectPeripheral(BlePeripheralInfo peripheral, Action callback)
{
var gattThread = this.wclBleMainThread.GetGattThread(peripheral);
if(gattThread != null && gattThread.CanLoadWork)
{
this.callbacks.Remove(peripheral);
this.servicesCallbacks.Remove(peripheral);
this.characteristicNotificationCallbacks.Remove(peripheral);
this.disconnectedCallback.Add(peripheral, callback);
gattThread.Discounect();
}
}
public static BleMobileInterface GetInterface()
{
if(hwInterface == null)
{
hwInterface = new BleMobileInterface();
}
return hwInterface;
}
public void StartScan(Action<BleAdvertisementInfo> discoveredCallBack)
{
pCache.Clear();
_discoveredCallback = discoveredCallBack;
this.wclBleMainThread.StartWatcher();
}
private void ManagerStatusChanged(WclBleMainThread sender, WclBleManagerStatus status)
{
this.BleState = BleMobileInterface.StateFromNativeState(status);
//Debug.Log("win hw:" + status);
}
private void GattConnected(WclBleGattThread gattClient, BleResponse response)
{
Debug.Log($"gatt connected { response.ToString() }");
if (!response.IsSuccess)
{
gattClient.Stop();
this.callbacks[gattClient.Peripheral].Invoke(this, gattClient.Peripheral, response);
this.callbacks.Remove(gattClient.Peripheral);
return;
}
this.callbacks[gattClient.Peripheral].Invoke(this, gattClient.Peripheral, response);
this.callbacks.Remove(gattClient.Peripheral);
}
private void CleanUpPeripheral(BlePeripheralInfo peripheralInfo)
{
//this.callbacks.Clear()
}
private void GattDisconnected(WclBleGattThread gattClient, BleResponse response)
{
Debug.Log($"gatt disconnected { gattClient.Peripheral.Name }");
this.callbacks.Remove(gattClient.Peripheral);
this.servicesCallbacks.Remove(gattClient.Peripheral);
this.characteristicNotificationCallbacks.Remove(gattClient.Peripheral);
//App.MainDeviceAdapter.PrintStatus();
var manualDisconnect = disconnectedCallback.ContainsKey(gattClient.Peripheral);
this.peripheralDisconnectedEvent(this, gattClient.Peripheral, response, manualDisconnect);
//App.MainDeviceAdapter.PrintStatus();
if (disconnectedCallback.ContainsKey(gattClient.Peripheral))
{
disconnectedCallback[gattClient.Peripheral].Invoke();
disconnectedCallback.Remove(gattClient.Peripheral);
}
//this.pCache.Remove(gattClient.Peripheral.Address);
}
private void GattServicesDiscovered(WclBleGattThread gattClient, BleResponse<List<BleServiceInfo>> response)
{
//Debug.Log("services discovered");
//this.callbacks[gattClient.Peripheral].Invoke(this, gattClient.Peripheral, response);
//foreach (var item in response.Data)
//{
// Debug.Log(item.ToString());
//}
if (this.servicesCallbacks.ContainsKey(gattClient.Peripheral))
{
this.servicesCallbacks[gattClient.Peripheral].Invoke(this, gattClient.Peripheral, response);
}
}
private void GattCharacteristicsDiscovered(WclBleGattThread gattClient, BleServiceInfo service, BleResponse<List<BleCharacteristicInfo>> response)
{
//Debug.Log("characteristics discovered");
if (this.characteristicsDiscoveredCallbacks.ContainsKey(service))
{
this.characteristicsDiscoveredCallbacks[service].Invoke(this, service, response);
}
}
private void GattCharacteristicSubscribed(WclBleGattThread gattClient, BleCharacteristicInfo characteristic, BleResponse response)
{
//Debug.Log("characteristics subscribed");
if (this.characteristicNotificationCallbacks.ContainsKey(gattClient.Peripheral))
{
this.characteristicNotificationCallbacks[gattClient.Peripheral].Invoke(this, characteristic, response);
}
}
private void GattCharacteristicRead(WclBleGattThread gattClient, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
Debug.Log("characteristic read");
if (this.characteristicReadCallbacks.ContainsKey(characteristic))
{
this.characteristicReadCallbacks[characteristic].Invoke(this, characteristic, response);
this.characteristicReadCallbacks.Remove(characteristic);
}
this.characteristicReadEvent.Invoke(this, characteristic, response);
}
private void GattCharacteristicWrote(WclBleGattThread gattClient, BleCharacteristicInfo characteristic, BleResponse<BleCharacteristicWriteType> response)
{
Debug.Log("characteristic wrote");
}
private void GattCharacteristicChanged(WclBleGattThread gattClient, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
//Debug.Log("characteristic changed");
if(this.wclBleMainThread.GetGattThread(characteristic.Peripheral) != null)
{
this.characteristicReadEvent.Invoke(this, characteristic, response);
}
}
public void DiscoverServices(BlePeripheralInfo peripheral, Action<IBleWinHwInterface, BlePeripheralInfo, BleResponse<List<BleServiceInfo>>> callback)
{
WclBleGattThread gattThread = this.wclBleMainThread.GetGattThread(peripheral);
if(gattThread == null)
{
return;
}
this.servicesCallbacks.Add(peripheral, callback);
int num = gattThread.DiscoverServices();
if (WclBleErrors.IsSuccessCode(num))
{
return;
}
BleResponse<List<BleServiceInfo>> response = new BleResponse<List<BleServiceInfo>>
{
IsSuccess = false,
Error = new BleHwInterfaceError(new int?(num), "WclBleGattClientErrorDomain", string.Format("Error discovering services - {0}", num))
};
this.GattServicesDiscovered(gattThread, response);
}
public void DiscoverCharacteristic(BleServiceInfo service, CharacteristicsDiscoveredCallback callback)
{
WclBleGattThread gattThread = this.wclBleMainThread.GetGattThread(service.Peripheral);
if(gattThread == null)
{
return;
}
if (!this.characteristicsDiscoveredCallbacks.ContainsKey(service))
{
this.characteristicsDiscoveredCallbacks.Add(service, callback);
}
int num = gattThread.DiscoverCharacteristics(service);
if (WclBleErrors.IsSuccessCode(num))
{
return;
}
BleResponse<List<BleCharacteristicInfo>> response = new BleResponse<List<BleCharacteristicInfo>>
{
IsSuccess = false,
Error = new BleHwInterfaceError(new int?(num), "WclBleGattClientErrorDomain", string.Format("Error discovering characteristics - {0}", num))
};
this.GattCharacteristicsDiscovered(gattThread, service, response);
}
public void SubscribeCharacteristic(BleCharacteristicInfo characteristic, Action<IBleWinHwInterface, BleCharacteristicInfo, BleResponse> callback)
{
WclBleGattThread gattThread = this.wclBleMainThread.GetGattThread(characteristic.Peripheral);
this.characteristicNotificationCallbacks.Add(gattThread.Peripheral, callback);
int num = gattThread.SubscribeCharacteristic(characteristic);
if (WclBleErrors.IsSuccessCode(num))
{
return;
}
BleResponse<List<BleServiceInfo>> response = new BleResponse<List<BleServiceInfo>>
{
IsSuccess = false,
Error = new BleHwInterfaceError(new int?(num), "WclBleGattClientErrorDomain", string.Format("Error subscribing characteristic - {0}", num))
};
this.GattCharacteristicSubscribed(gattThread, characteristic, response);
}
public void WriteCharacteristic(BleCharacteristicInfo characteristic, byte[] data)
{
var gattThread = this.wclBleMainThread.GetGattThread(characteristic.Peripheral);
if(gattThread == null)
{
return;
}
int num = gattThread.WriteCharacteristic(characteristic, data);
if (WclBleErrors.IsSuccessCode(num))
{
Debug.Log("设置命令成功");
return;
}
}
public void Dispose()
{
this.wclBleMainThread.ManagerStatusChanged -= ManagerStatusChanged;
this.wclBleMainThread.ScanInfoReceived -= WatcherScanInfoReceived;
this.wclBleMainThread.Stop();
this.wclBleMainThread = null;
hwInterface = null;
pCache.Clear();
}
public void ReadCharacteristic(BleCharacteristicInfo characteristic, CharacteristicReadCallback callback)
{
WclBleGattThread gattThread = this.wclBleMainThread.GetGattThread(characteristic.Peripheral);
if(gattThread == null)
{
return;
}
this.characteristicReadCallbacks.Add(characteristic, callback);
int num = gattThread.ReadCharacteristicValue(characteristic);
if (WclBleErrors.IsSuccessCode(num))
{
return;
}
}
private static BleState StateFromNativeState(WclBleManagerStatus status)
{
switch (status)
{
case WclBleManagerStatus.RadioOff:
return BleState.Off;
case WclBleManagerStatus.RadioOn:
return BleState.On;
case WclBleManagerStatus.Unknown:
return BleState.Unknown;
default:
return BleState.Unavailable;
}
}
private class WinBlePeripheralInfo : BlePeripheralInfo
{
// Token: 0x06003F35 RID: 16181 RVA: 0x000E9FBF File Offset: 0x000E81BF
public WinBlePeripheralInfo(string address, string name) : base(address, name)
{
}
// Token: 0x06003F36 RID: 16182 RVA: 0x000E9FC9 File Offset: 0x000E81C9
public void SetName(string name)
{
base.Name = name;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e5257ea169e69a498a3e4d935a51306
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +1,5 @@
using Assets.Scripts.Devices.Ant;
using Assets.Scripts.Ble;
using Assets.Scripts.Devices.Ant;
using Assets.Scripts.Devices.Ble;
using System;
using System.Collections.Generic;
@ -27,7 +28,11 @@ namespace Assets.Scripts.Devices
private void CreateBleAdapter()
{
adapters.Add(new BleDeviceAdapter());
#if UNITY_IOS || UNITY_TVOS || UNITY_ANDROID
adapters.Add(new BleDeviceAdapter(BleWinHwInterface.GetInterface()));
#else
adapters.Add(new BleDeviceAdapter(BleWinHwInterface.GetInterface()));
#endif
}
public void StartScan()

View File

@ -115,6 +115,7 @@ namespace Assets.Scenes.Ride.Scripts
GameObject MoreHead { get; set; }
Text CompetitionTitle { get; set; }
Text EndTime { get; set; }
Text MapId { get; set; }
//构建赛事界面
protected override void InitGameObject()
{
@ -135,6 +136,7 @@ namespace Assets.Scenes.Ride.Scripts
ReadMore = panel.transform.Find("ReadMore").gameObject;
GetReady = panel.transform.Find("GetReady").GetComponent<Text>();
GetReadyTitle = panel.transform.Find("GetReadyTitle").GetComponent<Text>();
MapId = panel.transform.Find("MapId").GetComponent<Text>();
Watcher = Resources.Load<GameObject>("UI/Prefab/Match/Watcher");
MoreHead = Resources.Load<GameObject>("UI/Prefab/Match/MoreHead");
Watch.GetComponent<Button>().enabled = false;
@ -183,6 +185,8 @@ namespace Assets.Scenes.Ride.Scripts
ShowPlayers(competition.UserList);
//路书描述
mapDescText.text = competition.Dec;
//线路编号
MapId.text = route.Id.ToString();
ReadMore.SetActive(!string.IsNullOrEmpty(competition.CompetitionPreviewUrl));
//主办方logo

View File

@ -20,6 +20,7 @@ namespace Assets.Scenes.Ride.Scripts
protected RawImage mapCountry;
protected RawImage altitudeGraph;
protected Transform mapRanking;
protected Text mapId;
#endregion
public override void InjectController(CyclingController controller)
@ -54,6 +55,7 @@ namespace Assets.Scenes.Ride.Scripts
head = panel.transform.Find("UploadByHead").GetComponent<RawImage>();
altitudeGraph = panel.transform.Find("AltitudeGraph").GetComponent<RawImage>();
mapRanking = panel.transform.Find("MapRanking");
mapId = panel.transform.Find("MapId").GetComponent<Text>();
}
protected override void InitGameObjectData()
{
@ -67,6 +69,7 @@ namespace Assets.Scenes.Ride.Scripts
rideNum.text = route.TheHeat.ToString();
distance.text = route.Distance.ToString("f1") + "KM";
mapDescText.text = route.Dec;
mapId.text = route.Id.ToString();
var userList = ConfigHelper.mapApi.GetOnlineUserInfo(new int[] { route.UserId }).data;
if (userList.Count > 0)
{

View File

@ -29,8 +29,21 @@ namespace Assets.Scenes.Ride.Scripts
protected override void CreateList()
{
OnlineUserNum.text = MapUDPService.GetNearRiderCount().ToString();
LayoutRebuilder.ForceRebuildLayoutImmediate(OnlineUserNum.rectTransform);
var nearList = MapUDPService.GetNearRiderData(pageIndex, pageSize, new double[] { playerController.Currentlatlong.x, playerController.Currentlatlong.y });
totalPages = MapUDPService.GetNearRiderCount();
//删除
var currentNearList = FindObjectsOfType<NearByItemScript>();
foreach (var item in currentNearList)
{
var e = nearList.Where(c => c.Id == item.UserId).FirstOrDefault();
if (e == null)
{
item.transform.gameObject.SetActive(false);
bufferSize--;
}
}
for (int i = 0; i < nearList.Count(); i++)
{
Create(nearList[i]);

View File

@ -40,7 +40,7 @@ namespace Assets.Scripts.UI.Prefab.MapList
{"HC","750-99999" },
};
public static List<Dropdown.OptionData> sorts = new string[] {
"Trend","Name","Distance","Difficulty"//,"Times"
"Near", "Trend","Name","Distance","Difficulty","Time"
}.Select(x => new Dropdown.OptionData(x)).ToList();
public static Dictionary<string, string> diffDisplayDict = new Dictionary<string, string>()
{

View File

@ -43,6 +43,8 @@ public class MapListController : PFUIPanel
private bool isEnd = false;
protected override void Start()
{
sort = "Near";
sortDire = "asc";
//if (hardSelector != null)
//{
// hardSelector.onValueChanged.AddListener(ChangeHard);
@ -179,8 +181,17 @@ public class MapListController : PFUIPanel
sort = "Hot";
}
var image = sortDir.Find("Image").GetComponent<Image>();
image.sprite = Resources.Load<Sprite>("Images/DOWN");
sortDire = "desc";
if (sort == "Near")
{
image.sprite = Resources.Load<Sprite>("Images/UP");
sortDire = "asc";
}
else
{
image.sprite = Resources.Load<Sprite>("Images/DOWN");
sortDire = "desc";
}
Refresh();
});
}
@ -265,7 +276,7 @@ public class MapListController : PFUIPanel
string distance = "";
List<string> hands = new List<string>();
bool is3d = false,isFav = false;
string sort = "Hot",sortDire = "desc";
string sort = "",sortDire = "";
//string name = "";
//string name = "";
async void GetList()

View File

@ -111,7 +111,7 @@ namespace Assets.Scripts
{"Power","Power Meter|Images/Devices/Power_3" },
{"Cadence","Cadence Sensor|Images/Devices/Cadence_3" },
{"HeartRate","Heart Rate Monitor|Images/Devices/Heart Rate_3" },
{"SpeedCadence","Speed Meter|Images/Devices/Speed_3" },
{"SpeedCadence","Cadence Sensor|Images/Devices/Cadence_3" },
{"Speed","Speed Meter|Images/Devices/Speed_3" }
};
}

View File

@ -133,7 +133,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 2.0.0
bundleVersion: 2.0.1
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0