浏览代码

Merged in latest bug fixes.

/main/staging/UI_Marketing_Assets
当前提交
f9b30e40
共有 21 个文件被更改,包括 1141 次插入688 次删除
  1. 147
      Assets/Prefabs/UI/BackButtonBG.prefab
  2. 45
      Assets/Prefabs/UI/CreateContent.prefab
  3. 60
      Assets/Prefabs/UI/GameCanvas.prefab
  4. 200
      Assets/Prefabs/UI/JoinContent.prefab
  5. 294
      Assets/Prefabs/UI/LobbyUserList.prefab
  6. 9
      Assets/Prefabs/UI/SpinnerUI.prefab
  7. 881
      Assets/Scenes/mainScene.unity
  8. 16
      Assets/Scripts/Auth/SubIdentity_Authentication.cs
  9. 6
      Assets/Scripts/Game/LocalLobby.cs
  10. 1
      Assets/Scripts/Infrastructure/Locator.cs
  11. 8
      Assets/Scripts/Infrastructure/LogHandlerSettings.cs
  12. 3
      Assets/Scripts/Infrastructure/Messenger.cs
  13. 1
      Assets/Scripts/Infrastructure/Observed.cs
  14. 20
      Assets/Scripts/Lobby/LobbyAsyncRequests.cs
  15. 3
      Assets/Scripts/Relay/RelayAPIInterface.cs
  16. 62
      Assets/Scripts/Relay/RelayUtpClient.cs
  17. 4
      Assets/Scripts/Relay/RelayUtpHost.cs
  18. 17
      Assets/Scripts/Relay/RelayUtpSetup.cs
  19. 1
      Assets/Scripts/UI/JoinMenuUI.cs
  20. 32
      Assets/Scripts/UI/SpinnerUI.cs
  21. 19
      Assets/Scripts/Vivox/VivoxUserHandler.cs

147
Assets/Prefabs/UI/BackButtonBG.prefab


serializedVersion: 6
m_Component:
- component: {fileID: 21306902101918852}
- component: {fileID: 892943604221978165}
- component: {fileID: 9211534540060107035}
- component: {fileID: 3548897939371032169}
- component: {fileID: 7262104930290195570}
- component: {fileID: 8907220659739637781}

m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2344342489728598789}
- {fileID: 8687266200334079465}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!223 &892943604221978165
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5416637149047939654}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 1
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 2
m_TargetDisplay: 0
--- !u!222 &8554403787917887813
CanvasRenderer:
m_ObjectHideFlags: 0

m_GameObject: {fileID: 5416637149047939654}
m_CullTransparentMesh: 1
--- !u!114 &9211534540060107035
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5416637149047939654}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!225 &3548897939371032169
CanvasGroup:
m_ObjectHideFlags: 0

m_PersistentCalls:
m_Calls: []
ShowThisWhen: 2
--- !u!1 &6668424015570691350
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2344342489728598789}
- component: {fileID: 5813347457509296480}
- component: {fileID: 731239719284957053}
- component: {fileID: 8114326487105409297}
- component: {fileID: 5670435380500466409}
m_Layer: 5
m_Name: LobbyDataLayer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2344342489728598789
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6668424015570691350}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 8687266200334079465}
m_Father: {fileID: 21306902101918852}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5813347457509296480
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6668424015570691350}
m_CullTransparentMesh: 1
--- !u!225 &731239719284957053
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6668424015570691350}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!114 &8114326487105409297
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6668424015570691350}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f38cf340acfcd4c64a6968b7386ad570, type: 3}
m_Name:
m_EditorClassIdentifier:
m_onVisibilityChange:
m_PersistentCalls:
m_Calls: []
m_ShowThisWhen: 5
--- !u!114 &5670435380500466409
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6668424015570691350}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 70dfc2fde0a9ef04eaff29a138f0bf45, type: 3}
m_Name:
m_EditorClassIdentifier:
OnObservedUpdated:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 8114326487105409297}
m_TargetAssemblyTypeName: LobbyRooms.UI.LobbyStateVisibilityUI, LobbyRooms
m_MethodName: ObservedUpdated
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &9098499516663060533
GameObject:
m_ObjectHideFlags: 0

m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2344342489728598789}
m_Father: {fileID: 21306902101918852}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}

45
Assets/Prefabs/UI/CreateContent.prefab


- component: {fileID: 5377961148241680866}
- component: {fileID: 1079176168591545865}
- component: {fileID: 5149602142760426050}
- component: {fileID: 7339923225503164155}
- component: {fileID: 6735354375166727125}
- component: {fileID: 7555225420414765091}
m_Layer: 5
m_Name: CreateButton
m_TagString: Untagged

m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!225 &7339923225503164155
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8424691209185600525}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!114 &6735354375166727125
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8424691209185600525}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab355d5994635724dbde297a055fb586, type: 3}
m_Name:
m_EditorClassIdentifier:
m_onVisibilityChange:
m_PersistentCalls:
m_Calls: []
--- !u!114 &7555225420414765091
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8424691209185600525}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 771ddda4ce2ee2a4dad57866ecc1170d, type: 3}
m_Name:
m_EditorClassIdentifier:
m_target: {fileID: 6735354375166727125}
m_alphaWhenHidden: 0.5
m_requestType: 3
--- !u!1 &8821530958799360497
GameObject:
m_ObjectHideFlags: 0

60
Assets/Prefabs/UI/GameCanvas.prefab


m_GameObject: {fileID: 8311671065491865313}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.80160326, y: 0.80160326, z: 0.80160326}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 343505739898811738}
m_RootOrder: 0

objectReference: {fileID: 0}
- target: {fileID: 654573747854143971, guid: 247f79ab5aefc6d40bcbdade4d9467b7, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 50
value: 0
value: 50
value: 0
value: 168.62498
value: 0
value: -27.5
objectReference: {fileID: 0}
- target: {fileID: 1097905206279711496, guid: 247f79ab5aefc6d40bcbdade4d9467b7, type: 3}
propertyPath: m_AnchorMax.y

objectReference: {fileID: 0}
- target: {fileID: 4551996994186358382, guid: 247f79ab5aefc6d40bcbdade4d9467b7, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 50
value: 0
value: 50
value: 0
value: 115.624985
value: 0
value: -27.5
value: 0
value: 1
value: 0
value: 1
value: 0
value: 50
value: 0
value: 50
value: 0
value: 62.624985
value: 0
value: -27.5
objectReference: {fileID: 0}
- target: {fileID: 4579962283283078673, guid: 247f79ab5aefc6d40bcbdade4d9467b7, type: 3}
propertyPath: m_AnchorMax.y

objectReference: {fileID: 0}
- target: {fileID: 5749901921003950368, guid: 247f79ab5aefc6d40bcbdade4d9467b7, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 50
value: 0
value: 50
value: 0
value: 221.62498
value: 0
value: -27.5
objectReference: {fileID: 0}
- target: {fileID: 5880450519661781334, guid: 247f79ab5aefc6d40bcbdade4d9467b7, type: 3}
propertyPath: m_AnchorMax.x

objectReference: {fileID: 0}
- target: {fileID: 3638764283281205412, guid: 404728f5cffe43940b290121bd31f601, type: 3}
propertyPath: m_Size
value: 0.9907783
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3675426980811071808, guid: 404728f5cffe43940b290121bd31f601, type: 3}
propertyPath: m_AnchorMax.x

objectReference: {fileID: 0}
- target: {fileID: 4583769822633113396, guid: 404728f5cffe43940b290121bd31f601, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4583769822633113396, guid: 404728f5cffe43940b290121bd31f601, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4967310541059166553, guid: 404728f5cffe43940b290121bd31f601, type: 3}

objectReference: {fileID: 0}
- target: {fileID: 8314627591180998490, guid: 404728f5cffe43940b290121bd31f601, type: 3}
propertyPath: m_fontSize
value: 23.45
value: 20.65
value: 23.45
value: 20.65
objectReference: {fileID: 0}
- target: {fileID: 8636295960037856115, guid: 404728f5cffe43940b290121bd31f601, type: 3}
propertyPath: m_AnchorMax.y

200
Assets/Prefabs/UI/JoinContent.prefab


m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4325310634866704869}
- {fileID: 7970272424148618348}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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_Name:
m_EditorClassIdentifier:
m_AllowSwitchOff: 0
--- !u!1 &2398639361971652739
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7970272424148618348}
- component: {fileID: 8120981699771385937}
- component: {fileID: 5477591940033768985}
- component: {fileID: 9093001432108375031}
- component: {fileID: 4619572163995016148}
m_Layer: 5
m_Name: RaycastBlocker
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7970272424148618348
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2398639361971652739}
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: 785260762106121647}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!225 &8120981699771385937
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2398639361971652739}
m_Enabled: 1
m_Alpha: 0
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!114 &5477591940033768985
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2398639361971652739}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab355d5994635724dbde297a055fb586, type: 3}
m_Name:
m_EditorClassIdentifier:
m_onVisibilityChange:
m_PersistentCalls:
m_Calls: []
--- !u!222 &9093001432108375031
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2398639361971652739}
m_CullTransparentMesh: 1
--- !u!114 &4619572163995016148
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2398639361971652739}
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: 0}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
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 &2530186012912267203
GameObject:
m_ObjectHideFlags: 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: 7144088886657378797, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 6317050540274997421, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
propertyPath: m_raycastBlocker
value:
objectReference: {fileID: 5477591940033768985}
- 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}
value: 0.5
value: 1
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
value: 0.5
value: 1
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
value: 0.5
value: 0
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
value: 0.5
value: 0
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
value: 100
value: 0
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b, type: 3}
- target: {fileID: 8141644855275361747, guid: c9b04951bd45e154b8096955d9bc8a0b,
type: 3}
value: 100
value: 0
- 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}

294
Assets/Prefabs/UI/LobbyUserList.prefab


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

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

m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
m_PixelsPerUnitMultiplier: 25
--- !u!225 &633533396086944350
CanvasGroup:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
- target: {fileID: 2599817509811505645, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 40
value: 0
value: 40
value: 0
value: 43
value: 0
value: -23
value: 0
value: 1
value: 0
value: 1
value: 0
value: 133.46281
value: 0
value: 39.25
value: 0
value: 576.85126
value: 0
value: -22.625
value: 0
value: 1
value: 0
value: 1
value: 0
value: 33.365704
value: 0
value: 39.25
value: 0
value: 670.26855
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3229036008637484624, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_Pivot.x

objectReference: {fileID: 0}
- target: {fileID: 5804120253616419419, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 400.38843
value: 0
value: 39.25
value: 0
value: 243.19421
value: 0
value: -22.625
value: 0
value: 1
value: 0
value: 1
value: 0
value: 66.73141
value: 0
value: 39.25
value: 0
value: 703.6343
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6125340877524701612, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.x

objectReference: {fileID: 0}
- target: {fileID: 7147564553318460541, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 60.05159
value: 0
value: 39.25
value: 0
value: 636.90283
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7829259871691718144, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.x

objectReference: {fileID: 0}
- target: {fileID: 2599817509811505645, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 40
value: 0
value: 40
value: 0
value: 43
value: 0
value: -23
value: 0
value: 1
value: 0
value: 1
value: 0
value: 133.46281
value: 0
value: 39.25
value: 0
value: 576.85126
value: 0
value: -22.625
value: 0
value: 1
value: 0
value: 1
value: 0
value: 33.365704
value: 0
value: 39.25
value: 0
value: 670.26855
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3229036008637484624, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_Pivot.x

objectReference: {fileID: 0}
- target: {fileID: 5804120253616419419, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 400.38843
value: 0
value: 39.25
value: 0
value: 243.19421
value: 0
value: -22.625
value: 0
value: 1
value: 0
value: 1
value: 0
value: 66.73141
value: 0
value: 39.25
value: 0
value: 703.6343
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6125340877524701612, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.x

objectReference: {fileID: 0}
- target: {fileID: 7147564553318460541, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 60.05159
value: 0
value: 39.25
value: 0
value: 636.90283
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7829259871691718144, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.x

objectReference: {fileID: 0}
- target: {fileID: 2599817509811505645, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 40
value: 0
value: 40
value: 0
value: 43
value: 0
value: -23
value: 0
value: 1
value: 0
value: 1
value: 0
value: 133.46281
value: 0
value: 39.25
value: 0
value: 576.85126
value: 0
value: -22.625
value: 0
value: 1
value: 0
value: 1
value: 0
value: 33.365704
value: 0
value: 39.25
value: 0
value: 670.26855
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3229036008637484624, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_Pivot.x

objectReference: {fileID: 0}
- target: {fileID: 5804120253616419419, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 400.38843
value: 0
value: 39.25
value: 0
value: 243.19421
value: 0
value: -22.625
value: 0
value: 1
value: 0
value: 1
value: 0
value: 66.73141
value: 0
value: 39.25
value: 0
value: 703.6343
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6125340877524701612, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.x

objectReference: {fileID: 0}
- target: {fileID: 7147564553318460541, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 60.05159
value: 0
value: 39.25
value: 0
value: 636.90283
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7829259871691718144, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.x

objectReference: {fileID: 0}
- target: {fileID: 2599817509811505645, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 40
value: 0
value: 40
value: 0
value: 43
value: 0
value: -23
value: 0
value: 1
value: 0
value: 1
value: 0
value: 133.46281
value: 0
value: 39.25
value: 0
value: 576.85126
value: 0
value: -22.625
value: 0
value: 1
value: 0
value: 1
value: 0
value: 33.365704
value: 0
value: 39.25
value: 0
value: 670.26855
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3229036008637484624, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_Pivot.x

objectReference: {fileID: 0}
- target: {fileID: 5804120253616419419, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 400.38843
value: 0
value: 39.25
value: 0
value: 243.19421
value: 0
value: -22.625
value: 0
value: 1
value: 0
value: 1
value: 0
value: 66.73141
value: 0
value: 39.25
value: 0
value: 703.6343
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6125340877524701612, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.x

objectReference: {fileID: 0}
- target: {fileID: 7147564553318460541, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
value: 1
value: 0
value: 60.05159
value: 0
value: 39.25
value: 0
value: 636.90283
value: 0
value: -22.625
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7829259871691718144, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.x

9
Assets/Prefabs/UI/SpinnerUI.prefab


m_onVisibilityChange:
m_PersistentCalls:
m_Calls: []
errorText: {fileID: 7859013680193933450}
spinnerImage: {fileID: 50617661778815274}
noServerText: {fileID: 1576294672583716881}
errorTextVisibility: {fileID: 8041986936720407558}
m_errorText: {fileID: 7859013680193933450}
m_spinnerImage: {fileID: 50617661778815274}
m_noServerText: {fileID: 1576294672583716881}
m_errorTextVisibility: {fileID: 8041986936720407558}
m_raycastBlocker: {fileID: 0}
--- !u!114 &2592976293271768794
MonoBehaviour:
m_ObjectHideFlags: 0

881
Assets/Scenes/mainScene.unity
文件差异内容过多而无法显示
查看文件

16
Assets/Scripts/Auth/SubIdentity_Authentication.cs


AuthenticationService.Instance.SignedIn += OnSignInChange;
AuthenticationService.Instance.SignedOut += OnSignInChange;
if (!AuthenticationService.Instance.IsSignedIn)
await AuthenticationService.Instance.SignInAnonymouslyAsync(); // Don't sign out later, since that changes the anonymous token, which would prevent the player from exiting lobbies they're already in.
onSigninComplete?.Invoke();
try
{ if (!AuthenticationService.Instance.IsSignedIn)
await AuthenticationService.Instance.SignInAnonymouslyAsync(); // Don't sign out later, since that changes the anonymous token, which would prevent the player from exiting lobbies they're already in.
onSigninComplete?.Invoke();
}
catch
{ UnityEngine.Debug.LogError("Failed to login. Did you remember to set your Project ID under Services > General Settings?");
throw;
}
// Note: If for some reason your login state gets weird, you can comment out the previous block and instead call AuthenticationService.Instance.SignOut().
// Then, running Play mode will fail to actually function and instead will log out of your previous anonymous account.
// When you revert that change and run Play mode again, you should be logged in as a new anonymous account with a new default name.
}
private void OnSignInChange()

6
Assets/Scripts/Game/LocalLobby.cs


get => m_data.Color;
set
{
m_data.Color = value;
OnChanged(this);
if (m_data.Color != value)
{ m_data.Color = value;
OnChanged(this);
}
}
}

1
Assets/Scripts/Infrastructure/Locator.cs


/// <summary>
/// Anything which provides itself to a Locator can then be globally accessed. This should be a single access point for things that *want* to be singleton (that is,
/// when they want to be available for use by arbitrary, unknown clients) but might not always be available or might need alternate flavors for tests, logging, etc.
/// (See http://gameprogrammingpatterns.com/service-locator.html to learn more.)
/// </summary>
public class Locator : LocatorBase
{

8
Assets/Scripts/Infrastructure/LogHandlerSettings.cs


Locator.Get.Messenger.Unsubscribe(this);
}
/// <summary>
/// For convenience while in the Editor, update the log verbosity when its value is changed in the Inspector.
/// </summary>
public void OnValidate()
{
LogHandler.Get().mode = m_editorLogVerbosity;
}
public void OnReceiveMessage(MessageType type, object msg)
{
if (type == MessageType.DisplayErrorPopup && msg != null)

3
Assets/Scripts/Infrastructure/Messenger.cs


CancelCountdown = 10,
ConfirmInGameState = 11,
DisplayErrorPopup = 12,
SetPlayerSound = 13,
SetPlayerSound = 13,
}
/// <summary>

1
Assets/Scripts/Infrastructure/Observed.cs


/// <summary>
/// Something that exposes some data that, when changed, an observer would want to be notified about automatically.
/// Used for UI elements and for keeping our local Lobby state synchronized with the remote Lobby service data.
/// (See http://gameprogrammingpatterns.com/observer.html to learn more.)
///
/// In your Observed child implementations, be sure to call OnChanged when setting the value of any property.
/// </summary>

20
Assets/Scripts/Lobby/LobbyAsyncRequests.cs


#region Lobby API calls are rate limited, and some other operations might want an alert when the rate limits have passed.
// Note that some APIs limit to 1 call per N seconds, while others limit to M calls per N seconds. We'll treat all APIs as though they limited to 1 call per N seconds.
// Also, this is seralized, so don't reorder the values unless you know what that will affect.
QuickJoin
QuickJoin,
Host
}
public RateLimitCooldown GetRateLimit(RequestType type)

else if (type == RequestType.QuickJoin)
return m_rateLimitQuickJoin;
else if (type == RequestType.Host)
return m_rateLimitHost;
return m_rateLimitQuery;
}

private RateLimitCooldown m_rateLimitHost = new RateLimitCooldown(3f);
// TODO: Shift to using this to do rate limiting for all API calls? E.g. the lobby data pushing is on its own loop.

/// </summary>
public void CreateLobbyAsync(string lobbyName, int maxPlayers, bool isPrivate, LobbyUser localUser, Action<Lobby> onSuccess, Action onFailure)
{
if (!m_rateLimitHost.CanCall())
{
onFailure?.Invoke();
UnityEngine.Debug.LogWarning("Create Lobby hit the rate limit.");
return;
}
string uasId = AuthenticationService.Instance.PlayerId;
LobbyAPIInterface.CreateLobbyAsync(uasId, lobbyName, maxPlayers, isPrivate, CreateInitialPlayerData(localUser), OnLobbyCreated);

(lobbyId == null && lobbyCode == null))
{
onFailure?.Invoke();
// TODO: Emit some failure message.
UnityEngine.Debug.LogWarning("Join Lobby hit the rate limit.");
return;
}

if (!m_rateLimitQuickJoin.CanCall())
{
onFailure?.Invoke();
UnityEngine.Debug.LogWarning("Quick Join Lobby hit the rate limit.");
return;
}

{
onListRetrieved?.Invoke(null);
m_rateLimitQuery.EnqueuePendingOperation(() => { RetrieveLobbyListAsync(onListRetrieved, onError, limitToColor); });
UnityEngine.Debug.LogWarning("Retrieve Lobby list hit the rate limit. Will try again soon...");
return;
}

if (!m_rateLimitQuery.CanCall())
{
onComplete?.Invoke(null);
UnityEngine.Debug.LogWarning("Retrieve Lobby hit the rate limit.");
return;
}
LobbyAPIInterface.GetLobbyAsync(lobbyId, OnGet);

3
Assets/Scripts/Relay/RelayAPIInterface.cs


{
/// <summary>
/// Wrapper for all the interaction with the Relay API.
/// Relay acts as an intermediary between hosts and clients for privacy. Each player will connect to an obfuscated IP address provided by Relay as though connecting directly to other players.
/// </summary>
public static class RelayAPIInterface
{

/// <summary>
/// Only after an Allocation has been completed can a Relay join code be obtained. This code will be stored in the lobby's data as non-public
/// such that players can retrieve the Relay join code only after connecting to the lobby.
/// such that players can retrieve the Relay join code only after connecting to the lobby. (Note that this is not the same as the lobby code.)
/// </summary>
public static void GetJoinCodeAsync(Guid hostAllocationId, Action<string> onComplete)
{

62
Assets/Scripts/Relay/RelayUtpClient.cs


{
if (cmd == NetworkEvent.Type.Data)
{
MsgType msgType = (MsgType)strm.ReadByte();
string id = ReadLengthAndString(ref strm);
if (id == m_localUser.ID || !m_localLobby.LobbyUsers.ContainsKey(id)) // We don't hold onto messages, since an incoming user will be fully initialized before they send events.
List<byte> msgContents = new List<byte>(ReadMessageContents(ref strm));
if (msgContents.Count < 3) // We require at a minimum - Message type, the length of the user ID, and the user ID.
MsgType msgType = (MsgType)msgContents[0];
int idLength = msgContents[1];
if (msgContents.Count < idLength + 2)
return;
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.
return;
msgContents.RemoveRange(0, 2 + idLength);
string name = ReadLengthAndString(ref strm);
int nameLength = msgContents[0];
string name = System.Text.Encoding.UTF8.GetString(msgContents.GetRange(1, nameLength).ToArray());
EmoteType emote = (EmoteType)strm.ReadByte();
EmoteType emote = (EmoteType)msgContents[0];
UserStatus status = (UserStatus)strm.ReadByte();
UserStatus status = (UserStatus)msgContents[0];
m_localLobby.LobbyUsers[id].UserStatus = status;
}
else if (msgType == MsgType.StartCountdown)

else if (msgType == MsgType.EndInGame)
Locator.Get.Messenger.OnReceiveMessage(MessageType.EndGame, null);
ProcessNetworkEventDataAdditional(conn, strm, msgType, id);
ProcessNetworkEventDataAdditional(conn, msgType, id);
protected virtual void ProcessNetworkEventDataAdditional(NetworkConnection conn, DataStreamReader strm, MsgType msgType, string id) { }
protected virtual void ProcessNetworkEventDataAdditional(NetworkConnection conn, MsgType msgType, string id) { }
protected virtual void ProcessDisconnectEvent(NetworkConnection conn, DataStreamReader strm)
{
// The host disconnected, and Relay does not support host migration. So, all clients should disconnect.

}
/// <summary>
/// Relay uses raw pointers for efficiency. This converts them to byte arrays, assuming the stream contents are 1 byte for array length followed by contents.
/// UTP uses raw pointers for efficiency (i.e. C-style byte* instead of byte[]).
/// ReadMessageContents converts them back to byte arrays, assuming the stream contains 1 byte for array length followed by contents.
/// Any actual pointer manipulation and so forth happens service-side, so we simply need to convert back to a byte array here.
unsafe private string ReadLengthAndString(ref DataStreamReader strm)
unsafe private byte[] ReadMessageContents(ref DataStreamReader strm) // unsafe is required to access the pointer.
byte length = strm.ReadByte();
int length = strm.Length;
return System.Text.Encoding.UTF8.GetString(bytes);
return bytes;
}
/// <summary>

byte[] idBytes = System.Text.Encoding.UTF8.GetBytes(id);
byte[] strBytes = System.Text.Encoding.UTF8.GetBytes(str);
List<byte> message = new List<byte>(idBytes.Length + strBytes.Length + 3);
List<byte> message = new List<byte>(idBytes.Length + strBytes.Length + 3); // Extra 3 bytes for the msgType plus the ID and message lengths.
if (driver.BeginSend(connection, out var dataStream) == 0) // Oh, should check this first?
{
byte[] bytes = message.ToArray();
unsafe
{
fixed (byte* bytesPtr = bytes)
{
dataStream.WriteBytes(bytesPtr, message.Count);
driver.EndSend(dataStream);
}
}
}
SendMessageData(driver, connection, message);
}
/// <summary>

{
byte[] idBytes = System.Text.Encoding.UTF8.GetBytes(id);
List<byte> message = new List<byte>(idBytes.Length + 3);
List<byte> message = new List<byte>(idBytes.Length + 3); // Extra 3 bytes for the msgType, ID length, and the byte value.
SendMessageData(driver, connection, message);
}
if (driver.BeginSend(connection, out var dataStream) == 0) // Oh, should check this first?
private void SendMessageData(NetworkDriver driver, NetworkConnection connection, List<byte> message)
{
if (driver.BeginSend(connection, out var dataStream) == 0)
unsafe
unsafe // Similarly to ReadMessageContents, our data must be converted to a pointer before being sent.
{
fixed (byte* bytesPtr = bytes)
{

4
Assets/Scripts/Relay/RelayUtpHost.cs


ForceFullUserUpdate(m_networkDriver, conn, user.Value);
}
protected override void ProcessNetworkEventDataAdditional(NetworkConnection conn, DataStreamReader strm, MsgType msgType, string id)
protected override void ProcessNetworkEventDataAdditional(NetworkConnection conn, MsgType msgType, string id)
// Note that the strm contents might have already been consumed, depending on the msgType.
// Forward messages from clients to other clients.
if (msgType == MsgType.PlayerName)
{

17
Assets/Scripts/Relay/RelayUtpSetup.cs


namespace LobbyRelaySample.relay
{
/// <summary>
/// Responsible for setting up a connection with Relay using UTP, for the lobby host.
/// Responsible for setting up a connection with Relay using Unity Transport (UTP). A Relay Allocation is created by the host, and then all players
/// bind UTP to that Allocation in order to send data to each other.
/// Must be a MonoBehaviour since the binding process doesn't have asynchronous callback options.
/// </summary>
public abstract class RelayUtpSetup : MonoBehaviour

protected abstract void JoinRelay();
/// <summary>
/// Shared behavior for binding to the Relay allocation, which is required for use.
/// Shared behavior for binding UTP to the Relay Allocation, which is required for use.
/// Note that a host will send bytes from the Allocation it creates, whereas a client will send bytes from the JoinAllocation it receives using a relay code.
/// </summary>
protected void BindToAllocation(string ip, int port, byte[] allocationIdBytes, byte[] connectionDataBytes, byte[] hostConnectionDataBytes, byte[] hmacKeyBytes, int connectionCapacity)

{
if (m_networkDriver.Listen() != 0)
{
Debug.LogError("Server failed to listen");
Debug.LogError("RelayUtpSetupHost failed to bind to the Relay Allocation.");
Debug.LogWarning("Server is now listening!");
Debug.Log("Relay host is bound.");
m_joinState |= JoinState.Bound;
CheckForComplete();
}

{
if (m_joinState == (JoinState.Joined | JoinState.Bound))
if (m_joinState == (JoinState.Joined | JoinState.Bound) && this != null) // this will equal null (i.e. this component has been destroyed) if the host left the lobby during the Relay connection sequence.
{
m_isRelayConnected = true;
RelayUtpHost host = gameObject.AddComponent<RelayUtpHost>();

private void OnJoin(JoinAllocation joinAllocation)
{
if (joinAllocation == null)
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);

}
if (m_networkDriver.GetConnectionState(m_connections[0]) != NetworkConnection.State.Connected)
{
Debug.LogError("Client failed to connect to server");
Debug.LogError("RelayUtpSetupClient could not connect to the host.");
else
else if (this != null)
{
m_isRelayConnected = true;
RelayUtpClient client = gameObject.AddComponent<RelayUtpClient>();

1
Assets/Scripts/UI/JoinMenuUI.cs


public void OnJoinButtonPressed()
{
Locator.Get.Messenger.OnReceiveMessage(MessageType.JoinLobbyRequest, m_LocalLobbySelected);
m_LocalLobbySelected = default;
}
public void OnRefresh()

32
Assets/Scripts/UI/SpinnerUI.cs


using System.Text;
using TMPro;
using UnityEngine;
namespace LobbyRelaySample.UI
{

public class SpinnerUI : ObserverPanel<LobbyServiceData>
{
public TMP_Text errorText;
public UIPanelBase spinnerImage;
public UIPanelBase noServerText;
public UIPanelBase errorTextVisibility;
[SerializeField] private TMP_Text m_errorText;
[SerializeField] private UIPanelBase m_spinnerImage;
[SerializeField] private UIPanelBase m_noServerText;
[SerializeField] private UIPanelBase m_errorTextVisibility;
[Tooltip("This prevents selecting a lobby or Joining while the spinner is visible.")]
[SerializeField] private UIPanelBase m_raycastBlocker;
public override void ObservedUpdated(LobbyServiceData observed)
{

spinnerImage.Show();
noServerText.Hide();
errorTextVisibility.Hide();
m_spinnerImage.Show();
m_raycastBlocker.Show();
m_noServerText.Hide();
m_errorTextVisibility.Hide();
spinnerImage.Hide();
errorTextVisibility.Show();
errorText.SetText("Error. See Unity Console log for details.");
m_spinnerImage.Hide();
m_raycastBlocker.Hide();
m_errorTextVisibility.Show();
m_errorText.SetText("Error. See Unity Console log for details.");
noServerText.Show();
m_noServerText.Show();
noServerText.Hide();
m_noServerText.Hide();
spinnerImage.Hide();
m_spinnerImage.Hide();
m_raycastBlocker.Hide();
}
}
}

19
Assets/Scripts/Vivox/VivoxUserHandler.cs


// In the future, remove FindVivoxId and pass the environment ID here instead.
m_vivoxId = null;
// SetID might be called after we've received the IChannelSession for remote players, which would mean after OnParticipant Added. So, duplicate the VivoxID work here.
// SetID might be called after we've received the IChannelSession for remote players, which would mean after OnParticipantAdded. So, duplicate the VivoxID work here.
if (m_channelSession != null)
{
foreach (var participant in m_channelSession.Participants)

}
}
public void OnChannelJoined(IChannelSession channelSession)
public void OnChannelJoined(IChannelSession channelSession) // Called after a connection is established, which begins once a lobby is joined.
{
m_channelSession = channelSession;
m_channelSession.Participants.AfterKeyAdded += OnParticipantAdded;

public void OnChannelLeft()
public void OnChannelLeft() // Called when we leave the lobby.
m_channelSession.Participants.AfterKeyAdded -= OnParticipantAdded;
m_channelSession.Participants.BeforeKeyRemoved -= BeforeParticipantRemoved;
m_channelSession.Participants.AfterValueUpdated -= OnParticipantValueUpdated;
m_channelSession = null;
if (m_channelSession != null) // It's possible we'll attempt to leave a channel that isn't joined, if we leave the lobby while Vivox is connecting.
{
m_channelSession.Participants.AfterKeyAdded -= OnParticipantAdded;
m_channelSession.Participants.BeforeKeyRemoved -= BeforeParticipantRemoved;
m_channelSession.Participants.AfterValueUpdated -= OnParticipantValueUpdated;
m_channelSession = null;
}
}
/// <summary>

}
else
{ m_lobbyUserVolumeUI.EnableVoice(false);
participant.SetIsMuteForAll(m_vivoxId, false, null);
participant.SetIsMuteForAll(m_vivoxId, false, null); // Also note: This call is asynchronous, so it's possible to exit the lobby before this completes, resulting in a Vivox error.
}
}
else if (property == "IsMutedForAll")

正在加载...
取消
保存