[feat] donate

# Conflicts:
#	Content.Client/Entry/EntryPoint.cs
#	Content.Client/IoC/ClientContentIoC.cs
#	Content.Server/Chat/Managers/ChatManager.cs
#	Content.Server/Entry/EntryPoint.cs
#	Content.Server/GameTicking/GameTicker.Player.cs
#	Content.Server/GameTicking/GameTicker.StatusShell.cs
#	Content.Server/IoC/ServerContentIoC.cs
#	Content.Shared/Humanoid/HumanoidCharacterAppearance.cs
#	Content.Shared/Humanoid/Markings/MarkingPrototype.cs
#	Content.Shared/Preferences/HumanoidCharacterProfile.cs
This commit is contained in:
rhailrake
2023-04-25 19:46:20 +06:00
committed by Remuchi
parent 0cbb69d0a1
commit 4e85539ec6
29 changed files with 809 additions and 83 deletions

View File

@@ -21,6 +21,8 @@ using Content.Client.Singularity;
using Content.Client.Stylesheets;
using Content.Client.Viewport;
using Content.Client.Voting;
using Content.Client.White.JoinQueue;
using Content.Client.White.Sponsors;
using Content.Shared.Ame;
using Content.Shared.Gravity;
using Content.Shared.Localizations;
@@ -71,6 +73,11 @@ namespace Content.Client.Entry
[Dependency] private readonly IReplayLoadManager _replayLoad = default!;
[Dependency] private readonly ILogManager _logManager = default!;
//WD-EDIT
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
[Dependency] private readonly JoinQueueManager _queueManager = default!;
//WD-EDIT
public override void Init()
{
ClientContentIoC.Register();
@@ -163,6 +170,11 @@ namespace Content.Client.Entry
_userInterfaceManager.SetActiveTheme(_configManager.GetCVar(CVars.InterfaceTheme));
_documentParsingManager.Initialize();
//WD-EDIT
_sponsorsManager.Initialize();
_queueManager.Initialize();
//WD-EDIT
_baseClient.RunLevelChanged += (_, args) =>
{
if (args.NewLevel == ClientRunLevel.Initialize)

View File

@@ -1,4 +1,5 @@
using System.Linq;
using Content.Client.White.Sponsors;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
@@ -19,6 +20,10 @@ public sealed partial class MarkingPicker : Control
[Dependency] private readonly MarkingManager _markingManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
//WD-EDIT
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
//WD-EDIT
public Action<MarkingSet>? OnMarkingAdded;
public Action<MarkingSet>? OnMarkingRemoved;
public Action<MarkingSet>? OnMarkingColorChange;
@@ -202,6 +207,18 @@ public sealed partial class MarkingPicker : Control
var item = CMarkingsUnused.AddItem($"{GetMarkingName(marking)}", marking.Sprites[0].Frame0());
item.Metadata = marking;
//WD-EDIT
if (marking.SponsorOnly)
{
item.Disabled = true;
if (_sponsorsManager.TryGetInfo(out var sponsor))
{
item.Disabled = !sponsor.AllowedMarkings.Contains(marking.ID);
}
}
//WD-EDIT
}
CMarkingPoints.Visible = _currentMarkings.PointsLeft(_selectedMarkingCategory) != -1;

View File

@@ -1,4 +1,5 @@
using System.Linq;
using Content.Client.White.Sponsors;
using Content.Shared.Humanoid.Markings;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
@@ -12,6 +13,10 @@ public sealed partial class SingleMarkingPicker : BoxContainer
{
[Dependency] private readonly MarkingManager _markingManager = default!;
//WD-EDIT
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
//WD-EDIT
/// <summary>
/// What happens if a marking is selected.
/// It will send the 'slot' (marking index)
@@ -191,6 +196,17 @@ public sealed partial class SingleMarkingPicker : BoxContainer
var item = MarkingList.AddItem(Loc.GetString($"marking-{id}"), marking.Sprites[0].Frame0());
item.Metadata = marking.ID;
//WD-EDIT
if (marking.SponsorOnly)
{
item.Disabled = true;
if (_sponsorsManager.TryGetInfo(out var sponsor))
{
item.Disabled = !sponsor.AllowedMarkings.Contains(marking.ID);
}
}
//WD-EDIT
if (_markings[Slot].MarkingId == id)
{
_ignoreItemSelected = true;

View File

@@ -2,7 +2,6 @@ using Content.Client.Administration.Managers;
using Content.Client.Changelog;
using Content.Client.Chat.Managers;
using Content.Client.Clickable;
using Content.Client.Options;
using Content.Client.Eui;
using Content.Client.GhostKick;
using Content.Client.Info;
@@ -15,14 +14,13 @@ using Content.Client.Fullscreen;
using Content.Client.Stylesheets;
using Content.Client.Viewport;
using Content.Client.Voting;
using Content.Shared.Administration;
using Content.Shared.Administration.Logs;
using Content.Shared.Module;
using Content.Client.Guidebook;
using Content.Client.Replay;
using Content.Client.White.JoinQueue;
using Content.Client.White.Sponsors;
using Content.Shared.Administration.Managers;
namespace Content.Client.IoC
{
internal static class ClientContentIoC
@@ -49,6 +47,11 @@ namespace Content.Client.IoC
IoCManager.Register<JobRequirementsManager>();
IoCManager.Register<DocumentParsingManager>();
IoCManager.Register<ContentReplayPlaybackManager, ContentReplayPlaybackManager>();
//WD-EDIT
IoCManager.Register<JoinQueueManager>();
IoCManager.Register<SponsorsManager>();
//WD-EDIT
}
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Client.White.Sponsors;
using Content.Shared.Preferences;
using Robust.Client;
using Robust.Shared.IoC;
@@ -19,6 +20,10 @@ namespace Content.Client.Preferences
[Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IBaseClient _baseClient = default!;
//WD-EDIT
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
//WD-EDIT
public event Action? OnServerDataLoaded;
public GameSettings Settings { get; private set; } = default!;
@@ -60,7 +65,10 @@ namespace Content.Client.Preferences
public void UpdateCharacter(ICharacterProfile profile, int slot)
{
profile.EnsureValid();
//WD-EDIT
var allowedMarkings = _sponsorsManager.TryGetInfo(out var sponsor) ? sponsor.AllowedMarkings : new string[]{};
profile.EnsureValid(allowedMarkings);
//WD-EDIT
var characters = new Dictionary<int, ICharacterProfile>(Preferences.Characters) {[slot] = profile};
Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor);
var msg = new MsgUpdateCharacter

View File

@@ -0,0 +1,26 @@
using Content.Shared.White.JoinQueue;
using Robust.Client.State;
using Robust.Shared.Network;
namespace Content.Client.White.JoinQueue;
public sealed class JoinQueueManager
{
[Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IStateManager _stateManager = default!;
public void Initialize()
{
_netManager.RegisterNetMessage<MsgQueueUpdate>(OnQueueUpdate);
}
private void OnQueueUpdate(MsgQueueUpdate msg)
{
if (_stateManager.CurrentState is not QueueState)
{
_stateManager.RequestStateChange<QueueState>();
}
((QueueState) _stateManager.CurrentState).OnQueueUpdate(msg);
}
}

View File

@@ -0,0 +1,34 @@
<Control xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:parallax="clr-namespace:Content.Client.Parallax"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls">
<parallax:ParallaxControl />
<Control HorizontalAlignment="Center" VerticalAlignment="Center">
<PanelContainer StyleClasses="AngleRect" />
<BoxContainer Orientation="Vertical" MinSize="200 200">
<BoxContainer Orientation="Horizontal">
<Label Margin="8 0 0 0" Text="{Loc 'queue-title'}"
StyleClasses="LabelHeading" VAlign="Center" />
<Button Name="QuitButton" Text="{Loc 'queue-quit'}"
HorizontalAlignment="Right" HorizontalExpand="True" />
</BoxContainer>
<controls:HighDivider />
<BoxContainer Orientation="Vertical" VerticalExpand="True" Margin="0 20 0 0">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Vertical" VerticalExpand="True">
<Label Text="{Loc 'queue-position'}" Align="Center" />
<Label Name="QueuePosition" StyleClasses="LabelHeading" Align="Center" />
</BoxContainer>
<BoxContainer Orientation="Vertical" VerticalExpand="True" Margin="0 10 0 0">
<Label Text="{Loc 'queue-total'}" Align="Center" />
<Label Name="QueueTotal" StyleClasses="LabelHeading" Align="Center" />
</BoxContainer>
</BoxContainer>
</BoxContainer>
<BoxContainer Orientation="Horizontal" VerticalAlignment="Bottom" Margin="0 20 0 0">
<Button Name="PriorityJoinButton" Text="{Loc 'queue-priority-join'}" HorizontalExpand="True" StyleClasses="OpenRight" />
</BoxContainer>
</BoxContainer>
</Control>
</Control>

View File

@@ -0,0 +1,36 @@
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
namespace Content.Client.White.JoinQueue;
[GenerateTypedNameReferences]
public sealed partial class QueueGui : Control
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
public event Action? QuitPressed;
public QueueGui()
{
RobustXamlLoader.Load(this);
LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide);
QuitButton.OnPressed += (_) => QuitPressed?.Invoke();
PriorityJoinButton.OnPressed += (_) =>
{
var linkPatreon = _cfg.GetCVar(CCVars.InfoLinksPatreon);
IoCManager.Resolve<IUriOpener>().OpenUri(linkPatreon);
};
}
public void UpdateInfo(int total, int position)
{
QueueTotal.Text = total.ToString();
QueuePosition.Text = position.ToString();
}
}

View File

@@ -0,0 +1,53 @@
using Robust.Client.Console;
using Robust.Client.GameObjects;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Shared.Player;
using Content.Shared.White.JoinQueue;
using Robust.Client.Audio;
namespace Content.Client.White.JoinQueue;
public sealed class QueueState : State
{
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
private const string JoinSoundPath = "/Audio/Effects/voteding.ogg";
private QueueGui? _gui;
protected override void Startup()
{
_gui = new QueueGui();
_userInterfaceManager.StateRoot.AddChild(_gui);
_gui.QuitPressed += OnQuitPressed;
}
protected override void Shutdown()
{
_gui!.QuitPressed -= OnQuitPressed;
_gui.Dispose();
Ding();
}
private void Ding()
{
if (IoCManager.Resolve<IEntityManager>().TrySystem<AudioSystem>(out var audio))
{
audio.PlayGlobal(JoinSoundPath, Filter.Local(), false);
}
}
public void OnQueueUpdate(MsgQueueUpdate msg)
{
_gui?.UpdateInfo(msg.Total, msg.Position);
}
private void OnQuitPressed()
{
_consoleHost.ExecuteCommand("quit");
}
}

View File

@@ -0,0 +1,23 @@
using System.Diagnostics.CodeAnalysis;
using Content.Shared.White.Sponsors;
using Robust.Shared.Network;
namespace Content.Client.White.Sponsors;
public sealed class SponsorsManager
{
[Dependency] private readonly IClientNetManager _netMgr = default!;
private SponsorInfo? _info;
public void Initialize()
{
_netMgr.RegisterNetMessage<MsgSponsorInfo>(msg => _info = msg.Info);
}
public bool TryGetInfo([NotNullWhen(true)] out SponsorInfo? sponsor)
{
sponsor = _info;
return _info != null;
}
}