mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 16:57:22 +01:00
add apply last received data
This commit is contained in:
parent
c403e7b45b
commit
66fb103c94
5 changed files with 24 additions and 6 deletions
|
|
@ -56,14 +56,14 @@ public class CachedPlayer : IDisposable
|
||||||
|
|
||||||
public bool WasVisible { get; private set; }
|
public bool WasVisible { get; private set; }
|
||||||
|
|
||||||
public void ApplyCharacterData(API.Data.CharacterData characterData, OptionalPluginWarning warning)
|
public void ApplyCharacterData(API.Data.CharacterData characterData, OptionalPluginWarning warning, bool forced = false)
|
||||||
{
|
{
|
||||||
Logger.Debug("Received data for " + this);
|
Logger.Debug("Received data for " + this);
|
||||||
|
|
||||||
Logger.Debug("Checking for files to download for player " + PlayerName);
|
Logger.Debug("Checking for files to download for player " + PlayerName);
|
||||||
Logger.Debug("Hash for data is " + characterData.DataHash.Value + ", current cache hash is " + _cachedData.DataHash.Value);
|
Logger.Debug("Hash for data is " + characterData.DataHash.Value + ", current cache hash is " + _cachedData.DataHash.Value);
|
||||||
|
|
||||||
if (string.Equals(characterData.DataHash.Value, _cachedData.DataHash.Value, StringComparison.Ordinal)) return;
|
if (string.Equals(characterData.DataHash.Value, _cachedData.DataHash.Value, StringComparison.Ordinal) && !forced) return;
|
||||||
|
|
||||||
bool updateModdedPaths = false;
|
bool updateModdedPaths = false;
|
||||||
List<ObjectKind> charaDataToUpdate = new();
|
List<ObjectKind> charaDataToUpdate = new();
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,15 @@ public class PairManager : IDisposable
|
||||||
|
|
||||||
public void AddUserPair(UserPairDto dto, bool addToLastAddedUser = true)
|
public void AddUserPair(UserPairDto dto, bool addToLastAddedUser = true)
|
||||||
{
|
{
|
||||||
if (!_allClientPairs.ContainsKey(dto.User)) _allClientPairs[dto.User] = _pairFactory.Create();
|
if (!_allClientPairs.ContainsKey(dto.User))
|
||||||
|
{
|
||||||
|
_allClientPairs[dto.User] = _pairFactory.Create();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addToLastAddedUser = false;
|
||||||
|
}
|
||||||
|
|
||||||
_allClientPairs[dto.User].UserPair = dto;
|
_allClientPairs[dto.User].UserPair = dto;
|
||||||
if (addToLastAddedUser)
|
if (addToLastAddedUser)
|
||||||
LastAddedUser = _allClientPairs[dto.User];
|
LastAddedUser = _allClientPairs[dto.User];
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors></Authors>
|
<Authors></Authors>
|
||||||
<Company></Company>
|
<Company></Company>
|
||||||
<Version>0.7.9</Version>
|
<Version>0.7.10</Version>
|
||||||
<Description></Description>
|
<Description></Description>
|
||||||
<Copyright></Copyright>
|
<Copyright></Copyright>
|
||||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public class Pair
|
||||||
ApplyLastReceivedData();
|
ApplyLastReceivedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyLastReceivedData()
|
public void ApplyLastReceivedData(bool forced = false)
|
||||||
{
|
{
|
||||||
if (CachedPlayer == null) return;
|
if (CachedPlayer == null) return;
|
||||||
if (LastReceivedCharacterData == null) return;
|
if (LastReceivedCharacterData == null) return;
|
||||||
|
|
@ -95,7 +95,7 @@ public class Pair
|
||||||
ShownPalettePlusWarning = _configService.Current.DisableOptionalPluginWarnings,
|
ShownPalettePlusWarning = _configService.Current.DisableOptionalPluginWarnings,
|
||||||
};
|
};
|
||||||
|
|
||||||
CachedPlayer.ApplyCharacterData(RemoveNotSyncedFiles(LastReceivedCharacterData.DeepClone())!, _pluginWarnings);
|
CachedPlayer.ApplyCharacterData(RemoveNotSyncedFiles(LastReceivedCharacterData.DeepClone())!, _pluginWarnings, forced);
|
||||||
}
|
}
|
||||||
|
|
||||||
private API.Data.CharacterData? RemoveNotSyncedFiles(API.Data.CharacterData? data)
|
private API.Data.CharacterData? RemoveNotSyncedFiles(API.Data.CharacterData? data)
|
||||||
|
|
|
||||||
|
|
@ -503,6 +503,16 @@ public class CompactUi : Window, IDisposable
|
||||||
|
|
||||||
private void DrawPairedClientMenu(Pair entry)
|
private void DrawPairedClientMenu(Pair entry)
|
||||||
{
|
{
|
||||||
|
if (entry.IsVisible)
|
||||||
|
{
|
||||||
|
if (UiShared.IconTextButton(FontAwesomeIcon.Sync, "Reload last data"))
|
||||||
|
{
|
||||||
|
entry.ApplyLastReceivedData(forced: true);
|
||||||
|
ImGui.CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
UiShared.AttachToolTip("This reapplies the last received character data to this character");
|
||||||
|
}
|
||||||
|
|
||||||
var entryUID = entry.UserData.AliasOrUID;
|
var entryUID = entry.UserData.AliasOrUID;
|
||||||
if (UiShared.IconTextButton(FontAwesomeIcon.Folder, "Pair Groups"))
|
if (UiShared.IconTextButton(FontAwesomeIcon.Folder, "Pair Groups"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue