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;
using NewHorizons.External.Modules.Props.EchoesOfTheEye; using NewHorizons.External.Modules.Props.EchoesOfTheEye;
using NewHorizons.Handlers; using NewHorizons.Handlers;
@ -8,13 +9,10 @@ using OWML.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading;
using UnityEngine;
using static NewHorizons.Main;
using System.Linq; using System.Linq;
using HarmonyLib; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
using Epic.OnlineServices.Presence; using static NewHorizons.Main;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
@ -471,7 +469,13 @@ namespace NewHorizons.Builder.Props
NHLogger.Log($"SLIDE REEL ATLAS from {slides.First().imagePath}: {s}"); NHLogger.Log($"SLIDE REEL ATLAS from {slides.First().imagePath}: {s}");
ImageUtilities.TrackCachedTexture(atlasKey, t); 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++) for (int i = 0; i < slides.Length; i++)
{ {
var slide = new Slide(); var slide = new Slide();
@ -485,14 +489,7 @@ namespace NewHorizons.Builder.Props
else else
{ {
// attempt to load inverted guy from disk and precache so theres a cache hit when using ImageUtilities // 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.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))); 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", "author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends",
"name": "New Horizons", "name": "New Horizons",
"uniqueName": "xen.NewHorizons", "uniqueName": "xen.NewHorizons",
"version": "1.21.2", "version": "1.21.3",
"owmlVersion": "2.12.1", "owmlVersion": "2.12.1",
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "PacificEngine.OW_CommonResources" ], "conflicts": [ "PacificEngine.OW_CommonResources" ],