Fixed editor's "limit to my creatures" setting not updating properly, fixed mirror mode not working on reset buttons

This commit is contained in:
RisaDev
2024-01-09 22:14:41 +03:00
parent 44607e10d7
commit b979751ca4
9 changed files with 83 additions and 30 deletions

View File

@@ -5,6 +5,7 @@ using CustomizePlus.Armatures.Data;
using CustomizePlus.Core.Data;
using CustomizePlus.Core.Extensions;
using CustomizePlus.Core.Services;
using CustomizePlus.Profiles.Enums;
using CustomizePlus.Templates;
using CustomizePlus.Templates.Data;
using Newtonsoft.Json;
@@ -46,11 +47,13 @@ public sealed class Profile : ISavable
public bool IsWriteProtected { get; internal set; }
public ProfileType ProfileType { get; set; }
/// <summary>
/// Specifies if this profile is not persistent (ex. was made via IPC calls) and should not be displayed in UI.
/// Tells us if this profile is not persistent (ex. was made via IPC calls) and should have specific treatement like not being shown in UI, etc.
/// WARNING, TEMPLATES FOR TEMPORARY PROFILES *ARE NOT* STORED IN TemplateManager
/// </summary>
public bool IsTemporary { get; set; }
public bool IsTemporary => ProfileType == ProfileType.Temporary;
/// <summary>
/// Identificator specifying specific actor this profile applies to, only works for temporary profiles

View File

@@ -0,0 +1,8 @@
namespace CustomizePlus.Profiles.Enums;
public enum ProfileType
{
Normal,
Temporary,
Editor
}

View File

@@ -21,6 +21,7 @@ using CustomizePlus.Templates.Data;
using CustomizePlus.GameData.Data;
using CustomizePlus.GameData.Services;
using CustomizePlus.GameData.Extensions;
using CustomizePlus.Profiles.Enums;
namespace CustomizePlus.Profiles;
@@ -378,7 +379,7 @@ public class ProfileManager : IDisposable
return;
profile.Enabled = true;
profile.IsTemporary = true;
profile.ProfileType = ProfileType.Temporary;
profile.TemporaryActor = identifier;
profile.CharacterName = identifier.ToNameWithoutOwnerName();
profile.LimitLookupToOwnedObjects = false;
@@ -500,6 +501,10 @@ public class ProfileManager : IDisposable
private void SaveProfile(Profile profile)
{
//disallow saving special profiles
if (profile.ProfileType != ProfileType.Normal)
return;
profile.ModifiedDate = DateTimeOffset.UtcNow;
_saveService.QueueSave(profile);
}