Skip to content

Commit

Permalink
Just some minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bittiez committed Feb 1, 2024
1 parent 12b2be4 commit 8accb46
Show file tree
Hide file tree
Showing 18 changed files with 319 additions and 324 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private void Update()
{
_size = _layoutBuilder.Layout(Text, Font, Width);
}
catch (System.Exception ex)
catch
{
}

Expand All @@ -249,7 +249,7 @@ public Point Measure(int? width)
result = _layoutBuilder.Layout(Text, Font, width, true);
_measures[key] = result;
}
catch (System.Exception ex)
catch
{
}

Expand Down
33 changes: 26 additions & 7 deletions src/ClassicUO.Assets/PNGLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ public Texture2D GetImageTexture(string fullImagePath)

public GumpInfo LoadGumpTexture(uint graphic)
{
Texture2D texture;

if (gump_availableIDs == null)
return new GumpInfo();
int index = Array.IndexOf(gump_availableIDs, graphic);
if (index == -1) return new GumpInfo();

Texture2D texture;

gump_textureCache.TryGetValue(graphic, out texture);

if (exePath != null && texture == null && GraphicsDevice != null)
Expand Down Expand Up @@ -160,6 +160,10 @@ public Task Load()
uint.TryParse(fname.Substring(0, fname.Length - 4), out gump_availableIDs[i]);
}
}
else
{
Directory.CreateDirectory(gumpPath);
}
string artPath = Path.Combine(exePath, IMAGES_FOLDER, ART_EXTERNAL_FOLDER);
if (Directory.Exists(artPath))
Expand All @@ -176,6 +180,10 @@ public Task Load()
}
}
}
else
{
Directory.CreateDirectory(artPath);
}
});
}

Expand All @@ -184,7 +192,7 @@ public Task LoadResourceAssets()
return Task.Run(
() =>
{
var assembly = this.GetType().Assembly;
var assembly = GetType().Assembly;
//Load the custom gump art included with TUO
for (uint i = 40303; i <= 40312; i++)
Expand All @@ -200,6 +208,10 @@ public Task LoadResourceAssets()
continue;
}
}
else
{
continue;
}
var resourceName = assembly.GetName().Name + $".gumpartassets.{i}.png";
Console.WriteLine(resourceName);
Expand All @@ -214,10 +226,17 @@ public Task LoadResourceAssets()
//Increase available gump id's
uint[] availableIDs = new uint[gump_availableIDs.Length + 1];
gump_availableIDs.CopyTo(availableIDs, 0);
availableIDs[availableIDs.Length - 1] = i;
gump_availableIDs = availableIDs;
if (gump_availableIDs != null)
{
uint[] availableIDs = new uint[gump_availableIDs.Length + 1];
gump_availableIDs.CopyTo(availableIDs, 0);
availableIDs[availableIDs.Length - 1] = i;
gump_availableIDs = availableIDs;
}
else
{
gump_availableIDs = [i];
}
stream.Dispose();
}
Expand Down
Loading

0 comments on commit 8accb46

Please sign in to comment.