浏览代码

Latest Rename Changes.

/dev
UnityJacob 3 年前
当前提交
d7613e86
共有 76 个文件被更改,包括 383 次插入636 次删除
  1. 4
      Assets/Prefabs/UI/JoinContent.prefab
  2. 7
      Assets/Prefabs/UI/LobbyButtonUI.prefab
  3. 22
      Assets/Prefabs/UI/LobbyGameCanvas.prefab
  4. 42
      Assets/Prefabs/UI/LobbyUserList.prefab
  5. 4
      Assets/Prefabs/UI/PlayerInteractionPanel.prefab
  6. 17
      Assets/Prefabs/UI/RelayCodeCanvas.prefab
  7. 232
      Assets/Scenes/mainScene.unity
  8. 2
      Assets/Scripts/Auth/Identity.cs
  9. 2
      Assets/Scripts/Auth/SubIdentity_Authentication.cs
  10. 68
      Assets/Scripts/Entities/GameStateManager.cs
  11. 2
      Assets/Scripts/Entities/LobbyServiceData.cs
  12. 14
      Assets/Scripts/Entities/LobbyUser.cs
  13. 2
      Assets/Scripts/Entities/LocalLobby.cs
  14. 2
      Assets/Scripts/Infrastructure/UpdateSlow.cs
  15. 4
      Assets/Scripts/Lobby/LobbyContentHeartbeat.cs
  16. 6
      Assets/Scripts/Tests/Editor/ObserverTests.cs
  17. 2
      Assets/Scripts/Tests/Editor/Tests.Editor.asmdef
  18. 2
      Assets/Scripts/Tests/PlayMode/Tests.Play.asmdef
  19. 3
      Assets/Scripts/UI/BackButtonUI.cs
  20. 3
      Assets/Scripts/UI/CountdownUI.cs
  21. 3
      Assets/Scripts/UI/CreateMenuUI.cs
  22. 3
      Assets/Scripts/UI/EmoteButtonUI.cs
  23. 5
      Assets/Scripts/UI/EndGameButtonUI.cs
  24. 3
      Assets/Scripts/UI/ExitButtonUI.cs
  25. 3
      Assets/Scripts/UI/GameStateVisibilityUI.cs
  26. 38
      Assets/Scripts/UI/JoinMenuUI.cs
  27. 5
      Assets/Scripts/UI/LobbyButtonUI.cs
  28. 2
      Assets/Scripts/UI/MainMenuUI.cs
  29. 2
      Assets/Scripts/UI/NameChangeUI.cs
  30. 5
      Assets/Scripts/UI/ObserverPanel.cs
  31. 3
      Assets/Scripts/UI/PlayerNameUI.cs
  32. 3
      Assets/Scripts/UI/ReadyCheckUI.cs
  33. 3
      Assets/Scripts/UI/SpinnerUI.cs
  34. 3
      Assets/Scripts/UI/UIPanelBase.cs
  35. 5
      Assets/Scripts/UI/UserStateVisibilityUI.cs
  36. 42
      Assets/Scripts/UI/JoinCreateLobbyUI.cs
  37. 4
      Assets/Scripts/UI/InLobbyUserUI.cs
  38. 2
      Assets/Scripts/LobbyRelaySample.asmdef
  39. 17
      README.md
  40. 5
      Assets/Scripts/Auth/NameGenerator.cs
  41. 33
      Assets/Scripts/UI/DisplayCodeUI.cs
  42. 60
      Assets/Scripts/UI/InLobbyUserList.cs
  43. 19
      Assets/Scripts/UI/LobbyNameUI.cs
  44. 19
      Assets/Scripts/UI/RelayAddressUI.cs
  45. 22
      Assets/Scripts/UI/ShowWhenLobbyStateUI.cs
  46. 15
      Assets/Scripts/UI/StartLobbyButtonUI.cs
  47. 11
      Assets/Scripts/UI/RelayCodeUI.cs.meta
  48. 5
      Assets/Scripts/UI/SerializedValueEvents.cs
  49. 11
      Assets/Scripts/UI/SerializedValueEvents.cs.meta
  50. 12
      Assets/Scripts/UI/StartLobbyButton.cs
  51. 19
      Assets/Scripts/UI/LobbyStateVisibilityUI.cs
  52. 60
      Assets/Scripts/UI/LobbyUsersUI.cs
  53. 27
      Assets/Scripts/UI/RelayCodeUI.cs
  54. 26
      Assets/Scripts/UI/RoomCodeUI.cs
  55. 16
      Assets/Scripts/UI/ServerAddressUI.cs
  56. 16
      Assets/Scripts/UI/ServerNameUI.cs
  57. 8
      Assets/Scripts/Utilities.meta
  58. 11
      Assets/TempDeleteAllRooms.cs.meta
  59. 33
      Assets/TempDeleteAllRooms.cs
  60. 0
      /Assets/Scripts/UI/JoinCreateLobbyUI.cs.meta
  61. 0
      /Assets/Scripts/UI/ShowWhenLobbyStateUI.cs.meta
  62. 0
      /Assets/Scripts/UI/InLobbyUserUI.cs.meta
  63. 0
      /Assets/Scripts/UI/InLobbyUserList.cs.meta
  64. 0
      /Assets/Scripts/UI/DisplayCodeUI.cs.meta
  65. 0
      /Assets/Scripts/UI/RelayAddressUI.cs.meta
  66. 0
      /Assets/Scripts/UI/LobbyNameUI.cs.meta
  67. 0
      /Assets/Scripts/UI/StartLobbyButtonUI.cs.meta
  68. 0
      /Assets/Scripts/UI/JoinCreateLobbyUI.cs
  69. 0
      /Assets/Scripts/UI/InLobbyUserUI.cs
  70. 0
      /Assets/Scripts/LobbyRelaySample.asmdef.meta
  71. 0
      /Assets/Scripts/LobbyRelaySample.asmdef
  72. 0
      /Assets/Scripts/Lobby/ReadyCheck.cs
  73. 0
      /Assets/Scripts/Lobby/ReadyCheck.cs.meta
  74. 0
      /Assets/Scripts/Auth/NameGenerator.cs
  75. 0
      /Assets/Scripts/Auth/NameGenerator.cs.meta

4
Assets/Prefabs/UI/JoinContent.prefab


m_CallState: 2
showing: 1
m_LobbyButtonPrefab: {fileID: 7018369548608736188, guid: f6d35a456ba76a24587dce83bd088b7d, type: 3}
m_RoomCodeField: {fileID: 8659642538454988273}
m_RoomButtonParent: {fileID: 7824921818678239159}
m_LobbyCodeField: {fileID: 8659642538454988273}
m_LobbyButtonParent: {fileID: 7824921818678239159}
--- !u!114 &7550446569341709048
MonoBehaviour:
m_ObjectHideFlags: 0

7
Assets/Prefabs/UI/LobbyButtonUI.prefab


m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 7018369548608736188}
m_TargetAssemblyTypeName: LobbyRooms.UI.LobbyButtonUI, LobbyRooms
m_MethodName: OnRoomUpdated
m_Mode: 0
m_TargetAssemblyTypeName: LobbyRelaySample.UI.LobbyButtonUI, LobbyRooms
m_MethodName: OnLobbyClicked
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine

m_BoolArgument: 0
m_CallState: 2
observeOnStart: 1
--- !u!114 &1059336587790472163
MonoBehaviour:
m_ObjectHideFlags: 0

22
Assets/Prefabs/UI/LobbyGameCanvas.prefab


m_PersistentCalls:
m_Calls: []
showing: 0
m_ServerNameText: {fileID: 7322885418547999459}
m_lobbyNameText: {fileID: 7322885418547999459}
--- !u!225 &6749879306276389991
CanvasGroup:
m_ObjectHideFlags: 0

- component: {fileID: 2725000139462485941}
- component: {fileID: 7322885418547999459}
m_Layer: 5
m_Name: ServerText
m_Name: LobbyNameText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

- component: {fileID: 279783410280127446}
- component: {fileID: 8630015524497407890}
m_Layer: 5
m_Name: ServerIPPanel
m_Name: RelayIPPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

propertyPath: m_fontSize
value: 26.15
objectReference: {fileID: 0}
- target: {fileID: 840905996306701940, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_fontSize
value: 26.15
objectReference: {fileID: 0}
- target: {fileID: 1079919869245620301, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_AnchorMax.y
value: 0

- target: {fileID: 2762366222576510419, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3246194187207366366, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_fontSize
value: 26.15
objectReference: {fileID: 0}
- target: {fileID: 3253464371495375142, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_AnchorMax.y

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4917538085660885383, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_fontSize
value: 26.15
objectReference: {fileID: 0}
- target: {fileID: 5186258928042496532, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_fontSize
value: 26.15

- target: {fileID: 7620090743157897760, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7824963406237393945, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_fontSize
value: 26.15
objectReference: {fileID: 0}
- target: {fileID: 8020923114782963594, guid: e269788e17cbca145bf78e8971aeb223, type: 3}
propertyPath: m_fontSize

42
Assets/Prefabs/UI/LobbyUserList.prefab


m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
m_PresetInfoIsWorld: 0
--- !u!114 &4463750083940306577
MonoBehaviour:
m_ObjectHideFlags: 0

m_PersistentCalls:
m_Calls: []
showing: 0
m_PlayerCardSlots:
m_UserUIObjects:
- {fileID: 8208727230702623701}
- {fileID: 4503217775887893542}
- {fileID: 1646035575854440888}

m_Modifications:
- target: {fileID: 1767503274657767312, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_Name
value: UserCardPanel_4
value: UserUI_4
objectReference: {fileID: 0}
- target: {fileID: 2889154384621986752, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y

objectReference: {fileID: 0}
- target: {fileID: 3540056819003737500, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_fontSize
value: 26.15
value: 58
value: 26.15
value: 72
objectReference: {fileID: 0}
- target: {fileID: 5235189765028238254, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: showing

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
--- !u!224 &3685075291402800769 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3229036008637484624, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
m_PrefabInstance: {fileID: 2300164376451760337}
m_PrefabAsset: {fileID: 0}
--- !u!114 &6290668908104815487 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5235189765028238254, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}

m_Script: {fileID: 11500000, guid: 9557a5d232068a149987bc0753800f26, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &3685075291402800769 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3229036008637484624, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
m_PrefabInstance: {fileID: 2300164376451760337}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &4128781293466929275
PrefabInstance:
m_ObjectHideFlags: 0

m_Modifications:
- target: {fileID: 1767503274657767312, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_Name
value: UserCardPanel_1
value: UserUI_1
objectReference: {fileID: 0}
- target: {fileID: 2889154384621986752, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3540056819003737500, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_fontSize
value: 58
objectReference: {fileID: 0}
- target: {fileID: 3667934756810823183, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_fontSize
value: 72
objectReference: {fileID: 0}
- target: {fileID: 5804120253616419419, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 0

m_Modifications:
- target: {fileID: 1767503274657767312, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_Name
value: UserCardPanel_3
value: UserUI_3
objectReference: {fileID: 0}
- target: {fileID: 2889154384621986752, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y

objectReference: {fileID: 0}
- target: {fileID: 3540056819003737500, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_fontSize
value: 26.15
value: 58
value: 26.15
value: 72
objectReference: {fileID: 0}
- target: {fileID: 5235189765028238254, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: showing

m_Modifications:
- target: {fileID: 1767503274657767312, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_Name
value: UserCardPanel_2
value: UserUI_2
objectReference: {fileID: 0}
- target: {fileID: 2889154384621986752, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y

objectReference: {fileID: 0}
- target: {fileID: 3540056819003737500, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_fontSize
value: 26.15
value: 58
value: 26.15
value: 72
objectReference: {fileID: 0}
- target: {fileID: 5235189765028238254, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: showing

4
Assets/Prefabs/UI/PlayerInteractionPanel.prefab


m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 900710893788416922}
m_TargetAssemblyTypeName: LobbyRooms.UI.GameStateButtonUI, Assembly-CSharp
m_MethodName: EndServer
m_TargetAssemblyTypeName: LobbyRelaySample.UI.EndGameButtonUI, LobbyRelaySample
m_MethodName: EndGame
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

17
Assets/Prefabs/UI/RelayCodeCanvas.prefab


m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 20.55
m_fontSize: 72
m_fontSizeBase: 45
m_fontWeight: 400
m_enableAutoSizing: 1

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

- component: {fileID: 4102997489641105917}
- component: {fileID: 4102997489641105913}
- component: {fileID: 7676491730539518990}
- component: {fileID: 2381432589029884226}
- component: {fileID: 3340928240658051873}
- component: {fileID: 4523467532116611583}
m_Layer: 5
m_Name: RelayCodeCanvas

m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!114 &2381432589029884226
--- !u!114 &3340928240658051873
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9a70bc1b6f999ee43974bbbf991a0b6a, type: 3}
m_Script: {fileID: 11500000, guid: a6e005db2e7b3d94d9409975660cf97c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_onVisibilityChange:

relayCodeText: {fileID: 8798075752901962210}
m_outputText: {fileID: 8798075752901962210}
m_codeType: 1
--- !u!114 &4523467532116611583
MonoBehaviour:
m_ObjectHideFlags: 0

OnObservedUpdated:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 2381432589029884226}
m_TargetAssemblyTypeName: LobbyRooms.UI.RelayCodeUI, LobbyRooms
- m_Target: {fileID: 3340928240658051873}
m_TargetAssemblyTypeName: LobbyRelaySample.UI.DisplayCodeUI, LobbyRelaySample
m_MethodName: ObservedUpdated
m_Mode: 0
m_Arguments:

232
Assets/Scenes/mainScene.unity


m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!224 &462074380 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 2637199315671523625, guid: f1d618bdc6f1813449d428126e640aa5, type: 3}
m_PrefabInstance: {fileID: 2637199315837045693}
m_PrefabAsset: {fileID: 0}
--- !u!114 &648562208 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6939937855246394599, guid: f1d618bdc6f1813449d428126e640aa5, type: 3}

m_Script: {fileID: 11500000, guid: 70dfc2fde0a9ef04eaff29a138f0bf45, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1790515943
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1790515944}
- component: {fileID: 1790515946}
- component: {fileID: 1790515945}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1790515944
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1790515943}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1839563668}
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!114 &1790515945
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1790515943}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Delete all my lobbies
--- !u!222 &1790515946
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1790515943}
m_CullTransparentMesh: 1
--- !u!1 &1839563667
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1839563668}
- component: {fileID: 1839563672}
- component: {fileID: 1839563671}
- component: {fileID: 1839563670}
- component: {fileID: 1839563669}
m_Layer: 5
m_Name: DeleteAllMine
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1839563668
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1839563667}
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_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1790515944}
m_Father: {fileID: 462074380}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1839563669
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1839563667}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0e7b1d59375bdf94795f339fd9395761, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1839563670
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1839563667}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1839563671}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1839563669}
m_TargetAssemblyTypeName: TempDeleteAllRooms, Assembly-CSharp
m_MethodName: OnButton
m_Mode: 1
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!114 &1839563671
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1839563667}
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_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
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!222 &1839563672
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1839563667}
m_CullTransparentMesh: 1
--- !u!114 &1886099429 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3845984648666374778, guid: f1d618bdc6f1813449d428126e640aa5, type: 3}

2
Assets/Scripts/Auth/Identity.cs


/// <summary>
/// Our internal representation of a player, wrapping the data required for interfacing with the identities of that player in the services.
/// One will be created for the local player, as well as for each other member of the room.
/// One will be created for the local player, as well as for each other member of the lobby.
/// </summary>
public class Identity : IIdentity, IDisposable
{

2
Assets/Scripts/Auth/SubIdentity_Authentication.cs


AuthenticationService.Instance.SignedOut += OnSignInChange;
if (!AuthenticationService.Instance.IsSignedIn)
await AuthenticationService.Instance.SignInAnonymouslyAsync(); // Note: We don't want to sign out later, since that changes the UAS anonymous token, which would prevent the player from exiting rooms they're already in.
await AuthenticationService.Instance.SignInAnonymouslyAsync(); // Note: We don't want to sign out later, since that changes the UAS anonymous token, which would prevent the player from exiting lobbies they're already in.
onSigninComplete?.Invoke();
}

68
Assets/Scripts/Entities/GameStateManager.cs


[SerializeField]
List<LobbyServiceDataObserver> m_LobbyServiceObservers = new List<LobbyServiceDataObserver>();
private LobbyContentHeartbeat m_roomsContentHeartbeat = new LobbyContentHeartbeat();
private LobbyContentHeartbeat m_lobbyContentHeartbeat = new LobbyContentHeartbeat();
LobbyUser m_localUser;
LocalLobby m_localLobby;

}
else if (type == MessageType.CreateLobbyRequest)
{
var createRoomData = (LocalLobby)msg;
LobbyAsyncRequests.Instance.CreateLobbyAsync(createRoomData.LobbyName, createRoomData.MaxPlayerCount, createRoomData.Private, (r) =>
var createLobbyData = (LocalLobby)msg;
LobbyAsyncRequests.Instance.CreateLobbyAsync(createLobbyData.LobbyName, createLobbyData.MaxPlayerCount, createLobbyData.Private, (r) =>
OnCreatedRoom();
OnCreatedLobby();
LobbyInfo roomData = (LobbyInfo)msg;
LobbyAsyncRequests.Instance.JoinLobbyAsync(roomData.LobbyID, roomData.LobbyCode, (r) =>
LobbyInfo lobbyInfo = (LobbyInfo)msg;
LobbyAsyncRequests.Instance.JoinLobbyAsync(lobbyInfo.LobbyID, lobbyInfo.LobbyCode, (r) =>
OnJoinedRoom();
OnJoinedLobby();
}, OnFailedJoin);
}
else if (type == MessageType.QueryLobbies)

if (!m_LobbyServiceObservers.Contains(lobbyServiceObs))
m_LobbyServiceObservers.Add(lobbyServiceObs);
}
if (m_GameStateObservers.Count < 4)
Debug.LogWarning($"Scene has less than the default expected Game State Observers, ensure all the observers in the scene that need to watch the gameState are registered in the LocalGameStateObservers List.");

void SetGameState(GameState state)
{
bool isLeavingRoom = (state == GameState.Menu || state == GameState.JoinMenu) && m_localGameState.State == GameState.Lobby;
bool isLeavingLobby = (state == GameState.Menu || state == GameState.JoinMenu) && m_localGameState.State == GameState.Lobby;
if (isLeavingRoom)
OnLeftRoom();
if (isLeavingLobby)
OnLeftLobby();
void OnRefreshed(IEnumerable<LocalLobby> lobbies)
{
var newLobbyDict = new Dictionary<string, LocalLobby>();

m_lobbyServiceData.State = LobbyServiceState.Error;
}
void OnCreatedRoom()
void OnCreatedLobby()
OnJoinedRoom();
OnJoinedLobby();
}
void OnGotRelayAllocation(Allocation allocationID)

void OnGotRelayCode(string relayCode)
{
m_localLobby.RelayCode = relayCode;
void OnJoinedRoom()
void OnJoinedLobby()
m_roomsContentHeartbeat.BeginTracking(m_localLobby, m_localUser);
m_lobbyContentHeartbeat.BeginTracking(m_localLobby, m_localUser);
SetUserLobbyState();
Dictionary<string, string> displayNameData = new Dictionary<string, string>();
displayNameData.Add("DisplayName", m_localUser.DisplayName);

void OnLeftRoom()
void OnLeftLobby()
m_roomsContentHeartbeat.EndTracking();
m_lobbyContentHeartbeat.EndTracking();
LobbyAsyncRequests.Instance.EndTracking();
}

{
SetGameState(GameState.JoinMenu);
}
/// <summary>
/// We do the Relay server Allocations right before we do the relay join allocations, as waiting too long will
/// cause the relay server to get cleand up by the service
/// </summary>
// We want to do all the Relay Allocation calls in quick succession, as waiting too long
// (10s) will cause the Relay server to get cleaned up by the service
/// <summary>
/// This is currently a countdown to Connection, once we have our transport integrated, this will be a countdown to Game Start
/// </summary>
IEnumerator CountDown()
{
m_ReadyCheck.EndCheckingForReady();

m_localUser.UserStatus = UserStatus.Connecting;
m_localLobby.State = LobbyState.InGame;
RelayInterface.JoinAsync(m_localLobby.RelayCode, OnJoinedGame);
// TODO TRANSPORT: Move Relay Join to Pre-Countdown, and do connection and health checks before counting down for the game start.
RelayInterface.JoinAsync(m_localLobby.RelayCode, OnJoinedRelay);
void OnJoinedGame(JoinAllocation joinData)
/// <summary>
/// Non Hosts Connect to server Here
/// </summary>
void OnJoinedRelay(JoinAllocation joinData)
{
m_localUser.UserStatus = UserStatus.Connected;
var ip = joinData.RelayServer.IpV4;

}
/// <summary>
/// In builds, if we are in a room and try to send a Leave request on application quit, it won't go through if we're quitting on the same frame.
/// In builds, if we are in a lobby and try to send a Leave request on application quit, it won't go through if we're quitting on the same frame.
/// So, we need to delay just briefly to let the request happen (though we don't need to wait for the result).
/// </summary>
IEnumerator LeaveBeforeQuit()

// TEMP: Since we're temporarily (as of 6/31/21) deleting empty rooms when we leave them manually, we'll delay a bit to ensure that happens.
// TEMP: Since we're temporarily (as of 6/31/21) deleting empty lobbies when we leave them manually, we'll delay longer to ensure that happens.
//yield return null;
yield return new WaitForSeconds(0.5f);
Application.Quit();

2
Assets/Scripts/Entities/LobbyServiceData.cs


}
/// <summary>
/// Holds the latest service data, such as the list of rooms
/// Holds data related to the Lobby service itself - The latest retrieved lobby list, the state of retrieval.
/// </summary>
[System.Serializable]
public class LobbyServiceData : Observed<LobbyServiceData>

14
Assets/Scripts/Entities/LobbyUser.cs


{
/// <summary>
/// Current state of the user in the lobby.
/// Set as a flag to allow for the unity inspector to select multiples for various UI features.
/// This is a Flags enum to allow for the Inspector to select multiples for various UI features.
Lobby = 1, // Connected to lobby, not ready yet
Ready = 4, // User clicked ready
Connecting = 8, // User sent join request through relay
Connected = 16, // User connected through relay
Menu = 32, // User is in a menu, external to the lobby
Lobby = 1, // Connected to lobby, not ready yet
Ready = 4, // User clicked ready (Note that 2 is missing; some flags have been removed over time, but we want any serialized values to be unaffected.)
Connecting = 8, // User sent join request through Relay
Connected = 16, // User connected through Relay
Menu = 32, // User is in a menu, external to the lobby
/// Lobby Room Data for a player
/// Data for a local player instance. This will update data and is observed to know when to push local player changes to the entire lobby.
/// </summary>
[Serializable]
public class LobbyUser : Observed<LobbyUser>

2
Assets/Scripts/Entities/LocalLobby.cs


}
/// <summary>
/// The local lobby data that the game can observe
/// A local wrapper around a lobby's remote data, with additional functionality for providing that data to UI elements and tracking local player objects.
/// </summary>
[System.Serializable]
public class LocalLobby : Observed<LocalLobby>

2
Assets/Scripts/Infrastructure/UpdateSlow.cs


public class UpdateSlow : MonoBehaviour, IUpdateSlow
{
[SerializeField]
[Tooltip("Update interval. Note that room Get requests must occur at least 1 second apart, so this period should likely be greater than that.")]
[Tooltip("Update interval. Note that lobby Get requests must occur at least 1 second apart, so this period should likely be greater than that.")]
private float m_updatePeriod = 1.5f;
[SerializeField]
[Tooltip("If a subscriber to slow update takes longer than this to execute, it can be automatically unsubscribed.")]

4
Assets/Scripts/Lobby/LobbyContentHeartbeat.cs


m_isAwaitingQuery = true; // Note that because we make async calls, if one of them fails and doesn't call our callback, this will never be reset to false.
if (m_shouldPushData)
PushDataToRoom();
PushDataToLobby();
void PushDataToRoom()
void PushDataToLobby()
{
if (m_localUser == null)
{

6
Assets/Scripts/Tests/Editor/ObserverTests.cs


public IEnumerator ObserverChangeWhenObservedChanged() // Test if Observer changes when StringField gets set
{
var observed = new TestObserved();
var observer = new GameObject("PlayerObserver").AddComponent<TestObservereBehaviour>();
var observer = new GameObject("PlayerObserver").AddComponent<TestObserverBehaviour>();
observer.BeginObserving(observed);
Assert.AreNotEqual("NewName", observed.StringField);

var observed = new TestObserved();
observed.StringField = "NewName"; // Set the field before we begin observing
var observer = new GameObject("PlayerObserver").AddComponent<TestObservereBehaviour>();
var observer = new GameObject("PlayerObserver").AddComponent<TestObserverBehaviour>();
Assert.AreNotEqual(observed.StringField, observer.displayStringField);
observer.BeginObserving(observed);

}
//Mock UI Observer
class TestObservereBehaviour : ObserverBehaviour<TestObserved>
class TestObserverBehaviour : ObserverBehaviour<TestObserved>
{
public string displayStringField;

2
Assets/Scripts/Tests/Editor/Tests.Editor.asmdef


"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"LobbyRooms"
"LobbyRelaySample"
],
"includePlatforms": [
"Editor"

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


"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"LobbyRooms",
"LobbyRelaySample",
"Unity.Services.Rooms",
"Unity.Services.Relay"
],

3
Assets/Scripts/UI/BackButtonUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// For navigating the main menu.
/// </summary>
public class BackButtonUI : MonoBehaviour
{
public void ToJoinMenu()

3
Assets/Scripts/UI/CountdownUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// After all players ready up for the game, this will show the countdown that occurs.
/// </summary>
public class CountdownUI : ObserverPanel<LocalLobby>
{
[SerializeField]

3
Assets/Scripts/UI/CreateMenuUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Handles the menu for a player creating a new lobby.
/// </summary>
public class CreateMenuUI : UIPanelBase
{
[SerializeField]

3
Assets/Scripts/UI/EmoteButtonUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Controls a button which will set the local player's emote state when pressed. This demonstrates a player updating their data within the room.
/// </summary>
public class EmoteButtonUI : MonoBehaviour
{
[SerializeField]

5
Assets/Scripts/UI/EndGameButtonUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// After connecting to Relay, the host can use this to end the game, returning to the regular lobby state.
/// </summary>
public void EndServer()
public void EndGame()
{
Locator.Get.Messenger.OnReceiveMessage(MessageType.ToLobby, null);
}

3
Assets/Scripts/UI/ExitButtonUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// When the main menu's Exit button is selected, send a quit signal.
/// </summary>
public class ExitButtonUI : MonoBehaviour
{
public void OnExitButton()

3
Assets/Scripts/UI/GameStateVisibilityUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Show or hide a UI element based on the current GameState (e.g. in a lobby).
/// </summary>
[RequireComponent(typeof(LocalGameStateObserver))]
public class GameStateVisibilityUI : ObserverPanel<LocalGameState>
{

38
Assets/Scripts/UI/JoinMenuUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Handles the list of LobbyButtons and ensures it stays synchronous with the list from the service.
/// Handles the list of LobbyButtons and ensures it stays synchronized with the lobby list from the service.
/// </summary>
public class JoinMenuUI : ObserverPanel<LobbyServiceData>
{

[SerializeField]
TMP_InputField m_RoomCodeField;
TMP_InputField m_LobbyCodeField;
RectTransform m_RoomButtonParent;
RectTransform m_LobbyButtonParent;
/// <summary>
/// Key: Lobby ID, Value Lobby UI

/// <summary>Contains some amount of information used to join an existing room.</summary>
LobbyInfo m_localLobbySelected;
/// <summary>Contains some amount of information used to join an existing lobby.</summary>
LobbyInfo m_LocalLobbySelected;
m_localLobbySelected = lobby.Data;
m_LocalLobbySelected = lobby.Data;
m_localLobbySelected = new LobbyInfo(newCode.ToUpper());
m_LocalLobbySelected = new LobbyInfo(newCode.ToUpper());
Locator.Get.Messenger.OnReceiveMessage(MessageType.JoinLobbyRequest, m_localLobbySelected);
Locator.Get.Messenger.OnReceiveMessage(MessageType.JoinLobbyRequest, m_LocalLobbySelected);
}
public void OnRefresh()

List<string> previousKeys = new List<string>(m_LobbyButtons.Keys);
foreach (var codeLobby in observed.CurrentLobbies)
{
var roomCodeKey = codeLobby.Key;
var lobbyCodeKey = codeLobby.Key;
if (!m_LobbyButtons.ContainsKey(roomCodeKey))
if (!m_LobbyButtons.ContainsKey(lobbyCodeKey))
AddNewLobbyButton(roomCodeKey, lobbyData);
AddNewLobbyButton(lobbyCodeKey, lobbyData);
UpdateLobbyButton(roomCodeKey, lobbyData);
UpdateLobbyButton(lobbyCodeKey, lobbyData);
previousKeys.Remove(roomCodeKey);
previousKeys.Remove(lobbyCodeKey);
}
foreach (string key in previousKeys) // Need to remove any lobbies from the list that no longer exist.

/// <summary>
/// Instantiates UI element and initializes the observer with the LobbyData
/// </summary>
void AddNewLobbyButton(string roomCode, LocalLobby lobby)
void AddNewLobbyButton(string lobbyCode, LocalLobby lobby)
var lobbyButtonInstance = Instantiate(m_LobbyButtonPrefab, m_RoomButtonParent);
var lobbyButtonInstance = Instantiate(m_LobbyButtonPrefab, m_LobbyButtonParent);
m_LobbyButtons.Add(roomCode, lobbyButtonInstance);
m_LocalLobby.Add(roomCode, lobby);
m_LobbyButtons.Add(lobbyCode, lobbyButtonInstance);
m_LocalLobby.Add(lobbyCode, lobby);
void UpdateLobbyButton(string roomCode, LocalLobby lobby)
void UpdateLobbyButton(string lobbyCode, LocalLobby lobby)
m_LobbyButtons[roomCode].UpdateLobby(lobby);
m_LobbyButtons[lobbyCode].UpdateLobby(lobby);
}
void RemoveLobbyButton(LocalLobby lobby)

5
Assets/Scripts/UI/LobbyButtonUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Controls an entry in the join menu's list of lobbies, acting as a clickable button as well as displaying info about the lobby.
/// </summary>
[RequireComponent(typeof(LocalLobbyObserver))]
public class LobbyButtonUI : MonoBehaviour
{

m_DataObserver.observed.CopyObserved(lobby);
}
public void OnRoomUpdated(LocalLobby data)
public void OnLobbyUpdated(LocalLobby data)
{
lobbyNameText.SetText(data.LobbyName);
lobbyCountText.SetText($"{data.PlayerCount}/{data.MaxPlayerCount}");

2
Assets/Scripts/UI/MainMenuUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Watches for Changes in the Game State to/from Menu
/// Watches for changes in the game state to/from the main menu.
/// </summary>
[RequireComponent(typeof(LocalGameStateObserver))]
public class MainMenuUI : ObserverPanel<LocalGameState>

2
Assets/Scripts/UI/NameChangeUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Sends a message that should change the displayName Data only.
/// When the player changes their name with the UI, this triggers the actual rename.
/// </summary>
public class NameChangeUI : UIPanelBase
{

5
Assets/Scripts/UI/ObserverPanel.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Observer UI panel base class, for UI panels that need hiding, and hookup to observerBehaviours
/// Observer UI panel base class. This allows UI elements to be shown or hidden based on an Observed element.
/// <typeparam name="T"></typeparam>
}

3
Assets/Scripts/UI/PlayerNameUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Displays the player's name.
/// </summary>
public class PlayerNameUI : ObserverPanel<LobbyUser>
{
[SerializeField]

3
Assets/Scripts/UI/ReadyCheckUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Button callbacks for the "Ready"/"Not Ready" buttons used to indicate the local player is ready/not ready.
/// </summary>
public class ReadyCheckUI : MonoBehaviour
{
public void OnReadyButton()

3
Assets/Scripts/UI/SpinnerUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Controls a simple throbber that is displayed when the lobby list is being refreshed.
/// </summary>
public class SpinnerUI : ObserverPanel<LobbyServiceData>
{
public TMP_Text errorText;

3
Assets/Scripts/UI/UIPanelBase.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Basic UI element that can be shown or hidden.
/// </summary>
[RequireComponent(typeof(CanvasGroup))]
public class UIPanelBase : MonoBehaviour
{

5
Assets/Scripts/UI/UserStateVisibilityUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Current user statea
/// Set as a flag to allow for the unity inspector to select multiples for various UI features.
/// User permission type. It's a flag enum to allow for the Inspector to select multiples for various UI features.
/// </summary>
[Flags]
public enum UserPermission

}
/// <summary>
/// Shows the UI when the lobbyuser is set to the matching conditions.
/// Shows the UI when the LobbyUser matches some conditions, including having the target permissions.
/// </summary>
[RequireComponent(typeof(LobbyUserObserver))]
public class UserStateVisibilityUI : ObserverPanel<LobbyUser>

42
Assets/Scripts/UI/JoinCreateLobbyUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// The panel that holds the room joining and creation panels.
/// </summary>
public class JoinCreateRoomUI : ObserverPanel<LocalGameState>
{
public override void ObservedUpdated(LocalGameState observed)
{
if (observed.State == GameState.JoinMenu)
{
Show();
Locator.Get.Messenger.OnReceiveMessage(MessageType.QueryLobbies, null);
}
else
{
Hide();
}
}
}
}
namespace LobbyRelaySample.UI
{
/// <summary>
/// The panel that holds the lobby joining and creation panels.
/// </summary>
public class JoinCreateLobbyUI : ObserverPanel<LocalGameState>
{
public override void ObservedUpdated(LocalGameState observed)
{
if (observed.State == GameState.JoinMenu)
{
Show();
Locator.Get.Messenger.OnReceiveMessage(MessageType.QueryLobbies, null);
}
else
{
Hide();
}
}
}
}

4
Assets/Scripts/UI/InLobbyUserUI.cs


namespace LobbyRelaySample.UI
{
/// <summary>
/// Shows the player info in-lobby and game
/// When inside a lobby, this will show information about a player, whether local or remote.
public class LobbyUserCardUI : ObserverPanel<LobbyUser>
public class InLobbyUserUI : ObserverPanel<LobbyUser>
{
[SerializeField]
TMP_Text m_DisplayNameText;

2
Assets/Scripts/LobbyRelaySample.asmdef


{
"name": "LobbyRooms",
"name": "LobbyRelaySample",
"rootNamespace": "",
"references": [
"GUID:6055be8ebefd69e48b49212b09b47b2f",

17
README.md


### Closed Beta - 7/14/21
Lobby and Relay are **only** available in closed beta at the moment, to use these services you will need to have signed up here for the services to show in your Organization:
https://create.unity3d.com/relay-lobby-beta-signup
Lobby and Relay are **only** available in closed beta at the moment, to use these services you will need to have signed up here for the services to show in your Organization: https://create.unity3d.com/relay-lobby-beta-signup
# Game Lobby Sample
## *Unity 2021.0b1*

[Lobby Overview](http://documentation.cloud.unity3d.com/en/articles/5371715-unity-lobby-service)
Navigate to https://dashboard.unity3d.com/lobby
*(This will only be visibile if you are in the closed beta)*
In the bottom left, select "Get Started"
Follow the steps until you hit "Lobby On"
## Relay

*(This will only be visibile if you are in the closed beta)*
![Relay](~Documentation/Images/dashboard1_beta.png?raw=true "Relay location.")
*(For the moment, you can skip downloading the Transport)*
*(Current version of the sample does not use transport, so you may skip it.)*
## Unity Editor Setup

5
Assets/Scripts/Auth/NameGenerator.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
/// Just for fun, give a cute default name if no name is provided.
/// Just for fun, give a cute default player name if no name is provided.
/// </summary>
public static class NameGenerator
{

33
Assets/Scripts/UI/DisplayCodeUI.cs


using TMPro;
using UnityEngine;
namespace LobbyRelaySample.UI
{
/// <summary>
/// Watches a lobby or relay code for updates, displaying the current code to lobby members.
/// </summary>
public class DisplayCodeUI : ObserverPanel<LocalLobby>
{
public enum CodeType { Lobby = 0, Relay = 1 }
[SerializeField]
TMP_InputField m_outputText;
[SerializeField]
CodeType m_codeType;
public override void ObservedUpdated(LocalLobby observed)
{
string code = m_codeType == CodeType.Lobby ? observed.LobbyCode : observed.RelayCode;
if (!string.IsNullOrEmpty(code))
{
m_outputText.text = code;
Show();
}
else
{
Hide();
}
}
}
}

60
Assets/Scripts/UI/InLobbyUserList.cs


using System.Collections.Generic;
using UnityEngine;
namespace LobbyRelaySample.UI
{
/// <summary>
/// Contains the InLobbyUserUI instances while showing the UI for a lobby.
/// </summary>
[RequireComponent(typeof(LocalLobbyObserver))]
public class InLobbyUserList : ObserverPanel<LocalLobby>
{
[SerializeField]
List<InLobbyUserUI> m_UserUIObjects = new List<InLobbyUserUI>();
List<string> m_CurrentUsers = new List<string>(); // Just for keeping track more easily of which users are already displayed.
/// <summary>
/// When the observed data updates, we need to detect changes to the list of players.
/// </summary>
public override void ObservedUpdated(LocalLobby observed)
{
for (int id = m_CurrentUsers.Count - 1; id >= 0; id--) // We might remove users if they aren't in the new data, so iterate backwards.
{
string userId = m_CurrentUsers[id];
if (!observed.LobbyUsers.ContainsKey(userId))
{
foreach (var ui in m_UserUIObjects)
{
if (ui.UserId == userId)
{
ui.OnUserLeft();
OnUserLeft(userId);
}
}
}
}
foreach (var lobbyUserKvp in observed.LobbyUsers) // If there are new players, we need to hook them into the UI.
{
if (m_CurrentUsers.Contains(lobbyUserKvp.Key))
continue;
m_CurrentUsers.Add(lobbyUserKvp.Key);
foreach (var pcu in m_UserUIObjects)
{
if (pcu.IsAssigned)
continue;
pcu.SetUser(lobbyUserKvp.Value);
break;
}
}
}
void OnUserLeft(string userID)
{
if (!m_CurrentUsers.Contains(userID))
return;
m_CurrentUsers.Remove(userID);
}
}
}

19
Assets/Scripts/UI/LobbyNameUI.cs


using TMPro;
using UnityEngine;
namespace LobbyRelaySample.UI
{
/// <summary>
/// Displays the name of the lobby.
/// </summary>
public class LobbyNameUI : ObserverPanel<LocalLobby>
{
[SerializeField]
TMP_Text m_lobbyNameText;
public override void ObservedUpdated(LocalLobby observed)
{
m_lobbyNameText.SetText(observed.LobbyName);
}
}
}

19
Assets/Scripts/UI/RelayAddressUI.cs


using TMPro;
using UnityEngine;
namespace LobbyRelaySample.UI
{
/// <summary>
/// Displays the IP when connected to Relay.
/// </summary>
public class RelayAddressUI : ObserverPanel<LocalLobby>
{
[SerializeField]
TMP_Text m_IPAddressText;
public override void ObservedUpdated(LocalLobby observed)
{
m_IPAddressText.SetText(observed.RelayServer?.ToString());
}
}
}

22
Assets/Scripts/UI/ShowWhenLobbyStateUI.cs


using UnityEngine;
namespace LobbyRelaySample.UI
{
/// <summary>
/// UI element that is displayed when the lobby is in a particular state (e.g. counting down, in-game).
/// </summary>
public class ShowWhenLobbyStateUI : ObserverPanel<LocalLobby>
{
[SerializeField]
private LobbyState m_ShowThisWhen;
public override void ObservedUpdated(LocalLobby observed)
{
if (m_ShowThisWhen.HasFlag(observed.State))
Show();
else
Hide();
}
}
}

15
Assets/Scripts/UI/StartLobbyButtonUI.cs


using UnityEngine;
namespace LobbyRelaySample
{
/// <summary>
/// Main menu start button.
/// </summary>
public class StartLobbyButtonUI : MonoBehaviour
{
public void ToJoinMenu()
{
Locator.Get.Messenger.OnReceiveMessage(MessageType.ChangeGameState, GameState.JoinMenu);
}
}
}

11
Assets/Scripts/UI/RelayCodeUI.cs.meta


fileFormatVersion: 2
guid: 9a70bc1b6f999ee43974bbbf991a0b6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

5
Assets/Scripts/UI/SerializedValueEvents.cs


using UnityEngine;
using UnityEngine.Events;
[System.Serializable]
public class StringEvent : UnityEvent<string> { }

11
Assets/Scripts/UI/SerializedValueEvents.cs.meta


fileFormatVersion: 2
guid: 19bfe59f0f446ac4ea431b38580a52cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
Assets/Scripts/UI/StartLobbyButton.cs


using UnityEngine;
namespace LobbyRelaySample
{
public class StartLobbyButton : MonoBehaviour
{
public void ToJoinMenu()
{
Locator.Get.Messenger.OnReceiveMessage(MessageType.ChangeGameState, GameState.JoinMenu);
}
}
}

19
Assets/Scripts/UI/LobbyStateVisibilityUI.cs


using UnityEngine;
namespace LobbyRelaySample.UI
{
public class LobbyStateVisibilityUI : ObserverPanel<LocalLobby>
{
[SerializeField]
private LobbyState m_ShowThisWhen;
public override void ObservedUpdated(LocalLobby observed)
{
if (m_ShowThisWhen.HasFlag(observed.State))
Show();
else
Hide();
}
}
}

60
Assets/Scripts/UI/LobbyUsersUI.cs


using System.Collections.Generic;
using UnityEngine;
namespace LobbyRelaySample.UI
{
/// <summary>
/// Watches for changes in the Lobby's player List
/// </summary>
[RequireComponent(typeof(LocalLobbyObserver))]
public class LobbyUsersUI : ObserverPanel<LocalLobby>
{
[SerializeField]
List<LobbyUserCardUI> m_PlayerCardSlots = new List<LobbyUserCardUI>();
List<string> m_CurrentUsers = new List<string>(); // Just for keeping track more easily of which users are already displayed.
/// <summary>
/// When the observed data updates, we need to detect changes to the list of players.
/// </summary>
public override void ObservedUpdated(LocalLobby observed)
{
for (int id = m_CurrentUsers.Count - 1; id >= 0; id--) // We might remove users if they aren't in the new data, so iterate backwards.
{
string userId = m_CurrentUsers[id];
if (!observed.LobbyUsers.ContainsKey(userId))
{
foreach (var card in m_PlayerCardSlots)
{
if (card.UserId == userId)
{
card.OnUserLeft();
OnUserLeft(userId);
}
}
}
}
foreach (var lobbyUserKvp in observed.LobbyUsers) // If there are new players, we need to hook them into the UI.
{
if (m_CurrentUsers.Contains(lobbyUserKvp.Key))
continue;
m_CurrentUsers.Add(lobbyUserKvp.Key);
foreach (var pcu in m_PlayerCardSlots)
{
if (pcu.IsAssigned)
continue;
pcu.SetUser(lobbyUserKvp.Value);
break;
}
}
}
void OnUserLeft(string userID)
{
if (!m_CurrentUsers.Contains(userID))
return;
m_CurrentUsers.Remove(userID);
}
}
}

27
Assets/Scripts/UI/RelayCodeUI.cs


using TMPro;
using UnityEngine;
namespace LobbyRelaySample.UI
{
/// <summary>
/// Read Only input field (for copy/paste reasons) Watches for the changes in the lobby's Relay Code
/// </summary>
public class RelayCodeUI : ObserverPanel<LocalLobby>
{
[SerializeField]
TMP_InputField relayCodeText;
public override void ObservedUpdated(LocalLobby observed)
{
if (!string.IsNullOrEmpty(observed.RelayCode))
{
relayCodeText.text = observed.RelayCode;
Show();
}
else
{
Hide();
}
}
}
}

26
Assets/Scripts/UI/RoomCodeUI.cs


using TMPro;
namespace LobbyRelaySample.UI
{
/// <summary>
/// Read Only input field (for copy/paste reasons) Watches for the changes in the lobby's Room Code
/// </summary>
public class RoomCodeUI : ObserverPanel<LocalLobby>
{
public TMP_InputField roomCodeText;
public override void ObservedUpdated(LocalLobby observed)
{
if (!string.IsNullOrEmpty(observed.LobbyCode))
{
roomCodeText.text = observed.LobbyCode;
Show();
}
else
{
Hide();
}
}
}
}

16
Assets/Scripts/UI/ServerAddressUI.cs


using TMPro;
using UnityEngine;
namespace LobbyRelaySample.UI
{
public class ServerAddressUI : ObserverPanel<LocalLobby>
{
[SerializeField]
TMP_Text m_IPAddressText;
public override void ObservedUpdated(LocalLobby observed)
{
m_IPAddressText.SetText(observed.RelayServer?.ToString());
}
}
}

16
Assets/Scripts/UI/ServerNameUI.cs


using TMPro;
using UnityEngine;
namespace LobbyRelaySample.UI
{
public class ServerNameUI : ObserverPanel<LocalLobby>
{
[SerializeField]
TMP_Text m_ServerNameText;
public override void ObservedUpdated(LocalLobby observed)
{
m_ServerNameText.SetText(observed.LobbyName);
}
}
}

8
Assets/Scripts/Utilities.meta


fileFormatVersion: 2
guid: 4e59a0c0ec4227344bcc4a4f79c8ac31
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/TempDeleteAllRooms.cs.meta


fileFormatVersion: 2
guid: 0e7b1d59375bdf94795f339fd9395761
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

33
Assets/TempDeleteAllRooms.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Temporary script to allow a user to delete all the rooms they've previously made, so we don't have orphaned empty rooms.
/// </summary>
public class TempDeleteAllRooms : MonoBehaviour
{
private Queue<Unity.Services.Rooms.Models.Room> m_pendingRooms;
public void OnButton()
{
LobbyRelaySample.Lobby.LobbyAPIInterface.QueryAllLobbiesAsync((qr) => { DoDeletes(qr); });
}
private void DoDeletes(Unity.Services.Rooms.Response<Unity.Services.Rooms.Models.QueryResponse> response)
{
if (response != null && response.Status >= 200 && response.Status < 300)
{
StartCoroutine(DeleteCoroutine(response.Result.Results));
}
}
private IEnumerator DeleteCoroutine(List<Unity.Services.Rooms.Models.Room> rooms)
{
foreach (var room in rooms)
{
LobbyRelaySample.Lobby.LobbyAPIInterface.DeleteLobbyAsync(room.Id, null); // The onComplete callback isn't called in some error cases, e.g. a 403 when we don't have permissions, so don't block on it.
yield return new WaitForSeconds(1); // We need to wait a little to avoid 429's, but we might not run an onComplete depending on how the delete call fails.
}
}
}

/Assets/Scripts/UI/JoinCreateRoomUI.cs.meta → /Assets/Scripts/UI/JoinCreateLobbyUI.cs.meta

/Assets/Scripts/UI/LobbyStateVisibilityUI.cs.meta → /Assets/Scripts/UI/ShowWhenLobbyStateUI.cs.meta

/Assets/Scripts/UI/LobbyUserCardUI.cs.meta → /Assets/Scripts/UI/InLobbyUserUI.cs.meta

/Assets/Scripts/UI/LobbyUsersUI.cs.meta → /Assets/Scripts/UI/InLobbyUserList.cs.meta

/Assets/Scripts/UI/RoomCodeUI.cs.meta → /Assets/Scripts/UI/DisplayCodeUI.cs.meta

/Assets/Scripts/UI/ServerAddressUI.cs.meta → /Assets/Scripts/UI/RelayAddressUI.cs.meta

/Assets/Scripts/UI/ServerNameUI.cs.meta → /Assets/Scripts/UI/LobbyNameUI.cs.meta

/Assets/Scripts/UI/StartLobbyButton.cs.meta → /Assets/Scripts/UI/StartLobbyButtonUI.cs.meta

/Assets/Scripts/UI/JoinCreateRoomUI.cs → /Assets/Scripts/UI/JoinCreateLobbyUI.cs

/Assets/Scripts/UI/LobbyUserCardUI.cs → /Assets/Scripts/UI/InLobbyUserUI.cs

/Assets/Scripts/LobbyRooms.asmdef.meta → /Assets/Scripts/LobbyRelaySample.asmdef.meta

/Assets/Scripts/LobbyRooms.asmdef → /Assets/Scripts/LobbyRelaySample.asmdef

/Assets/Scripts/Entities/ReadyCheck.cs → /Assets/Scripts/Lobby/ReadyCheck.cs

/Assets/Scripts/Entities/ReadyCheck.cs.meta → /Assets/Scripts/Lobby/ReadyCheck.cs.meta

/Assets/Scripts/Utilities/NameGenerator.cs → /Assets/Scripts/Auth/NameGenerator.cs

/Assets/Scripts/Utilities/NameGenerator.cs.meta → /Assets/Scripts/Auth/NameGenerator.cs.meta

正在加载...
取消
保存