Фикс описания, надеюсь последний
This commit is contained in:
parent
f7e7f70c82
commit
fda5f30a1d
4 changed files with 23 additions and 12 deletions
|
|
@ -11,9 +11,9 @@ namespace Content.Client.FlavorText
|
|||
{
|
||||
public Action<string>? OnFlavorTextChanged;
|
||||
|
||||
private ISharedSponsorsManager? _sponsorsMgr; // Sunrise-Sponsors
|
||||
private readonly ISharedSponsorsManager? _sponsorsMgr; // Sunrise-Sponsors
|
||||
|
||||
public FlavorText(ISharedSponsorsManager? sponsorsMgr, bool sponsorOnly) // Sunrise-Edit
|
||||
public FlavorText(ISharedSponsorsManager? sponsorsMgr, bool sponsorOnly, int baseMaxDescLength) // Sunrise-Edit
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
|
@ -23,17 +23,25 @@ namespace Content.Client.FlavorText
|
|||
var loc = IoCManager.Resolve<ILocalizationManager>();
|
||||
CFlavorTextInput.Placeholder = new Rope.Leaf(loc.GetString("flavor-text-placeholder"));
|
||||
CFlavorTextInput.OnTextChanged += _ => FlavorTextChanged();
|
||||
// Sunrise-Start
|
||||
if (sponsorOnly)
|
||||
{
|
||||
SponsorOnlyNotify.Visible = true;
|
||||
CFlavorTextInput.Visible = false;
|
||||
LimitBox.Visible = false;
|
||||
}
|
||||
|
||||
if (_sponsorsMgr != null && _sponsorsMgr.ClientAllowedFlavor())
|
||||
{
|
||||
var maxDescLength = _sponsorsMgr.ClientGetSizeFlavor();
|
||||
LimitLabel.Text = $"{maxDescLength}";
|
||||
}
|
||||
else
|
||||
{
|
||||
LimitLabel.Text = $"{baseMaxDescLength}";
|
||||
}
|
||||
// Sunrise-Start
|
||||
if (!sponsorOnly || _sponsorsMgr == null)
|
||||
{
|
||||
SponsorOnlyNotify.Visible = false;
|
||||
CFlavorTextInput.Visible = true;
|
||||
LimitBox.Visible = true;
|
||||
}
|
||||
else if (_sponsorsMgr.ClientAllowedFlavor())
|
||||
{
|
||||
SponsorOnlyNotify.Visible = false;
|
||||
CFlavorTextInput.Visible = true;
|
||||
LimitBox.Visible = true;
|
||||
|
|
|
|||
|
|
@ -472,7 +472,8 @@ namespace Content.Client.Lobby.UI
|
|||
|
||||
// Sunrise-Start
|
||||
var sponsorOnly = _cfgManager.GetCVar(SunriseCCVars.FlavorTextSponsorOnly);
|
||||
_flavorText = new FlavorText.FlavorText(_sponsorsMgr, sponsorOnly);
|
||||
var baseMaxDescLength = _cfgManager.GetCVar(SunriseCCVars.FlavorTextBaseLength);
|
||||
_flavorText = new FlavorText.FlavorText(_sponsorsMgr, sponsorOnly, baseMaxDescLength);
|
||||
// Sunrise-End
|
||||
TabContainer.AddChild(_flavorText);
|
||||
TabContainer.SetTabTitle(TabContainer.ChildCount - 1, Loc.GetString("humanoid-profile-editor-flavortext-tab"));
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ namespace Content.Shared.Preferences
|
|||
private static readonly Regex ICNameCaseRegex = new(@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)");
|
||||
|
||||
public const int MaxNameLength = 32;
|
||||
public const int MaxDescLength = 512;
|
||||
|
||||
/// <summary>
|
||||
/// Job preferences for initial spawn.
|
||||
|
|
@ -573,7 +572,7 @@ namespace Content.Shared.Preferences
|
|||
|
||||
// Sunrise-Start
|
||||
IoCManager.Instance!.TryResolveType<ISharedSponsorsManager>(out var sponsors);
|
||||
var maxDescLength = MaxDescLength;
|
||||
var maxDescLength = configManager.GetCVar(SunriseCCVars.FlavorTextBaseLength);
|
||||
if (sponsors != null)
|
||||
{
|
||||
maxDescLength = sponsors.GetSizeFlavor(session.UserId);
|
||||
|
|
|
|||
|
|
@ -389,4 +389,7 @@ public sealed class SunriseCCVars
|
|||
/// </summary>
|
||||
public static readonly CVarDef<bool> FlavorTextSponsorOnly =
|
||||
CVarDef.Create("flavor_text.sponsor_only", true, CVar.SERVER | CVar.REPLICATED);
|
||||
|
||||
public static readonly CVarDef<int> FlavorTextBaseLength =
|
||||
CVarDef.Create("flavor_text.length", 512, CVar.SERVER | CVar.REPLICATED);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue