Fix loadbp window perm issue (#9671)
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Text="{Loc Path}" MinSize="100 0" />
|
||||
<Control MinSize="50 0" />
|
||||
<OptionButton Name="MapPath" MinSize="200 0" HorizontalExpand="True" />
|
||||
<LineEdit Name="MapPath" MinSize="200 0" HorizontalExpand="True" Text="/Maps/" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Text="{Loc X}" MinSize="100 0" />
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user