Фикс панели выбора персонажей

This commit is contained in:
Valtos
2023-06-23 10:02:58 +07:00
committed by Aviu00
parent dd45d9d613
commit 204aab28dd
2 changed files with 6 additions and 13 deletions

View File

@@ -126,11 +126,10 @@ namespace Content.Client.Preferences.UI
continue;
}
isDisplayedMaxSlots = numberOfFullSlots >= _preferencesManager.Settings.MaxCharacterSlots;
if (isDisplayedMaxSlots)
break;
numberOfFullSlots++;
isDisplayedMaxSlots = numberOfFullSlots >= _preferencesManager.Settings.MaxCharacterSlots;
var characterPickerButton = new CharacterPickerButton(_entityManager,
_preferencesManager,
_prototypeManager,
@@ -148,6 +147,7 @@ namespace Content.Client.Preferences.UI
UpdateUI();
args.Event.Handle();
};
characterPickerButton.Disabled = numberOfFullSlots >= _preferencesManager.Settings.MaxCharacterSlots + 1;
}
_createNewCharacterButton.Disabled = isDisplayedMaxSlots;

View File

@@ -36,8 +36,6 @@ namespace Content.Server.Preferences.Managers
private readonly Dictionary<NetUserId, PlayerPrefData> _cachedPlayerPrefs =
new();
//private int MaxCharacterSlots => _cfg.GetCVar(CCVars.GameMaxCharacterSlots);
public void Init()
{
_netManager.RegisterNetMessage<MsgPreferencesAndSettings>();
@@ -133,7 +131,7 @@ namespace Content.Server.Preferences.Managers
return;
}
if (slot < 0 || slot >= GetMaxUserCharacterSlots(userId))
if (slot < 0)
{
return;
}
@@ -238,12 +236,7 @@ namespace Content.Server.Preferences.Managers
{
var maxSlots = _cfg.GetCVar(CCVars.GameMaxCharacterSlots);
var extraSlots = _sponsors.TryGetInfo(userId, out var sponsor) ? sponsor.ExtraSlots : 0;
var maxSavedSlots = 1;
if (_cachedPlayerPrefs.TryGetValue(userId, out var pref))
{
maxSavedSlots = pref.Prefs!.Characters.Count;
}
return Math.Max(maxSlots + extraSlots, maxSavedSlots - 1);
return maxSlots + extraSlots;
}
/// <summary>