Few changes
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
using MessagePipe;
|
||||
using Players;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
public sealed class ApplicationLifetimeScope : LifetimeScope
|
||||
{
|
||||
[SerializeField] private PlayerNameService _playerNameService;
|
||||
|
||||
protected override void Configure(IContainerBuilder builder)
|
||||
{
|
||||
RegisterMessagePipe(builder);
|
||||
RegisterServices(builder);
|
||||
}
|
||||
|
||||
private void RegisterMessagePipe(IContainerBuilder builder)
|
||||
@@ -27,4 +32,9 @@ public sealed class ApplicationLifetimeScope : LifetimeScope
|
||||
builder.RegisterMessagePipe();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void RegisterServices(IContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterInstance(_playerNameService).AsSelf();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using FishNet.Connection;
|
||||
using FishNet.Object;
|
||||
using FishNet.Object.Synchronizing;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Players
|
||||
{
|
||||
public sealed class PlayerNameService : NetworkBehaviour
|
||||
{
|
||||
public static event Action<NetworkConnection, string> OnPlayerNameChange;
|
||||
|
||||
private readonly SyncDictionary<NetworkConnection, string> _playerNames = new();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_playerNames.OnChange += OnPlayerNamesChange;
|
||||
}
|
||||
|
||||
private void OnPlayerNamesChange(SyncDictionaryOperation op, NetworkConnection key, string value, bool asServer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f8a0d6abee44a7282f69c32e04a6f4c
|
||||
timeCreated: 1775595133
|
||||
Reference in New Issue
Block a user