From 075dac755ac13e6a5625d759b69540d843a34e50 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 17 Feb 2025 16:27:56 -0500 Subject: [PATCH] edit for rework --- docs/src/content/docs/guides/title-screens.md | 129 ++++++++++-------- 1 file changed, 74 insertions(+), 55 deletions(-) diff --git a/docs/src/content/docs/guides/title-screens.md b/docs/src/content/docs/guides/title-screens.md index 332b2f76..285a4713 100644 --- a/docs/src/content/docs/guides/title-screens.md +++ b/docs/src/content/docs/guides/title-screens.md @@ -14,58 +14,71 @@ A title screen config file will look something like this: ```json title="title-screen.json" { "$schema": "https://raw.githubusercontent.com/Outer-Wilds-New-Horizons/new-horizons/main/NewHorizons/Schemas/title_screen_schema.json", - "disableNHPlanets": true, - "factRequiredForTitle": "EXAMPLES_ARTIFICIAL_GRAVITY", - "shareTitleScreen": true, - "menuTextTint": { - "r": 128, - "g": 128, - "b": 255 - }, - "music": "planets/assets/TitleScreenMusic.mp3", - "ambience": "planets/assets/TitleScreenAmbience.mp3", - "Skybox": { - "destroyStarField": true, - "rightPath": "systems/New System Assets/Skybox/Right_Large.png", - "leftPath": "systems/New System Assets/Skybox/Left_Large.png", - "topPath": "systems/New System Assets/Skybox/Up_Large.png", - "bottomPath": "systems/New System Assets/Skybox/Down_Large.png", - "frontPath": "systems/New System Assets/Skybox/Front_Large.png", - "backPath": "systems/New System Assets/Skybox/Back_Large.png" - }, - "Background": { - "details": [ - { - "assetBundle": "assetbundles/test", - "path": "Assets/Prefabs/Background.prefab", - "position": {"x": 200, "y": 280, "z": -50}, - "rotation": {"x": 310, "y": 0, "z": 310}, - "scale": 0.05 + "titleScreens": [ + { + "disableNHPlanets": false, + "shareTitleScreen": true, + "music": "planets/assets/TitleScreenMusic.mp3" + }, + { + "disableNHPlanets": true, + "shareTitleScreen": true, + "factRequiredForTitle": "EXAMPLES_ARTIFICIAL_GRAVITY", + "menuTextTint": { + "r": 128, + "g": 128, + "b": 255 + }, + "music": "planets/assets/TitleScreenMusic.mp3", + "ambience": "planets/assets/TitleScreenAmbience.mp3", + "Skybox": { + "destroyStarField": true, + "rightPath": "systems/New System Assets/Skybox/Right_Large.png", + "leftPath": "systems/New System Assets/Skybox/Left_Large.png", + "topPath": "systems/New System Assets/Skybox/Up_Large.png", + "bottomPath": "systems/New System Assets/Skybox/Down_Large.png", + "frontPath": "systems/New System Assets/Skybox/Front_Large.png", + "backPath": "systems/New System Assets/Skybox/Back_Large.png" + }, + "Background": { + "details": [ + { + "assetBundle": "assetbundles/test", + "path": "Assets/Prefabs/Background.prefab", + "position": {"x": 200, "y": 280, "z": -50}, + "rotation": {"x": 310, "y": 0, "z": 310}, + "scale": 0.05 + } + ], + "rotationSpeed": 10 + }, + "MenuPlanet": { + "destroyMenuPlanet": false, + "removeChildren": ["PlanetRoot/Props"], + "details": [ + { + "assetBundle": "assetbundles/test", + "path": "Assets/Prefabs/ArtificialGravity.prefab", + "removeChildren": ["Gravity"], + "parentPath": "PlanetRoot", + "position": {"x": 0, "y": 32, "z": 0}, + "rotation": {"x": 90, "y": 0, "z": 0}, + "scale": 10 + } + ], + "rotationSpeed": 20 } - ], - "rotationSpeed": 10 - }, - "MenuPlanet": { - "destroyMenuPlanet": false, - "removeChildren": ["PlanetRoot/Props"], - "details": [ - { - "assetBundle": "assetbundles/test", - "path": "Assets/Prefabs/ArtificialGravity.prefab", - "removeChildren": ["Gravity"], - "parentPath": "PlanetRoot", - "position": {"x": 0, "y": 32, "z": 0}, - "rotation": {"x": 90, "y": 0, "z": 0}, - "scale": 10 - } - ], - "rotationSpeed": 20 - } + } + ] } ``` +You can have multiple title screens but only one will be selected from the list. The last title screen in the list, that is unlocked, will always be selected. + ## Configs +Title screens from configs are always put first into the list. + ### `disableNHPlanets` If set to `true`, prevents NH-generated planets from appearing on the title screen. Defaults to true. @@ -105,7 +118,11 @@ To see all the different things you can put into a config file check out the [Ti ## API -New Horizons provides an API method to register and build custom title screens dynamically. Keep in mind you can only choose config or api not both as they don't merge. +New Horizons provides an API method to register and build custom title screens dynamically. + +These will be put at the end of the list for the selection of all your mod's title screens. + +You cannot combine configs with API unfortunately as only the API will be selected. ```csharp title="INewHorizons.cs" /// @@ -119,7 +136,9 @@ It shares a few values with the configs but also has an exclusive one. `builder`: Builder to run when this title screen is selected. The GameObject passed through it is the main scene object containing both the background and menu planet. -### Example usage +### Example API usage + +You can run `RegisterTitleScreenBuilder` more than once to add multiple title screen builders. ```csharp title="YourModBehaviour.cs" NewHorizons = ModHelper.Interaction.TryGetModApi("xen.NewHorizons"); @@ -136,14 +155,14 @@ public void BuildTitleScreen(GameObject scene) ## Events -Additionally, New Horizons provides events for tracking title screen loading: +Additionally, New Horizons provides events in the API for tracking title screen loading: ```csharp title="INewHorizons.cs" /// /// An event invoked when NH has finished building a title screen. -/// Gives the unique name of the mod the title screen builder was from. +/// Gives the unique name of the mod the title screen builder was from and the index for when you have multiple title screens. /// -UnityEvent GetTitleScreenLoadedEvent(); +UnityEvent GetTitleScreenLoadedEvent(); /// /// An event invoked when NH has finished building the title screen. @@ -151,7 +170,7 @@ UnityEvent GetTitleScreenLoadedEvent(); UnityEvent GetAllTitleScreensLoadedEvent(); ``` -### Example usage +### Example event usage ```csharp title="YourModBehaviour.cs" NewHorizons = ModHelper.Interaction.TryGetModApi("xen.NewHorizons"); @@ -160,13 +179,13 @@ NewHorizons.GetAllTitleScreensLoadedEvent().AddListener(OnAllTitleScreensLoaded) ``` ```csharp title="YourModBehaviour.cs" -public void OnTitleScreenLoaded(string modUniqueName) +public void OnTitleScreenLoaded(string modUniqueName, int index) { - ModHelper.Console.WriteLine($"Title screen loaded: " + modUniqueName, MessageType.Success); + ModHelper.Console.WriteLine($"Title screen loaded: {modUniqueName} #{index}", MessageType.Success); } public void OnAllTitleScreensLoaded() { - ModHelper.Console.WriteLine($"All title screens loaded", MessageType.Success); + ModHelper.Console.WriteLine("All title screens loaded", MessageType.Success); } ```