Redial Button II - Now with magic! (#8237)

* Redial Button II - Now with magic!

* 15-second timer before redial is allowed
This commit is contained in:
20kdc
2022-05-22 02:56:18 +01:00
committed by GitHub
parent 959c9a9615
commit 98c2b34512
7 changed files with 121 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
using System;
using Robust.Client;
using Robust.Client.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Network;
namespace Content.Client.Launcher;
/// <summary>
/// So apparently the way that disconnect information is shipped around is really indirect.
/// But honestly, given that content might have additional flags (i.e. hide disconnect button for bans)?
/// This is responsible for collecting any extended disconnect information.
/// </summary>
public sealed class ExtendedDisconnectInformationManager
{
[Dependency] private readonly IClientNetManager _clientNetManager = default!;
private NetDisconnectedArgs? _lastNetDisconnectedArgs = null;
public NetDisconnectedArgs? LastNetDisconnectedArgs
{
get => _lastNetDisconnectedArgs;
private set
{
_lastNetDisconnectedArgs = value;
LastNetDisconnectedArgsChanged?.Invoke(value);
}
}
// BE CAREFUL!
// This may fire at an arbitrary time before or after whatever code that needs it.
public event Action<NetDisconnectedArgs?>? LastNetDisconnectedArgsChanged;
public void Initialize()
{
_clientNetManager.Disconnect += OnNetDisconnect;
}
private void OnNetDisconnect(object? sender, NetDisconnectedArgs args)
{
LastNetDisconnectedArgs = args;
}
}