* Add shuttle interior drawing back Just do it per-tile she'll be right, at least it's done with 1 draw call. * Revamp shuttle console * Bunch of cleanup work * Lables sortito * dok * Pixel alignment and colours * Fix a bunch of drawing bugs * Shuttle map drawing * Drawing fixes * Map parallax working finally * weh * Commit all my stuff * mic * deez * Update everything * Xamlify everything * uh * Rudimentary blocker range * My enemies have succeeded * Bunch of changes to FTL * Heaps of cleanup * Fix FTL bugs * FTL * weewoo * FTL fallback * wew * weh * Basic FTL working * FTL working * FTL destination fixes * a * Exclusion zones * Fix drawing / FTL * Beacons working * Coordinates drawing * Fix unknown map names * Dorks beginning * State + docking cleanup start * Basic dock drawing * Bunch of drawing fixes * Batching / color fixes * Cleanup and beacons support * weh * weh * Begin pings * First draft at map objects * Map fixup * Faster drawing * Fix perf + FTL * Cached drawing * Fix drawing * Best I got * strips * Back to lists but with caching * Final optimisation * Fix dock bounds * Docking work * stinker * kobolds * Btns * Docking vis working * Fix docking pre-vis * canasses * Helldivers 2 * a * Array life * Fix * Fix TODOs * liltenhead feature club * dorking * Merge artifacts * Last-minute touchup
149 lines
3.9 KiB
C#
149 lines
3.9 KiB
C#
using System.Numerics;
|
|
using Content.Client.Computer;
|
|
using Content.Client.UserInterface.Controls;
|
|
using Content.Shared.Shuttles.BUIStates;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Map;
|
|
|
|
namespace Content.Client.Shuttles.UI;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
|
IComputerWindow<ShuttleBoundUserInterfaceState>
|
|
{
|
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
|
|
|
private ShuttleConsoleMode _mode = ShuttleConsoleMode.Nav;
|
|
|
|
public event Action<MapCoordinates, Angle>? RequestFTL;
|
|
public event Action<NetEntity, Angle>? RequestBeaconFTL;
|
|
|
|
public event Action<NetEntity, NetEntity>? DockRequest;
|
|
public event Action<NetEntity>? UndockRequest;
|
|
|
|
public ShuttleConsoleWindow()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
// Mode switching
|
|
NavModeButton.OnPressed += NavPressed;
|
|
MapModeButton.OnPressed += MapPressed;
|
|
DockModeButton.OnPressed += DockPressed;
|
|
|
|
// Modes are exclusive
|
|
var group = new ButtonGroup();
|
|
|
|
NavModeButton.Group = group;
|
|
MapModeButton.Group = group;
|
|
DockModeButton.Group = group;
|
|
|
|
NavModeButton.Pressed = true;
|
|
SetupMode(_mode);
|
|
|
|
MapContainer.RequestFTL += (coords, angle) =>
|
|
{
|
|
RequestFTL?.Invoke(coords, angle);
|
|
};
|
|
|
|
MapContainer.RequestBeaconFTL += (ent, angle) =>
|
|
{
|
|
RequestBeaconFTL?.Invoke(ent, angle);
|
|
};
|
|
|
|
DockContainer.DockRequest += (entity, netEntity) =>
|
|
{
|
|
DockRequest?.Invoke(entity, netEntity);
|
|
};
|
|
|
|
DockContainer.UndockRequest += entity =>
|
|
{
|
|
UndockRequest?.Invoke(entity);
|
|
};
|
|
}
|
|
|
|
private void ClearModes(ShuttleConsoleMode mode)
|
|
{
|
|
if (mode != ShuttleConsoleMode.Nav)
|
|
{
|
|
NavContainer.Visible = false;
|
|
}
|
|
|
|
if (mode != ShuttleConsoleMode.Map)
|
|
{
|
|
MapContainer.Visible = false;
|
|
MapContainer.SetMap(MapId.Nullspace, Vector2.Zero);
|
|
}
|
|
|
|
if (mode != ShuttleConsoleMode.Dock)
|
|
{
|
|
DockContainer.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void NavPressed(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
SwitchMode(ShuttleConsoleMode.Nav);
|
|
}
|
|
|
|
private void MapPressed(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
SwitchMode(ShuttleConsoleMode.Map);
|
|
}
|
|
|
|
private void DockPressed(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
SwitchMode(ShuttleConsoleMode.Dock);
|
|
}
|
|
|
|
private void SetupMode(ShuttleConsoleMode mode)
|
|
{
|
|
switch (mode)
|
|
{
|
|
case ShuttleConsoleMode.Nav:
|
|
NavContainer.Visible = true;
|
|
break;
|
|
case ShuttleConsoleMode.Map:
|
|
MapContainer.Visible = true;
|
|
MapContainer.Startup();
|
|
break;
|
|
case ShuttleConsoleMode.Dock:
|
|
DockContainer.Visible = true;
|
|
break;
|
|
default:
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|
|
public void SwitchMode(ShuttleConsoleMode mode)
|
|
{
|
|
if (_mode == mode)
|
|
return;
|
|
|
|
_mode = mode;
|
|
ClearModes(mode);
|
|
SetupMode(_mode);
|
|
}
|
|
|
|
public enum ShuttleConsoleMode : byte
|
|
{
|
|
Nav,
|
|
Map,
|
|
Dock,
|
|
}
|
|
|
|
public void UpdateState(EntityUid owner, ShuttleBoundUserInterfaceState cState)
|
|
{
|
|
var coordinates = _entManager.GetCoordinates(cState.NavState.Coordinates);
|
|
NavContainer.SetShuttle(coordinates?.EntityId);
|
|
MapContainer.SetShuttle(coordinates?.EntityId);
|
|
MapContainer.SetConsole(owner);
|
|
|
|
NavContainer.UpdateState(cState.NavState);
|
|
MapContainer.UpdateState(cState.MapState);
|
|
DockContainer.UpdateState(coordinates?.EntityId, cState.DockState);
|
|
}
|
|
}
|