You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
3 weeks ago
|
using System;
|
||
|
using Unity.BossRoom.Gameplay.GameplayObjects;
|
||
|
using Unity.Multiplayer.Samples.Utilities;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Unity.BossRoom.Gameplay.UI
|
||
|
{
|
||
|
public class ClientBossRoomLoadingScreen : ClientLoadingScreen
|
||
|
{
|
||
|
[SerializeField]
|
||
|
PersistentPlayerRuntimeCollection m_PersistentPlayerRuntimeCollection;
|
||
|
|
||
|
protected override void AddOtherPlayerProgressBar(ulong clientId, NetworkedLoadingProgressTracker progressTracker)
|
||
|
{
|
||
|
base.AddOtherPlayerProgressBar(clientId, progressTracker);
|
||
|
m_LoadingProgressBars[clientId].NameText.text = GetPlayerName(clientId);
|
||
|
}
|
||
|
|
||
|
protected override void UpdateOtherPlayerProgressBar(ulong clientId, int progressBarIndex)
|
||
|
{
|
||
|
base.UpdateOtherPlayerProgressBar(clientId, progressBarIndex);
|
||
|
m_LoadingProgressBars[clientId].NameText.text = GetPlayerName(clientId);
|
||
|
}
|
||
|
|
||
|
string GetPlayerName(ulong clientId)
|
||
|
{
|
||
|
foreach (var player in m_PersistentPlayerRuntimeCollection.Items)
|
||
|
{
|
||
|
if (clientId == player.OwnerClientId)
|
||
|
{
|
||
|
return player.NetworkNameState.Name.Value;
|
||
|
}
|
||
|
}
|
||
|
return "";
|
||
|
}
|
||
|
}
|
||
|
}
|