Change behavior of default user creation. (#3396)
Change AccountManager to create a random id for the default user. Change UserEditorView to not show the 'Delete' button if there is only one user present.
This commit is contained in:
parent
7124d679fd
commit
ba9e0ca6dc
2 changed files with 10 additions and 5 deletions
|
@ -37,13 +37,16 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
|
|
||||||
_accountSaveDataManager = new AccountSaveDataManager(_profiles);
|
_accountSaveDataManager = new AccountSaveDataManager(_profiles);
|
||||||
|
|
||||||
if (!_profiles.TryGetValue(DefaultUserId.ToString(), out _))
|
if (_profiles.IsEmpty)
|
||||||
{
|
{
|
||||||
byte[] defaultUserImage = EmbeddedResources.Read("Ryujinx.HLE/HOS/Services/Account/Acc/DefaultUserImage.jpg");
|
byte[] defaultUserImage = EmbeddedResources.Read("Ryujinx.HLE/HOS/Services/Account/Acc/DefaultUserImage.jpg");
|
||||||
|
|
||||||
AddUser("RyuPlayer", defaultUserImage, DefaultUserId);
|
// Use a random UserId as default to avoid issues in multiplayer per #3396.
|
||||||
|
UserId userId = new UserId(Guid.NewGuid().ToString().Replace("-", ""));
|
||||||
|
|
||||||
OpenUser(DefaultUserId);
|
AddUser("RyuPlayer", defaultUserImage, userId);
|
||||||
|
|
||||||
|
OpenUser(userId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Data;
|
using Avalonia.Data;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
using FluentAvalonia.Core;
|
||||||
using FluentAvalonia.UI.Controls;
|
using FluentAvalonia.UI.Controls;
|
||||||
using FluentAvalonia.UI.Navigation;
|
using FluentAvalonia.UI.Navigation;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.UI.Controls;
|
using Ryujinx.Ava.UI.Controls;
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.Models;
|
using Ryujinx.Ava.UI.Models;
|
||||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
|
||||||
using System;
|
using System;
|
||||||
using UserProfile = Ryujinx.Ava.UI.Models.UserProfile;
|
using UserProfile = Ryujinx.Ava.UI.Models.UserProfile;
|
||||||
|
|
||||||
|
@ -21,7 +21,9 @@ namespace Ryujinx.Ava.UI.Views.User
|
||||||
|
|
||||||
public TempProfile TempProfile { get; set; }
|
public TempProfile TempProfile { get; set; }
|
||||||
public static uint MaxProfileNameLength => 0x20;
|
public static uint MaxProfileNameLength => 0x20;
|
||||||
public bool IsDeletable => _profile.UserId != AccountManager.DefaultUserId;
|
|
||||||
|
// Don't allow deletion if there is only one user
|
||||||
|
public bool IsDeletable => _parent.AccountManager.GetAllUsers().Count() != 1;
|
||||||
|
|
||||||
public UserEditorView()
|
public UserEditorView()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue