From 47dcd79744d9d0c64ee6a4de0d5686a301006b1c Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 28 Nov 2023 12:10:30 -0800 Subject: [PATCH 1/5] set streamingAssetIdentifier to non null value --- NewHorizons/Builder/Props/ProjectionBuilder.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index c73b330e..9305e54e 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -110,6 +110,7 @@ namespace NewHorizons.Builder.Props // Now we replace the slides int slidesCount = info.slides.Length; var slideCollection = new SlideCollection(slidesCount); + slideCollection.streamingAssetIdentifier = string.Empty; // NREs if null // The base game ones only have 15 slides max var textures = new Texture2D[slidesCount >= 15 ? 15 : slidesCount]; @@ -177,7 +178,8 @@ namespace NewHorizons.Builder.Props // Now we replace the slides int slidesCount = info.slides.Length; var slideCollection = new SlideCollection(slidesCount); - + slideCollection.streamingAssetIdentifier = string.Empty; // NREs if null + var imageLoader = AddAsyncLoader(projectorObj, mod, info.slides, ref slideCollection); imageLoader.imageLoadedEvent.AddListener((Texture2D tex, int index) => { slideCollection.slides[index]._image = ImageUtilities.Invert(tex); }); @@ -215,6 +217,7 @@ namespace NewHorizons.Builder.Props var slides = info.slides; var slidesCount = slides.Length; var slideCollection = new SlideCollection(slidesCount); // TODO: uh I think that info.slides[i].playTimeDuration is not being read here... note to self for when I implement support for that: 0.7 is what to default to if playTimeDuration turns out to be 0 + slideCollection.streamingAssetIdentifier = string.Empty; // NREs if null var imageLoader = AddAsyncLoader(g, mod, info.slides, ref slideCollection); imageLoader.imageLoadedEvent.AddListener((Texture2D tex, int index) => { slideCollection.slides[index]._image = tex; }); @@ -262,6 +265,7 @@ namespace NewHorizons.Builder.Props var slides = info.slides; var slidesCount = slides.Length; var slideCollection = new SlideCollection(slidesCount); + slideCollection.streamingAssetIdentifier = string.Empty; // NREs if null var imageLoader = AddAsyncLoader(standingTorch, mod, slides, ref slideCollection); From 67ff544fb38eec9d4d7cf58a2aab22b0b903e37a Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 28 Nov 2023 13:11:04 -0800 Subject: [PATCH 2/5] document base game defaults for slides --- .../Modules/Props/EchoesOfTheEye/SlideInfo.cs | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs b/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs index 3b656dfd..bfe34b25 100644 --- a/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs +++ b/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs @@ -7,80 +7,75 @@ namespace NewHorizons.External.Modules.Props.EchoesOfTheEye public class SlideInfo { /// - /// Ambient light colour when viewing this slide. + /// The path to the image file for this slide. /// - public MColor ambientLightColor; - + public string imagePath; // SlideAmbientLightModule /// - /// Ambient light intensity when viewing this slide. + /// Ambient light intensity when viewing this slide. (Base game default: 1) /// public float ambientLightIntensity; /// - /// Ambient light range when viewing this slide. + /// Ambient light range when viewing this slide. (Base game default: 20) /// public float ambientLightRange; + /// + /// Ambient light colour when viewing this slide. (Base game default: white) + /// + public MColor ambientLightColor; + + /// + /// Spotlight intensity modifier when viewing this slide. (Base game default: 0) + /// + public float spotIntensityMod; + // SlideBackdropAudioModule /// - /// The name of the AudioClip that will continuously play while watching these slides + /// The name of the AudioClip that will continuously play while watching these slides (Base game default: Reel_1_Backdrop_A) /// public string backdropAudio; /// - /// The time to fade into the backdrop audio + /// The time to fade into the backdrop audio (Base game default: 2) /// public float backdropFadeTime; // SlideBeatAudioModule /// - /// The name of the AudioClip for a one-shot sound when opening the slide. + /// The name of the AudioClip for a one-shot sound when opening the slide. (Base game default: Reel_1_Beat_A) /// public string beatAudio; /// - /// The time delay until the one-shot audio + /// The time delay until the one-shot audio (Base game default: 0) /// public float beatDelay; - // SlideBlackFrameModule /// - /// Before viewing this slide, there will be a black frame for this many seconds. + /// Before viewing this slide, there will be a black frame for this many seconds. (Base game default: 0) /// public float blackFrameDuration; - /// - /// The path to the image file for this slide. - /// - public string imagePath; - - // SlidePlayTimeModule /// - /// Play-time duration for auto-projector slides. + /// Play-time duration for auto-projector slides. (Base game default: 0) /// public float playTimeDuration; - // SlideShipLogEntryModule /// - /// Ship log fact revealed when viewing this slide + /// Ship log fact revealed when viewing this slide (Base game default: "") /// public string reveal; - - /// - /// Spotlight intensity modifier when viewing this slide. - /// - public float spotIntensityMod; } - -} +} \ No newline at end of file From f16498c4dffd4f83dcd09e3990faf16b65f2ed81 Mon Sep 17 00:00:00 2001 From: Ben C Date: Tue, 28 Nov 2023 21:13:34 +0000 Subject: [PATCH 3/5] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 88 ++++++++++++++-------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 380c4dfb..1e2ed3ee 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1935,60 +1935,60 @@ "type": "object", "additionalProperties": false, "properties": { - "ambientLightColor": { - "description": "Ambient light colour when viewing this slide.", - "$ref": "#/definitions/MColor" - }, - "ambientLightIntensity": { - "type": "number", - "description": "Ambient light intensity when viewing this slide.", - "format": "float" - }, - "ambientLightRange": { - "type": "number", - "description": "Ambient light range when viewing this slide.", - "format": "float" - }, - "backdropAudio": { - "type": "string", - "description": "The name of the AudioClip that will continuously play while watching these slides" - }, - "backdropFadeTime": { - "type": "number", - "description": "The time to fade into the backdrop audio", - "format": "float" - }, - "beatAudio": { - "type": "string", - "description": "The name of the AudioClip for a one-shot sound when opening the slide." - }, - "beatDelay": { - "type": "number", - "description": "The time delay until the one-shot audio", - "format": "float" - }, - "blackFrameDuration": { - "type": "number", - "description": "Before viewing this slide, there will be a black frame for this many seconds.", - "format": "float" - }, "imagePath": { "type": "string", "description": "The path to the image file for this slide." }, + "ambientLightIntensity": { + "type": "number", + "description": "Ambient light intensity when viewing this slide. (Base game default: 1)", + "format": "float" + }, + "ambientLightRange": { + "type": "number", + "description": "Ambient light range when viewing this slide. (Base game default: 20)", + "format": "float" + }, + "ambientLightColor": { + "description": "Ambient light colour when viewing this slide. (Base game default: white)", + "$ref": "#/definitions/MColor" + }, + "spotIntensityMod": { + "type": "number", + "description": "Spotlight intensity modifier when viewing this slide. (Base game default: 0)", + "format": "float" + }, + "backdropAudio": { + "type": "string", + "description": "The name of the AudioClip that will continuously play while watching these slides (Base game default: Reel_1_Backdrop_A)" + }, + "backdropFadeTime": { + "type": "number", + "description": "The time to fade into the backdrop audio (Base game default: 2)", + "format": "float" + }, + "beatAudio": { + "type": "string", + "description": "The name of the AudioClip for a one-shot sound when opening the slide. (Base game default: Reel_1_Beat_A)" + }, + "beatDelay": { + "type": "number", + "description": "The time delay until the one-shot audio (Base game default: 0)", + "format": "float" + }, + "blackFrameDuration": { + "type": "number", + "description": "Before viewing this slide, there will be a black frame for this many seconds. (Base game default: 0)", + "format": "float" + }, "playTimeDuration": { "type": "number", - "description": "Play-time duration for auto-projector slides.", + "description": "Play-time duration for auto-projector slides. (Base game default: 0)", "format": "float" }, "reveal": { "type": "string", - "description": "Ship log fact revealed when viewing this slide" - }, - "spotIntensityMod": { - "type": "number", - "description": "Spotlight intensity modifier when viewing this slide.", - "format": "float" + "description": "Ship log fact revealed when viewing this slide (Base game default: \"\")" } } }, From 914ff4df5c9eaa9ec8554a3214877209b8e02316 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 28 Nov 2023 13:22:05 -0800 Subject: [PATCH 4/5] actually provide default values --- .../Builder/Props/ProjectionBuilder.cs | 10 ++--- .../Modules/Props/EchoesOfTheEye/SlideInfo.cs | 37 +++++++++++-------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index 9305e54e..98378181 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -335,7 +335,7 @@ namespace NewHorizons.Builder.Props private static void AddModules(SlideInfo slideInfo, ref Slide slide, IModBehaviour mod) { var modules = new List(); - if (!String.IsNullOrEmpty(slideInfo.beatAudio)) + if (!string.IsNullOrEmpty(slideInfo.beatAudio)) { var audioBeat = new SlideBeatAudioModule { @@ -344,7 +344,7 @@ namespace NewHorizons.Builder.Props }; modules.Add(audioBeat); } - if (!String.IsNullOrEmpty(slideInfo.backdropAudio)) + if (!string.IsNullOrEmpty(slideInfo.backdropAudio)) { var audioBackdrop = new SlideBackdropAudioModule { @@ -353,13 +353,13 @@ namespace NewHorizons.Builder.Props }; modules.Add(audioBackdrop); } - if (slideInfo.ambientLightIntensity > 0) + if (slideInfo.ambientLightIntensity != 0) { var ambientLight = new SlideAmbientLightModule { _intensity = slideInfo.ambientLightIntensity, _range = slideInfo.ambientLightRange, - _color = slideInfo.ambientLightColor.ToColor(), + _color = slideInfo.ambientLightColor?.ToColor() ?? Color.white, _spotIntensityMod = slideInfo.spotIntensityMod }; modules.Add(ambientLight); @@ -380,7 +380,7 @@ namespace NewHorizons.Builder.Props }; modules.Add(blackFrame); } - if (!String.IsNullOrEmpty(slideInfo.reveal)) + if (!string.IsNullOrEmpty(slideInfo.reveal)) { var shipLogEntry = new SlideShipLogEntryModule { diff --git a/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs b/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs index bfe34b25..26b6053d 100644 --- a/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs +++ b/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs @@ -1,5 +1,6 @@ using NewHorizons.External.SerializableData; using Newtonsoft.Json; +using System.ComponentModel; namespace NewHorizons.External.Modules.Props.EchoesOfTheEye { @@ -14,67 +15,73 @@ namespace NewHorizons.External.Modules.Props.EchoesOfTheEye // SlideAmbientLightModule /// - /// Ambient light intensity when viewing this slide. (Base game default: 1) + /// Ambient light intensity when viewing this slide. + /// Set this to add ambient light module. Base game default is 1. /// public float ambientLightIntensity; /// - /// Ambient light range when viewing this slide. (Base game default: 20) + /// Ambient light range when viewing this slide. /// - public float ambientLightRange; + [DefaultValue(20f)] public float ambientLightRange = 20f; /// - /// Ambient light colour when viewing this slide. (Base game default: white) + /// Ambient light colour when viewing this slide. Defaults to white. /// public MColor ambientLightColor; /// - /// Spotlight intensity modifier when viewing this slide. (Base game default: 0) + /// Spotlight intensity modifier when viewing this slide. /// - public float spotIntensityMod; + [DefaultValue(0f)] public float spotIntensityMod = 0f; // SlideBackdropAudioModule /// - /// The name of the AudioClip that will continuously play while watching these slides (Base game default: Reel_1_Backdrop_A) + /// The name of the AudioClip that will continuously loop while watching these slides. + /// Set this to include backdrop audio module. Base game default is Reel_1_Backdrop_A. /// public string backdropAudio; /// - /// The time to fade into the backdrop audio (Base game default: 2) + /// The time to fade into the backdrop audio. /// - public float backdropFadeTime; + [DefaultValue(2f)] public float backdropFadeTime = 2f; // SlideBeatAudioModule /// - /// The name of the AudioClip for a one-shot sound when opening the slide. (Base game default: Reel_1_Beat_A) + /// The name of the AudioClip for a one-shot sound when opening the slide. + /// Set this to include beat audio module. Base game default is Reel_1_Beat_A. /// public string beatAudio; /// - /// The time delay until the one-shot audio (Base game default: 0) + /// The time delay until the one-shot audio. /// - public float beatDelay; + [DefaultValue(0f)] public float beatDelay = 0f; // SlideBlackFrameModule /// - /// Before viewing this slide, there will be a black frame for this many seconds. (Base game default: 0) + /// Before viewing this slide, there will be a black frame for this many seconds. + /// Set this to include black frame module. Base game default is 0. /// public float blackFrameDuration; // SlidePlayTimeModule /// - /// Play-time duration for auto-projector slides. (Base game default: 0) + /// Play-time duration for auto-projector slides. + /// Set this to include play time module. Base game default is 0. /// public float playTimeDuration; // SlideShipLogEntryModule /// - /// Ship log fact revealed when viewing this slide (Base game default: "") + /// Ship log fact revealed when viewing this slide. + /// Set this to include ship log entry module. Base game default is "". /// public string reveal; } From 97602b959db3561d842bf557ba8f74784941f513 Mon Sep 17 00:00:00 2001 From: Ben C Date: Tue, 28 Nov 2023 21:24:42 +0000 Subject: [PATCH 5/5] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 34 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 1e2ed3ee..886383e8 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1941,54 +1941,58 @@ }, "ambientLightIntensity": { "type": "number", - "description": "Ambient light intensity when viewing this slide. (Base game default: 1)", + "description": "Ambient light intensity when viewing this slide.\nSet this to add ambient light module. Base game default is 1.", "format": "float" }, "ambientLightRange": { "type": "number", - "description": "Ambient light range when viewing this slide. (Base game default: 20)", - "format": "float" + "description": "Ambient light range when viewing this slide.", + "format": "float", + "default": 20.0 }, "ambientLightColor": { - "description": "Ambient light colour when viewing this slide. (Base game default: white)", + "description": "Ambient light colour when viewing this slide. Defaults to white.", "$ref": "#/definitions/MColor" }, "spotIntensityMod": { "type": "number", - "description": "Spotlight intensity modifier when viewing this slide. (Base game default: 0)", - "format": "float" + "description": "Spotlight intensity modifier when viewing this slide.", + "format": "float", + "default": 0.0 }, "backdropAudio": { "type": "string", - "description": "The name of the AudioClip that will continuously play while watching these slides (Base game default: Reel_1_Backdrop_A)" + "description": "The name of the AudioClip that will continuously loop while watching these slides.\nSet this to include backdrop audio module. Base game default is Reel_1_Backdrop_A." }, "backdropFadeTime": { "type": "number", - "description": "The time to fade into the backdrop audio (Base game default: 2)", - "format": "float" + "description": "The time to fade into the backdrop audio.", + "format": "float", + "default": 2.0 }, "beatAudio": { "type": "string", - "description": "The name of the AudioClip for a one-shot sound when opening the slide. (Base game default: Reel_1_Beat_A)" + "description": "The name of the AudioClip for a one-shot sound when opening the slide.\nSet this to include beat audio module. Base game default is Reel_1_Beat_A." }, "beatDelay": { "type": "number", - "description": "The time delay until the one-shot audio (Base game default: 0)", - "format": "float" + "description": "The time delay until the one-shot audio.", + "format": "float", + "default": 0.0 }, "blackFrameDuration": { "type": "number", - "description": "Before viewing this slide, there will be a black frame for this many seconds. (Base game default: 0)", + "description": "Before viewing this slide, there will be a black frame for this many seconds.\nSet this to include black frame module. Base game default is 0.", "format": "float" }, "playTimeDuration": { "type": "number", - "description": "Play-time duration for auto-projector slides. (Base game default: 0)", + "description": "Play-time duration for auto-projector slides.\nSet this to include play time module. Base game default is 0.", "format": "float" }, "reveal": { "type": "string", - "description": "Ship log fact revealed when viewing this slide (Base game default: \"\")" + "description": "Ship log fact revealed when viewing this slide.\nSet this to include ship log entry module. Base game default is \"\"." } } },