Fix loadbp window perm issue (#9671)

This commit is contained in:
metalgearsloth
2022-07-15 13:03:18 +10:00
committed by GitHub
parent a98047b47d
commit 2420d281bb
2 changed files with 4 additions and 27 deletions

View File

@@ -2,13 +2,10 @@ using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.ContentPack;
using Robust.Shared.Map;
using Robust.Shared.Utility;
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
{
@@ -16,8 +13,6 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
[UsedImplicitly]
public sealed partial class LoadBlueprintsWindow : DefaultWindow
{
private Dictionary<int, string> _pathIndices = new();
public LoadBlueprintsWindow()
{
RobustXamlLoader.Load(this);
@@ -26,30 +21,15 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
protected override void EnteredTree()
{
var mapManager = IoCManager.Resolve<IMapManager>();
var provider = IoCManager.Resolve<IResourceCache>();
foreach (var mapId in mapManager.GetAllMapIds())
{
MapOptions.AddItem(mapId.ToString(), (int) mapId);
}
var pathIndex = 0;
foreach (var path in provider.ContentFindFiles(new ResourcePath("/Maps/")))
{
var strPath = path.ToString();
if (strPath.StartsWith("/Maps/Salvage/") || strPath.StartsWith("/Maps/Test/")) continue;
MapPath.AddItem(strPath[6..], pathIndex);
_pathIndices[pathIndex] = strPath;
pathIndex++;
}
Reset();
MapOptions.OnItemSelected += OnOptionSelect;
MapPath.OnItemSelected += OnPathSelect;
RotationSpin.ValueChanged += OnRotate;
SubmitButton.OnPressed += OnSubmitButtonPressed;
TeleportButton.OnPressed += OnTeleportButtonPressed;
@@ -114,11 +94,6 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
return newValue;
}
private void OnPathSelect(OptionButton.ItemSelectedEventArgs obj)
{
MapPath.SelectId(obj.Id);
}
private void OnOptionSelect(OptionButton.ItemSelectedEventArgs obj)
{
MapOptions.SelectId(obj.Id);
@@ -132,8 +107,10 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs obj)
{
if (MapPath.Text.Length == 0) return;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"loadbp {MapOptions.SelectedId} \"{_pathIndices[MapPath.SelectedId]}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
$"loadbp {MapOptions.SelectedId} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
}
}
}