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; } public Vector2 ParallaxAnchor { get; set; }
private readonly ConcurrentDictionary<string, ParallaxLayerPrepared[]> _parallaxesLQ = new(); private readonly Dictionary<string, ParallaxLayerPrepared[]> _parallaxesLQ = new();
private readonly ConcurrentDictionary<string, ParallaxLayerPrepared[]> _parallaxesHQ = 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); 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 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) public void UnloadParallax(string name)
@@ -45,8 +45,8 @@ public sealed class ParallaxManager : IParallaxManager
} }
if (!_parallaxesLQ.ContainsKey(name)) return; if (!_parallaxesLQ.ContainsKey(name)) return;
_parallaxesLQ.Remove(name, out _); _parallaxesLQ.Remove(name);
_parallaxesHQ.Remove(name, out _); _parallaxesHQ.Remove(name);
} }
public async void LoadDefaultParallax() public async void LoadDefaultParallax()
@@ -89,8 +89,8 @@ public sealed class ParallaxManager : IParallaxManager
if (token.Token.IsCancellationRequested) return; if (token.Token.IsCancellationRequested) return;
_parallaxesLQ[name] = layers[0]; _parallaxesLQ[name] = layers[1];
_parallaxesHQ[name] = layers[1]; _parallaxesHQ[name] = layers[0];
_sawmill.Info($"Loaded parallax {name}"); _sawmill.Info($"Loaded parallax {name}");

View File

@@ -32,7 +32,7 @@ public sealed class ParallaxControl : Control
foreach (var layer in _parallaxManager.GetParallaxLayers("FastSpace")) foreach (var layer in _parallaxManager.GetParallaxLayers("FastSpace"))
{ {
var tex = layer.Texture; var tex = layer.Texture;
var texSize = (tex.Size.X * (int) Size.X, tex.Size.Y * (int) Size.X) * layer.Config.Scale.Floored() / 540; var texSize = (tex.Size.X * (int) Size.X, tex.Size.Y * (int) Size.X) * layer.Config.Scale.Floored() / 1920;
var ourSize = PixelSize; var ourSize = PixelSize;
var currentTime = (float) _timing.RealTime.TotalSeconds; var currentTime = (float) _timing.RealTime.TotalSeconds;

View File

@@ -42,7 +42,7 @@
!type:ImageParallaxTextureSource !type:ImageParallaxTextureSource
path: "/Textures/Parallaxes/layer1.png" path: "/Textures/Parallaxes/layer1.png"
slowness: 0.5 slowness: 0.5
scale: "1, 1" scale: "3, 3"
- texture: - texture:
!type:GeneratedParallaxTextureSource !type:GeneratedParallaxTextureSource
id: "hq_wizard_stars" id: "hq_wizard_stars"