mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge remote-tracking branch 'origin/slide-reel-streaming' into slide-reel-streaming
This commit is contained in:
commit
ebb1871a3a
@ -209,8 +209,14 @@ namespace NewHorizons.Builder.Props
|
||||
var slidesBack = slideReelObj.GetComponentInChildren<TransformAnimator>(true).transform.Find("Slides_Back").GetComponent<MeshRenderer>();
|
||||
var slidesFront = slideReelObj.GetComponentInChildren<TransformAnimator>(true).transform.Find("Slides_Front").GetComponent<MeshRenderer>();
|
||||
|
||||
// Now put together the textures into a 4x4 thing for the materials
|
||||
var reelTexture = ImageUtilities.MakeReelTexture(mod, textures, key);
|
||||
// Now put together the textures into a 4x4 thing for the materials #888
|
||||
var displayTextures = textures;
|
||||
if (info.displaySlides != null && info.displaySlides.Length > 0)
|
||||
{
|
||||
displayTextures = info.displaySlides.Select(x => textures[x]).ToArray();
|
||||
}
|
||||
|
||||
var reelTexture = ImageUtilities.MakeReelTexture(mod, displayTextures, key);
|
||||
slidesBack.material.mainTexture = reelTexture;
|
||||
slidesBack.material.SetTexture(EmissionMap, reelTexture);
|
||||
slidesBack.material.name = reelTexture.name;
|
||||
|
||||
@ -27,7 +27,19 @@ public class NHSlideCollection : SlideCollection
|
||||
|
||||
static NHSlideCollection()
|
||||
{
|
||||
SceneManager.sceneUnloaded += (_) => _slidesRequiringPath.Clear();
|
||||
SceneManager.sceneUnloaded += (_) =>
|
||||
{
|
||||
foreach (var (slide, collections) in _slidesRequiringPath)
|
||||
{
|
||||
// If it has null, that means some other permanent thing loaded this texture and it will get cleared elsewhere
|
||||
// Otherwise it was loaded by an NHSlideCollection and should be deleted
|
||||
if (collections.Any() && !collections.Contains(null))
|
||||
{
|
||||
ImageUtilities.DeleteTexture(slide);
|
||||
}
|
||||
}
|
||||
_slidesRequiringPath.Clear();
|
||||
};
|
||||
}
|
||||
|
||||
public NHSlideCollection(int startArrSize, IModBehaviour mod, string[] slidePaths) : base(startArrSize)
|
||||
|
||||
@ -85,6 +85,12 @@ namespace NewHorizons.External.Modules.Props.EchoesOfTheEye
|
||||
/// Exclusive to the slide reel type. Condition/material of the reel. Antique is the Stranger, Pristine is the Dreamworld, Rusted is a burned reel.
|
||||
/// </summary>
|
||||
[DefaultValue("antique")] public SlideReelCondition reelCondition = SlideReelCondition.Antique;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set which slides appear on the slide reel model. Leave empty to default to the first few slides.
|
||||
/// Takes a list of indices, i.e., to show the first 5 slides in reverse you would put [4, 3, 2, 1, 0].
|
||||
/// Index starts at 0.
|
||||
/// </summary>
|
||||
public int[] displaySlides;
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +71,19 @@ namespace NewHorizons.Utility.Files
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not sure why the other method takes in the texture as well
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
public static void DeleteTexture(string key)
|
||||
{
|
||||
if (_textureCache.ContainsKey(key))
|
||||
{
|
||||
UnityEngine.Object.Destroy(_textureCache[key]);
|
||||
_textureCache.Remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteTexture(IModBehaviour mod, string filename, Texture2D texture)
|
||||
{
|
||||
var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename);
|
||||
@ -194,9 +207,9 @@ namespace NewHorizons.Utility.Files
|
||||
{
|
||||
for (int j = 0; j < size; j++)
|
||||
{
|
||||
var colour = Color.black;
|
||||
var colour = Color.clear;
|
||||
|
||||
if (srcTexture)
|
||||
if (srcTexture != null)
|
||||
{
|
||||
var srcX = i * srcTexture.width / (float)size;
|
||||
var srcY = j * srcTexture.height / (float)size;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user