浏览代码

Merge from current staging.

/main/staging/bugs_various
nathaniel.buck@unity3d.com 3 年前
当前提交
92365e69
共有 16 个文件被更改,包括 1048 次插入534 次删除
  1. 8
      Assets/Prefabs/UI/CreateContent.prefab
  2. 958
      Assets/Prefabs/UI/GameCanvas.prefab
  3. 85
      Assets/Prefabs/UI/JoinContent.prefab
  4. 178
      Assets/Prefabs/UI/JoinCreateCanvas.prefab
  5. 4
      Assets/Prefabs/UI/LobbyButtonUI.prefab
  6. 30
      Assets/Prefabs/UI/LobbyCodeCanvas.prefab
  7. 124
      Assets/Prefabs/UI/LobbyGameCanvas.prefab
  8. 8
      Assets/Prefabs/UI/MainMenuCanvas.prefab
  9. 26
      Assets/Prefabs/UI/RelayCodeCanvas.prefab
  10. 2
      Assets/Scripts/Relay/RelayUtpClient.cs
  11. 43
      Assets/Scripts/Relay/RelayUtpSetup.cs
  12. 3
      Assets/Scripts/Tests/PlayMode/Tests.Play.asmdef
  13. 2
      Packages/manifest.json
  14. 2
      Packages/packages-lock.json
  15. 98
      Assets/Scripts/Tests/PlayMode/UtpTests.cs
  16. 11
      Assets/Scripts/Tests/PlayMode/UtpTests.cs.meta

8
Assets/Prefabs/UI/CreateContent.prefab


m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 35
m_fontSize: 22
m_fontSizeBase: 35
m_fontWeight: 400
m_enableAutoSizing: 0

m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0

m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 35
m_fontSize: 22
m_fontSizeBase: 35
m_fontWeight: 400
m_enableAutoSizing: 0

m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0

958
Assets/Prefabs/UI/GameCanvas.prefab
文件差异内容过多而无法显示
查看文件

85
Assets/Prefabs/UI/JoinContent.prefab


m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 22
m_fontSize: 16
m_fontSizeBase: 22
m_fontWeight: 400
m_enableAutoSizing: 0

m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_LobbyButtonPrefab: {fileID: 7018369548608736188, guid: f6d35a456ba76a24587dce83bd088b7d, type: 3}
m_LobbyButtonPrefab: {fileID: 7018369548608736188, guid: f6d35a456ba76a24587dce83bd088b7d,
type: 3}
m_LobbyButtonParent: {fileID: 7824921818678239159}
--- !u!114 &7550446569341709048
MonoBehaviour:

m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 22
m_fontSize: 16
m_fontSizeBase: 45
m_fontWeight: 400
m_enableAutoSizing: 0

m_Modification:
m_TransformParent: {fileID: 7955209533444849375}
m_Modifications:
- target: {fileID: 3328931846061827219, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 3328931846061827219, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 6317050540274997421, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 6317050540274997421, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 7144088886657378797, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 7144088886657378797, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 7859013680193933450, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 7859013680193933450, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}

RectTransform:
m_CorrespondingSourceObject: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
m_CorrespondingSourceObject: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
m_PrefabInstance: {fileID: 769605433028665681}
m_PrefabAsset: {fileID: 0}

178
Assets/Prefabs/UI/JoinCreateCanvas.prefab


m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 24.6
m_fontSize: 21.65
m_fontSizeBase: 24
m_fontWeight: 400
m_enableAutoSizing: 1

m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 24.6
m_fontSize: 21.65
m_fontSizeBase: 24
m_fontWeight: 400
m_enableAutoSizing: 1

propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5835329765895758438, guid: 328b912adedf1bc41a44f60a12723cc0, type: 3}
propertyPath: m_fontSizeBase
value: 22
objectReference: {fileID: 0}
- target: {fileID: 5860664165358648575, guid: 328b912adedf1bc41a44f60a12723cc0, type: 3}
propertyPath: m_fontSizeBase
value: 22
objectReference: {fileID: 0}
- target: {fileID: 5912780227213918576, guid: 328b912adedf1bc41a44f60a12723cc0, type: 3}
propertyPath: m_fontSize
value: 18

m_Modification:
m_TransformParent: {fileID: 1119140321553661053}
m_Modifications:
- target: {fileID: 282299378989204246, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_fontSizeMax
value: 15.91
objectReference: {fileID: 0}
- target: {fileID: 282299378989204246, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_fontSizeMin
value: 12
objectReference: {fileID: 0}
- target: {fileID: 282299378989204246, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_fontSizeBase
value: 16
objectReference: {fileID: 0}
- target: {fileID: 282299378989204246, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_enableAutoSizing
value: 0
objectReference: {fileID: 0}
objectReference: {fileID: 0}
- target: {fileID: 785260762106121644, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 785260762106121647, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_Pivot.x

objectReference: {fileID: 0}
- target: {fileID: 1604043255686064399, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_AnchorMax.x
value: 1
value: 0
value: -17
value: 0
value: 1
value: 0
value: -17
value: 0
value: 1
value: 0
value: 1
value: 0
value: 118.348625
value: 0
value: 40
value: 0
value: 645.8257
value: 0
value: -45
value: 0
value: 1
value: 0
value: 1
value: 0
value: 710
value: 0
value: 50
value: 0
value: 360
value: 0
value: -362.64648
value: 0
value: 1
value: 0
value: 1
value: 0
value: 710
value: 0
value: 327.64648
value: 0
value: 360
value: 0
value: -168.82324
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4279971184503703239, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4279971184503703239, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4279971184503703239, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4279971184503703239, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4279971184503703239, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4279971184503703239, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435268494180039831, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_fontSize
value: 14.95
value: 1
value: 0
value: 1
value: 0
value: 40
value: 0
value: 40
value: 0
value: 25
value: 0
value: -45
value: 0
value: 1
value: 0
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7315760059761538639, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
value: 0
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7573825319354851387, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_AnchorMin.x
value: 0
value: 10
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7824921818678239159, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_AnchoredPosition.x
value: -0.00003528595
objectReference: {fileID: 0}
- target: {fileID: 7824921818678239159, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.000030517578
value: 1
value: 0
value: 1
value: 0
value: -17
value: 0
value: -17
value: 0
value: 1
value: 0
value: 1
value: 0
value: 295.87155
value: 0
value: 40
value: 0
value: 197.93578
value: 0
value: -25
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8770739503633793913, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_fontSizeBase
value: 16
objectReference: {fileID: 0}
- target: {fileID: 9032799187230319547, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_Value

propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 230.77982
value: 0
value: 35
value: 0
value: 581.65137
value: 0
value: -25
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}

4
Assets/Prefabs/UI/LobbyButtonUI.prefab


m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_Color: {r: 0.9150943, g: 0.9150943, b: 0.9150943, a: 0.5686275}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1

m_Sprite: {fileID: 21300000, guid: df079b79a31b7ee458df2e5bbe02299a, type: 3}
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1

30
Assets/Prefabs/UI/LobbyCodeCanvas.prefab


m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1118541987231860824}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
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_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 25}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -42.9}
m_SizeDelta: {x: 220, y: 35}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1118541987231860831
CanvasRenderer:

m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 50, y: 0}
m_SizeDelta: {x: -100, y: 0}
m_AnchoredPosition: {x: 55, y: 0}
m_SizeDelta: {x: -110, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6105217159092868855
CanvasRenderer:

m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 20.55
m_fontSizeBase: 45
m_fontSize: 18
m_fontSizeBase: 18
m_enableAutoSizing: 1
m_enableAutoSizing: 0
m_fontSizeMin: 14
m_fontSizeMax: 22
m_fontStyle: 2

m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -50, y: 0}
m_SizeDelta: {x: -100, y: 0}
m_AnchoredPosition: {x: -55, y: 0}
m_SizeDelta: {x: -110, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7561133510483157462
CanvasRenderer:

m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 17.65
m_fontSizeBase: 36
m_fontSize: 18
m_fontSizeBase: 18
m_enableAutoSizing: 1
m_enableAutoSizing: 0
m_fontSizeMin: 10
m_fontSizeMax: 72
m_fontStyle: 0

124
Assets/Prefabs/UI/LobbyGameCanvas.prefab


m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSize: 35.8
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1

value: 0
objectReference: {fileID: 0}
- target: {fileID: 4102997489641105917, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_SizeDelta.x
value: -550
objectReference: {fileID: 0}
- target: {fileID: 4102997489641105917, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}

value: -0
objectReference: {fileID: 0}
- target: {fileID: 4102997489641105917, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4102997489641105917, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_AnchoredPosition.y
value: -5
objectReference: {fileID: 0}
- target: {fileID: 4102997489641105917, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}

value: RelayCodeCanvas
objectReference: {fileID: 0}
- target: {fileID: 7546827419935918100, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_fontColor.b
value: 0.8396226
objectReference: {fileID: 0}
- target: {fileID: 7546827419935918100, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_fontColor.g
value: 0.8396226
objectReference: {fileID: 0}
- target: {fileID: 7546827419935918100, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_fontColor.r
value: 0.8396226
objectReference: {fileID: 0}
- target: {fileID: 7546827419935918100, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_lineSpacing
value: 1
objectReference: {fileID: 0}

- target: {fileID: 7546827419935918100, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_enableAutoSizing
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7546827419935918100, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_fontColor32.rgba
value: 4292269782
objectReference: {fileID: 0}
- target: {fileID: 7546827419935918100, guid: 27536a164837c9141bbe1adf7ba37dde, type: 3}
propertyPath: m_enableWordWrapping

objectReference: {fileID: 0}
- target: {fileID: 1919168897190896396, guid: 2ff073ec9c74c8942bd90a541dc41bfc, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 50
value: 0
value: 50
value: 0
value: 167.125
value: 0
value: -27.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2056817220376623591, guid: 2ff073ec9c74c8942bd90a541dc41bfc, type: 3}
propertyPath: m_AnchorMax.y

objectReference: {fileID: 3223430358889797224}
- target: {fileID: 3210254045315593125, guid: 2ff073ec9c74c8942bd90a541dc41bfc, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 50
value: 0
value: 50
value: 0
value: 67.125
value: 0
value: -27.5
value: 0
value: 1
value: 0
value: 1
value: 0
value: 50
value: 0
value: 50
value: 0
value: 117.125
value: 0
value: -27.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4467363028704636643, guid: 2ff073ec9c74c8942bd90a541dc41bfc, type: 3}
propertyPath: m_fontSize

objectReference: {fileID: 0}
- target: {fileID: 6664205945102926799, guid: 2ff073ec9c74c8942bd90a541dc41bfc, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 50
value: 0
value: 50
value: 0
value: 217.125
value: 0
value: -27.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6687484736792569641, guid: 2ff073ec9c74c8942bd90a541dc41bfc, type: 3}
propertyPath: m_Enabled

value: 1
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_AnchorMin.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_SizeDelta.x
value: 200
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
value: 35
value: 40
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_LocalPosition.x

- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_AnchoredPosition.x
value: -1
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_AnchoredPosition.y
value: -42.9
objectReference: {fileID: 0}
- target: {fileID: 1118541987231860827, guid: 81e22025e6659264a8d0bc8dfebe95a7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x

8
Assets/Prefabs/UI/MainMenuCanvas.prefab


m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: df079b79a31b7ee458df2e5bbe02299a, type: 3}
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1

m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 15
m_PixelsPerUnitMultiplier: 2
--- !u!114 &1547097154637997990
MonoBehaviour:
m_ObjectHideFlags: 0

m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: df079b79a31b7ee458df2e5bbe02299a, type: 3}
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1

m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 15
m_PixelsPerUnitMultiplier: 2
--- !u!114 &2183907465135059793
MonoBehaviour:
m_ObjectHideFlags: 0

26
Assets/Prefabs/UI/RelayCodeCanvas.prefab


m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 20.55
m_fontSizeBase: 45
m_fontSize: 18
m_fontSizeBase: 18
m_enableAutoSizing: 1
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 2

m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 50, y: 0}
m_SizeDelta: {x: -100, y: 0}
m_AnchoredPosition: {x: 55, y: 0}
m_SizeDelta: {x: -110, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7191981219430119249
CanvasRenderer:

m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -50, y: 0}
m_SizeDelta: {x: -100, y: 0}
m_AnchoredPosition: {x: -55, y: 0}
m_SizeDelta: {x: -110, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4549533531444092506
CanvasRenderer:

serializedVersion: 2
rgba: 4294967295
m_fontSize: 18
m_fontSizeBase: 36
m_fontSizeBase: 18
m_enableAutoSizing: 1
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0

m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -247.72728, y: 234.57413}
m_SizeDelta: {x: 200, y: -10}
m_AnchoredPosition: {x: 0, y: -5}
m_SizeDelta: {x: -530, y: -10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4102997489641105913
CanvasRenderer:

m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 22
m_fontSizeBase: 22
m_fontSize: 18
m_fontSizeBase: 18
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18

2
Assets/Scripts/Relay/RelayUtpClient.cs


MsgType msgType = (MsgType)msgContents[0];
int idLength = msgContents[1];
if (msgContents.Count < idLength + 2)
{ UnityEngine.Debug.LogWarning($"Relay client processed message of length {idLength}, but contents were of length {msgContents.Count}.");
}
string id = System.Text.Encoding.UTF8.GetString(msgContents.GetRange(2, idLength).ToArray());
if (id == m_localUser.ID || !m_localLobby.LobbyUsers.ContainsKey(id)) // We don't need to hold onto messages if the ID is absent; users are initialized before they send events.

43
Assets/Scripts/Relay/RelayUtpSetup.cs


}
protected abstract void JoinRelay();
/// Shared behavior for binding UTP to the Relay Allocation, which is required for use.
/// Determine the server endpoint for connecting to the Relay server, for either an Allocation or a JoinAllocation.
/// If DTLS encryption is available, and there's a secure server endpoint available, use that as a secure connection. Otherwise, just connect to the Relay IP unsecured.
/// </summary>
protected NetworkEndPoint GetEndpointForAllocation(List<RelayServerEndpoint> endpoints, string ip, int port, out bool isSecure)
{
#if ENABLE_MANAGED_UNITYTLS
foreach (RelayServerEndpoint endpoint in endpoints)
{
if (endpoint.Secure && endpoint.Network == RelayServerEndpoint.NetworkOptions.Udp)
{
isSecure = true;
return NetworkEndPoint.Parse(endpoint.Host, (ushort)endpoint.Port);
}
}
#endif
isSecure = false;
return NetworkEndPoint.Parse(ip, (ushort)port);
}
/// <summary>
/// Shared behavior for binding to the Relay allocation, which is required for use.
protected void BindToAllocation(string ip, int port, byte[] allocationIdBytes, byte[] connectionDataBytes, byte[] hostConnectionDataBytes, byte[] hmacKeyBytes, int connectionCapacity)
protected void BindToAllocation(NetworkEndPoint serverEndpoint, byte[] allocationIdBytes, byte[] connectionDataBytes, byte[] hostConnectionDataBytes, byte[] hmacKeyBytes, int connectionCapacity, bool isSecure)
NetworkEndPoint serverEndpoint = NetworkEndPoint.Parse(ip, (ushort)port);
m_endpointForServer = serverEndpoint;
//TODO Implement DTLS
bool isSecure = false;
relayServerData.ComputeNewNonce();
relayServerData.ComputeNewNonce(); // For security, the nonce value sent when authenticating the allocation must be increased.
var relayNetworkParameter = new RelayNetworkParameter { ServerData = relayServerData };
m_networkDriver = NetworkDriver.Create(new INetworkParameter[] { relayNetworkParameter });

{
m_allocation = allocation;
RelayAPIInterface.GetJoinCodeAsync(allocation.AllocationId, OnRelayCode);
BindToAllocation(allocation.RelayServer.IpV4, allocation.RelayServer.Port, allocation.AllocationIdBytes, allocation.ConnectionData, allocation.ConnectionData, allocation.Key, 16);
bool isSecure = false;
m_endpointForServer = GetEndpointForAllocation(allocation.ServerEndpoints, allocation.RelayServer.IpV4, allocation.RelayServer.Port, out isSecure);
BindToAllocation(m_endpointForServer, allocation.AllocationIdBytes, allocation.ConnectionData, allocation.ConnectionData, allocation.Key, 16, isSecure);
m_localLobby.RelayServer = new ServerAddress(m_allocation.RelayServer.IpV4, m_allocation.RelayServer.Port);
m_localLobby.RelayServer = new ServerAddress(m_endpointForServer.Address.Split(':')[0], m_endpointForServer.Port);
m_joinState |= JoinState.Joined;
CheckForComplete();
}

if (joinAllocation == null || this == null) // The returned JoinAllocation is null if allocation failed. this would be destroyed already if you quit the lobby while Relay is connecting.
return;
m_allocation = joinAllocation;
BindToAllocation(joinAllocation.RelayServer.IpV4, joinAllocation.RelayServer.Port, joinAllocation.AllocationIdBytes, joinAllocation.ConnectionData, joinAllocation.HostConnectionData, joinAllocation.Key, 1);
m_localLobby.RelayServer = new ServerAddress(joinAllocation.RelayServer.IpV4, joinAllocation.RelayServer.Port);
bool isSecure = false;
m_endpointForServer = GetEndpointForAllocation(joinAllocation.ServerEndpoints, joinAllocation.RelayServer.IpV4, joinAllocation.RelayServer.Port, out isSecure);
BindToAllocation(m_endpointForServer, joinAllocation.AllocationIdBytes, joinAllocation.ConnectionData, joinAllocation.HostConnectionData, joinAllocation.Key, 1, isSecure);
m_localLobby.RelayServer = new ServerAddress(m_endpointForServer.Address.Split(':')[0], m_endpointForServer.Port);
}
protected override void OnBindingComplete()

3
Assets/Scripts/Tests/PlayMode/Tests.Play.asmdef


"UnityEditor.TestRunner",
"LobbyRelaySample",
"Unity.Services.Lobbies",
"Unity.Services.Relay"
"Unity.Services.Relay",
"Unity.Networking.Transport"
],
"includePlatforms": [],
"excludePlatforms": [],

2
Packages/manifest.json


"com.unity.test-framework": "1.1.27",
"com.unity.textmeshpro": "3.0.6",
"com.unity.toolchain.win-x86_64-linux-x86_64": "0.1.20-preview",
"com.unity.transport": "1.0.0-pre.3",
"com.unity.transport": "1.0.0-pre.5",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",

2
Packages/packages-lock.json


"url": "https://packages.unity.com"
},
"com.unity.transport": {
"version": "1.0.0-pre.3",
"version": "1.0.0-pre.5",
"depth": 0,
"source": "registry",
"dependencies": {

98
Assets/Scripts/Tests/PlayMode/UtpTests.cs


using System;
using System.Collections;
using LobbyRelaySample.relay;
using NUnit.Framework;
using Unity.Networking.Transport;
using Unity.Services.Relay.Models;
using UnityEngine;
using UnityEngine.TestTools;
namespace Test
{
public class UtpTests
{
private class RelayUtpTest : RelayUtpSetupHost
{
public Action<NetworkEndPoint, bool> OnGetEndpoint { private get; set; }
public void JoinRelayPublic()
{
JoinRelay();
}
protected override void JoinRelay()
{
RelayAPIInterface.AllocateAsync(1, OnAllocation);
void OnAllocation(Allocation allocation)
{
bool isSecure = false;
NetworkEndPoint endpoint = GetEndpointForAllocation(allocation.ServerEndpoints, allocation.RelayServer.IpV4, allocation.RelayServer.Port, out isSecure);
OnGetEndpoint?.Invoke(endpoint, isSecure);
// The allocation will be cleaned up automatically, since we won't be pinging it regularly.
}
}
}
private LobbyRelaySample.Auth.SubIdentity_Authentication m_auth;
private bool m_didSigninComplete = false;
GameObject m_dummy;
[OneTimeSetUp]
public void Setup()
{
m_dummy = new GameObject();
m_auth = new LobbyRelaySample.Auth.SubIdentity_Authentication(() => { m_didSigninComplete = true; });
}
[OneTimeTearDown]
public void Teardown()
{
m_auth?.Dispose();
GameObject.Destroy(m_dummy);
}
[UnityTest]
public IEnumerator DTLSCheck()
{
#if ENABLE_MANAGED_UNITYTLS
if (!m_didSigninComplete)
yield return new WaitForSeconds(3);
if (!m_didSigninComplete)
Assert.Fail("Did not sign in.");
yield return new WaitForSeconds(1); // To prevent a possible 429 after a previous test.
RelayUtpTest relaySetup = m_dummy.AddComponent<RelayUtpTest>();
relaySetup.OnGetEndpoint = OnGetEndpoint;
bool? isSecure = null;
NetworkEndPoint endpoint = default;
relaySetup.JoinRelayPublic();
float timeout = 5;
while (!isSecure.HasValue && timeout > 0)
{
timeout -= 0.25f;
yield return new WaitForSeconds(0.25f);
}
Component.Destroy(relaySetup);
Assert.IsTrue(timeout > 0, "Timeout check.");
Assert.IsTrue(isSecure, "Should have a secure server endpoint.");
Assert.IsTrue(endpoint.IsValid, "Endpoint should be valid.");
void OnGetEndpoint(NetworkEndPoint resultEndpoint, bool resultIsSecure)
{
endpoint = resultEndpoint;
isSecure = resultIsSecure;
}
#else
Assert.Ignore("DTLS encryption for Relay is not currently available for this version of Unity.");
yield break;
#endif
}
}
}

11
Assets/Scripts/Tests/PlayMode/UtpTests.cs.meta


fileFormatVersion: 2
guid: 0a6dfe6148a08af46a8eb5ffbbcf3f09
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存