mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-04-15 11:42:23 +00:00
hud marker cleanup
This commit is contained in:
parent
fe33f266af
commit
42954b25e3
@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using QSB.Tools;
|
||||
using QSB.TransformSync;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
@ -16,6 +17,7 @@ namespace QSB
|
||||
public QSBTool Signalscope => GetToolByType(ToolType.Signalscope);
|
||||
public QSBTool Translator => GetToolByType(ToolType.Translator);
|
||||
public QSBTool ProbeLauncher => GetToolByType(ToolType.ProbeLauncher);
|
||||
public PlayerHUDMarker HudMarker { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool IsReady { get; set; }
|
||||
public State State { get; set; }
|
||||
|
@ -15,7 +15,6 @@ namespace QSB
|
||||
public static List<TransformSync.TransformSync> TransformSyncs { get; } = new List<TransformSync.TransformSync>();
|
||||
public static List<TransformSync.TransformSync> LocalTransformSyncs => TransformSyncs.Where(t => t != null && t.hasAuthority).ToList();
|
||||
public static List<AnimationSync> AnimationSyncs { get; } = new List<AnimationSync>();
|
||||
public static List<PlayerHUDMarker> PlayerHudMarkers { get; } = new List<PlayerHUDMarker>();
|
||||
|
||||
public static PlayerInfo GetPlayer(uint id)
|
||||
{
|
||||
@ -61,10 +60,5 @@ namespace QSB
|
||||
{
|
||||
return AnimationSyncs.FirstOrDefault(x => x != null && x.netId.Value == id);
|
||||
}
|
||||
|
||||
public static PlayerHUDMarker GetPlayerMarker(uint id)
|
||||
{
|
||||
return PlayerHudMarkers.FirstOrDefault(x => x != null && x._player.NetId == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -159,11 +159,11 @@ namespace QSB
|
||||
var objectIds = connection.clientOwnedObjects.Select(x => x.Value).ToArray();
|
||||
GlobalMessenger<uint, uint[]>.FireEvent(EventNames.QSBPlayerLeave, playerId, objectIds);
|
||||
CleanupConnection(connection);
|
||||
//var marker = PlayerRegistry.GetPlayerMarker(playerId);
|
||||
//if (marker != null)
|
||||
//{
|
||||
// Destroy(marker.transform.parent.gameObject);
|
||||
//}
|
||||
var marker = PlayerRegistry.GetPlayer(playerId).HudMarker;
|
||||
if (marker != null)
|
||||
{
|
||||
Destroy(marker.transform.parent.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStopServer()
|
||||
@ -179,10 +179,10 @@ namespace QSB
|
||||
public override void OnClientDisconnect(NetworkConnection conn)
|
||||
{
|
||||
DebugLog.ToConsole("Disconnected from server.", OWML.Common.MessageType.Info);
|
||||
//foreach (var marker in PlayerRegistry.PlayerHudMarkers)
|
||||
//{
|
||||
// Destroy(marker.transform.parent.gameObject);
|
||||
//}
|
||||
foreach (var player in PlayerRegistry.PlayerList)
|
||||
{
|
||||
Destroy(player.HudMarker.transform.parent.gameObject);
|
||||
}
|
||||
foreach (var connection in NetworkServer.connections.Where(x => x != conn))
|
||||
{
|
||||
CleanupConnection(connection);
|
||||
|
@ -19,8 +19,8 @@ namespace QSB.TransformSync
|
||||
|
||||
public void Init(PlayerInfo player)
|
||||
{
|
||||
PlayerRegistry.PlayerHudMarkers.Add(this);
|
||||
_player = player;
|
||||
PlayerRegistry.GetPlayer(_player.NetId).HudMarker = this;
|
||||
_isReady = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user