Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jukebox #208

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4c8283b
All of it
Pspritechologist Jun 9, 2023
968a037
Merge branch 'master' of https://github.com/Simple-Station/Parkstatio…
Pspritechologist Jul 27, 2023
bebc7a8
it.. works?
DEATHB4DEFEAT Jul 27, 2023
49e82e4
Removed borked scrolls, fixed trackbar
Pspritechologist Jul 27, 2023
41fe374
what
DEATHB4DEFEAT Jul 27, 2023
a5ac623
Merge branch 'master' of https://github.com/Park-station/Parkstation …
DEATHB4DEFEAT Sep 16, 2023
6945164
it's something?
DEATHB4DEFEAT Sep 16, 2023
719f3fc
locale
DEATHB4DEFEAT Sep 16, 2023
3c44e0b
more queued songs
DEATHB4DEFEAT Sep 16, 2023
f2f9c7e
everything stylish
DEATHB4DEFEAT Sep 17, 2023
79ecdab
Jukeboxes can now be emagged. Renamed a handful of things to be less …
Pspritechologist Sep 24, 2023
39e59ff
Handled map pausing, added some docs, and generally clarified things.
Pspritechologist Oct 6, 2023
868e686
Added upgradable Jukebox parts (which means Jukeboxes are constructab…
Pspritechologist Oct 7, 2023
8caa105
Replaced the timer with an update check. Autoplay is working baybee
Pspritechologist Oct 13, 2023
be7d1e7
Jukebox now supports signalling, both for controlling it and reacting…
Pspritechologist Oct 13, 2023
c16e74a
Several naming and doc clarifications- and Jukeboxes now have proper …
Pspritechologist Oct 13, 2023
29fa453
Tons of stuff.
Pspritechologist Oct 30, 2023
791e9f0
Component uses actual colors
Pspritechologist Oct 30, 2023
5618361
Uses ResPath now
Pspritechologist Oct 30, 2023
32d684c
Danya Vodogonez
Pspritechologist Nov 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using Content.Shared.SimpleStation14.Jukebox;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.SimpleStation14.Jukebox.Ui;

[UsedImplicitly]
public sealed class JukeboxBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IEntityManager _entity = default!;
private readonly ISawmill _log = default!;

private JukeboxWindow? _window;

public JukeboxBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
_log = EntMan.System<SharedJukeBoxSystem>().Log;
}

protected override void Open()
{
base.Open();

if (!_entity.TryGetComponent<JukeboxComponent>(Owner, out var jukeboxComp))
{
_log.Error("No Jukebox component found for {0}!", _entity.ToPrettyString(Owner));
return;
}

_window = new JukeboxWindow(jukeboxComp, _log)
{
Title = _entity.GetComponent<MetaDataComponent>(Owner).EntityName
};

_window.OpenCentered();
_window.OnClose += Close;

_window.OnPlayButtonPressed += () => SendMessage(new JukeboxPlayButtonPressedMessage());

_window.OnSkipButtonPressed += () => SendMessage(new JukeboxSkipButtonPressedMessage());

_window.OnSongSelected += song => SendMessage(new JukeboxSongSelectedMessage(song));
}

protected override void ReceiveMessage(BoundUserInterfaceMessage msg)
{
base.ReceiveMessage(msg);

if (msg is not JukeboxUpdateStateMessage jukeboxMessage)
return;

_window?.UpdateState(jukeboxMessage.PopulateSongs);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;

_window?.Dispose();
}
}

20 changes: 20 additions & 0 deletions Content.Client/SimpleStation14/Jukebox/Ui/JukeboxSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Content.Shared.Emag.Systems;

namespace Content.Shared.SimpleStation14.Jukebox;

public sealed class SharedJukeBoxSystem : EntitySystem
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ClientSide, not Shared.

{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<JukeboxComponent, GotEmaggedEvent>(OnEmagged);
}

/// <summary>
/// Handles setting the Jukebox's state to emagged.
/// </summary>
private void OnEmagged(EntityUid jukeBox, JukeboxComponent jukeboxComp, ref GotEmaggedEvent args)
{
args.Handled = true;
}
}
296 changes: 296 additions & 0 deletions Content.Client/SimpleStation14/Jukebox/Ui/JukeboxWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
<controls:FancyWindow
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="null"
SetSize="550 775"
Resizable="False">
<Control>
<PanelContainer Name="BG_1">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#602C00"/>
</PanelContainer.PanelOverride>
</PanelContainer>

<BoxContainer
Margin="8 0 8 8"
Orientation="Vertical"
VerticalAlignment="Center"
HorizontalAlignment="Center">

<!-- Upper portion of UI -->
<BoxContainer
MinSize="530 487"
Margin="10 10 10 10"
Orientation="Horizontal">
<Control>
<PanelContainer
Name="Panel_1">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#767676"/>
</PanelContainer.PanelOverride>
</PanelContainer>

<BoxContainer
Orientation="Horizontal"
VerticalAlignment="Center"
HorizontalAlignment="Center">

<!-- Left side of upper portion -->
<BoxContainer
MinSize="300 487"
Orientation="Vertical"
Margin="10 10 10 10"
VerticalAlignment="Center"
HorizontalAlignment="Center">

<!-- Song art -->
<BoxContainer
Orientation="Vertical"
MinSize="270 212"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<TextureRect
Name="SongIcon"
Stretch="KeepAspectCentered"
SetSize="170 170" />

<Label
Name="SongName"
MinHeight="42"
Text="Song Name"
HorizontalAlignment="Center"
HorizontalExpand="False" />
</BoxContainer>

<!-- Controls/Next up -->
<BoxContainer
MinSize="295 236"
Margin="12 5 12 5"
Orientation="Horizontal"
VerticalAlignment="Center"
HorizontalAlignment="Left">
<!-- Controls -->
<BoxContainer
MinSize="69 158"
Orientation="Vertical"
VerticalAlignment="Center"
HorizontalAlignment="Left">

<Control MinSize="69 69" HorizontalAlignment="Center" VerticalAlignment="Center">
<PanelContainer Name="Accent_1" StyleClasses="AngleRect" />
<TextureButton
Name="PlayButton"
Scale="2 2"
TexturePath="/Textures/SimpleStation14/Interface/MediaControls/playpause.png"
Margin="5 5 5 5"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Control>

<Control MinSize="20 20"/>

<Control MinSize="69 69" HorizontalAlignment="Center" VerticalAlignment="Center">
<PanelContainer Name="Accent_2" StyleClasses="AngleRect" />
<TextureButton
Name="SkipButton"
Scale="2 2"
TexturePath="/Textures/SimpleStation14/Interface/MediaControls/skip.png"
Margin="5 5 5 5"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Control>
</BoxContainer>

<Control HorizontalAlignment="Stretch" HorizontalExpand="True" />

<!-- Next up -->
<ScrollContainer
Name="NextUpScroll"
MinSize="200 180"
Margin="8 5 5 5"
HScrollEnabled="False">
<BoxContainer
Name="NextSongsBox"
Orientation="Vertical"
VerticalAlignment="Center">
<!-- Songs are added here by code -->
</BoxContainer>
</ScrollContainer>
</BoxContainer>

<!-- Track bar -->
<ProgressBar
Name="RunTimeBar"
MinSize="275 20"
HorizontalExpand="True"
MaxValue="1"
MinValue="0"
SetHeight="25"
VerticalAlignment="Center"/>
</BoxContainer>
</BoxContainer>
</Control>

<Control MinSize="20 20" />

<!-- Right side of upper portion -->
<BoxContainer
MinSize="190 485"
Orientation="Vertical"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<!-- Song picker -->
<Label
Name="SongsLabel"
Text="{Loc 'jukebox-ui-available-songs'}"
MinHeight="42"
HorizontalAlignment="Center"
HorizontalExpand="False" />

<Control MinSize="190 445">
<PanelContainer Name="Panel_2">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#767676"/>
</PanelContainer.PanelOverride>
</PanelContainer>

<BoxContainer
Orientation="Vertical">
<ScrollContainer
Name="SongPickerScroll"
Margin="8 8 8 8"
MinWidth="182"
MaxWidth="182"
MinHeight="437"
HScrollEnabled="False">
<BoxContainer
Name="SongPickerBox"
Orientation="Vertical"
Margin="5, 4, 2, 4">
<!-- Songs are added here by code -->
</BoxContainer>
</ScrollContainer>
</BoxContainer>
</Control>
</BoxContainer>
</BoxContainer>

<!-- Divider -->
<Control MinSize="512 2" HorizontalAlignment="Center" VerticalAlignment="Center">
<PanelContainer
Name="Accent_3"
StyleClasses="LowDivider">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#20181B"/>
</PanelContainer.PanelOverride>
</PanelContainer>
</Control>

<!-- Lower portion of UI -->
<BoxContainer
Name="DecorativeBox"
MinSize="482 172"
Margin="10 10 10 10"
Orientation="Horizontal"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<!-- Serial number plate -->
<Control MinSize="264 172" Margin="4 4 4 4">
<PanelContainer>
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#9D9EA8"/>
</PanelContainer.PanelOverride>
</PanelContainer>

<Control MinSize="258 164" HorizontalAlignment="Center" VerticalAlignment="Center">
<PanelContainer>
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#2D2D2D"/>
</PanelContainer.PanelOverride>
</PanelContainer>

<Control VerticalAlignment="Stretch" />

<BoxContainer Orientation="Vertical">
<!-- Title -->
<RichTextLabel Name="SerialTitle" MaxWidth="255" VerticalAlignment="Top" HorizontalAlignment="Center" />

<!-- Divider -->
<Control SetSize="249 2" HorizontalAlignment="Center" VerticalAlignment="Stretch">
<PanelContainer
Name="Accent_4"
StyleClasses="LowDivider">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#525252"/>
</PanelContainer.PanelOverride>
</PanelContainer>
</Control>
<Control VerticalAlignment="Stretch" VerticalExpand="True" />

<BoxContainer Margin="8 8 8 8" Orientation="Horizontal" VerticalAlignment="Bottom">
<Label Name="SerialHeader" MinSize="58 22" HorizontalAlignment="Left" Text="S#:" />

<Control HorizontalExpand="True" HorizontalAlignment="Stretch" />

<Control MinSize="135 30" HorizontalAlignment="Right">
<PanelContainer StyleClasses="AngleRect" />
<Label Name="SerialNumber" MinSize="95 20" Text="000000" HorizontalAlignment="Center" />
</Control>
</BoxContainer>
</BoxContainer>
</Control>
</Control>

<Control MinSize="30 30" />

<BoxContainer MinSize="180 172" Margin="4 4 4 4">
<!-- Coins Marker -->
<Control MinSize="80 172">
<PanelContainer>
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#A88B5E" />
</PanelContainer.PanelOverride>
</PanelContainer>

<Control MinSize="74 164" HorizontalAlignment="Center" VerticalAlignment="Center">
<PanelContainer>
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#903131" />
</PanelContainer.PanelOverride>
</PanelContainer>

<BoxContainer Name="CoinLabels" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<Label Text="C"/>
<Label Text="O"/>
<Label Text="I"/>
<Label Text="N"/>
<Label Text="S"/>
</BoxContainer>
</Control>
</Control>

<Control MinSize="22 22" />

<!-- Coin Slot -->
<Control MinSize="78 172">
<PanelContainer Name="Panel_3">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#480F0F" />
</PanelContainer.PanelOverride>
</PanelContainer>

<Control MinSize="11 123" MaxSize="11 123 ">
<PanelContainer>
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1A1A1C" />
</PanelContainer.PanelOverride>
</PanelContainer>
</Control>
</Control>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</Control>
</controls:FancyWindow>
Loading
Loading