diff --git a/Intersect.Client.Core/MonoGame/File Management/MonoContentManager.cs b/Intersect.Client.Core/MonoGame/File Management/MonoContentManager.cs index bcd691f329..30d807d907 100644 --- a/Intersect.Client.Core/MonoGame/File Management/MonoContentManager.cs +++ b/Intersect.Client.Core/MonoGame/File Management/MonoContentManager.cs @@ -54,15 +54,16 @@ public override void LoadTilesets(string[] tilesetnames) foreach (var t in tilesetnames) { var realFilename = tilesetFiles.FirstOrDefault(file => t.Equals(file, StringComparison.InvariantCultureIgnoreCase)) ?? t; + var assetName = Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", t.ToLower()).Replace('\\', '/'); if (!string.IsNullOrWhiteSpace(t) && (!string.IsNullOrWhiteSpace(realFilename) || - AtlasReference.TryGet(Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", t.ToLower()), out _) != null) && + AtlasReference.TryGet(assetName, out _)) && !mTilesetDict.ContainsKey(t.ToLower())) { mTilesetDict.Add( t.ToLower(), Core.Graphics.Renderer.LoadTexture( - Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", t), + assetName, Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", realFilename) ) ); diff --git a/Intersect.Client.Core/MonoGame/Graphics/MonoRenderer.Texture.cs b/Intersect.Client.Core/MonoGame/Graphics/MonoRenderer.Texture.cs index c36bf3d4c4..f76f5b72ff 100644 --- a/Intersect.Client.Core/MonoGame/Graphics/MonoRenderer.Texture.cs +++ b/Intersect.Client.Core/MonoGame/Graphics/MonoRenderer.Texture.cs @@ -148,9 +148,13 @@ AtlasReference atlasReference { } - public override int Width => PlatformTexture?.Width ?? 0; + public override int Width => AtlasReference?.IsRotated == true + ? AtlasReference.Bounds.Height + : AtlasReference?.Bounds.Width ?? PlatformTexture?.Width ?? 0; - public override int Height => PlatformTexture?.Height ?? 0; + public override int Height => AtlasReference?.IsRotated == true + ? AtlasReference.Bounds.Width + : AtlasReference?.Bounds.Height ?? PlatformTexture?.Height ?? 0; protected override Texture2D? CreatePlatformTextureFromStream(Stream stream) { diff --git a/Intersect.Client.Framework/Graphics/AtlasReference.cs b/Intersect.Client.Framework/Graphics/AtlasReference.cs index 31e5563bdd..8a704aa639 100644 --- a/Intersect.Client.Framework/Graphics/AtlasReference.cs +++ b/Intersect.Client.Framework/Graphics/AtlasReference.cs @@ -61,7 +61,8 @@ public static AtlasReference[] GetAllFor(string folderName) public static bool TryGet(string assetName, [NotNullWhen(true)] out AtlasReference? atlasReference) { - return _atlasReferences.TryGetValue(assetName, out atlasReference) || - _atlasReferences.TryGetValue(assetName.ToLowerInvariant(), out atlasReference); + var normalizedAssetName = assetName.Replace('\\', '/'); + return _atlasReferences.TryGetValue(normalizedAssetName, out atlasReference) || + _atlasReferences.TryGetValue(normalizedAssetName.ToLowerInvariant(), out atlasReference); } } \ No newline at end of file diff --git a/Intersect.Client.Framework/Graphics/GameTexture.cs b/Intersect.Client.Framework/Graphics/GameTexture.cs index 2fd9cd8551..c16e5f7ffd 100644 --- a/Intersect.Client.Framework/Graphics/GameTexture.cs +++ b/Intersect.Client.Framework/Graphics/GameTexture.cs @@ -257,6 +257,12 @@ private void LoadPlatformTexture(bool force = false) } atlasTexture.LoadPlatformTexture(force); + IsMissingOrCorrupt = atlasTexture.IsMissingOrCorrupt; + if (!IsMissingOrCorrupt) + { + UpdateAccessTime(); + EmitLoaded(); + } return; } diff --git a/Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs b/Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs index 29f7184e94..d7b1d1180c 100644 --- a/Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs +++ b/Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs @@ -1,4 +1,4 @@ -using Intersect.Client.Framework.GenericClasses; +using Intersect.Client.Framework.GenericClasses; using Intersect.Client.Framework.Graphics; namespace Intersect.Client.Framework.Gwen.Skin.Texturing; @@ -185,7 +185,7 @@ public void Draw(Renderer.Base render, Rectangle r, Color col) public bool Equals(Bordered other) { - return _texture.Equals(other._texture) && _subRects.Equals(other._subRects) && _margin.Equals(other._margin) && _width.Equals(other._width) && _height.Equals(other._height); + return (_texture?.Equals(other._texture) ?? false) && _subRects.Equals(other._subRects) && _margin.Equals(other._margin) && _width.Equals(other._width) && _height.Equals(other._height); } public override bool Equals(object? obj)