adds ahelp relay (#5837)

This commit is contained in:
Paul Ritter
2021-12-22 13:34:09 +01:00
committed by GitHub
parent 0263c9ae89
commit 1b028c5ff7
8 changed files with 143 additions and 64 deletions

View File

@@ -1,19 +1,15 @@
#nullable enable
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Content.Client.Administration.UI;
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Localization;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.Player;
using Robust.Shared.Audio;
using Robust.Shared.IoC;
using Robust.Shared.Network;
namespace Content.Client.Administration
{
@@ -43,24 +39,16 @@ namespace Content.Client.Administration
public BwoinkWindow EnsureWindow(NetUserId channelId)
{
if (_activeWindowMap.TryGetValue(channelId, out var existingWindow))
if (!_activeWindowMap.TryGetValue(channelId, out var existingWindow))
{
existingWindow.Open();
return existingWindow;
_activeWindowMap[channelId] = existingWindow = new BwoinkWindow(channelId,
_playerManager.SessionsDict.TryGetValue(channelId, out var otherSession)
? otherSession.Name
: channelId.ToString());
}
string title;
if (_playerManager.SessionsDict.TryGetValue(channelId, out var otherSession))
{
title = otherSession.Name;
}
else
{
title = channelId.ToString();
}
var window = new BwoinkWindow(channelId, title);
_activeWindowMap[channelId] = window;
window.Open();
return window;
existingWindow.Open();
return existingWindow;
}
public void EnsureWindowForLocalPlayer()

View File

@@ -1,24 +1,13 @@
#nullable enable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Content.Client.UserInterface;
using Content.Client.Administration;
using Content.Shared;
using Robust.Client.Credits;
using Robust.Client.AutoGenerated;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using Robust.Shared.Network;
using Robust.Shared.GameObjects;
using YamlDotNet.RepresentationModel;
using Robust.Shared.Network;
using Robust.Shared.Utility;
namespace Content.Client.Administration.UI
{
@@ -33,14 +22,13 @@ namespace Content.Client.Administration.UI
private readonly NetUserId _channelId;
public BwoinkWindow(NetUserId channelId, string title)
public BwoinkWindow(NetUserId userId, string channelName)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_channelId = channelId;
Title = (_playerManager.LocalPlayer?.UserId == _channelId) ? "Admin Message" : title;
_channelId = userId;
Title = (_playerManager.LocalPlayer?.UserId == _channelId) ? "Admin Message" : channelName;
SenderLineEdit.OnTextEntered += Input_OnTextEntered;
}