Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 40 additions & 2 deletions Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Clothing;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Clothing.Upgrades.Components; // Corvax-Wega-UpgradableClothing
using Content.Shared.DirtVisuals; // Corvax-Wega-Dirtable
using Content.Shared.Humanoid;
using Content.Shared.Inventory;
Expand All @@ -13,6 +14,7 @@
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Containers; // Corvax-Wega-UpgradableClothing
using Robust.Shared.GameStates; // Corvax-Wega-ToggleClothing
using Robust.Shared.Serialization.TypeSerializers.Implementations;
using Robust.Shared.Utility;
Expand Down Expand Up @@ -58,6 +60,7 @@ public sealed class ClientClothingSystem : ClothingSystem
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly DisplacementMapSystem _displacement = default!;
[Dependency] private readonly SpriteSystem _sprite = default!;
[Dependency] private readonly SharedContainerSystem _container = default!; // Corvax-Wega-UpgradableClothing

public override void Initialize()
{
Expand Down Expand Up @@ -113,8 +116,7 @@ private void OnGetVisuals(EntityUid uid, ClothingComponent item, GetEquipmentVis
List<PrototypeLayerData>? layers = null;
// Corvax-Wega-ToggleClothing-start
var suffix = TryComp<ToggleableSpriteClothingComponent>(uid, out var toggleable)
? toggleable.ActiveSuffix
: string.Empty;
? toggleable.ActiveSuffix : string.Empty;
// Corvax-Wega-ToggleClothing-end

// first attempt to get species specific data.
Expand Down Expand Up @@ -161,6 +163,26 @@ private void OnGetVisuals(EntityUid uid, ClothingComponent item, GetEquipmentVis
}));
// Corvax-Wega-ToggleClothing-Edit-end
}

// Corvax-Wega-UpgradableClothing-start
if (TryComp<UpgradeableClothingComponent>(uid, out var upgradeable))
{
foreach (var upgrade in GetCurrentUpgrades(uid, upgradeable))
{
if (upgrade.Comp.EquippedState is not SpriteSpecifier.Rsi rsi)
continue;

var layerData = new PrototypeLayerData
{
RsiPath = rsi.RsiPath.ToString(),
State = rsi.RsiState,
};

var key = $"upgrade-{upgrade.Owner}-{args.Slot}";
args.Layers.Add((key, layerData));
}
}
// Corvax-Wega-UpgradableClothing-end
}

/// <summary>
Expand Down Expand Up @@ -450,6 +472,7 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot
RaiseLocalEvent(equipment, new EquipmentVisualsUpdatedEvent(equipee, slot, revealedLayers), true);
}

// Corvax-Wega-Add-start
// Corvax-Wega-ToggleClothing-start
private bool StateExists(EntityUid uid, string state, string? speciesId)
{
Expand Down Expand Up @@ -489,4 +512,19 @@ private void UpdateClothingVisuals(EntityUid uid)
RenderEquipment(parent, uid, clothing.InSlot, inventory, clothingComponent: clothing);
}
// Corvax-Wega-ToggleClothing-end

// Corvax-Wega-UpgradableClothing-start
private IEnumerable<Entity<ClothingUpgradeComponent>> GetCurrentUpgrades(EntityUid clothing, UpgradeableClothingComponent component)
{
if (!_container.TryGetContainer(clothing, component.UpgradesContainerId, out var container))
yield break;

foreach (var contained in container.ContainedEntities)
{
if (TryComp<ClothingUpgradeComponent>(contained, out var upgradeComp))
yield return (contained, upgradeComp);
}
}
// Corvax-Wega-UpgradableClothing-end
// Corvax-Wega-Add-end
}
4 changes: 4 additions & 0 deletions Content.Client/Lobby/UI/LobbyGui.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
<controls:HSpacer Spacing="10" />
<!-- Voting & misc button bar -->
<BoxContainer Orientation="Horizontal" MinSize="0 40" HorizontalAlignment="Right">
<!-- Corvax-Wega-Achievements-start -->
<Button Name="AchievementsButton" Access="Public" Text="{Loc 'ui-lobby-achievements-button'}"
StyleClasses="ButtonBig" />
<!-- Corvax-Wega-Achievements-end -->
<Button Name="AHelpButton" Access="Public" Text="{Loc 'ui-lobby-ahelp-button'}"
StyleClasses="ButtonBig" />
<vote:VoteCallMenuButton Name="CallVoteButton" StyleClasses="ButtonBig" />
Expand Down
19 changes: 19 additions & 0 deletions Content.Client/Lobby/UI/LobbyGui.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Client._Wega.Achievements; // Corvax-Wega-Achievements
using Content.Client.Message;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Robust.Client.AutoGenerated;
Expand All @@ -12,6 +13,8 @@ public sealed partial class LobbyGui : UIScreen
{
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;

private AchievementsWindow? _achievementsWindow; // Corvax-Wega-Achievements

public LobbyGui()
{
RobustXamlLoader.Load(this);
Expand All @@ -21,13 +24,29 @@ public LobbyGui()

LobbySong.SetMarkup(Loc.GetString("lobby-state-song-no-song-text"));

AchievementsButton.OnPressed += _ => OpenAchievementsWindow(); // Corvax-Wega-Achievements

LeaveButton.OnPressed += _ => _consoleHost.ExecuteCommand("disconnect");
OptionsButton.OnPressed += _ => UserInterfaceManager.GetUIController<OptionsUIController>().ToggleWindow();

CollapseButton.OnPressed += _ => TogglePanel(false);
ExpandButton.OnPressed += _ => TogglePanel(true);
}

// Corvax-Wega-Achievements-start
private async void OpenAchievementsWindow()
{
if (_achievementsWindow != null && _achievementsWindow.IsOpen)
{
_achievementsWindow.Close();
return;
}

_achievementsWindow = new AchievementsWindow();
_achievementsWindow.OpenCentered();
}
// Corvax-Wega-Achievements-end

public void SwitchState(LobbyGuiState state)
{
DefaultState.Visible = false;
Expand Down
24 changes: 24 additions & 0 deletions Content.Client/_Wega/Achievements/AchievementEntry.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Button Name="Container" xmlns="https://spacestation14.io"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
ToggleMode="True"
HorizontalExpand="True"
MouseFilter="Pass">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="5">
<PanelContainer SetSize="76 76" Margin="0 0 10 0">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#1B1B1E" BorderColor="#1E3D2A" BorderThickness="2" />
</PanelContainer.PanelOverride>
<TextureRect Name="AchievementIcon"
Stretch="KeepCentered" />
</PanelContainer>

<BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Label Name="AchievementName" StyleClasses="LabelHeading" />
<Control HorizontalExpand="True" />
<Label Name="AchievementStatus" StyleClasses="LabelSubText" />
</BoxContainer>
<RichTextLabel Name="AchievementDescription" VerticalExpand="True" />
</BoxContainer>
</BoxContainer>
</Button>
48 changes: 48 additions & 0 deletions Content.Client/_Wega/Achievements/AchievementEntry.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Content.Shared.Achievements;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._Wega.Achievements;

[GenerateTypedNameReferences]
public sealed partial class AchievementEntry : Button
{
public AchievementEntry(AchievementPrototype prototype, bool isUnlocked, SpriteSystem sprite)
{
RobustXamlLoader.Load(this);

var spriteSpecifier = prototype.AchievementIcon;
AchievementIcon.Texture = sprite.Frame0(spriteSpecifier);

AchievementName.Text = Loc.GetString(prototype.Name);

AchievementStatus.Text = isUnlocked
? Loc.GetString("ui-achievements-unlocked")
: Loc.GetString("ui-achievements-locked");
AchievementStatus.FontColorOverride = isUnlocked ? Color.Gold : Color.Gray;

if (prototype.Description != null)
{
var description = Loc.GetString(prototype.Description);
AchievementDescription.SetMessage(description);
}

Container.OnPressed += args => SetSelected(true);
}

public void SetSelected(bool selected)
{
Container.Pressed = selected;

if (selected)
{
Container.StyleClasses.Add("ButtonOpenBoth");
}
else
{
Container.StyleClasses.Remove("ButtonOpenBoth");
}
}
}
56 changes: 56 additions & 0 deletions Content.Client/_Wega/Achievements/AchievementNotification.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<PanelContainer
Name="NotificationRoot"
xmlns="https://spacestation14.io"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="0 0 20 20" SetSize="500 120"
Access="Public" Visible="False">

<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat
BackgroundColor="#1B1B1E"
BorderColor="#2F6F3B"
BorderThickness="3" />
</PanelContainer.PanelOverride>

<BoxContainer Orientation="Horizontal" Margin="10">

<PanelContainer SetSize="46 46" Margin="10 0 20 10">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat
BackgroundColor="#141417"
BorderColor="#4A8B5F"
BorderThickness="2" />
</PanelContainer.PanelOverride>
<TextureRect Name="NotificationIcon"
Stretch="KeepCentered"
SetSize="38 38"
Margin="5" />
</PanelContainer>

<BoxContainer Orientation="Vertical" VerticalExpand="True" MinWidth="250">

<BoxContainer Orientation="Horizontal" Margin="0 0 0 5">
<Label Text="{Loc 'ui-achievements-new'}"
StyleClasses="LabelHeading"
FontColorOverride="#4A8B5F" />
<Control HorizontalExpand="True" />
</BoxContainer>

<Label Name="NotificationName"
StyleClasses="LabelHeading"
Margin="0 0 0 5"
FontColorOverride="White" />

<RichTextLabel Name="NotificationDescription"
VerticalExpand="True"
HorizontalExpand="True"
StyleClasses="LabelSubText"
Margin="0 0 0 5" />

</BoxContainer>

</BoxContainer>

</PanelContainer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._Wega.Achievements;

[GenerateTypedNameReferences]
public sealed partial class AchievementNotification : PanelContainer
{
public AchievementNotification()
{
RobustXamlLoader.Load(this);
}

public void Show(string name, string description, Texture? icon)
{
NotificationName.Text = name;
NotificationDescription.SetMessage(description);
NotificationIcon.Texture = icon;

NotificationRoot.Visible = true;
}
}
Loading
Loading