Parallax fix + menu tweak (#10576)

This commit is contained in:
metalgearsloth
2022-08-15 14:16:53 +10:00
committed by GitHub
parent c6c35abb5e
commit 702cfd15e9
3 changed files with 16 additions and 16 deletions

View File

@@ -18,10 +18,10 @@ public sealed class ParallaxManager : IParallaxManager
public Vector2 ParallaxAnchor { get; set; }
private readonly ConcurrentDictionary<string, ParallaxLayerPrepared[]> _parallaxesLQ = new();
private readonly ConcurrentDictionary<string, ParallaxLayerPrepared[]> _parallaxesHQ = new();
private readonly Dictionary<string, ParallaxLayerPrepared[]> _parallaxesLQ = new();
private readonly Dictionary<string, ParallaxLayerPrepared[]> _parallaxesHQ = new();
private readonly ConcurrentDictionary<string, CancellationTokenSource> _loadingParallaxes = new();
private readonly Dictionary<string, CancellationTokenSource> _loadingParallaxes = new();
public bool IsLoaded(string name) => _parallaxesLQ.ContainsKey(name);
@@ -32,7 +32,7 @@ public sealed class ParallaxManager : IParallaxManager
return !_parallaxesLQ.TryGetValue(name, out var lq) ? Array.Empty<ParallaxLayerPrepared>() : lq;
}
return !_parallaxesLQ.TryGetValue(name, out var hq) ? Array.Empty<ParallaxLayerPrepared>() : hq;
return !_parallaxesHQ.TryGetValue(name, out var hq) ? Array.Empty<ParallaxLayerPrepared>() : hq;
}
public void UnloadParallax(string name)
@@ -45,8 +45,8 @@ public sealed class ParallaxManager : IParallaxManager
}
if (!_parallaxesLQ.ContainsKey(name)) return;
_parallaxesLQ.Remove(name, out _);
_parallaxesHQ.Remove(name, out _);
_parallaxesLQ.Remove(name);
_parallaxesHQ.Remove(name);
}
public async void LoadDefaultParallax()
@@ -89,8 +89,8 @@ public sealed class ParallaxManager : IParallaxManager
if (token.Token.IsCancellationRequested) return;
_parallaxesLQ[name] = layers[0];
_parallaxesHQ[name] = layers[1];
_parallaxesLQ[name] = layers[1];
_parallaxesHQ[name] = layers[0];
_sawmill.Info($"Loaded parallax {name}");