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