当前提交
4f570a1a
共有 68 个文件被更改,包括 5473 次插入 和 2455 次删除
-
14Assets/Art/Crown/Crown.png.meta
-
10Assets/Prefabs/UI/BackButtonBG.prefab
-
14Assets/Prefabs/UI/CreateContent.prefab
-
787Assets/Prefabs/UI/GameCanvas.prefab
-
356Assets/Prefabs/UI/JoinContent.prefab
-
166Assets/Prefabs/UI/JoinCreateCanvas.prefab
-
7Assets/Prefabs/UI/LobbyButtonUI.prefab
-
36Assets/Prefabs/UI/LobbyCodeCanvas.prefab
-
536Assets/Prefabs/UI/LobbyGameCanvas.prefab
-
356Assets/Prefabs/UI/LobbyUserList.prefab
-
19Assets/Prefabs/UI/MainMenuCanvas.prefab
-
44Assets/Prefabs/UI/PlayerInteractionPanel.prefab
-
4Assets/Prefabs/UI/PopUpUI.prefab
-
26Assets/Prefabs/UI/RelayCodeCanvas.prefab
-
18Assets/Prefabs/UI/RenameCanvas.prefab
-
10Assets/Prefabs/UI/RenamePopup.prefab
-
902Assets/Prefabs/UI/UserCardPanel.prefab
-
818Assets/Scenes/mainScene.unity
-
92Assets/Scripts/Game/GameManager.cs
-
29Assets/Scripts/Game/LobbyUser.cs
-
3Assets/Scripts/Infrastructure/Messenger.cs
-
12Assets/Scripts/Lobby/LobbyAPIInterface.cs
-
79Assets/Scripts/Lobby/LobbyAsyncRequests.cs
-
13Assets/Scripts/Lobby/LobbyContentHeartbeat.cs
-
4Assets/Scripts/LobbyRelaySample.asmdef
-
23Assets/Scripts/Relay/RelayUtpClient.cs
-
19Assets/Scripts/Relay/RelayUtpHost.cs
-
2Assets/Scripts/Relay/RelayUtpSetup.cs
-
9Assets/Scripts/UI/InLobbyUserUI.cs
-
5Assets/Scripts/UI/JoinMenuUI.cs
-
2Assets/Scripts/UI/RecolorForLobbyType.cs
-
2Packages/manifest.json
-
24Packages/packages-lock.json
-
999~Documentation/Images/1_lobby_list.PNG
-
999~Documentation/Images/2_lobby.PNG
-
8Assets/Art/Borders.meta
-
8Assets/Art/Volume.meta
-
120Assets/Prefabs/UI/LogManager.prefab
-
7Assets/Prefabs/UI/LogManager.prefab.meta
-
28Assets/Scripts/Game/LobbyUserAudio.cs
-
11Assets/Scripts/Game/LobbyUserAudio.cs.meta
-
69Assets/Scripts/UI/LobbyUserVolumeUI.cs
-
11Assets/Scripts/UI/LobbyUserVolumeUI.cs.meta
-
8Assets/Scripts/Vivox.meta
-
15Assets/Art/Borders/roundRect_fillBottom.png
-
14Assets/Art/Borders/roundRect.png
-
108Assets/Art/Borders/roundRect.png.meta
-
108Assets/Art/Borders/roundRect_fillBottom.png.meta
-
67Assets/Art/Volume/volumeRings.png
-
108Assets/Art/Volume/volumeRings.png.meta
-
23Assets/Art/Volume/volumeSpeaker.png
-
108Assets/Art/Volume/volumeSpeaker.png.meta
-
12Assets/Art/Volume/micIcon.png
-
29Assets/Art/Volume/mutedIcon.png
-
96Assets/Art/Volume/mutedIcon.png.meta
-
96Assets/Art/Volume/micIcon.png.meta
-
11Assets/Scripts/Vivox/VivoxSetup.cs.meta
-
11Assets/Scripts/Vivox/VivoxUserHandler.cs.meta
-
112Assets/Scripts/Vivox/VivoxSetup.cs
-
162Assets/Scripts/Vivox/VivoxUserHandler.cs
-
38ProjectSettings/Packages/com.unity.services.vivox/Settings.json
-
94Assets/Prefabs/UI/JoiningGamePopUp.prefab
-
7Assets/Prefabs/UI/JoiningGamePopUp.prefab.meta
787
Assets/Prefabs/UI/GameCanvas.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
902
Assets/Prefabs/UI/UserCardPanel.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
818
Assets/Scenes/mainScene.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
999
~Documentation/Images/1_lobby_list.PNG
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
999
~Documentation/Images/2_lobby.PNG
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 86db93d1f566ace4980689b0b9a0946f |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c315c6e928cad71408999266f828ce5c |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &8425041362224744844 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 8425041362224744849} |
|||
- component: {fileID: 8425041362224744848} |
|||
- component: {fileID: 8425041362224744851} |
|||
- component: {fileID: 8425041362224744850} |
|||
- component: {fileID: 8425041362224744845} |
|||
m_Layer: 5 |
|||
m_Name: LogManager |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &8425041362224744849 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8425041362224744844} |
|||
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_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 0, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0, y: 0} |
|||
--- !u!223 &8425041362224744848 |
|||
Canvas: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8425041362224744844} |
|||
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_AdditionalShaderChannelsFlag: 25 |
|||
m_SortingLayerID: 0 |
|||
m_SortingOrder: 1 |
|||
m_TargetDisplay: 0 |
|||
--- !u!114 &8425041362224744851 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8425041362224744844} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_UiScaleMode: 1 |
|||
m_ReferencePixelsPerUnit: 100 |
|||
m_ScaleFactor: 1 |
|||
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 &8425041362224744850 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8425041362224744844} |
|||
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!114 &8425041362224744845 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8425041362224744844} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 089231d71bcfb8d479b4f8b778b1026f, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_editorLogVerbosity: 0 |
|||
m_popUpPrefab: {fileID: 2974111728825125460, guid: 79d6084439b78bb4eaf5232cb953fd87, type: 3} |
|||
m_errorReaction: |
|||
m_logMessageCallback: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|
|||
fileFormatVersion: 2 |
|||
guid: 35249394896e31643ba0641c2a6f8e8d |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
|
|||
namespace LobbyRelaySample |
|||
{ |
|||
[SerializeField] |
|||
public class LobbyUserAudio |
|||
{ |
|||
public string ID { get; private set; } |
|||
public bool HasVoice { get; set; } |
|||
public bool Muted { get; set; } |
|||
|
|||
// We should explicitly ensure that UserVolume is a normalized value, as letting the volume be set too high could be harmful to listeners.
|
|||
private float m_userVolume; |
|||
public float UserVolume |
|||
{ |
|||
get => m_userVolume; |
|||
set => m_userVolume = Mathf.Clamp01(value); |
|||
} |
|||
|
|||
public LobbyUserAudio(string userID) |
|||
{ |
|||
ID = userID; |
|||
HasVoice = false; |
|||
Muted = false; |
|||
UserVolume = 50/70f; // Begin at what will be neutral volume given the range of min to max volume.
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 72da29b13ed488348a7520473d7db840 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace LobbyRelaySample.UI |
|||
{ |
|||
public class LobbyUserVolumeUI : MonoBehaviour |
|||
{ |
|||
[SerializeField] |
|||
private UIPanelBase m_volumeSliderContainer; |
|||
[SerializeField] |
|||
private UIPanelBase m_muteToggleContainer; |
|||
[SerializeField] |
|||
[Tooltip("This is shown for other players, to mute them.")] |
|||
private GameObject m_muteIcon; |
|||
[SerializeField] |
|||
[Tooltip("This is shown for the local player, to make it clearer that they are muting themselves.")] |
|||
private GameObject m_micMuteIcon; |
|||
public bool IsLocalPlayer { private get; set; } |
|||
|
|||
[SerializeField] |
|||
private Slider m_volumeSlider; |
|||
[SerializeField] |
|||
private Toggle m_muteToggle; |
|||
|
|||
/// <param name="shouldResetUi">
|
|||
/// When the user is being added, we want the UI to reset to the default values.
|
|||
/// (We don't do this if the user is already in the lobby so that the previous values are retained. E.g. If they're too loud and volume was lowered, keep it lowered on reenable.)
|
|||
/// </param>
|
|||
public void EnableVoice(bool shouldResetUi) |
|||
{ |
|||
if (shouldResetUi) |
|||
{ m_volumeSlider.SetValueWithoutNotify(vivox.VivoxUserHandler.NormalizedVolumeDefault); |
|||
m_muteToggle.SetIsOnWithoutNotify(false); |
|||
} |
|||
|
|||
if (IsLocalPlayer) |
|||
{ |
|||
m_volumeSliderContainer.Hide(0); |
|||
m_muteToggleContainer.Show(); |
|||
m_muteIcon.SetActive(false); |
|||
m_micMuteIcon.SetActive(true); |
|||
} |
|||
else |
|||
{ |
|||
m_volumeSliderContainer.Show(); |
|||
m_muteToggleContainer.Show(); |
|||
m_muteIcon.SetActive(true); |
|||
m_micMuteIcon.SetActive(false); |
|||
} |
|||
} |
|||
|
|||
/// <param name="shouldResetUi">
|
|||
/// When the user leaves the lobby (but not if they just lose voice access for some reason, e.g. device disconnect), reset state to the default values.
|
|||
/// (We can't just do this during Enable since it could cause Vivox to have a state conflict during participant add.)
|
|||
/// </param>
|
|||
public void DisableVoice(bool shouldResetUi) |
|||
{ |
|||
if (shouldResetUi) |
|||
{ m_volumeSlider.value = vivox.VivoxUserHandler.NormalizedVolumeDefault; |
|||
m_muteToggle.isOn = false; |
|||
} |
|||
|
|||
m_volumeSliderContainer.Hide(0.4f); |
|||
m_muteToggleContainer.Hide(0.4f); |
|||
m_muteIcon.SetActive(true); |
|||
m_micMuteIcon.SetActive(false); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a06ec4a4943ad514da7a222eacb66528 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 679d3159a518edc44a3d0ec4a97e0645 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: df079b79a31b7ee458df2e5bbe02299a |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 11 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 2 |
|||
mipMapFadeDistanceEnd: 4 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: 1 |
|||
aniso: 1 |
|||
mipBias: 0 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: 1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 1 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 47, y: 46, z: 49, w: 46} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 8 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
spritePackingTag: |
|||
pSDRemoveMatte: 0 |
|||
pSDShowRemoveMatteOption: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 974fba2de3551d64fb1f637c443709d6 |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 11 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: 1 |
|||
aniso: 1 |
|||
mipBias: 0 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: 1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 1 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 48, y: 0, z: 48, w: 48} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 8 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
spritePackingTag: |
|||
pSDRemoveMatte: 0 |
|||
pSDShowRemoveMatteOption: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 58e0be4ce77f448448111c125786b71b |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 11 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: 1 |
|||
aniso: 1 |
|||
mipBias: 0 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: 1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 1 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 8 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
spritePackingTag: |
|||
pSDRemoveMatte: 0 |
|||
pSDShowRemoveMatteOption: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 661811ae1d3399b4180ad5c251384df4 |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 11 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: 1 |
|||
aniso: 1 |
|||
mipBias: 0 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: 1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 1 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 8 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
spritePackingTag: |
|||
pSDRemoveMatte: 0 |
|||
pSDShowRemoveMatteOption: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: bf5910b0ba2403a448a96cb6f77b611c |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 11 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 0 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: 1 |
|||
aniso: 1 |
|||
mipBias: 0 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: 1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 1 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 8 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
spritePackingTag: |
|||
pSDRemoveMatte: 0 |
|||
pSDShowRemoveMatteOption: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: d98c1d9f6f85f6e4cb4a0552d0452b48 |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 11 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: 1 |
|||
aniso: 1 |
|||
mipBias: 0 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: 1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 1 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 8 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
spritePackingTag: |
|||
pSDRemoveMatte: 0 |
|||
pSDShowRemoveMatteOption: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c03a71d8e07097647ae53b5f0b98d69d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 78d292f3bd9f1614cb744dcb4fe3ac12 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.Services.Vivox; |
|||
using VivoxUnity; |
|||
|
|||
namespace LobbyRelaySample.vivox |
|||
{ |
|||
/// <summary>
|
|||
/// Handles setting up a voice channel once inside a lobby.
|
|||
/// </summary>
|
|||
public class VivoxSetup |
|||
{ |
|||
private bool m_hasInitialized = false; |
|||
private bool m_isMidInitialize = false; |
|||
private ILoginSession m_loginSession = null; |
|||
private IChannelSession m_channelSession = null; |
|||
private List<VivoxUserHandler> m_userHandlers; |
|||
|
|||
/// <summary>
|
|||
/// Initialize the Vivox service, before actually joining any audio channels.
|
|||
/// </summary>
|
|||
/// <param name="onComplete">Called whether the login succeeds or not.</param>
|
|||
public void Initialize(List<VivoxUserHandler> userHandlers, Action<bool> onComplete) |
|||
{ |
|||
if (m_isMidInitialize) |
|||
return; |
|||
m_isMidInitialize = true; |
|||
|
|||
m_userHandlers = userHandlers; |
|||
VivoxService.Instance.Initialize(); |
|||
Account account = new Account(Locator.Get.Identity.GetSubIdentity(Auth.IIdentityType.Auth).GetContent("id")); |
|||
m_loginSession = VivoxService.Instance.Client.GetLoginSession(account); |
|||
string token = m_loginSession.GetLoginToken(); |
|||
|
|||
m_loginSession.BeginLogin(token, SubscriptionMode.Accept, null, null, null, result => |
|||
{ |
|||
try |
|||
{ |
|||
m_loginSession.EndLogin(result); |
|||
m_hasInitialized = true; |
|||
onComplete?.Invoke(true); |
|||
} |
|||
catch (Exception ex) |
|||
{ UnityEngine.Debug.LogWarning("Vivox failed to login: " + ex.Message); |
|||
onComplete?.Invoke(false); |
|||
} |
|||
finally |
|||
{ |
|||
m_isMidInitialize = false; |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Once in a lobby, start joining a voice channel for that lobby. Be sure to complete Initialize first.
|
|||
/// </summary>
|
|||
/// <param name="onComplete">Called whether the channel is successfully joined or not.</param>
|
|||
public void JoinLobbyChannel(string lobbyId, Action<bool> onComplete) |
|||
{ |
|||
if (!m_hasInitialized || m_loginSession.State != LoginState.LoggedIn) |
|||
{ |
|||
UnityEngine.Debug.LogWarning("Can't join a Vivox audio channel, as Vivox login hasn't completed yet."); |
|||
onComplete?.Invoke(false); |
|||
return; |
|||
} |
|||
|
|||
ChannelType channelType = ChannelType.NonPositional; |
|||
Channel channel = new Channel(lobbyId + "_voice", channelType, null); |
|||
m_channelSession = m_loginSession.GetChannelSession(channel); |
|||
string token = m_channelSession.GetConnectToken(); |
|||
|
|||
m_channelSession.BeginConnect(true, false, true, token, result => |
|||
{ |
|||
try |
|||
{ m_channelSession.EndConnect(result); |
|||
onComplete?.Invoke(true); |
|||
foreach (VivoxUserHandler userHandler in m_userHandlers) |
|||
userHandler.OnChannelJoined(m_channelSession); |
|||
} |
|||
catch (Exception ex) |
|||
{ UnityEngine.Debug.LogWarning("Vivox failed to connect: " + ex.Message); |
|||
onComplete?.Invoke(false); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// To be called when leaving a lobby.
|
|||
/// </summary>
|
|||
public void LeaveLobbyChannel() |
|||
{ |
|||
if (m_channelSession != null) |
|||
{ |
|||
ChannelId id = m_channelSession.Channel; |
|||
m_channelSession?.Disconnect( |
|||
(result) => { m_loginSession.DeleteChannelSession(id); m_channelSession = null; }); |
|||
} |
|||
foreach (VivoxUserHandler userHandler in m_userHandlers) |
|||
userHandler.OnChannelLeft(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// To be called on quit, this will disconnect the player from Vivox entirely instead of just leaving any open lobby channels.
|
|||
/// </summary>
|
|||
public void Uninitialize() |
|||
{ |
|||
if (!m_hasInitialized) |
|||
return; |
|||
m_loginSession.Logout(); |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using Unity.Services.Vivox; |
|||
using VivoxUnity; |
|||
|
|||
namespace LobbyRelaySample.vivox |
|||
{ |
|||
/// <summary>
|
|||
/// Listens for changes to Vivox state for one user in the lobby.
|
|||
/// Instead of going through Relay, this will listen to the Vivox service since it will already transmit state changes for all clients.
|
|||
/// </summary>
|
|||
public class VivoxUserHandler : MonoBehaviour |
|||
{ |
|||
[SerializeField] |
|||
private UI.LobbyUserVolumeUI m_lobbyUserVolumeUI; |
|||
|
|||
private IChannelSession m_channelSession; |
|||
private string m_id; |
|||
private string m_vivoxId; |
|||
|
|||
private const int k_volumeMin = -50, k_volumeMax = 20; // From the Vivox docs, the valid range is [-50, 50] but anything above 25 risks being painfully loud.
|
|||
public static float NormalizedVolumeDefault { get { return (0f - k_volumeMin) / (k_volumeMax - k_volumeMin); } } |
|||
|
|||
public void Start() |
|||
{ |
|||
m_lobbyUserVolumeUI.DisableVoice(true); |
|||
} |
|||
|
|||
public void SetId(string id) |
|||
{ |
|||
m_id = id; |
|||
// Vivox appends additional info to the ID we provide, in order to associate it with a specific channel. We'll construct m_vivoxId to match the ID used by Vivox.
|
|||
// FUTURE: This isn't yet available. When using Auth, the Vivox ID will match this format:
|
|||
// Account account = new Account(id);
|
|||
// m_vivoxId = $"sip:.{account.Issuer}.{m_id}.{environmentId}.@{account.Domain}";
|
|||
// However, the environment ID from Auth is not exposed anywhere, and Vivox doesn't provide a way to retrieve the ID, either.
|
|||
// Instead, when needed, we'll search for the Vivox ID containing this user's Auth ID, which is a GUID so collisions are extremely unlikely.
|
|||
// In the future, remove FindVivoxId and pass the environment ID here instead.
|
|||
m_vivoxId = null; |
|||
|
|||
// SetID might be called after we've received the IChannelSession for remote players, which would mean after OnParticipant Added. So, duplicate the VivoxID work here.
|
|||
if (m_channelSession != null) |
|||
{ |
|||
foreach (var participant in m_channelSession.Participants) |
|||
{ |
|||
if (m_id == participant.Account.DisplayName) |
|||
{ |
|||
m_vivoxId = participant.Key; |
|||
m_lobbyUserVolumeUI.IsLocalPlayer = participant.IsSelf; |
|||
m_lobbyUserVolumeUI.EnableVoice(true); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public void OnChannelJoined(IChannelSession channelSession) |
|||
{ |
|||
m_channelSession = channelSession; |
|||
m_channelSession.Participants.AfterKeyAdded += OnParticipantAdded; |
|||
m_channelSession.Participants.BeforeKeyRemoved += BeforeParticipantRemoved; |
|||
m_channelSession.Participants.AfterValueUpdated += OnParticipantValueUpdated; |
|||
} |
|||
|
|||
public void OnChannelLeft() |
|||
{ |
|||
m_channelSession.Participants.AfterKeyAdded -= OnParticipantAdded; |
|||
m_channelSession.Participants.BeforeKeyRemoved -= BeforeParticipantRemoved; |
|||
m_channelSession.Participants.AfterValueUpdated -= OnParticipantValueUpdated; |
|||
m_channelSession = null; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// To be called whenever a new Participant is added to the channel, using the events from Vivox's custom dictionary.
|
|||
/// </summary>
|
|||
private void OnParticipantAdded(object sender, KeyEventArg<string> keyEventArg) |
|||
{ |
|||
var source = (VivoxUnity.IReadOnlyDictionary<string, IParticipant>)sender; |
|||
var participant = source[keyEventArg.Key]; |
|||
var username = participant.Account.DisplayName; |
|||
|
|||
bool isThisUser = username == m_id; |
|||
if (isThisUser) |
|||
{ m_vivoxId = keyEventArg.Key; // Since we couldn't construct the Vivox ID earlier, retrieve it here.
|
|||
m_lobbyUserVolumeUI.IsLocalPlayer = participant.IsSelf; |
|||
m_lobbyUserVolumeUI.EnableVoice(true); |
|||
} |
|||
} |
|||
private void BeforeParticipantRemoved(object sender, KeyEventArg<string> keyEventArg) |
|||
{ |
|||
var source = (VivoxUnity.IReadOnlyDictionary<string, IParticipant>)sender; |
|||
var participant = source[keyEventArg.Key]; |
|||
var username = participant.Account.DisplayName; |
|||
|
|||
bool isThisUser = username == m_id; |
|||
if (isThisUser) |
|||
{ m_lobbyUserVolumeUI.DisableVoice(true); |
|||
} |
|||
} |
|||
private void OnParticipantValueUpdated(object sender, ValueEventArg<string, IParticipant> valueEventArg) |
|||
{ |
|||
var source = (VivoxUnity.IReadOnlyDictionary<string, IParticipant>)sender; |
|||
var participant = source[valueEventArg.Key]; |
|||
var username = participant.Account.DisplayName; |
|||
string property = valueEventArg.PropertyName; |
|||
|
|||
if (username == m_id) |
|||
{ |
|||
if (property == "UnavailableCaptureDevice") |
|||
{ |
|||
if (participant.UnavailableCaptureDevice) |
|||
{ m_lobbyUserVolumeUI.DisableVoice(false); |
|||
participant.SetIsMuteForAll(m_vivoxId, true, null); // Note: If you add more places where a player might be globally muted, a state machine might be required for accurate logic.
|
|||
} |
|||
else |
|||
{ m_lobbyUserVolumeUI.EnableVoice(false); |
|||
participant.SetIsMuteForAll(m_vivoxId, false, null); |
|||
} |
|||
} |
|||
else if (property == "IsMutedForAll") |
|||
{ |
|||
if (participant.IsMutedForAll) |
|||
m_lobbyUserVolumeUI.DisableVoice(false); |
|||
else |
|||
m_lobbyUserVolumeUI.EnableVoice(false); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public void OnVolumeSlide(float volumeNormalized) |
|||
{ |
|||
if (m_channelSession == null || m_vivoxId == null) // Verify initialization, since SetId and OnChannelJoined are called at different times for local vs. remote clients.
|
|||
return; |
|||
|
|||
int vol = (int)Mathf.Clamp(k_volumeMin + (k_volumeMax - k_volumeMin) * volumeNormalized, k_volumeMin, k_volumeMax); // Clamping as a precaution; if UserVolume somehow got above 1, listeners could be harmed.
|
|||
bool isSelf = m_channelSession.Participants[m_vivoxId].IsSelf; |
|||
if (isSelf) |
|||
{ |
|||
VivoxService.Instance.Client.AudioInputDevices.VolumeAdjustment = vol; |
|||
} |
|||
else |
|||
{ |
|||
m_channelSession.Participants[m_vivoxId].LocalVolumeAdjustment = vol; |
|||
} |
|||
} |
|||
|
|||
public void OnMuteToggle(bool isMuted) |
|||
{ |
|||
if (m_channelSession == null || m_vivoxId == null) |
|||
return; |
|||
|
|||
bool isSelf = m_channelSession.Participants[m_vivoxId].IsSelf; |
|||
if (isSelf) |
|||
{ |
|||
VivoxService.Instance.Client.AudioInputDevices.Muted = isMuted; |
|||
} |
|||
else |
|||
{ |
|||
m_channelSession.Participants[m_vivoxId].LocalMute = isMuted; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
{ |
|||
"m_Name": "Settings", |
|||
"m_Path": "ProjectSettings/Packages/com.unity.services.vivox/Settings.json", |
|||
"m_Dictionary": { |
|||
"m_DictionaryValues": [ |
|||
{ |
|||
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", |
|||
"key": "isEnvironmentCustom", |
|||
"value": "{\"m_Value\":false}" |
|||
}, |
|||
{ |
|||
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", |
|||
"key": "domain", |
|||
"value": "{\"m_Value\":\"mtu1xp.vivox.com\"}" |
|||
}, |
|||
{ |
|||
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", |
|||
"key": "server", |
|||
"value": "{\"m_Value\":\"https://unity.vivox.com/appconfig/0bf04-com_u-76576-test\"}" |
|||
}, |
|||
{ |
|||
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", |
|||
"key": "tokenIssuer", |
|||
"value": "{\"m_Value\":\"0bf04-com_u-76576-test\"}" |
|||
}, |
|||
{ |
|||
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", |
|||
"key": "tokenKey", |
|||
"value": "{\"m_Value\":\"jQr72GjGtoB2lpdtK1GmV1BgtOsFUzK6\"}" |
|||
}, |
|||
{ |
|||
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", |
|||
"key": "pulledCredentialProjectId", |
|||
"value": "{\"m_Value\":\"0bf0426b-e1fd-4251-82d0-3eea033ef1ad\"}" |
|||
} |
|||
] |
|||
} |
|||
} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &6175543402711722863 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 5717129646262184410} |
|||
- component: {fileID: 1345944725475549397} |
|||
- component: {fileID: 7263462266751159530} |
|||
- component: {fileID: 6129612084803202136} |
|||
m_Layer: 5 |
|||
m_Name: JoiningGamePopUp |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &5717129646262184410 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 6175543402711722863} |
|||
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_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 &1345944725475549397 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 6175543402711722863} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 51373dc3c6ac79b4f8e36ac7c4419205, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
OnObservedUpdated: |
|||
m_PersistentCalls: |
|||
m_Calls: |
|||
- m_Target: {fileID: 7263462266751159530} |
|||
m_TargetAssemblyTypeName: LobbyRooms.UI.GameStateVisibilityUI, LobbyRooms |
|||
m_MethodName: ObservedUpdated |
|||
m_Mode: 0 |
|||
m_Arguments: |
|||
m_ObjectArgument: {fileID: 0} |
|||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine |
|||
m_IntArgument: 0 |
|||
m_FloatArgument: 0 |
|||
m_StringArgument: |
|||
m_BoolArgument: 0 |
|||
m_CallState: 2 |
|||
--- !u!114 &7263462266751159530 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 6175543402711722863} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 166d8ab6b922da04f851733dcb0e37e1, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
showing: 0 |
|||
stateToShow: 8 |
|||
--- !u!225 &6129612084803202136 |
|||
CanvasGroup: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 6175543402711722863} |
|||
m_Enabled: 1 |
|||
m_Alpha: 1 |
|||
m_Interactable: 1 |
|||
m_BlocksRaycasts: 1 |
|||
m_IgnoreParentGroups: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: 136ea6745a7767c4d9d030508e0124d6 |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue