make annoucements call different method

This commit is contained in:
_nebula 2023-07-27 19:34:45 +01:00
parent 05be99e122
commit 34e5590490
4 changed files with 13 additions and 6 deletions

View File

@ -42,7 +42,7 @@ public class PlayerDeathMessage : QSBMessage<DeathType>
var deathMessage = Necronomicon.GetPhrase(Data, NecronomiconIndex);
if (deathMessage != null)
{
MultiplayerHUDManager.Instance.WriteMessage(string.Format(deathMessage, playerName), Color.grey);
MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(deathMessage, playerName), Color.grey);
}
RespawnManager.Instance.OnPlayerDeath(player);

View File

@ -83,6 +83,13 @@ internal class MultiplayerHUDManager : MonoBehaviour, IAddComponentOnStart
private readonly ListStack<(string msg, Color color)> _messages = new(false);
private float _lastMessageTime;
// this just exists so i can patch this in my tts addon
// perks of being a qsb dev :-)
public void WriteSystemMessage(string message, Color color)
{
WriteMessage(message, color);
}
public void WriteMessage(string message, Color color)
{
// dont write messages when not ready
@ -453,7 +460,7 @@ internal class MultiplayerHUDManager : MonoBehaviour, IAddComponentOnStart
Destroy(player.HUDBox?.gameObject);
Destroy(player.MinimapPlayerMarker);
WriteMessage(string.Format(QSBLocalization.Current.PlayerLeftTheGame, player.Name), Color.yellow);
WriteSystemMessage(string.Format(QSBLocalization.Current.PlayerLeftTheGame, player.Name), Color.yellow);
}
private PlanetTrigger CreateTrigger(string parentPath, HUDIcon icon)

View File

@ -127,7 +127,7 @@ public class PlayerJoinMessage : QSBMessage
var player = QSBPlayerManager.GetPlayer(From);
player.Name = PlayerName;
MultiplayerHUDManager.Instance.WriteMessage(string.Format(QSBLocalization.Current.PlayerJoinedTheGame, player.Name), Color.green);
MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(QSBLocalization.Current.PlayerJoinedTheGame, player.Name), Color.green);
DebugLog.DebugWrite($"{player} joined. qsbVersion:{QSBVersion}, gameVersion:{GameVersion}, dlcInstalled:{DlcInstalled}", MessageType.Info);
}

View File

@ -36,15 +36,15 @@ internal class PlayerKickMessage : QSBMessage<string>
{
if (QSBPlayerManager.PlayerExists(PlayerId))
{
MultiplayerHUDManager.Instance.WriteMessage(string.Format(QSBLocalization.Current.PlayerWasKicked, QSBPlayerManager.GetPlayer(PlayerId).Name), Color.red);
MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(QSBLocalization.Current.PlayerWasKicked, QSBPlayerManager.GetPlayer(PlayerId).Name), Color.red);
return;
}
MultiplayerHUDManager.Instance.WriteMessage(string.Format(QSBLocalization.Current.PlayerWasKicked, PlayerId), Color.red);
MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(QSBLocalization.Current.PlayerWasKicked, PlayerId), Color.red);
return;
}
MultiplayerHUDManager.Instance.WriteMessage(string.Format(QSBLocalization.Current.KickedFromServer, Data), Color.red);
MultiplayerHUDManager.Instance.WriteSystemMessage(string.Format(QSBLocalization.Current.KickedFromServer, Data), Color.red);
MenuManager.Instance.OnKicked(Data);
NetworkClient.Disconnect();