Skip to content

Commit

Permalink
Merge pull request #567 from ow-mods/dev
Browse files Browse the repository at this point in the history
2.10.0
  • Loading branch information
misternebula authored Mar 20, 2024
2 parents e1de2cf + 7d9cd55 commit d496f82
Show file tree
Hide file tree
Showing 62 changed files with 4,764 additions and 257 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
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
}
}
6 changes: 6 additions & 0 deletions src/OWML.Common/Interfaces/IModBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ public interface IModBehaviour

object GetApi();

void SetupTitleMenu();

void SetupPauseMenu();

void SetupOptionsMenu();

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.", true)]
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; }
}
}
13 changes: 13 additions & 0 deletions src/OWML.Common/Interfaces/Menus/IOWMLFourChoicePopupMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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);
}
}
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;
}
}
17 changes: 17 additions & 0 deletions src/OWML.Common/Interfaces/Menus/IOWMLPopupInputMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using UnityEngine.UI;

namespace OWML.Common.Interfaces.Menus
{
public interface IOWMLPopupInputMenu
{
public event PopupInputMenu.InputPopupValidateCharEvent OnInputPopupValidateChar;

public void EnableMenu(bool value);

public string GetInputText();

public InputField GetInputField();

public event PopupMenu.PopupConfirmEvent OnPopupConfirm;
}
}
9 changes: 9 additions & 0 deletions src/OWML.Common/Interfaces/Menus/IOWMLSliderElement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace OWML.Common
{
public delegate void FloatOptionValueChangedEvent(float newValue);

public interface IOWMLSliderElement : IOWMLMenuValueOption
{
public event FloatOptionValueChangedEvent OnValueChanged;
}
}
11 changes: 11 additions & 0 deletions src/OWML.Common/Interfaces/Menus/IOWMLTextEntryElement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace OWML.Common
{
public delegate void TextEntryConfirmEvent();

public interface IOWMLTextEntryElement : IOWMLMenuValueOption
{
public event TextEntryConfirmEvent OnConfirmEntry;

public string GetInputText();
}
}
Loading

0 comments on commit d496f82

Please sign in to comment.