2021-07-17 02:37:09 +02:00
|
|
|
|
using System.Collections.Generic;
|
2021-02-17 09:39:31 -03:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
using Robust.Client.AutoGenerated;
|
|
|
|
|
|
using Robust.Client.Console;
|
|
|
|
|
|
using Robust.Client.Player;
|
|
|
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
|
using Robust.Client.UserInterface.CustomControls;
|
2021-12-03 14:20:34 +01:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-02-17 09:39:31 -03:00
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
2021-02-17 09:39:31 -03:00
|
|
|
|
{
|
|
|
|
|
|
[GenerateTypedNameReferences]
|
|
|
|
|
|
[UsedImplicitly]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed partial class AddAtmosWindow : DefaultWindow
|
2021-02-17 09:39:31 -03:00
|
|
|
|
{
|
|
|
|
|
|
private IEnumerable<IMapGrid>? _data;
|
|
|
|
|
|
|
|
|
|
|
|
protected override void EnteredTree()
|
|
|
|
|
|
{
|
|
|
|
|
|
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
|
|
|
|
|
foreach (var grid in _data)
|
|
|
|
|
|
{
|
2021-12-06 14:00:39 +01:00
|
|
|
|
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
|
|
|
|
|
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridID;
|
2021-02-17 09:39:31 -03:00
|
|
|
|
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
|
|
|
|
|
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_data == null)
|
|
|
|
|
|
return;
|
|
|
|
|
|
var dataList = _data.ToList();
|
|
|
|
|
|
var selectedGrid = dataList[GridOptions.SelectedId].Index;
|
|
|
|
|
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|