Should not have been adding a listener per slide

This commit is contained in:
Nick 2024-06-14 12:14:36 -04:00
parent bcf0c2d0d9
commit 79c5c46403
2 changed files with 12 additions and 15 deletions

View File

@ -1,3 +1,4 @@
using HarmonyLib;
using NewHorizons.External.Modules.Props;
using NewHorizons.External.Modules.Props.EchoesOfTheEye;
using NewHorizons.Handlers;
@ -8,13 +9,10 @@ using OWML.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using UnityEngine;
using static NewHorizons.Main;
using System.Linq;
using HarmonyLib;
using UnityEngine;
using UnityEngine.InputSystem;
using Epic.OnlineServices.Presence;
using static NewHorizons.Main;
namespace NewHorizons.Builder.Props
{
@ -471,6 +469,12 @@ namespace NewHorizons.Builder.Props
NHLogger.Log($"SLIDE REEL ATLAS from {slides.First().imagePath}: {s}");
ImageUtilities.TrackCachedTexture(atlasKey, t);
});
invertedImageLoader.imageLoadedEvent.AddListener((Texture2D t, int i, string s) =>
{
var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, slides[i].imagePath);
var key = $"{ImageUtilities.GetKey(path)} > invert";
ImageUtilities.TrackCachedTexture(key, t);
});
for (int i = 0; i < slides.Length; i++)
{
@ -486,13 +490,6 @@ namespace NewHorizons.Builder.Props
{
// attempt to load inverted guy from disk and precache so theres a cache hit when using ImageUtilities
invertedImageLoader.PathsToLoad.Add((i, Path.Combine(mod.ModHelper.Manifest.ModFolderPath, INVERTED_SLIDE_CACHE_FOLDER, slideInfo.imagePath)));
invertedImageLoader.imageLoadedEvent.AddListener((Texture2D t, int i, string s) =>
{
var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, slides[i].imagePath);
var key = $"{ImageUtilities.GetKey(path)} > invert";
ImageUtilities.TrackCachedTexture(key, t);
});
imageLoader.PathsToLoad.Add((i, Path.Combine(mod.ModHelper.Manifest.ModFolderPath, slideInfo.imagePath)));
}

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends",
"name": "New Horizons",
"uniqueName": "xen.NewHorizons",
"version": "1.21.2",
"version": "1.21.3",
"owmlVersion": "2.12.1",
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "PacificEngine.OW_CommonResources" ],