mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 22:17:22 +01:00
Merge branch 'main' of https://github.com/Penumbra-Sync/client
This commit is contained in:
commit
04a3d88661
6 changed files with 60 additions and 42 deletions
|
|
@ -141,7 +141,7 @@ public class Pair
|
|||
ShownHonorificWarning = _configService.Current.DisableOptionalPluginWarnings,
|
||||
};
|
||||
|
||||
CachedPlayer.Initialize(name);
|
||||
CachedPlayer.Initialize(name).Wait();
|
||||
|
||||
ApplyLastReceivedData();
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ public class Pair
|
|||
data.FileReplacements[objectKind] = data.FileReplacements[objectKind]
|
||||
.Where(f => !f.GamePaths.Any(p => p.EndsWith("tmb", StringComparison.OrdinalIgnoreCase) || p.EndsWith("pap", StringComparison.OrdinalIgnoreCase)))
|
||||
.ToList();
|
||||
if(disableVFX)
|
||||
if (disableVFX)
|
||||
data.FileReplacements[objectKind] = data.FileReplacements[objectKind]
|
||||
.Where(f => !f.GamePaths.Any(p => p.EndsWith("atex", StringComparison.OrdinalIgnoreCase) || p.EndsWith("avfx", StringComparison.OrdinalIgnoreCase)))
|
||||
.ToList();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
private readonly CharacterData _playerData = new();
|
||||
private readonly Dictionary<ObjectKind, GameObjectHandler> _playerRelatedObjects = new();
|
||||
private Task? _cacheCreationTask;
|
||||
private CancellationTokenSource _honorificCts = new();
|
||||
private CancellationTokenSource _palettePlusCts = new();
|
||||
|
||||
public CacheCreationService(ILogger<CacheCreationService> logger, MareMediator mediator, Func<ObjectKind, Func<IntPtr>, bool, GameObjectHandler> gameObjectHandlerFactory,
|
||||
|
|
@ -61,10 +62,13 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
PalettePlusChanged();
|
||||
}
|
||||
});
|
||||
Mediator.Subscribe<HonorificMessage>(this, async (_) =>
|
||||
Mediator.Subscribe<HonorificMessage>(this, (msg) =>
|
||||
{
|
||||
Logger.LogDebug("Received Honorific change, updating player");
|
||||
await AddPlayerCacheToCreate().ConfigureAwait(false);
|
||||
if (!string.Equals(msg.NewHonorificTitle, _playerData.HonorificData, StringComparison.Ordinal))
|
||||
{
|
||||
Logger.LogDebug("Received Honorific change, updating player");
|
||||
HonorificChanged();
|
||||
}
|
||||
});
|
||||
Mediator.Subscribe<PenumbraModSettingChangedMessage>(this, async (msg) =>
|
||||
{
|
||||
|
|
@ -97,6 +101,20 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
_cacheCreateLock.Release();
|
||||
}
|
||||
|
||||
private void HonorificChanged()
|
||||
{
|
||||
_honorificCts?.Cancel();
|
||||
_honorificCts?.Dispose();
|
||||
_honorificCts = new();
|
||||
var token = _honorificCts.Token;
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(3), token).ConfigureAwait(false);
|
||||
await AddPlayerCacheToCreate().ConfigureAwait(false);
|
||||
}, token);
|
||||
}
|
||||
|
||||
private void PalettePlusChanged()
|
||||
{
|
||||
_palettePlusCts?.Cancel();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue