Fix loadbp window perm issue (#9671)
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
<BoxContainer Orientation="Horizontal">
|
<BoxContainer Orientation="Horizontal">
|
||||||
<Label Text="{Loc Path}" MinSize="100 0" />
|
<Label Text="{Loc Path}" MinSize="100 0" />
|
||||||
<Control MinSize="50 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>
|
||||||
<BoxContainer Orientation="Horizontal">
|
<BoxContainer Orientation="Horizontal">
|
||||||
<Label Text="{Loc X}" MinSize="100 0" />
|
<Label Text="{Loc X}" MinSize="100 0" />
|
||||||
|
|||||||
@@ -2,13 +2,10 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.Console;
|
using Robust.Client.Console;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Client.ResourceManagement;
|
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.ContentPack;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Utility;
|
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||||
{
|
{
|
||||||
@@ -16,8 +13,6 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed partial class LoadBlueprintsWindow : DefaultWindow
|
public sealed partial class LoadBlueprintsWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
private Dictionary<int, string> _pathIndices = new();
|
|
||||||
|
|
||||||
public LoadBlueprintsWindow()
|
public LoadBlueprintsWindow()
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
@@ -26,30 +21,15 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
|||||||
protected override void EnteredTree()
|
protected override void EnteredTree()
|
||||||
{
|
{
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var provider = IoCManager.Resolve<IResourceCache>();
|
|
||||||
|
|
||||||
foreach (var mapId in mapManager.GetAllMapIds())
|
foreach (var mapId in mapManager.GetAllMapIds())
|
||||||
{
|
{
|
||||||
MapOptions.AddItem(mapId.ToString(), (int) mapId);
|
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();
|
Reset();
|
||||||
|
|
||||||
MapOptions.OnItemSelected += OnOptionSelect;
|
MapOptions.OnItemSelected += OnOptionSelect;
|
||||||
MapPath.OnItemSelected += OnPathSelect;
|
|
||||||
RotationSpin.ValueChanged += OnRotate;
|
RotationSpin.ValueChanged += OnRotate;
|
||||||
SubmitButton.OnPressed += OnSubmitButtonPressed;
|
SubmitButton.OnPressed += OnSubmitButtonPressed;
|
||||||
TeleportButton.OnPressed += OnTeleportButtonPressed;
|
TeleportButton.OnPressed += OnTeleportButtonPressed;
|
||||||
@@ -114,11 +94,6 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPathSelect(OptionButton.ItemSelectedEventArgs obj)
|
|
||||||
{
|
|
||||||
MapPath.SelectId(obj.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnOptionSelect(OptionButton.ItemSelectedEventArgs obj)
|
private void OnOptionSelect(OptionButton.ItemSelectedEventArgs obj)
|
||||||
{
|
{
|
||||||
MapOptions.SelectId(obj.Id);
|
MapOptions.SelectId(obj.Id);
|
||||||
@@ -132,8 +107,10 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
|||||||
|
|
||||||
private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs obj)
|
private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
|
if (MapPath.Text.Length == 0) return;
|
||||||
|
|
||||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
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