Фикс панели выбора персонажей
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user