Skip to content
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
bb8dfa0
recreation of vivox scripts from old PR
Elfi0Kuhndorf Nov 7, 2024
99c892d
updating ServiceHelper to join channel
Elfi0Kuhndorf Nov 7, 2024
b40e0aa
wip: Enable Vivox, voice and text working somehow without UI atm
hammerlerobi Nov 11, 2024
62e236b
wip: textchat working
hammerlerobi Nov 13, 2024
a130940
feat: improve Chat
hammerlerobi Nov 13, 2024
0f5dba5
wip: Improve TextChat
hammerlerobi Nov 14, 2024
e0c12fb
wip: achitectural changes
hammerlerobi Nov 14, 2024
a865c81
wip: small improvements
hammerlerobi Nov 14, 2024
996ae1b
chore: decouple TextChat from Services
hammerlerobi Nov 18, 2024
ee013f9
chore: cleanup
hammerlerobi Nov 18, 2024
a1436bf
feat: Block Player Input on Chat Input focused
hammerlerobi Nov 18, 2024
0a6bc49
fix: await Vivox Login
hammerlerobi Nov 19, 2024
d62afb4
chore: remove unused files
hammerlerobi Nov 19, 2024
caaa3bf
chore: remove scene
hammerlerobi Nov 19, 2024
d6e40eb
fix: focus state on textfield
hammerlerobi Nov 19, 2024
1d8170c
fix: improve initialization and handle session leave
hammerlerobi Nov 20, 2024
0a0d12c
chore: cleanup
hammerlerobi Nov 20, 2024
f4e064e
wip: Add positional voice chat
hammerlerobi Nov 21, 2024
19680a2
chore: improve architecture
hammerlerobi Nov 21, 2024
661280b
chore: add icon
hammerlerobi Nov 21, 2024
49128af
fix: apply review changes
hammerlerobi Nov 21, 2024
1fcc5db
feat: seperate voice and textchat
hammerlerobi Nov 21, 2024
6beb415
Merge branch 'feat/distributed-authority-sample/vivox-integration-upd…
hammerlerobi Nov 21, 2024
03ffd6a
fix: catching some potential null refs
hammerlerobi Nov 21, 2024
2999565
Merge branch 'develop' into feat/distributed-authority-sample/vivox-i…
hammerlerobi Nov 22, 2024
3b242ca
feat: select audio device wip
hammerlerobi Nov 22, 2024
6a3b54e
fix: add missing UI
hammerlerobi Nov 22, 2024
331348b
feat: Make sure to ask for Microphone permissions on MacOS
hammerlerobi Nov 22, 2024
20743e6
wip: VoiceChat feature complete. Needs cleanup
hammerlerobi Nov 25, 2024
b25c4c5
fix: Focus issue
hammerlerobi Nov 25, 2024
066a1ad
chore: cleanup extract fields etc.
hammerlerobi Nov 25, 2024
cdeff4c
Merge branch 'develop' into feat/distributed-authority-sample/vivox-i…
hammerlerobi Nov 25, 2024
b52e9bc
fix: vivox joining and leaving working
hammerlerobi Nov 26, 2024
a04fc81
chore: remove unnecessary code, attach to device change events
hammerlerobi Nov 26, 2024
36fc36a
docs: Update changelog
hammerlerobi Nov 26, 2024
7ecd74d
chore: final cleanup
hammerlerobi Nov 26, 2024
e46216b
fix: Hide UI because of Vivox bug
hammerlerobi Nov 27, 2024
2777114
chore: internalize method
hammerlerobi Dec 3, 2024
8fc9b00
chore: remove buildprofile
hammerlerobi Dec 3, 2024
00a7b8a
chore: Move permission check before login
hammerlerobi Dec 3, 2024
5e46a9d
chore: change subscription to events
hammerlerobi Dec 3, 2024
7631e17
chore: remove UI dependency in VivoxManager
hammerlerobi Dec 3, 2024
2caffea
Merge branch 'develop' into feat/distributed-authority-sample/vivox-i…
hammerlerobi Dec 3, 2024
b79642b
chore: remove unnecessary argument
hammerlerobi Dec 3, 2024
e4f69ef
chore: cleanup ingameMenu
hammerlerobi Dec 3, 2024
271ce2b
fix: reapply VivoxPosition Component
hammerlerobi Dec 3, 2024
9bfa7e7
fix: Make sure base is called
hammerlerobi Dec 4, 2024
622d937
chore: remove unsubscription
hammerlerobi Dec 4, 2024
ba5ab5a
chore: wrap everything related to mic permission into define
hammerlerobi Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,20 @@ MonoBehaviour:
TransitionDuration: 0.1
TriggerNameHash: -1243957561
TransitionIndex: 0
- IsCrossFadeExit: 0
Layer: 1
OriginatingState: -1413593168
DestinationState: -802706916
TransitionDuration: 0.25
TriggerNameHash: -802706916
TransitionIndex: 1
- IsCrossFadeExit: 0
Layer: 1
OriginatingState: 1177697483
DestinationState: -802706916
TransitionDuration: 0.25
TriggerNameHash: -802706916
TransitionIndex: 1
m_Animator: {fileID: 7006295767383679619}
m_PhysicsPlayerController: {fileID: 4655812346339390596}
m_AvatarInputs: {fileID: 8197190117666738524}
Expand Down Expand Up @@ -423,6 +437,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 8353930243667998089, guid: d1d89ad5a0ed99e499fe819ca87ae4c8, type: 3}
insertIndex: -1
addedObject: {fileID: 3050276823525430539}
- targetCorrespondingSourceObject: {fileID: 8353930243667998089, guid: d1d89ad5a0ed99e499fe819ca87ae4c8, type: 3}
insertIndex: -1
addedObject: {fileID: 4683992500645973501}
m_SourcePrefab: {fileID: 100100000, guid: d1d89ad5a0ed99e499fe819ca87ae4c8, type: 3}
--- !u!136 &36137897785899347 stripped
CapsuleCollider:
Expand Down Expand Up @@ -456,6 +473,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f398d1c0abd4744eb035893ea7619cf, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &4683992500645973501
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3745480105526614893}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bee830f09ba1465fa953159de83e882e, type: 3}
m_Name:
m_EditorClassIdentifier:
ShowTopMostFoldoutHeaderGroup: 1
--- !u!4 &4085133075368149463 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8693301772691271475, guid: d1d89ad5a0ed99e499fe819ca87ae4c8, type: 3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ static class GameplayEventHandler
internal static event Action OnExitedSession;
internal static event Action<string, string, bool> OnTextMessageReceived;
internal static event Action<string> OnSendTextMessage;
internal static event Action<bool> OnBlockPlayerControls;
internal static event Action<bool> OnChatIsReady;
internal static event Action<bool, string> OnChatIsReady;

internal static void NetworkObjectDespawned(NetworkObject networkObject)
{
Expand Down Expand Up @@ -75,14 +74,9 @@ internal static void SendTextMessage(string message)
OnSendTextMessage?.Invoke(message);
}

public static void BlockPlayerControls(bool disable)
public static void SetTextChatReady(bool enabled, string channelName)
{
OnBlockPlayerControls?.Invoke(disable);
}

public static void SetTextChatReady(bool enabled)
{
OnChatIsReady?.Invoke(enabled);
OnChatIsReady?.Invoke(enabled, channelName);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using Unity.Collections;
using Unity.Multiplayer.Samples.SocialHub.GameManagement;
using Unity.Multiplayer.Samples.SocialHub.Gameplay;
using UnityEngine;
using Unity.Multiplayer.Samples.SocialHub.Input;
using Unity.Multiplayer.Samples.SocialHub.Physics;
Expand Down Expand Up @@ -29,13 +27,16 @@ class AvatarTransform : PhysicsObjectMotion, INetworkUpdateSystem
PlayersTopUIController m_TopUIController;

NetworkVariable<FixedString32Bytes> m_PlayerName = new NetworkVariable<FixedString32Bytes>(string.Empty, readPerm: NetworkVariableReadPermission.Everyone, writePerm: NetworkVariableWritePermission.Owner);
NetworkVariable<FixedString32Bytes> m_PlayerId = new NetworkVariable<FixedString32Bytes>(string.Empty, readPerm: NetworkVariableReadPermission.Everyone, writePerm: NetworkVariableWritePermission.Owner);


public override void OnNetworkSpawn()
{
gameObject.name = $"[Client-{OwnerClientId}]{name}";

m_TopUIController = FindFirstObjectByType<PlayersTopUIController>();
m_PlayerName.OnValueChanged += OnPlayerNameChanged;
m_PlayerId.OnValueChanged += OnPlayerIdChanged;
OnPlayerNameChanged(string.Empty, m_PlayerName.Value);

if (!HasAuthority)
Expand All @@ -44,8 +45,8 @@ public override void OnNetworkSpawn()
return;
}

// a randomly-generated suffix consisting of a hash and four digits (e.g. #1234) is automatically appended to the requested name
m_PlayerName.Value = new FixedString32Bytes(AuthenticationService.Instance.PlayerName.Split('#')[0]);
m_PlayerId.Value = new FixedString32Bytes(AuthenticationService.Instance.PlayerId);
m_PlayerName.Value = new FixedString32Bytes(UIUtils.ExtractPlayerNameFromAuthUserName(AuthenticationService.Instance.PlayerName));
m_PlayerInput.enabled = true;
m_AvatarInputs.enabled = true;
m_AvatarInputs.Jumped += OnJumped;
Expand All @@ -69,8 +70,6 @@ public override void OnNetworkSpawn()
Debug.LogError("CameraControl not found on the Main Camera or Main Camera is missing.");
}

GameplayEventHandler.OnBlockPlayerControls += OnBlockPlayerControls;

base.OnNetworkSpawn();
}

Expand All @@ -91,7 +90,6 @@ public override void OnNetworkDespawn()
cameraControl.SetTransform(null);
}

GameplayEventHandler.OnBlockPlayerControls -= OnBlockPlayerControls;
m_TopUIController?.RemovePlayer(gameObject);
}

Expand Down Expand Up @@ -120,12 +118,12 @@ void OnTransformUpdate()

void OnPlayerNameChanged(FixedString32Bytes previousValue, FixedString32Bytes newValue)
{
m_TopUIController.AddPlayer(gameObject, newValue.Value);
m_TopUIController.AddOrUpdatePlayer(gameObject, newValue.Value,m_PlayerId.Value.Value);
}

void OnBlockPlayerControls(bool blockInput)
void OnPlayerIdChanged(FixedString32Bytes previousValue, FixedString32Bytes newValue)
{
m_PlayerInput.enabled = !blockInput;
m_TopUIController.AddOrUpdatePlayer(gameObject, m_PlayerName.Value.Value,newValue.Value);
}

public void NetworkUpdate(NetworkUpdateStage updateStage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ async void LeaveSession()
}
}

void SignInFailed(RequestFailedException obj)
void SignInFailed(RequestFailedException e)
{
Debug.LogWarning($"Sign in via Authentication failed: obj.ErrorCode {obj.ErrorCode}");
Debug.LogWarning($"Sign in via Authentication failed: obj.ErrorCode {e.ErrorCode}");
}

void RemovedFromSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"GUID:6087a74f6015aae4daed9a2577a7596c",
"GUID:1491147abca9d7d4bb7105af628b223e",
"GUID:707bb6c7c4ef140eeac239b4f8251af8",
"GUID:75469ad4d38634e559750d17036d5f7c"
"GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:86923d8926a1f4aca9fcdd3f0097bfd7"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand All @@ -19,4 +20,4 @@
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using UnityEngine;
using Unity.Netcode;
using Unity.Multiplayer.Samples.SocialHub.GameManagement;

namespace Unity.Multiplayer.Samples.SocialHub.Services
{
class Vivox3DPositioning : NetworkBehaviour
{
bool m_Initialized;
float m_NextPosUpdate;

void Start()
{
GameplayEventHandler.OnChatIsReady -= OnChatIsReady;
GameplayEventHandler.OnChatIsReady += OnChatIsReady;

GameplayEventHandler.OnExitedSession -= OnExitSession;
GameplayEventHandler.OnExitedSession += OnExitSession;
}

void OnChatIsReady(bool chatIsReady, string channelName)
{
m_Initialized = chatIsReady;
}

void OnExitSession()
{
m_Initialized = false;
}

void Update()
{
if (IsOwner && m_Initialized)
{
if (Time.time > m_NextPosUpdate)
{
VivoxManager.Instance.SetPlayer3DPosition(gameObject);
m_NextPosUpdate = Time.time + 0.3f;
}
}
}

public override void OnDestroy()
{
GameplayEventHandler.OnChatIsReady -= OnChatIsReady;
GameplayEventHandler.OnExitedSession -= OnExitSession;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading