Skip to content

Commit

Permalink
Merge branch 'master' into guy-le-dep-array-null
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy authored Mar 22, 2024
2 parents 72bd6c4 + cd1dadc commit b64149b
Show file tree
Hide file tree
Showing 65 changed files with 4,951 additions and 258 deletions.
11 changes: 3 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,9 @@ To get started, check out [our tutorial on the docs](https://owml.outerwildsmods

## Compatibility

|Version|Compatible|
|-|-|
|1.1.10|Yes|
|1.1.9|Unknown|
|1.1.8|Unknown|
|1.0.0 - 1.0.7|No|
OWML is only supported on the latest game version. It may work on older versions, but that cannot be guaranteed.

OWML is compatible with Echoes of the Eye, and works on both Epic and Steam installations.
OWML is compatible with Echoes of the Eye, and works on Epic, Steam, and Microsoft Store installations.

## Feedback and Support

Expand All @@ -80,7 +75,7 @@ Contributors:
* [JohnCorby](https://github.com/JohnCorby) - Helped with audio loading stuff.

Special thanks to:
* [Outer Wilds](http://www.outerwilds.com)
* [Outer Wilds](https://www.mobiusdigitalgames.com/outer-wilds.html)
* [Outer Wilds on Reddit](https://www.reddit.com/r/outerwilds)
* The unnofficial Outer Wilds Discord
* Inspired by (and some code from) [SMAPI](https://smapi.io)
Expand Down
2 changes: 1 addition & 1 deletion docs/content/pages/guides/patching.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public class MyPatchClass {
```

!!! alert-info "How can we access that private field?"
OWML Publicizes all base-game assemblies for you, meaning you can get and set private fields and call private methods on base-game classes.
We publicize all base-game assemblies for you, meaning you can get and set private fields and call private methods on base-game classes. This is done in [the Outer Wilds game libs package](https://github.com/ow-mods/OuterWildsGameLibs){class="link-info"}

### Getting The Arguments Passed

Expand Down
10 changes: 5 additions & 5 deletions docs/content/pages/mod_helper/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ A `Dictionary<string, object>` containing your mod's settings, it's recommended

## GetSettingValue&lt;T&gt;

Gets the setting's value from the mod's config with the given key. Deserialized into type `T`
Gets the setting's value from the mod's config with the given key. Deserialized into type `T`.

### Get Parameters

- `string key`: The key to get
- `string key`: The key to get.

## SetSettingsValue

Sets the setting's value in the mod's config with the given key to the given value.

### Set Parameters

- `string key`: The key to set
- `object value`: The value to set the key to, auto-serialized to a JSON string
- `string key`: The key to set.
- `object value`: The value to set the key to, auto-serialized to a JSON string.

## Copy

Copies the config of the mod
Copies the config of the mod.
156 changes: 2 additions & 154 deletions docs/content/pages/mod_helper/menus.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,157 +4,5 @@ Title: Menus

# ModHelper.Menus

Provides utilities to extend base-game menus and UI.

## Interfaces

These interfaces are used throughout the module

## IModMenu

Represents a menu

### OnInit

The event that's fired when the menu has been initialized.

## IModButton

Represents a button

### OnClick

The event that fires when clicked

### Title

Text displayed on the button

### Duplicate

Duplicates the button with a new label

### Show

Shows the button

### Hide

Hides the button

## IModMessagePopup

### OnConfirm

The event that's fired when the confirm button is pressed

### OnCancel

The event that's fired when the cancel button is pressed

## IModInputMenu

### OnConfirm(string)

The event that's fired when the input is confirmed, it expects an Action&lt;string&gt;

## MainMenu

The main menu of the game. It is represented by `IModMainMenu`.

### IModButtons

- OptionsButton
- QuitButton
- ResumeExpeditionButton
- NewExpeditionButton
- ViewCreditsButton
- SwitchProfileButton

## PauseMenu

The pause menu. It is represented by `IModPauseMenu`.

### IModButtons

- ResumeButton
- OptionsButton
- QuitButton

## Button Example

```csharp
public class MyCoolMod : ModBehaviour {
public void Start() {
ModHelper.Menus.MainMenu.OnInit += () => {
var myButton = ModHelper.Menus.MainMenu.OptionsButton.Duplicate("My Cool Button");
myButton.OnClick += MyButtonClicked;
};
}

public void MyButtonClicked() {
ModHelper.Console.WriteLine("My Button Was Clicked!");
}
}
```

## PopupManager

Allows you to show information and input messages

### CreateMessagePopup

Creates a new message popup

#### Message Parameters

(*italicized* = optional)

- `string message`: The message to show
- *`bool addCancel`*: Whether to add a cancel button to the popup
- *`string okMessage`*: The message to show in the OK button
- *`string cancelMessage`*: The message to show in the cancel button

#### Message Example

```csharp
public class MyCoolMod : ModBehaviour {
public void Start() {
var popup = ModHelper.Menus.PopupManager.CreateMessagePopup("What do?", true, "Yes", "What");
popup.OnConfirm += OnOk;
popup.OnCancel += OnCancel;
}

public void OnOk() {
ModHelper.Console.WriteLine("You Clicked OK!", MessageType.Success);
}

public void OnCancel() {
ModHelper.Console.WriteLine("You Clicked Cancel!", MessageType.Warning);
}
}
```

### CreateInputPopup

Creates a new input popup for the player.

#### Input Parameters

- `InputType inputType`: Either `InputType.Text` or `InputType.Number`
- `string value`: The default value for the prompt

#### Input Example

```csharp
public class MyCoolMod : ModBehaviour {
public void Start() {
var prompt = ModHelper.Menus.PopupManager.CreateInputPrompt(InputType.Text, "Default");
prompt.OnConfirm += OnConfirm;
}

public void OnConfirm(string value) {
ModHelper.Console.WriteLine($"You entered: {value}!");
}
}
```
!!! alert-warning "Deprecated"
This module has been deprecated in favor of the new menu system, covered in [the tutorial]({{ "Creating Custom Menus"|route }}){class="link-info"}.
9 changes: 8 additions & 1 deletion src/OWML.Common/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
namespace OWML.Common
using System.Runtime.CompilerServices;

// make everything in OWML.Common visible to these namespaces
// this is in this file just because it's the first one that comes up in VS :P
[assembly: InternalsVisibleTo("OWML.ModHelper.Menus")]
[assembly: InternalsVisibleTo("OWML.ModLoader")]

namespace OWML.Common
{
public class Constants
{
Expand Down
9 changes: 9 additions & 0 deletions src/OWML.Common/Enums/MenuSide.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace OWML.Common
{
public enum MenuSide
{
LEFT,
CENTER,
RIGHT
}
}
33 changes: 33 additions & 0 deletions src/OWML.Common/Interfaces/IModBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,39 @@ public interface IModBehaviour

object GetApi();

/// <summary>
/// Called when the title screen has loaded in.
/// Put any code that edits the title menu here.
/// </summary>
void SetupTitleMenu(ITitleMenuManager titleManager);

/// <summary>
/// Called when leaving the title menu scene. Put any event unsubscriptions here.
/// </summary>
void CleanupTitleMenu();

/// <summary>
/// Called when the SolarSystem or EyeOfTheUniverse scene has loaded in.
/// Put any code that edits the pause menu here.
/// </summary>
void SetupPauseMenu(IPauseMenuManager pauseManager);

/// <summary>
/// Called when leaving either game scene. Put any event unsubscriptions here.
/// </summary>
void CleanupPauseMenu();

/// <summary>
/// Called when the main menu or game has loaded in.
/// Put any code that edits the options menu here.
/// </summary>
void SetupOptionsMenu(IOptionsMenuManager optionsManager);

/// <summary>
/// Called when leaving the title or either game scene. Put any event unsubscriptions here.
/// </summary>
void CleanupOptionsMenu();

void Init(IModHelper helper);
}
}
2 changes: 1 addition & 1 deletion src/OWML.Common/Interfaces/IModData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public interface IModData

IModConfig Config { get; }

IModConfig DefaultConfig { get; }
IModDefaultConfig DefaultConfig { get; }

IModStorage Storage { get; }

Expand Down
15 changes: 15 additions & 0 deletions src/OWML.Common/Interfaces/IModDefaultConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Collections.Generic;

namespace OWML.Common
{
public interface IModDefaultConfig
{
bool Enabled { get; set; }

Dictionary<string, object> Settings { get; set; }

T GetSettingsValue<T>(string key);

IModConfig Copy();
}
}
6 changes: 6 additions & 0 deletions src/OWML.Common/Interfaces/IModHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OWML.Common.Menus;
using System;

namespace OWML.Common
{
Expand All @@ -16,14 +17,19 @@ public interface IModHelper

IModStorage Storage { get; }

[Obsolete("Use the new menu system instead.")]
IModMenus Menus { get; }

IModManifest Manifest { get; }

IModConfig Config { get; }

IModDefaultConfig DefaultConfig { get; }

IOwmlConfig OwmlConfig { get; }

IModInteraction Interaction { get; }

IMenuManager MenuHelper { get; }
}
}
14 changes: 14 additions & 0 deletions src/OWML.Common/Interfaces/Menus/IMenuManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections.Generic;

namespace OWML.Common
{
public interface IMenuManager
{
public ITitleMenuManager TitleMenuManager { get; }
public IPauseMenuManager PauseMenuManager { get; }
public IOptionsMenuManager OptionsMenuManager { get; }
public IPopupMenuManager PopupMenuManager { get; }

internal IList<IModBehaviour> ModList { get; set; }
}
}
16 changes: 16 additions & 0 deletions src/OWML.Common/Interfaces/Menus/IOWMLFourChoicePopupMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace OWML.Common
{
public interface IOWMLFourChoicePopupMenu
{
event PopupConfirmEvent OnPopupConfirm1;
event PopupConfirmEvent OnPopupConfirm2;
event PopupConfirmEvent OnPopupConfirm3;
event PopupValidateEvent OnPopupValidate;
event PopupCancelEvent OnPopupCancel;

void EnableMenu(bool value);

public event Menu.ActivateMenuEvent OnActivateMenu;
public event Menu.DeactivateMenuEvent OnDeactivateMenu;
}
}
7 changes: 7 additions & 0 deletions src/OWML.Common/Interfaces/Menus/IOWMLMenuValueOption.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace OWML.Common
{
public interface IOWMLMenuValueOption
{
string ModSettingKey { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace OWML.Common
{
public delegate void OptionValueChangedEvent(int newIndex, string newSelection);

public interface IOWMLOptionsSelectorElement : IOWMLMenuValueOption
{
public event OptionValueChangedEvent OnValueChanged;
}
}
Loading

0 comments on commit b64149b

Please sign in to comment.