All checks were successful
Tag and Release Lightless / tag-and-release (push) Successful in 2m9s
# Patchnotes 2.1.0 The changes in this update are more than just "patches". With a new UI, a new feature, and a bunch of bug fixes, improvements and a new member on the dev team, we thought this was more of a minor update. We would like to introduce @tsubasahane of MareCN to the team! We’re happy to work with them to bring Lightless and its features to the CN client as well as having another talented dev bring features and ideas to us. Speaking of which: # Location Sharing (Big shout out to @tsubasahane for bringing this feature) - Are you TIRED of scrambling to find the address of the venue you're in to share with your friends? We are introducing Location Sharing! An optional feature where you can share your location with direct pairs temporarily [30 minutes, 1 hour, 3 hours] minutes or until you turn it off for them. That's up to you! [#125](<#125>) [#49](<Lightless-Sync/LightlessServer#49>) - To share your location with a pair, click the three dots beside the pair and choose a duration to share with them. [#125](<#125>) [#49](<Lightless-Sync/LightlessServer#49>) - To view the location of someone who's shared with you, simply hover over the globe icon! [#125](<#125>) [#49](<Lightless-Sync/LightlessServer#49>) [1] # Model Optimization (Mesh Decimating) - This new option can automatically “simplify” incoming character meshes to help performance by reducing triangle counts. You choose how strong the reduction is (default/recommended is 80%). [#131](<#131>) - Decimation only kicks in when a mesh is above a certain triangle threshold, and only for the items that qualify for it and you selected for. [#131](<#131>) - Hair meshes is always excluded, since simplifying hair meshes is very prone to breaking. - You can find everything under Settings → Performance → Model Optimization. [#131](<#131>) + ** IF YOU HAVE USED DECIMATION IN TESTING, PLEASE CLEAR YOUR CACHE ❗ ** [2] # Animation (PAP) Validation (Safer animations) - Lightless now checks your currently animations to see if they work with your local skeleton/bone mod. If an animation matches, it’s included in what gets sent to other players. If it doesn’t, Lightless will skip it and write a warning to your log showing how many were skipped due to skeleton changes. Its defaulted to Unsafe (off). turn it on if you experience crashes from others users. [#131](<#131>) - Lightless also does the same kind of check for incoming animation files, to make sure they match the body/skeleton they were sent with. [#131](<#131>) - Because these checks can sometimes be a little picky, you can adjust how strict they are in Settings -> General -> Animation & Bones to reduce false positives. [#131](<#131>) # UI Changes (Thanks to @kyuwu for UI Changes) - The top part of the main screen has gotten a makeover. You can adjust the colors of the gradiant in the Color settings of Lightless. [#127](<#127>) [3] - Settings have gotten some changes as well to make this change more universal, and will use the same color settings. [#127](<#127>) - The particle effects of the gradient are toggleable in 'Settings -> UI -> Behavior' [#127](<#127>) - Instead of showing download/upload on bottom of Main UI, it will show VRAM usage and triangles with their optimization options next to it [#138](<#138>) # LightFinder / ShellFinder - UI Changes that follow our new design follow the color codes for the Gradient top as the main screen does. [#127](<#127>) [4] Co-authored-by: defnotken <itsdefnotken@gmail.com> Co-authored-by: azyges <aaaaaa@aaa.aaa> Co-authored-by: cake <admin@cakeandbanana.nl> Co-authored-by: Tsubasa <tsubasa@noreply.git.lightless-sync.org> Co-authored-by: choco <choco@patat.nl> Co-authored-by: celine <aaa@aaa.aaa> Co-authored-by: celine <celine@noreply.git.lightless-sync.org> Co-authored-by: Tsubasahane <wozaiha@gmail.com> Co-authored-by: cake <cake@noreply.git.lightless-sync.org> Reviewed-on: #123
222 lines
5.9 KiB
C#
222 lines
5.9 KiB
C#
using LightlessSync.API.Data;
|
|
using LightlessSync.API.Data.Enum;
|
|
using LightlessSync.API.Data.Extensions;
|
|
using LightlessSync.API.Dto.Group;
|
|
|
|
namespace LightlessSync.PlayerData.Pairs;
|
|
|
|
/// <summary>
|
|
/// core models for the pair system
|
|
/// </summary>
|
|
public sealed class PairState
|
|
{
|
|
public CharacterData? CharacterData { get; set; }
|
|
public Guid? TemporaryCollectionId { get; set; }
|
|
|
|
public bool IsEmpty => CharacterData is null && (TemporaryCollectionId is null || TemporaryCollectionId == Guid.Empty);
|
|
}
|
|
|
|
public readonly record struct PairUniqueIdentifier(string UserId);
|
|
|
|
/// <summary>
|
|
/// link between a pair id and character ident
|
|
/// </summary>
|
|
public sealed record PairRegistration(PairUniqueIdentifier PairIdent, string? CharacterIdent);
|
|
|
|
/// <summary>
|
|
/// per group membership info for a pair
|
|
/// </summary>
|
|
public sealed class GroupPairRelationship
|
|
{
|
|
public GroupPairRelationship(string groupId, GroupPairUserInfo? info)
|
|
{
|
|
GroupId = groupId;
|
|
UserInfo = info;
|
|
}
|
|
|
|
public string GroupId { get; }
|
|
public GroupPairUserInfo? UserInfo { get; private set; }
|
|
|
|
public void SetUserInfo(GroupPairUserInfo? info)
|
|
{
|
|
UserInfo = info;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// runtime view of a single pair connection
|
|
/// </summary>
|
|
public sealed class PairConnection
|
|
{
|
|
public PairConnection(UserData user)
|
|
{
|
|
User = user;
|
|
Groups = new Dictionary<string, GroupPairRelationship>(StringComparer.Ordinal);
|
|
}
|
|
|
|
public UserData User { get; }
|
|
public bool IsOnline { get; private set; }
|
|
public string? Ident { get; private set; }
|
|
public UserPermissions SelfToOtherPermissions { get; private set; } = UserPermissions.NoneSet;
|
|
public UserPermissions OtherToSelfPermissions { get; private set; } = UserPermissions.NoneSet;
|
|
public IndividualPairStatus? IndividualPairStatus { get; private set; }
|
|
public Dictionary<string, GroupPairRelationship> Groups { get; }
|
|
|
|
public bool IsPaused => SelfToOtherPermissions.IsPaused();
|
|
public bool IsDirectlyPaired => IndividualPairStatus is not null && IndividualPairStatus != API.Data.Enum.IndividualPairStatus.None;
|
|
public bool IsOneSided => IndividualPairStatus == API.Data.Enum.IndividualPairStatus.OneSided;
|
|
public bool HasAnyConnection => IsDirectlyPaired || Groups.Count > 0;
|
|
|
|
public void SetOnline(string? ident)
|
|
{
|
|
IsOnline = true;
|
|
Ident = ident;
|
|
}
|
|
|
|
public void SetOffline()
|
|
{
|
|
IsOnline = false;
|
|
Ident = null;
|
|
}
|
|
|
|
public void UpdatePermissions(UserPermissions own, UserPermissions other)
|
|
{
|
|
SelfToOtherPermissions = own;
|
|
OtherToSelfPermissions = other;
|
|
}
|
|
|
|
public void UpdateStatus(IndividualPairStatus? status)
|
|
{
|
|
IndividualPairStatus = status;
|
|
}
|
|
|
|
public void EnsureGroupRelationship(string groupId, GroupPairUserInfo? info)
|
|
{
|
|
if (Groups.TryGetValue(groupId, out var relationship))
|
|
{
|
|
relationship.SetUserInfo(info);
|
|
}
|
|
else
|
|
{
|
|
Groups[groupId] = new GroupPairRelationship(groupId, info);
|
|
}
|
|
}
|
|
|
|
public void RemoveGroupRelationship(string groupId)
|
|
{
|
|
Groups.Remove(groupId);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// syncshell metadata plus member connections
|
|
/// </summary>
|
|
public sealed class Syncshell
|
|
{
|
|
public Syncshell(GroupFullInfoDto dto)
|
|
{
|
|
GroupFullInfo = dto;
|
|
Users = new Dictionary<string, PairConnection>(StringComparer.Ordinal);
|
|
}
|
|
|
|
public GroupFullInfoDto GroupFullInfo { get; private set; }
|
|
public Dictionary<string, PairConnection> Users { get; }
|
|
|
|
public void Update(GroupFullInfoDto dto)
|
|
{
|
|
GroupFullInfo = dto;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// simple success/failure result
|
|
/// </summary>
|
|
public readonly struct PairOperationResult
|
|
{
|
|
private PairOperationResult(bool success, string? error)
|
|
{
|
|
Success = success;
|
|
Error = error;
|
|
}
|
|
|
|
public bool Success { get; }
|
|
public string? Error { get; }
|
|
|
|
public static PairOperationResult Ok() => new(true, null);
|
|
|
|
public static PairOperationResult Fail(string error) => new(false, error);
|
|
}
|
|
|
|
/// <summary>
|
|
/// typed success/failure result
|
|
/// </summary>
|
|
public readonly struct PairOperationResult<T>
|
|
{
|
|
private PairOperationResult(bool success, T value, string? error)
|
|
{
|
|
Success = success;
|
|
Value = value;
|
|
Error = error;
|
|
}
|
|
|
|
public bool Success { get; }
|
|
public T Value { get; }
|
|
public string? Error { get; }
|
|
|
|
public static PairOperationResult<T> Ok(T value) => new(true, value, null);
|
|
|
|
public static PairOperationResult<T> Fail(string error) => new(false, default!, error);
|
|
}
|
|
|
|
/// <summary>
|
|
/// state of which optional plugin warnings were shown
|
|
/// </summary>
|
|
public record OptionalPluginWarning
|
|
{
|
|
public bool ShownHeelsWarning { get; set; } = false;
|
|
public bool ShownCustomizePlusWarning { get; set; } = false;
|
|
public bool ShownHonorificWarning { get; set; } = false;
|
|
public bool ShownMoodlesWarning { get; set; } = false;
|
|
public bool ShowPetNicknamesWarning { get; set; } = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// tracks the handler registered pairs for an ident
|
|
/// </summary>
|
|
internal sealed class PairHandlerEntry
|
|
{
|
|
private readonly HashSet<PairUniqueIdentifier> _pairs = new();
|
|
|
|
public PairHandlerEntry(string ident, IPairHandlerAdapter handler)
|
|
{
|
|
Ident = ident;
|
|
Handler = handler;
|
|
}
|
|
|
|
public string Ident { get; }
|
|
public IPairHandlerAdapter Handler { get; }
|
|
|
|
public bool HasPairs => _pairs.Count > 0;
|
|
public int PairCount => _pairs.Count;
|
|
|
|
public void AddPair(PairUniqueIdentifier pair)
|
|
{
|
|
_pairs.Add(pair);
|
|
}
|
|
|
|
public bool RemovePair(PairUniqueIdentifier pair)
|
|
{
|
|
return _pairs.Remove(pair);
|
|
}
|
|
|
|
public IReadOnlyCollection<PairUniqueIdentifier> SnapshotPairs()
|
|
{
|
|
if (_pairs.Count == 0)
|
|
{
|
|
return Array.Empty<PairUniqueIdentifier>();
|
|
}
|
|
|
|
return _pairs.ToArray();
|
|
}
|
|
}
|