Блядь, проебался с блокировкой описания. Добавил лимит клиенту

This commit is contained in:
Vigers Ray 2024-12-28 07:29:15 +03:00
parent f956cf3d31
commit cb00121117
6 changed files with 28 additions and 8 deletions

View file

@ -1,6 +1,10 @@
<Control Name="CFlavorText" xmlns="https://spacestation14.io">
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
<Label Name="SponsorOnlyNotify" Text="{Loc 'humanoid-profile-editor-flavortext-sponsor-only'}" StyleClasses="LabelKeyText" Visible="False" />
<Label Name="SponsorOnlyNotify" Text="{Loc 'humanoid-profile-editor-flavor-text-sponsor-only'}" StyleClasses="LabelKeyText" Visible="False" />
<BoxContainer Name="LimitBox" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 5 0 0">
<Label Name="LimitTitle" Text="{Loc 'humanoid-profile-editor-flavor-text-limit'}" StyleClasses="LabelKeyText" Margin="0 0 5 0" />
<Label Name="LimitLabel"/>
</BoxContainer>
<TextEdit Name="CFlavorTextInput" Access="Public" MinSize="220 100" Margin="10" HorizontalExpand="True" VerticalExpand="True" />
</BoxContainer>
</Control>

View file

@ -24,15 +24,25 @@ namespace Content.Client.FlavorText
CFlavorTextInput.Placeholder = new Rope.Leaf(loc.GetString("flavor-text-placeholder"));
CFlavorTextInput.OnTextChanged += _ => FlavorTextChanged();
// Sunrise-Start
if (sponsorOnly && _sponsorsMgr != null && !_sponsorsMgr.ClientAllowedFlavor())
if (sponsorOnly)
{
SponsorOnlyNotify.Visible = true;
CFlavorTextInput.Visible = false;
LimitBox.Visible = false;
}
if (_sponsorsMgr != null && _sponsorsMgr.ClientAllowedFlavor())
{
var maxDescLength = _sponsorsMgr.ClientGetSizeFlavor();
LimitLabel.Text = $"{maxDescLength}";
SponsorOnlyNotify.Visible = false;
CFlavorTextInput.Visible = true;
LimitBox.Visible = true;
}
else
{
SponsorOnlyNotify.Visible = false;
CFlavorTextInput.Visible = true;
SponsorOnlyNotify.Visible = true;
CFlavorTextInput.Visible = false;
LimitBox.Visible = false;
}
// Sunrise-End
}

View file

@ -213,8 +213,8 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
var session = _actors.GetSession(entity);
if (!_configurationManager.GetCVar(SunriseCCVars.FlavorTextSponsorOnly)
&& _sponsorsManager != null
&& _sponsorsManager.ClientAllowedFlavor()
&& session != null)
&& session != null
&& _sponsorsManager.IsAllowedFlavor(session.UserId))
{
var maxDescLength = _sponsorsManager.GetSizeFlavor(session.UserId);
var flavortext = profile.FlavorText;
@ -224,6 +224,10 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
}
AddComp<DetailExaminableComponent>(entity.Value).Content = flavortext;
}
else
{
AddComp<DetailExaminableComponent>(entity.Value).Content = profile.FlavorText;
}
}
// Sunrise-End
}

View file

@ -576,7 +576,7 @@ namespace Content.Shared.Preferences
if (sponsors != null)
{
maxDescLength = sponsors.GetSizeFlavor(session.UserId);
if (sponsors.IsAllowedFlavor(session.UserId))
if (!sponsors.IsAllowedFlavor(session.UserId))
{
FlavorText = string.Empty;
}

View file

@ -1,4 +1,5 @@
ui-lobby-cfgwelcome = Добро пожаловать на { $name }
gamemode-title-hide = Скрыт
gamemode-desc-hide = Игровой режим скрыт.
humanoid-profile-editor-flavortext-sponsor-only = Описание доступно только для спонсоров.
humanoid-profile-editor-flavor-text-limit = Лимит символов:
humanoid-profile-editor-flavor-text-sponsor-only = Описание доступно только для спонсоров.

View file

@ -18,6 +18,7 @@ public interface ISharedSponsorsManager
public List<string> GetClientPrototypes();
public bool ClientAllowedRespawn();
public bool ClientAllowedFlavor();
public int ClientGetSizeFlavor();
public bool ClientIsSponsor();
public List<SponsorInfo> GetSponsorTiers();