From bb8dfa07a7c4d1fe1d71ca564806430ea31bfb15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elfi=20K=C3=BChndorf?= Date: Thu, 7 Nov 2024 10:50:08 +0100 Subject: [PATCH 01/20] recreation of vivox scripts from old PR --- .../Assets/Prefabs/Vivox.meta | 8 + .../Assets/Prefabs/Vivox/Vivox.prefab | 813 ++++++++++++++++++ .../Assets/Prefabs/Vivox/Vivox.prefab.meta | 7 + .../Assets/Prefabs/Vivox/VivoxManager.prefab | 48 ++ .../Prefabs/Vivox/VivoxManager.prefab.meta | 7 + .../Scripts/Services/AudioIOController.cs | 55 ++ .../Services/AudioIOController.cs.meta | 2 + .../Assets/Scripts/Services/RosterItem.cs | 60 ++ .../Scripts/Services/RosterItem.cs.meta | 2 + .../Scripts/Services/TextChatManager.cs | 90 ++ .../Scripts/Services/TextChatManager.cs.meta | 2 + ...tiplayer.Samples.SocialHub.Services.asmdef | 3 +- .../Scripts/Services/Update3DPosition.cs | 31 + .../Scripts/Services/Update3DPosition.cs.meta | 2 + .../Assets/Scripts/Services/VivoxManager.cs | 102 +++ .../Scripts/Services/VivoxManager.cs.meta | 2 + 16 files changed, 1233 insertions(+), 1 deletion(-) create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/Vivox.prefab create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/Vivox.prefab.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/VivoxManager.prefab create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/VivoxManager.prefab.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/AudioIOController.cs create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/AudioIOController.cs.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/RosterItem.cs create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/RosterItem.cs.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Update3DPosition.cs create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Update3DPosition.cs.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs.meta diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox.meta b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox.meta new file mode 100644 index 000000000..1adf7ea1e --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a547e3b96c1db794f83e00146d14d6d2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/Vivox.prefab b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/Vivox.prefab new file mode 100644 index 000000000..831e8348e --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/Vivox.prefab @@ -0,0 +1,813 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &297590662636667475 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8707819497847717017} + - component: {fileID: 1137314886201010796} + - component: {fileID: 5059868489389762047} + m_Layer: 0 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8707819497847717017 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297590662636667475} + 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: 6352165028052798557} + 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.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1137314886201010796 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297590662636667475} + m_CullTransparentMesh: 1 +--- !u!114 &5059868489389762047 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297590662636667475} + 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: 0.5} + 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: 2 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enter text... +--- !u!1 &353906806218503536 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6352165028052798557} + - component: {fileID: 6753985245104296889} + - component: {fileID: 4254881510726459112} + - component: {fileID: 6540512562964117375} + m_Layer: 0 + m_Name: ChatInputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6352165028052798557 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353906806218503536} + 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: 8707819497847717017} + - {fileID: 3590039148342149453} + m_Father: {fileID: 5819299865102833708} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -35.5, y: 1.6} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6753985245104296889 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353906806218503536} + m_CullTransparentMesh: 1 +--- !u!114 &4254881510726459112 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353906806218503536} + 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: 10911, 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!114 &6540512562964117375 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353906806218503536} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, 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: 4254881510726459112} + m_TextComponent: {fileID: 1629130836478069290} + m_Placeholder: {fileID: 5059868489389762047} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnSubmit: + m_PersistentCalls: + m_Calls: [] + m_OnDidEndEdit: + m_PersistentCalls: + m_Calls: [] + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 + m_ShouldActivateOnSelect: 1 +--- !u!1 &3518393422949913170 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5819299865102833708} + - component: {fileID: 1896714925012385718} + - component: {fileID: 1403067567439165311} + - component: {fileID: 6539678191054509143} + m_Layer: 0 + m_Name: ChatPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5819299865102833708 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3518393422949913170} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -12.362} + m_LocalScale: {x: 0.25753, y: 0.25753, z: 0.25753} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 6352165028052798557} + - {fileID: 3005017229042581625} + - {fileID: 4322685430459777907} + m_Father: {fileID: 2291838515526219642} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -59.7, y: -20.8} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1896714925012385718 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3518393422949913170} + m_CullTransparentMesh: 1 +--- !u!114 &1403067567439165311 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3518393422949913170} + 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.392} + 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: 10907, 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!114 &6539678191054509143 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3518393422949913170} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 893a7d85794ab094798b16ae014c5d52, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ChatInputField: {fileID: 6540512562964117375} + m_ChatDisplay: {fileID: 8513358137504055403} + m_SendButton: {fileID: 2020347211525253271} +--- !u!1 &3690868602757675492 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 947790431300715747} + m_Layer: 0 + m_Name: Vivox + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &947790431300715747 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3690868602757675492} + serializedVersion: 2 + 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: 2291838515526219642} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &6644335489489757655 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2291838515526219642} + - component: {fileID: 5720347309844080116} + - component: {fileID: 9027958812615142401} + - component: {fileID: 7025427243357502597} + m_Layer: 0 + m_Name: TextChat + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2291838515526219642 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6644335489489757655} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 5819299865102833708} + m_Father: {fileID: 947790431300715747} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!223 &5720347309844080116 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6644335489489757655} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!114 &9027958812615142401 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6644335489489757655} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 3.95 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &7025427243357502597 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6644335489489757655} + 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!1 &7747199782532080614 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3005017229042581625} + - component: {fileID: 6223574270595402541} + - component: {fileID: 8513358137504055403} + m_Layer: 0 + m_Name: ChatDisplayer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3005017229042581625 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7747199782532080614} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.5580264, y: 1.5580264, z: 1.5580264} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 5819299865102833708} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -34.3, y: -96.2} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6223574270595402541 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7747199782532080614} + m_CullTransparentMesh: 1 +--- !u!114 &8513358137504055403 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7747199782532080614} + 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: 13 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 7 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!1 &7889904402414316577 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4322685430459777907} + - component: {fileID: 1133428713922840986} + - component: {fileID: 3363638810533560656} + - component: {fileID: 2020347211525253271} + m_Layer: 0 + m_Name: SendButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4322685430459777907 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7889904402414316577} + 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: 8100498493189202876} + m_Father: {fileID: 5819299865102833708} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 82.1, y: 1.5} + m_SizeDelta: {x: 60, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1133428713922840986 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7889904402414316577} + m_CullTransparentMesh: 1 +--- !u!114 &3363638810533560656 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7889904402414316577} + 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!114 &2020347211525253271 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7889904402414316577} + 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: 3363638810533560656} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &8594114265748236893 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8100498493189202876} + - component: {fileID: 4817236769566130645} + - component: {fileID: 1603157003639485301} + m_Layer: 0 + m_Name: ButtonTextField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8100498493189202876 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8594114265748236893} + 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: 4322685430459777907} + 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 &4817236769566130645 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8594114265748236893} + m_CullTransparentMesh: 1 +--- !u!114 &1603157003639485301 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8594114265748236893} + 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: Send +--- !u!1 &8910697621894641749 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3590039148342149453} + - component: {fileID: 1474901144091743245} + - component: {fileID: 1629130836478069290} + m_Layer: 0 + m_Name: Text (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3590039148342149453 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8910697621894641749} + 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: 6352165028052798557} + 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.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1474901144091743245 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8910697621894641749} + m_CullTransparentMesh: 1 +--- !u!114 &1629130836478069290 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8910697621894641749} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/Vivox.prefab.meta b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/Vivox.prefab.meta new file mode 100644 index 000000000..f2e1060cb --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/Vivox.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b969b35dbbf1722499bb35fa02bf26d2 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/VivoxManager.prefab b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/VivoxManager.prefab new file mode 100644 index 000000000..9995db9a0 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/VivoxManager.prefab @@ -0,0 +1,48 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4141237635811601714 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7448202836938688200} + - component: {fileID: 8855226785007094250} + m_Layer: 0 + m_Name: VivoxManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7448202836938688200 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4141237635811601714} + serializedVersion: 2 + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8855226785007094250 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4141237635811601714} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dde97419ba27cd44bae2dcde9387507b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ParticipantPrefab: {fileID: 0} + m_ParticipantListParent: {fileID: 0} diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/VivoxManager.prefab.meta b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/VivoxManager.prefab.meta new file mode 100644 index 000000000..17b92c905 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/Vivox/VivoxManager.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 53316d28950de8e4494bc48f320e09f6 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/AudioIOController.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/AudioIOController.cs new file mode 100644 index 000000000..79155ac16 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/AudioIOController.cs @@ -0,0 +1,55 @@ +using System; +using Unity.Netcode; +using Unity.Services.Vivox; +using UnityEngine; + +public class AudioIOController : NetworkBehaviour +{ + private Boolean InputMuted, OutputMuted; + + void Start() + { + InputMuted = false; + OutputMuted = false; + } + + void Update() + { + if (IsOwner) + { + // Toggle mute input device + if (Input.GetKeyDown(KeyCode.I)) + { + if (InputMuted) + { + VivoxService.Instance.UnmuteInputDevice(); + Debug.Log("Input Unmuted"); + } + else + { + VivoxService.Instance.MuteInputDevice(); + Debug.Log("Input Muted"); + } + + InputMuted = !InputMuted; + } + + // Toggle mute output device + if (Input.GetKeyDown(KeyCode.O)) + { + if (OutputMuted) + { + VivoxService.Instance.UnmuteOutputDevice(); + Debug.Log("Output Unmuted"); + } + else + { + VivoxService.Instance.MuteOutputDevice(); + Debug.Log("Output Muted"); + } + + OutputMuted = !OutputMuted; + } + } + } +} diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/AudioIOController.cs.meta b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/AudioIOController.cs.meta new file mode 100644 index 000000000..ad05d34ca --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/AudioIOController.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 7be63113c826fa2448a7b2f4fe89ee3d \ No newline at end of file diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/RosterItem.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/RosterItem.cs new file mode 100644 index 000000000..acd2c6243 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/RosterItem.cs @@ -0,0 +1,60 @@ +using System; +using UnityEngine; +using UnityEngine.UI; +using Unity.Services.Vivox; + +public class RosterItem : MonoBehaviour +{ + public VivoxParticipant Participant { get; private set; } + public Text PlayerNameText; + public Image ChatStateImage; + public Sprite MutedImage; + public Sprite SpeakingImage; + public Sprite NotSpeakingImage; + + public void SetupRosterItem(VivoxParticipant participant) + { + Participant = participant; + PlayerNameText.text = Participant.DisplayName; + UpdateChatStateImage(); + Participant.ParticipantMuteStateChanged += OnParticipantMuteStateChanged; + Participant.ParticipantSpeechDetected += OnParticipantSpeechDetected; + } + + private void OnDestroy() + { + if (Participant != null) + { + Participant.ParticipantMuteStateChanged -= OnParticipantMuteStateChanged; + Participant.ParticipantSpeechDetected -= OnParticipantSpeechDetected; + } + } + + private void OnParticipantMuteStateChanged() + { + UpdateChatStateImage(); + } + + private void OnParticipantSpeechDetected() + { + UpdateChatStateImage(); + } + + private void UpdateChatStateImage() + { + if (Participant.IsMuted) + { + ChatStateImage.sprite = MutedImage; + ChatStateImage.gameObject.transform.localScale = Vector3.one; + } + else if (Participant.SpeechDetected) + { + ChatStateImage.sprite = SpeakingImage; + ChatStateImage.gameObject.transform.localScale = Vector3.one; + } + else + { + ChatStateImage.sprite = NotSpeakingImage; + } + } +} diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/RosterItem.cs.meta b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/RosterItem.cs.meta new file mode 100644 index 000000000..bc07201ec --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/RosterItem.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 52384e143e7c8694c8859af492d7d78e \ No newline at end of file diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs new file mode 100644 index 000000000..60594a4c0 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs @@ -0,0 +1,90 @@ +using System; +using Unity.Services.Vivox; +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.InputSystem; + +namespace Services +{ + public class TextChatManager : MonoBehaviour + { + public InputField m_ChatInputField; + public Text m_ChatDisplay; + public Button m_SendButton; + + readonly string currentChannel = VivoxManager.Instance.SessionName; + bool isChatActive = true; + InputAction toggleChatAction; + + void Awake() + { + // Initialize the new input action + toggleChatAction = new InputAction("ToggleChat", binding: "/slash"); + toggleChatAction.performed += ctx => ToggleChat(); + toggleChatAction.Enable(); + } + + void Start() + { + m_SendButton.onClick.AddListener(SendMessage); + m_ChatInputField.onEndEdit.AddListener(OnChatInputEndEdit); + + BindSessionEvents(true); + } + + void OnDestroy() + { + toggleChatAction.Disable(); + m_SendButton.onClick.RemoveListener(SendMessage); + m_ChatInputField.onEndEdit.RemoveListener(OnChatInputEndEdit); + BindSessionEvents(false); + } + + private void ToggleChat() + { + isChatActive = !isChatActive; + m_ChatInputField.enabled = isChatActive; + m_SendButton.enabled = isChatActive; + Debug.Log("Chat: " + (isChatActive ? "Activated" : "Disabled")); + } + + private async void SendMessage() + { + if (!string.IsNullOrEmpty(m_ChatInputField.text)) + { + await VivoxService.Instance.SendChannelTextMessageAsync(currentChannel, m_ChatInputField.text); + m_ChatInputField.text = ""; + } + } + + // Modified to use new input system key detection + private void OnChatInputEndEdit(string input) + { + if (Keyboard.current.enterKey.isPressed) + { + SendMessage(); + } + } + + private void BindSessionEvents(bool doBind) + { + if (doBind) + { + VivoxService.Instance.ChannelMessageReceived += OnChannelMessageReceived; + } + else + { + VivoxService.Instance.ChannelMessageReceived -= OnChannelMessageReceived; + } + } + + private void OnChannelMessageReceived(VivoxMessage message) + { + var senderDisplayName = message.SenderDisplayName; + var messageText = message.MessageText; + + m_ChatDisplay.text += $"{senderDisplayName}: {messageText}\n"; + } + } +} + diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs.meta b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs.meta new file mode 100644 index 000000000..8c1abf7d2 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 893a7d85794ab094798b16ae014c5d52 \ No newline at end of file diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Unity.Multiplayer.Samples.SocialHub.Services.asmdef b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Unity.Multiplayer.Samples.SocialHub.Services.asmdef index 75876aea7..2adb0fab0 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Unity.Multiplayer.Samples.SocialHub.Services.asmdef +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Unity.Multiplayer.Samples.SocialHub.Services.asmdef @@ -7,7 +7,8 @@ "GUID:37e17ffe38d86ae48bc3207e83ffef88", "GUID:6087a74f6015aae4daed9a2577a7596c", "GUID:1491147abca9d7d4bb7105af628b223e", - "GUID:707bb6c7c4ef140eeac239b4f8251af8" + "GUID:707bb6c7c4ef140eeac239b4f8251af8", + "GUID:75469ad4d38634e559750d17036d5f7c" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Update3DPosition.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Update3DPosition.cs new file mode 100644 index 000000000..5b1f0dc47 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Update3DPosition.cs @@ -0,0 +1,31 @@ +using Services; +using Unity.Services.Vivox; +using UnityEngine; +using Unity.Netcode; + +public class Update3DPosition : NetworkBehaviour +{ + private float m_NextPosUpdate; + private string m_ChannelName; + + void Start() + { + while (VivoxManager.Instance == null) {}; + + m_ChannelName = VivoxManager.Instance.SessionName; + m_NextPosUpdate = Time.time + 3.0f; // wait 3 seconds to give a chance for player to join channel + } + + void Update() + { + if (IsOwner) + { + if (Time.time > m_NextPosUpdate) + { + VivoxService.Instance.Set3DPosition(gameObject, m_ChannelName); + m_NextPosUpdate += 0.3f; // update position every 0.3s + } + } + + } +} diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Update3DPosition.cs.meta b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Update3DPosition.cs.meta new file mode 100644 index 000000000..fbcaf0224 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/Update3DPosition.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: dc19866e2574667468b7327d51439287 \ No newline at end of file diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs new file mode 100644 index 000000000..207bfc970 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs @@ -0,0 +1,102 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; +using Unity.Services.Vivox; + +namespace Services +{ + public class VivoxManager : MonoBehaviour + { + private List m_RosterItems = new List(); + public GameObject m_ParticipantPrefab; // Assign this in the Inspector + public Transform m_ParticipantListParent; // Assign this in the Inspector + + public static VivoxManager Instance { get; private set; } + + public static string PlayerProfileName { get; private set; } + public string SessionName { get; set; } + + private void Awake() + { + if (Instance == null) + { + Instance = this; + DontDestroyOnLoad(gameObject); + } + else + { + Destroy(gameObject); + } + } + + public async Task InitializeVivoxAsync(string playerName) + { + PlayerProfileName = playerName; + await VivoxService.Instance.InitializeAsync(); + await LoginToVivoxAsync(); + } + + private async Task LoginToVivoxAsync() + { + LoginOptions options = new LoginOptions(); + options.DisplayName = "Player_" + PlayerProfileName; + options.EnableTTS = false; + VivoxService.Instance.LoggedIn += LoggedInToVivox; + await VivoxService.Instance.LoginAsync(options); + } + + public async void JoinChannel(string channelName) + { + SessionName = channelName; + var channelOptions = new ChannelOptions(); + + await VivoxService.Instance.JoinPositionalChannelAsync(channelName, ChatCapability.TextAndAudio, + new Channel3DProperties(), channelOptions); + + VivoxService.Instance.Set3DPosition(m_ParticipantPrefab, channelName); + + Debug.Log("Joined text and audio channel"); + } + + void LoggedInToVivox() + { + Debug.Log(nameof(LoggedInToVivox)); + } + + private void BindSessionEvents(bool doBind) + { + if(doBind) + { + VivoxService.Instance.ParticipantAddedToChannel += onParticipantAddedToChannel; + VivoxService.Instance.ParticipantRemovedFromChannel += onParticipantRemovedFromChannel; + } + else + { + VivoxService.Instance.ParticipantAddedToChannel -= onParticipantAddedToChannel; + VivoxService.Instance.ParticipantRemovedFromChannel -= onParticipantRemovedFromChannel; + } + } + + private void onParticipantAddedToChannel(VivoxParticipant participant) + { + var participantGO = Instantiate(m_ParticipantPrefab, m_ParticipantListParent); + var participantComponent = participantGO.GetComponent(); + participantComponent.SetupRosterItem(participant); + //RosterItem newRosterItem = new RosterItem(); + //newRosterItem.SetupRosterItem(participant); + m_RosterItems.Add(participantComponent); + } + + private void onParticipantRemovedFromChannel(VivoxParticipant participant) + { + var participantToRemove = m_RosterItems.Find(p => p.Participant.PlayerId == participant.PlayerId); + if (participantToRemove != null) + { + m_RosterItems.Remove(participantToRemove); + Destroy(participantToRemove.gameObject); + } + /*RosterItem rosterItemToRemove = m_RosterItems.FirstOrDefault(p => p.Participant.PlayerId == participant.PlayerId); + m_RosterItems.Remove(rosterItemToRemove);*/ + } + } +} diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs.meta b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs.meta new file mode 100644 index 000000000..be0ec1b8c --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: dde97419ba27cd44bae2dcde9387507b \ No newline at end of file From 99c892d9d671211bdb0b2a9ccb3c8a2cfd96839b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elfi=20K=C3=BChndorf?= Date: Thu, 7 Nov 2024 11:30:14 +0100 Subject: [PATCH 02/20] updating ServiceHelper to join channel --- .../Assets/Scripts/Services/ServicesHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs index 5da7c9dc9..d696efe41 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs @@ -1,5 +1,6 @@ using System; using System.Threading.Tasks; +using Services; using Unity.Multiplayer.Samples.SocialHub.GameManagement; using Unity.Netcode; using Unity.Services.Authentication; @@ -143,6 +144,7 @@ static string GetRandomString(int length) void LoggedInToVivox() { Debug.Log(nameof(LoggedInToVivox)); + VivoxManager.Instance.JoinChannel(AuthenticationService.Instance.Profile); } async Task SignIn() From b40e0aaee991c57d17ea5ab9e1ff7daafb10000e Mon Sep 17 00:00:00 2001 From: Robert Hammerle Date: Mon, 11 Nov 2024 15:29:35 +0100 Subject: [PATCH 03/20] wip: Enable Vivox, voice and text working somehow without UI atm --- .../Assets/Prefabs/UI/IngameUI.prefab | 63 ++++++++++++++++ .../Assets/Scripts/Services/ServicesHelper.cs | 31 ++------ .../Scripts/Services/TextChatManager.cs | 74 ++++++++++++------- .../Assets/Scripts/Services/VivoxManager.cs | 37 ++++------ 4 files changed, 130 insertions(+), 75 deletions(-) diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/UI/IngameUI.prefab b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/UI/IngameUI.prefab index 07f1da6df..c66304a20 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/UI/IngameUI.prefab +++ b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/UI/IngameUI.prefab @@ -227,6 +227,7 @@ Transform: - {fileID: 2256034313796960807} - {fileID: 7559383771208540613} - {fileID: 8481058004063830698} + - {fileID: 77922382870540915} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &5231826839060252271 @@ -378,3 +379,65 @@ MonoBehaviour: m_PanelMaxSize: 1 m_DisplayYOffset: 1.8 m_Camera: {fileID: 0} +--- !u!1001 &7370564076831077563 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 8617889547341104717} + m_Modifications: + - target: {fileID: 4141237635811601714, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_Name + value: VivoxManager + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} +--- !u!4 &77922382870540915 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + m_PrefabInstance: {fileID: 7370564076831077563} + m_PrefabAsset: {fileID: 0} diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs index d696efe41..75160dad0 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs @@ -107,27 +107,12 @@ void SignInFailed(RequestFailedException obj) Debug.LogWarning($"{nameof(SignedIn)} obj.ErrorCode {obj.ErrorCode}"); } - void SignedIn() + async void SignedIn() { - if (m_InitiateVivoxOnAuthentication) - { - LogInToVivox(); - } - } - async void LogInToVivox() - { - await VivoxService.Instance.InitializeAsync(); - - var options = new LoginOptions - { - DisplayName = AuthenticationService.Instance.Profile, - EnableTTS = true - }; - VivoxService.Instance.LoggedIn += LoggedInToVivox; - await VivoxService.Instance.LoginAsync(options); } + static string GetRandomString(int length) { var r = new System.Random(); @@ -141,12 +126,6 @@ static string GetRandomString(int length) return new string(result); } - void LoggedInToVivox() - { - Debug.Log(nameof(LoggedInToVivox)); - VivoxManager.Instance.JoinChannel(AuthenticationService.Instance.Profile); - } - async Task SignIn() { try @@ -199,6 +178,12 @@ async Task ConnectThroughLiveService(string sessionName) m_CurrentSession = await MultiplayerService.Instance.CreateOrJoinSessionAsync(sessionName, options); m_CurrentSession.RemovedFromSession += RemovedFromSession; m_CurrentSession.StateChanged += CurrentSessionOnStateChanged; + + if (m_InitiateVivoxOnAuthentication) + { + await VivoxService.Instance.InitializeAsync(); + VivoxManager.Instance.JoinChannel(m_CurrentSession.Id); + } } catch (Exception e) { diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs index 60594a4c0..fc531c95c 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs @@ -1,23 +1,32 @@ using System; +using System.Collections.Generic; using Unity.Services.Vivox; using UnityEngine; -using UnityEngine.UI; using UnityEngine.InputSystem; +using UnityEngine.UIElements; namespace Services { public class TextChatManager : MonoBehaviour { - public InputField m_ChatInputField; - public Text m_ChatDisplay; - public Button m_SendButton; + [SerializeField] + VisualTreeAsset m_Asset; + + ListView m_MessageView; + TextField m_MessageInputField; + Button m_SendButton; - readonly string currentChannel = VivoxManager.Instance.SessionName; bool isChatActive = true; InputAction toggleChatAction; + [SerializeField, HideInInspector] + List m_Messages = new List(); + + + void Awake() { + // Initialize the new input action toggleChatAction = new InputAction("ToggleChat", binding: "/slash"); toggleChatAction.performed += ctx => ToggleChat(); @@ -26,47 +35,53 @@ void Awake() void Start() { - m_SendButton.onClick.AddListener(SendMessage); - m_ChatInputField.onEndEdit.AddListener(OnChatInputEndEdit); + var uiDoc = GetComponent(); + m_MessageView = new ListView(); + m_MessageInputField = new TextField(); + m_SendButton = new Button(); + + uiDoc.rootVisualElement.Add(m_MessageView); + uiDoc.rootVisualElement.Add(m_MessageInputField); + uiDoc.rootVisualElement.Add(m_SendButton); + + m_MessageView.makeItem = () => + { + return new Label(); + }; + + m_MessageView.bindItem = (element, i) => + { + ((Label)(element)).text = m_Messages[i]; + }; - BindSessionEvents(true); + m_MessageView.dataSource = m_Messages; + + m_SendButton.clicked += SendMessage; + // BindSessionEvents(true); } void OnDestroy() { toggleChatAction.Disable(); - m_SendButton.onClick.RemoveListener(SendMessage); - m_ChatInputField.onEndEdit.RemoveListener(OnChatInputEndEdit); + m_SendButton.clicked -= SendMessage; BindSessionEvents(false); } private void ToggleChat() { isChatActive = !isChatActive; - m_ChatInputField.enabled = isChatActive; - m_SendButton.enabled = isChatActive; - Debug.Log("Chat: " + (isChatActive ? "Activated" : "Disabled")); } private async void SendMessage() { - if (!string.IsNullOrEmpty(m_ChatInputField.text)) + if (!string.IsNullOrEmpty(m_MessageInputField.text)) { - await VivoxService.Instance.SendChannelTextMessageAsync(currentChannel, m_ChatInputField.text); - m_ChatInputField.text = ""; + await VivoxService.Instance.SendChannelTextMessageAsync(VivoxManager.Instance.SessionName, m_MessageInputField.value); + m_MessageInputField.value = ""; } } - // Modified to use new input system key detection - private void OnChatInputEndEdit(string input) - { - if (Keyboard.current.enterKey.isPressed) - { - SendMessage(); - } - } - - private void BindSessionEvents(bool doBind) + public void BindSessionEvents(bool doBind) { if (doBind) { @@ -82,8 +97,11 @@ private void OnChannelMessageReceived(VivoxMessage message) { var senderDisplayName = message.SenderDisplayName; var messageText = message.MessageText; - - m_ChatDisplay.text += $"{senderDisplayName}: {messageText}\n"; + m_Messages.Add($"{senderDisplayName}: {messageText}"); + foreach (var se in m_Messages) + { + Debug.Log(se+"\n"); + } } } } diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs index 207bfc970..bbfa26a57 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/VivoxManager.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Unity.Multiplayer.Samples.SocialHub.Services; using UnityEngine; using Unity.Services.Vivox; @@ -16,8 +17,10 @@ public class VivoxManager : MonoBehaviour public static string PlayerProfileName { get; private set; } public string SessionName { get; set; } - private void Awake() + private async void Awake() { + + if (Instance == null) { Instance = this; @@ -29,39 +32,25 @@ private void Awake() } } - public async Task InitializeVivoxAsync(string playerName) - { - PlayerProfileName = playerName; - await VivoxService.Instance.InitializeAsync(); - await LoginToVivoxAsync(); - } - - private async Task LoginToVivoxAsync() - { - LoginOptions options = new LoginOptions(); - options.DisplayName = "Player_" + PlayerProfileName; - options.EnableTTS = false; - VivoxService.Instance.LoggedIn += LoggedInToVivox; - await VivoxService.Instance.LoginAsync(options); - } - public async void JoinChannel(string channelName) { SessionName = channelName; var channelOptions = new ChannelOptions(); - await VivoxService.Instance.JoinPositionalChannelAsync(channelName, ChatCapability.TextAndAudio, - new Channel3DProperties(), channelOptions); + // await VivoxService.Instance.JoinPositionalChannelAsync(channelName, ChatCapability.TextAndAudio, + // new Channel3DProperties(), channelOptions); + // + + + await VivoxService.Instance.JoinGroupChannelAsync(channelName, ChatCapability.TextAndAudio, channelOptions); - VivoxService.Instance.Set3DPosition(m_ParticipantPrefab, channelName); + //VivoxService.Instance.Set3DPosition(m_ParticipantPrefab, channelName); + GetComponent().BindSessionEvents(true); Debug.Log("Joined text and audio channel"); } - void LoggedInToVivox() - { - Debug.Log(nameof(LoggedInToVivox)); - } + private void BindSessionEvents(bool doBind) { From 62e236bcd0daa3afc74c47bddd0e5d8380278170 Mon Sep 17 00:00:00 2001 From: Robert Hammerle Date: Wed, 13 Nov 2024 15:30:27 +0100 Subject: [PATCH 04/20] wip: textchat working --- .../Assets/Prefabs/UI/IngameUI.prefab | 105 ++--- .../Assets/Scenes/Bootstrap.unity | 67 ++- .../Assets/Scenes/HubScene_TownMarket.unity | 58 +++ .../Assets/Scenes/TempTextChat.unity | 413 ++++++++++++++++++ .../Assets/Scenes/TempTextChat.unity.meta | 7 + .../Assets/Scripts/Services/ServicesHelper.cs | 20 +- .../Scripts/Services/TextChatManager.cs | 90 ++-- .../Assets/Scripts/Services/VivoxManager.cs | 16 +- .../Assets/Scripts/UI/IngameUI/UIUtils.cs | 3 + .../Assets/UI/ScreenspacePanelSettings.asset | 2 +- .../Assets/UI/Uss/Global.uss | 45 +- .../Assets/UI/Uss/HomeScreen.uss | 18 - .../Assets/UI/Uss/Ingame.uss | 72 ++- .../Assets/UI/Uxml/Ingame/IngameMenu.uxml | 2 +- .../UI/Uxml/Ingame/ScreenspaceContainer.uxml | 1 + .../Assets/UI/Uxml/Ingame/TextChat.meta | 8 + .../UI/Uxml/Ingame/TextChat/ChatUI.uxml | 14 + .../UI/Uxml/Ingame/TextChat/ChatUI.uxml.meta | 10 + .../UI/Uxml/Ingame/TextChat/MessageItem.uxml | 16 + .../Ingame/TextChat/MessageItem.uxml.meta | 10 + 20 files changed, 829 insertions(+), 148 deletions(-) create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scenes/TempTextChat.unity create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/Scenes/TempTextChat.unity.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/UI/Uxml/Ingame/TextChat.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/UI/Uxml/Ingame/TextChat/ChatUI.uxml create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/UI/Uxml/Ingame/TextChat/ChatUI.uxml.meta create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/UI/Uxml/Ingame/TextChat/MessageItem.uxml create mode 100644 Basic/DistributedAuthoritySocialHub/Assets/UI/Uxml/Ingame/TextChat/MessageItem.uxml.meta diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/UI/IngameUI.prefab b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/UI/IngameUI.prefab index c66304a20..aa7738785 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/UI/IngameUI.prefab +++ b/Basic/DistributedAuthoritySocialHub/Assets/Prefabs/UI/IngameUI.prefab @@ -227,7 +227,7 @@ Transform: - {fileID: 2256034313796960807} - {fileID: 7559383771208540613} - {fileID: 8481058004063830698} - - {fileID: 77922382870540915} + - {fileID: 6866794867799222920} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &5231826839060252271 @@ -379,65 +379,50 @@ MonoBehaviour: m_PanelMaxSize: 1 m_DisplayYOffset: 1.8 m_Camera: {fileID: 0} ---- !u!1001 &7370564076831077563 -PrefabInstance: +--- !u!1 &8792977535300992051 +GameObject: m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 8617889547341104717} - m_Modifications: - - target: {fileID: 4141237635811601714, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_Name - value: VivoxManager - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} ---- !u!4 &77922382870540915 stripped + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6866794867799222920} + - component: {fileID: 2710521362083790645} + m_Layer: 0 + m_Name: TextChatUI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6866794867799222920 Transform: - m_CorrespondingSourceObject: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} - m_PrefabInstance: {fileID: 7370564076831077563} + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8792977535300992051} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 9.600002, y: -5.4000006, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8617889547341104717} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2710521362083790645 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8792977535300992051} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 893a7d85794ab094798b16ae014c5d52, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIDocument: {fileID: 436460152536684898} + m_Asset: {fileID: 9197481963319205126, guid: e47914746c33245118570e272f51690a, type: 3} + m_Messages: [] diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scenes/Bootstrap.unity b/Basic/DistributedAuthoritySocialHub/Assets/Scenes/Bootstrap.unity index b1bafbd5c..b0ab01ef5 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Scenes/Bootstrap.unity +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scenes/Bootstrap.unity @@ -42,7 +42,8 @@ RenderSettings: --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 12 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 m_GISettings: serializedVersion: 2 m_BounceScale: 1 @@ -147,7 +148,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b5134217b751de44fb27f189c7ef29e2, type: 3} m_Name: m_EditorClassIdentifier: - m_AutoAuthenticateOnStart: 1 m_InitiateVivoxOnAuthentication: 1 --- !u!4 &340021862 Transform: @@ -223,6 +223,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 593a2fe42fa9d37498c96f9a383b6521, type: 3} m_Name: m_EditorClassIdentifier: + NetworkManagerExpanded: 0 NetworkConfig: ProtocolVersion: 0 NetworkTransport: {fileID: 900326968} @@ -246,8 +247,8 @@ MonoBehaviour: SpawnTimeout: 10 EnableNetworkLogs: 1 NetworkTopology: 1 - UseCMBService: 0 - AutoSpawnPlayerPrefabClientSide: 1 + UseCMBService: 1 + AutoSpawnPlayerPrefabClientSide: 0 NetworkMessageMetrics: 1 NetworkProfilingMetrics: 1 OldPrefabList: [] @@ -268,9 +269,67 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1257184425 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4141237635811601714, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_Name + value: VivoxManager + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 340021862} - {fileID: 900326970} + - {fileID: 1257184425} diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scenes/HubScene_TownMarket.unity b/Basic/DistributedAuthoritySocialHub/Assets/Scenes/HubScene_TownMarket.unity index 89e842ce0..dbfa62ded 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Scenes/HubScene_TownMarket.unity +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scenes/HubScene_TownMarket.unity @@ -465,6 +465,63 @@ MonoBehaviour: m_LightCookieSize: {x: 1, y: 1} m_LightCookieOffset: {x: 0, y: 0} m_SoftShadowQuality: 0 +--- !u!1001 &387878127 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4141237635811601714, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_Name + value: VivoxManager + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7448202836938688200, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 53316d28950de8e4494bc48f320e09f6, type: 3} --- !u!1001 &406782382 PrefabInstance: m_ObjectHideFlags: 0 @@ -291126,3 +291183,4 @@ SceneRoots: - {fileID: 735923504} - {fileID: 8089728398451373915} - {fileID: 2053309536} + - {fileID: 387878127} diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scenes/TempTextChat.unity b/Basic/DistributedAuthoritySocialHub/Assets/Scenes/TempTextChat.unity new file mode 100644 index 000000000..f585b1249 --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scenes/TempTextChat.unity @@ -0,0 +1,413 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 10 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &332897398 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 332897400} + - component: {fileID: 332897399} + - component: {fileID: 332897401} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &332897399 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 332897398} + m_Enabled: 1 + serializedVersion: 11 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ForceVisible: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 +--- !u!4 &332897400 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 332897398} + serializedVersion: 2 + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!114 &332897401 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 332897398} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 3 + m_UsePipelineSettings: 1 + m_AdditionalLightsShadowResolutionTier: 2 + m_LightLayerMask: 1 + m_RenderingLayers: 1 + m_CustomShadowLayers: 0 + m_ShadowLayerMask: 1 + m_ShadowRenderingLayers: 1 + m_LightCookieSize: {x: 1, y: 1} + m_LightCookieOffset: {x: 0, y: 0} + m_SoftShadowQuality: 0 +--- !u!1 &500268212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 500268215} + - component: {fileID: 500268214} + - component: {fileID: 500268213} + m_Layer: 0 + m_Name: UIDocument + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &500268213 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 500268212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 893a7d85794ab094798b16ae014c5d52, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIDocument: {fileID: 500268214} + m_Asset: {fileID: 9197481963319205126, guid: e47914746c33245118570e272f51690a, type: 3} + m_Messages: + - wefwefwefwefwef + - a + - w + - we + - wer +--- !u!114 &500268214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 500268212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_PanelSettings: {fileID: 11400000, guid: f87c14ce92c804cf2a078e05e3ee2019, type: 2} + m_ParentUI: {fileID: 0} + sourceAsset: {fileID: 9197481963319205126, guid: e289958644d344faca163735e9292679, type: 3} + m_SortingOrder: 0 + m_WorldSpaceSizeMode: 1 + m_WorldSpaceWidth: 1920 + m_WorldSpaceHeight: 1080 +--- !u!4 &500268215 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 500268212} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 854.5, y: 480.5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &916919351 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 916919354} + - component: {fileID: 916919353} + - component: {fileID: 916919352} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &916919352 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 916919351} + m_Enabled: 1 +--- !u!20 &916919353 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 916919351} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &916919354 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 916919351} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 916919354} + - {fileID: 332897400} + - {fileID: 500268215} diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scenes/TempTextChat.unity.meta b/Basic/DistributedAuthoritySocialHub/Assets/Scenes/TempTextChat.unity.meta new file mode 100644 index 000000000..c82630c3e --- /dev/null +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scenes/TempTextChat.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ef65e551c80e64f66bb1714e1d38686f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs index 75160dad0..b19974fb7 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/ServicesHelper.cs @@ -8,6 +8,7 @@ using Unity.Services.Multiplayer; using Unity.Services.Vivox; using UnityEngine; +using UnityEngine.UIElements; namespace Unity.Multiplayer.Samples.SocialHub.Services { @@ -134,6 +135,7 @@ async Task SignIn() AuthenticationService.Instance.SignedIn += SignedIn; AuthenticationService.Instance.SwitchProfile(GetRandomString(5)); await AuthenticationService.Instance.SignInAnonymouslyAsync(); + Debug.Log($"Signed in anonymously before. Name: {name}. ID: {AuthenticationService.Instance.PlayerName}"); } catch (Exception e) { @@ -155,6 +157,7 @@ async Task ConnectToSession(string playerName, string sessionName) } await AuthenticationService.Instance.UpdatePlayerNameAsync(playerName); + Debug.Log($"Signed in anonymously after. Name: {name}. ID: {AuthenticationService.Instance.PlayerName}"); if (string.IsNullOrEmpty(sessionName)) { @@ -172,18 +175,27 @@ async Task ConnectThroughLiveService(string sessionName) var options = new SessionOptions() { Name = sessionName, + MaxPlayers = 64, }.WithDistributedAuthorityNetwork(); - m_CurrentSession = await MultiplayerService.Instance.CreateOrJoinSessionAsync(sessionName, options); - m_CurrentSession.RemovedFromSession += RemovedFromSession; - m_CurrentSession.StateChanged += CurrentSessionOnStateChanged; + if (m_InitiateVivoxOnAuthentication) { await VivoxService.Instance.InitializeAsync(); - VivoxManager.Instance.JoinChannel(m_CurrentSession.Id); + var loginOptions = new LoginOptions() + { + DisplayName = AuthenticationService.Instance.PlayerName, + PlayerId = AuthenticationService.Instance.PlayerId, + }; + await VivoxService.Instance.LoginAsync(loginOptions); } + + m_CurrentSession = await MultiplayerService.Instance.CreateOrJoinSessionAsync(sessionName, options); + VivoxManager.Instance.JoinChannel(m_CurrentSession.Id); + m_CurrentSession.RemovedFromSession += RemovedFromSession; + m_CurrentSession.StateChanged += CurrentSessionOnStateChanged; } catch (Exception e) { diff --git a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs index fc531c95c..a6ed7eccb 100644 --- a/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs +++ b/Basic/DistributedAuthoritySocialHub/Assets/Scripts/Services/TextChatManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Unity.Properties; using Unity.Services.Vivox; using UnityEngine; using UnityEngine.InputSystem; @@ -9,6 +10,9 @@ namespace Services { public class TextChatManager : MonoBehaviour { + [SerializeField] + UIDocument m_UIDocument; + [SerializeField] VisualTreeAsset m_Asset; @@ -19,10 +23,10 @@ public class TextChatManager : MonoBehaviour bool isChatActive = true; InputAction toggleChatAction; - [SerializeField, HideInInspector] - List m_Messages = new List(); - - + [SerializeField] + readonly List m_Messages = new List(); + VisualElement m_Root; + VisualElement m_TextChatView; void Awake() { @@ -35,29 +39,19 @@ void Awake() void Start() { - var uiDoc = GetComponent(); - m_MessageView = new ListView(); - m_MessageInputField = new TextField(); - m_SendButton = new Button(); - - uiDoc.rootVisualElement.Add(m_MessageView); - uiDoc.rootVisualElement.Add(m_MessageInputField); - uiDoc.rootVisualElement.Add(m_SendButton); - - m_MessageView.makeItem = () => - { - return new Label(); - }; - - m_MessageView.bindItem = (element, i) => - { - ((Label)(element)).text = m_Messages[i]; - }; - - m_MessageView.dataSource = m_Messages; - + m_Root = m_UIDocument.rootVisualElement.Q("textchat-container"); + m_Asset.CloneTree(m_Root); + m_TextChatView = m_Root.Q("text-chat"); + m_MessageView = m_Root.Q("message-list"); + m_SendButton = m_Root.Q