mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
edit for rework
This commit is contained in:
parent
a4a5d53416
commit
075dac755a
@ -14,9 +14,16 @@ 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",
|
||||
"titleScreens": [
|
||||
{
|
||||
"disableNHPlanets": false,
|
||||
"shareTitleScreen": true,
|
||||
"music": "planets/assets/TitleScreenMusic.mp3"
|
||||
},
|
||||
{
|
||||
"disableNHPlanets": true,
|
||||
"shareTitleScreen": true,
|
||||
"factRequiredForTitle": "EXAMPLES_ARTIFICIAL_GRAVITY",
|
||||
"menuTextTint": {
|
||||
"r": 128,
|
||||
"g": 128,
|
||||
@ -61,11 +68,17 @@ A title screen config file will look something like this:
|
||||
],
|
||||
"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"
|
||||
/// <summary>
|
||||
@ -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<INewHorizons>("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"
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
UnityEvent<string> GetTitleScreenLoadedEvent();
|
||||
UnityEvent<string, int> GetTitleScreenLoadedEvent();
|
||||
|
||||
/// <summary>
|
||||
/// An event invoked when NH has finished building the title screen.
|
||||
@ -151,7 +170,7 @@ UnityEvent<string> GetTitleScreenLoadedEvent();
|
||||
UnityEvent GetAllTitleScreensLoadedEvent();
|
||||
```
|
||||
|
||||
### Example usage
|
||||
### Example event usage
|
||||
|
||||
```csharp title="YourModBehaviour.cs"
|
||||
NewHorizons = ModHelper.Interaction.TryGetModApi<INewHorizons>("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);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user