mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* sprite, start work on systems * Woah! Its work! * Show gateways! Yay! * Update ring.png * Update portal.yml * bububui * Fuck UI * draw lines! * clear old links lines * UI button work now! * we can cut links via UI now! * yay! linking via UI * comfortable linking * Update hand_teleporter.yml * ambience, linked entities events * nice connect and disconnect sounds! * unpowering and memory * power fix * chip added * chip linking & auto linking * chip examined * auto linked chips&gates variants * Update meta.json * Update computers.yml * syndicate gateway console, portal coloring, realtime UI update * QoL update * Circuitboards * Update StationGatewayNavMapControl.cs * optimize Draw(), add Filled console variant * documentation * mass renaming bro * resprited * resprite agani * Update tags.yml * Update Resources/Prototypes/Entities/Structures/Machines/station_teleporter.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Resources/Prototypes/Entities/Objects/Devices/teleporters_chips.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Server/StationTeleporter/Components/TeleporterChipComponent.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Shared/StationTeleporter/StationTeleporterComponent.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * renaming renaming * sharedization * UI fix * Data simplify * remove autodeletion * PostWallDrawingAction * Update TeleporterChipComponent.cs * fix lines offset * labeler renaming, rebound restiction removed * prevent link popup and sound spamming * auto linking refactor * RD handheld teleporter integration * fix randomteleport bug * Update hand_teleporter.yml * Update SharedStationTeleporterSystem.cs * Update SharedStationTeleporterSystem.UI.cs * some clean up * first smol review pass * and that * review pass 2 * Update station_teleporter.yml * review pass 3 * review pass 4 * finally * update protos * another clean up * fix bugs * add to players * remove unnecesary update loop lol. * Update computers.yml * fieldrance review apply * Kazne resprite --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Co-authored-by: chromiumboy <50505512+chromiumboy@users.noreply.github.com>
117 lines
3.9 KiB
C#
117 lines
3.9 KiB
C#
using Content.Client.Message;
|
|
using Content.Shared.StationTeleporter;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Shared.Map;
|
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
|
|
|
namespace Content.Client.StationTeleporter;
|
|
|
|
/// <summary>
|
|
/// A single row in <see cref="StationTeleporterConsoleWindow"/>'s teleporter list: the name label plus the
|
|
/// locate/link buttons for one <see cref="StationTeleporterStatus"/>.
|
|
/// </summary>
|
|
public sealed class TeleporterRowControl : PanelContainer
|
|
{
|
|
private static readonly Color LinkedBackgroundColor = new(18, 61, 82); //TODO: UI palette usage
|
|
private static readonly Color UnlinkedBackgroundColor = new(30, 30, 34); //TODO: UI palette usage
|
|
private static readonly Color SelectedBackgroundColor = new(49, 117, 7); //TODO: UI palette usage
|
|
|
|
public readonly NetEntity TeleporterUid;
|
|
public readonly EntityCoordinates? Coordinates;
|
|
public readonly TeleporterButton LocateButton;
|
|
public readonly TeleporterButton LinkButton;
|
|
|
|
public TeleporterRowControl(StationTeleporterStatus teleporter, bool selected, EntityCoordinates? coordinates)
|
|
{
|
|
TeleporterUid = teleporter.TeleporterUid;
|
|
Coordinates = coordinates;
|
|
|
|
var linked = teleporter.LinkCoordinates is not null;
|
|
|
|
var bgColor = linked ? LinkedBackgroundColor : UnlinkedBackgroundColor;
|
|
if (selected)
|
|
bgColor = SelectedBackgroundColor;
|
|
|
|
HorizontalAlignment = HAlignment.Center;
|
|
VerticalAlignment = VAlignment.Center;
|
|
HorizontalExpand = true;
|
|
Margin = new Thickness(10);
|
|
PanelOverride = new StyleBoxFlat
|
|
{
|
|
BackgroundColor = bgColor,
|
|
BorderColor = Color.Black,
|
|
BorderThickness = new(2),
|
|
};
|
|
|
|
var mainBox = new BoxContainer
|
|
{
|
|
Orientation = LayoutOrientation.Vertical,
|
|
HorizontalExpand = true,
|
|
};
|
|
AddChild(mainBox);
|
|
|
|
// Teleporter name
|
|
var nameLabel = new RichTextLabel
|
|
{
|
|
HorizontalExpand = true,
|
|
HorizontalAlignment = HAlignment.Center,
|
|
Margin = new Thickness(0, 5),
|
|
};
|
|
nameLabel.SetMarkup($"[bold]{teleporter.Name}[/bold]");
|
|
mainBox.AddChild(nameLabel);
|
|
|
|
// Left subpart
|
|
var leftBox = new BoxContainer
|
|
{
|
|
SetWidth = 30,
|
|
Orientation = LayoutOrientation.Vertical,
|
|
HorizontalExpand = true,
|
|
};
|
|
mainBox.AddChild(leftBox);
|
|
|
|
// Right subpart
|
|
var rightBox = new BoxContainer
|
|
{
|
|
Orientation = LayoutOrientation.Vertical,
|
|
HorizontalExpand = true,
|
|
};
|
|
mainBox.AddChild(rightBox);
|
|
|
|
// Locating button
|
|
LocateButton = new TeleporterButton
|
|
{
|
|
Text = Loc.GetString("teleporter-console-user-interface-locate"),
|
|
TeleporterUid = teleporter.TeleporterUid,
|
|
Coordinates = coordinates,
|
|
HorizontalAlignment = HAlignment.Right,
|
|
SetWidth = 200f,
|
|
};
|
|
rightBox.AddChild(LocateButton);
|
|
|
|
// Link/Unlink button
|
|
var buttonLoc = "teleporter-console-user-interface-start-connection";
|
|
if (!teleporter.Powered)
|
|
buttonLoc = "teleporter-console-user-interface-no-power";
|
|
else if (linked)
|
|
buttonLoc = "teleporter-console-user-interface-cut-connection";
|
|
|
|
LinkButton = new TeleporterButton
|
|
{
|
|
Text = Loc.GetString(buttonLoc),
|
|
TeleporterUid = teleporter.TeleporterUid,
|
|
Coordinates = coordinates,
|
|
HorizontalAlignment = HAlignment.Right,
|
|
SetWidth = 200f,
|
|
Disabled = !teleporter.Powered,
|
|
};
|
|
rightBox.AddChild(LinkButton);
|
|
}
|
|
}
|
|
|
|
public sealed class TeleporterButton : Button
|
|
{
|
|
public int IndexInTable;
|
|
public NetEntity TeleporterUid;
|
|
public EntityCoordinates? Coordinates;
|
|
}
|