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,58 +14,71 @@ A title screen config file will look something like this:
|
|||||||
```json title="title-screen.json"
|
```json title="title-screen.json"
|
||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/Outer-Wilds-New-Horizons/new-horizons/main/NewHorizons/Schemas/title_screen_schema.json",
|
"$schema": "https://raw.githubusercontent.com/Outer-Wilds-New-Horizons/new-horizons/main/NewHorizons/Schemas/title_screen_schema.json",
|
||||||
"disableNHPlanets": true,
|
"titleScreens": [
|
||||||
"factRequiredForTitle": "EXAMPLES_ARTIFICIAL_GRAVITY",
|
{
|
||||||
"shareTitleScreen": true,
|
"disableNHPlanets": false,
|
||||||
"menuTextTint": {
|
"shareTitleScreen": true,
|
||||||
"r": 128,
|
"music": "planets/assets/TitleScreenMusic.mp3"
|
||||||
"g": 128,
|
},
|
||||||
"b": 255
|
{
|
||||||
},
|
"disableNHPlanets": true,
|
||||||
"music": "planets/assets/TitleScreenMusic.mp3",
|
"shareTitleScreen": true,
|
||||||
"ambience": "planets/assets/TitleScreenAmbience.mp3",
|
"factRequiredForTitle": "EXAMPLES_ARTIFICIAL_GRAVITY",
|
||||||
"Skybox": {
|
"menuTextTint": {
|
||||||
"destroyStarField": true,
|
"r": 128,
|
||||||
"rightPath": "systems/New System Assets/Skybox/Right_Large.png",
|
"g": 128,
|
||||||
"leftPath": "systems/New System Assets/Skybox/Left_Large.png",
|
"b": 255
|
||||||
"topPath": "systems/New System Assets/Skybox/Up_Large.png",
|
},
|
||||||
"bottomPath": "systems/New System Assets/Skybox/Down_Large.png",
|
"music": "planets/assets/TitleScreenMusic.mp3",
|
||||||
"frontPath": "systems/New System Assets/Skybox/Front_Large.png",
|
"ambience": "planets/assets/TitleScreenAmbience.mp3",
|
||||||
"backPath": "systems/New System Assets/Skybox/Back_Large.png"
|
"Skybox": {
|
||||||
},
|
"destroyStarField": true,
|
||||||
"Background": {
|
"rightPath": "systems/New System Assets/Skybox/Right_Large.png",
|
||||||
"details": [
|
"leftPath": "systems/New System Assets/Skybox/Left_Large.png",
|
||||||
{
|
"topPath": "systems/New System Assets/Skybox/Up_Large.png",
|
||||||
"assetBundle": "assetbundles/test",
|
"bottomPath": "systems/New System Assets/Skybox/Down_Large.png",
|
||||||
"path": "Assets/Prefabs/Background.prefab",
|
"frontPath": "systems/New System Assets/Skybox/Front_Large.png",
|
||||||
"position": {"x": 200, "y": 280, "z": -50},
|
"backPath": "systems/New System Assets/Skybox/Back_Large.png"
|
||||||
"rotation": {"x": 310, "y": 0, "z": 310},
|
},
|
||||||
"scale": 0.05
|
"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
|
## Configs
|
||||||
|
|
||||||
|
Title screens from configs are always put first into the list.
|
||||||
|
|
||||||
### `disableNHPlanets`
|
### `disableNHPlanets`
|
||||||
|
|
||||||
If set to `true`, prevents NH-generated planets from appearing on the title screen. Defaults to true.
|
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
|
## 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"
|
```csharp title="INewHorizons.cs"
|
||||||
/// <summary>
|
/// <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.
|
`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"
|
```csharp title="YourModBehaviour.cs"
|
||||||
NewHorizons = ModHelper.Interaction.TryGetModApi<INewHorizons>("xen.NewHorizons");
|
NewHorizons = ModHelper.Interaction.TryGetModApi<INewHorizons>("xen.NewHorizons");
|
||||||
@ -136,14 +155,14 @@ public void BuildTitleScreen(GameObject scene)
|
|||||||
|
|
||||||
## Events
|
## 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"
|
```csharp title="INewHorizons.cs"
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An event invoked when NH has finished building a title screen.
|
/// 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>
|
/// </summary>
|
||||||
UnityEvent<string> GetTitleScreenLoadedEvent();
|
UnityEvent<string, int> GetTitleScreenLoadedEvent();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An event invoked when NH has finished building the title screen.
|
/// An event invoked when NH has finished building the title screen.
|
||||||
@ -151,7 +170,7 @@ UnityEvent<string> GetTitleScreenLoadedEvent();
|
|||||||
UnityEvent GetAllTitleScreensLoadedEvent();
|
UnityEvent GetAllTitleScreensLoadedEvent();
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example usage
|
### Example event usage
|
||||||
|
|
||||||
```csharp title="YourModBehaviour.cs"
|
```csharp title="YourModBehaviour.cs"
|
||||||
NewHorizons = ModHelper.Interaction.TryGetModApi<INewHorizons>("xen.NewHorizons");
|
NewHorizons = ModHelper.Interaction.TryGetModApi<INewHorizons>("xen.NewHorizons");
|
||||||
@ -160,13 +179,13 @@ NewHorizons.GetAllTitleScreensLoadedEvent().AddListener(OnAllTitleScreensLoaded)
|
|||||||
```
|
```
|
||||||
|
|
||||||
```csharp title="YourModBehaviour.cs"
|
```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()
|
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