-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Обновление спонсорской системы (#905)
* Апдейт спонсорки * Доработка апдейта * упс
- Loading branch information
Showing
76 changed files
with
1,703 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Content.Client/_Sunrise/GhostTheme/GhostThemeBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt | ||
using Content.Shared._Sunrise.GhostTheme; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Client._Sunrise.GhostTheme; | ||
|
||
[UsedImplicitly] | ||
public sealed class GhostThemeBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
private GhostThemeMenu? _menu; | ||
|
||
public GhostThemeBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_menu = new GhostThemeMenu(); | ||
_menu.OnClose += Close; | ||
_menu.OnIdSelected += OnIdSelected; | ||
_menu.OpenCentered(); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
if (state is not GhostThemeBoundUserInterfaceState st) | ||
return; | ||
|
||
_menu?.UpdateState(st.GhostThemes); | ||
} | ||
|
||
private void OnIdSelected(string selectedId) | ||
{ | ||
SendMessage(new GhostThemePrototypeSelectedMessage(selectedId)); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
if (disposing) | ||
{ | ||
_menu?.Close(); | ||
_menu = null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
Title="{Loc 'ghost-theme-menu-title'}" | ||
MinSize="612 612" | ||
Resizable="False"> | ||
<BoxContainer Orientation="Vertical"> | ||
<ScrollContainer VerticalExpand="True"> | ||
<GridContainer Name="Grid" Columns="4" Margin="0 5" > | ||
</GridContainer> | ||
</ScrollContainer> | ||
</BoxContainer> | ||
</DefaultWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt | ||
using System.Numerics; | ||
using Content.Client.Stylesheets; | ||
using Content.Shared._Sunrise.GhostTheme; | ||
using Content.Shared._Sunrise.SunriseCCVars; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Client.Utility; | ||
using Robust.Shared.Configuration; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client._Sunrise.GhostTheme; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class GhostThemeMenu : DefaultWindow | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
|
||
public event Action<string>? OnIdSelected; | ||
|
||
private List<string> _availableGhostThemes = []; | ||
|
||
public GhostThemeMenu() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
} | ||
|
||
public void UpdateState(List<string> ghostThemes) | ||
{ | ||
_availableGhostThemes = ghostThemes; | ||
UpdateGrid(); | ||
} | ||
|
||
private void UpdateGrid() | ||
{ | ||
ClearGrid(); | ||
|
||
foreach (var ghostTheme in _availableGhostThemes) | ||
{ | ||
if (!_prototypeManager.TryIndex(ghostTheme, out GhostThemePrototype? ghostThemePrototype)) | ||
continue; | ||
|
||
var button = new Button | ||
{ | ||
SetSize = new Vector2(128, 128), | ||
HorizontalExpand = true, | ||
ToggleMode = false, | ||
StyleClasses = {StyleBase.ButtonSquare}, | ||
}; | ||
button.OnPressed += _ => | ||
{ | ||
OnIdSelected?.Invoke(ghostTheme); | ||
_cfg.SetCVar(SunriseCCVars.SponsorGhostTheme, ghostTheme); | ||
_cfg.SaveToFile(); | ||
}; | ||
Grid.AddChild(button); | ||
|
||
var ghost = new TextureRect() | ||
{ | ||
Texture = ghostThemePrototype.Sprite.Frame0(), | ||
Stretch = TextureRect.StretchMode.KeepAspectCentered, | ||
}; | ||
|
||
button.AddChild(ghost); | ||
} | ||
} | ||
|
||
private void ClearGrid() | ||
{ | ||
Grid.RemoveAllChildren(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
Content.Client/_Sunrise/SponsorTiers/SponsorTierEntry.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<Control xmlns="https://spacestation14.io" | ||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
Name="BackgroundColorPanel" | ||
MouseFilter="Pass"> | ||
<ScrollContainer HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True"> | ||
<BoxContainer Orientation="Vertical" VerticalExpand="True" VerticalAlignment="Stretch"> | ||
<BoxContainer Orientation="Vertical" Name="EntryContent" VerticalExpand="True" | ||
HorizontalAlignment="Stretch" VerticalAlignment="Top" Access="Public" > | ||
<!-- Информация --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-entry-info'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 5 0 0"> | ||
<Label Name="TierTitle" Text="{Loc 'sponsor-tiers-gui-tier'}" StyleClasses="LabelKeyText" Margin="0 0 5 0" /> | ||
<Label Name="TierLabel"/> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 5 0 0"> | ||
<Label Name="OocColorTitle" Text="{Loc 'sponsor-tiers-gui-ooc-color'}" StyleClasses="LabelKeyText" Margin="0 0 5 0" /> | ||
<Label Name="OocColorLabel"/> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 5 0 0"> | ||
<Label Name="ExtraSlotsTitle" Text="{Loc 'sponsor-tiers-gui-extra-slots'}" StyleClasses="LabelKeyText" Margin="0 0 5 0" /> | ||
<Label Name="ExtraSlotsLabel"/> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 5 0 0"> | ||
<Label Name="PriorityJoinTitle" Text="{Loc 'sponsor-tiers-gui-priority-join'}" StyleClasses="LabelKeyText" Margin="0 0 5 0" /> | ||
<Label Name="PriorityJoinLabel"/> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 5 0 0"> | ||
<Label Name="AllowedRespawnTitle" Text="{Loc 'sponsor-tiers-gui-allowed-respawn'}" StyleClasses="LabelKeyText" Margin="0 0 5 0" /> | ||
<Label Name="AllowedRespawnLabel"/> | ||
</BoxContainer> | ||
<!-- TTS голоса --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-tts-voices'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-tts-voices-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="TTSVoicesGrid" Columns="4" Margin="0 5" /> | ||
<!-- Открытие рас --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-allowed-species'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-allowed-species-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="AllowedSpeciesGrid" Columns="6" Margin="0 5" /> | ||
<!-- Открытие антагов --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-open-antags'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-open-antags-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="OpenAntagGrid" Columns="6" Margin="0 5" /> | ||
<!-- Приоритет антагов --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-priority-antags'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-priority-antags-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="PriorityAntagGrid" Columns="6" Margin="0 5" /> | ||
<!-- Открытие ролей призраков --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-open-ghost-roles'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-open-ghost-roles-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="OpenGhostRolesGrid" Columns="6" Margin="0 5" /> | ||
<!-- Приоритет ролей призраков --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-priority-ghost-roles'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-priority-ghost-roles-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="PriorityGhostRolesGrid" Columns="6" Margin="0 5" /> | ||
<!-- Открытие ролей --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-open-roles'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-open-roles-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="OpenRolesGrid" Columns="6" Margin="0 5" /> | ||
<!-- Приоритет ролей --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-priority-roles'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-priority-roles-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="PriorityRolesGrid" Columns="6" Margin="0 5" /> | ||
<!-- Пропуск ролей --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-bypass-roles'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-bypass-roles-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="BypassRolesGrid" Columns="6" Margin="0 5" /> | ||
<!-- Кастомизация --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-allowed-markings'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-allowed-markings-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="AllowedMarkingsGrid" Columns="6" Margin="0 5" /> | ||
<!-- Лоадауты --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-allowed-loadouts'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-allowed-loadouts-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="AllowedLoadoutsGrid" Columns="6" Margin="0 5" /> | ||
<!-- Скины призрака --> | ||
<BoxContainer Orientation="Horizontal" > | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
<Label Text="{Loc 'sponsor-tiers-gui-ghost-themes'}" StyleClasses="LabelKeyText"/> | ||
<customControls:HSeparator Color="#4972A1" HorizontalExpand="True" MaxHeight="2" /> | ||
</BoxContainer> | ||
<Label Text="{Loc 'sponsor-tiers-gui-ghost-themes-description'}" StyleClasses="LabelKeyText"/> | ||
<GridContainer Name="GhostThemesGrid" Columns="6" Margin="0 5" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</ScrollContainer> | ||
</Control> |
Oops, something went wrong.