-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
33 changed files
with
260 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace OWML.Common | ||
{ | ||
public interface IModBehaviour | ||
{ | ||
IModHelper ModHelper { get; } | ||
void Configure(IModConfig config); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
namespace OWML.Common | ||
using System.Collections.Generic; | ||
|
||
namespace OWML.Common | ||
{ | ||
public interface IModConfig | ||
{ | ||
string GamePath { get; set; } | ||
string ManagedPath { get; } | ||
string OWMLPath { get; } | ||
string ModsPath { get; } | ||
string OutputFilePath { get; } | ||
string LogFilePath { get; } | ||
bool Verbose { get; } | ||
Dictionary<string, object> Settings { get; } | ||
T GetSetting<T>(string key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace OWML.Common | ||
{ | ||
public interface IOwmlConfig | ||
{ | ||
string GamePath { get; set; } | ||
string ManagedPath { get; } | ||
string OWMLPath { get; } | ||
string ModsPath { get; } | ||
string OutputFilePath { get; } | ||
string LogFilePath { get; } | ||
bool Verbose { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"gamePath": "C:/Program Files (x86)/Outer Wilds", | ||
"verbose": false | ||
"gamePath": "C:/Program Files/Epic Games/OuterWilds", | ||
"verbose": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System.Collections.Generic; | ||
using OWML.Common; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
namespace OWML.ModHelper.Menus | ||
{ | ||
public class ModsMenu : IModMenu | ||
{ | ||
private readonly IModLogger _logger; | ||
private readonly IModConsole _console; | ||
private readonly List<IModBehaviour> _registeredMods; | ||
|
||
public ModsMenu(IModLogger logger, IModConsole console) | ||
{ | ||
_logger = logger; | ||
_console = console; | ||
_registeredMods = new List<IModBehaviour>(); | ||
} | ||
|
||
public void Register(IModBehaviour modBehaviour) | ||
{ | ||
_console.WriteLine("Registering " + modBehaviour.ModHelper.Manifest.UniqueName); | ||
_registeredMods.Add(modBehaviour); | ||
var button = AddButton(modBehaviour.ModHelper.Manifest.UniqueName, 0); | ||
button.onClick.AddListener(() => | ||
{ | ||
var config = ParseConfig(button); | ||
modBehaviour.ModHelper.Storage.Save(config, "config.json"); | ||
modBehaviour.Configure(config); | ||
}); | ||
} | ||
|
||
private IModConfig ParseConfig(Button button) | ||
{ | ||
_console.WriteLine("todo: implement ModsMenu.ParseConfig"); | ||
return new ModConfig(); | ||
} | ||
|
||
public Button AddButton(string name, int index) | ||
{ | ||
_console.WriteLine("todo: implement ModsMenu.AddButton"); | ||
var go = new GameObject(); | ||
return go.AddComponent<Button>(); // todo | ||
} | ||
|
||
public List<Button> GetButtons() | ||
{ | ||
_console.WriteLine("todo: implement ModsMenu.GetButtons"); | ||
return new List<Button>(); | ||
} | ||
|
||
public void Open() | ||
{ | ||
_console.WriteLine("todo: implement ModsMenu.Open"); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using OWML.Common; | ||
|
||
namespace OWML.ModHelper | ||
{ | ||
public class ModConfig : IModConfig | ||
{ | ||
[JsonProperty("gamePath")] | ||
public string GamePath { get; set; } | ||
[JsonProperty("settings")] | ||
public Dictionary<string, object> Settings { get; set; } | ||
|
||
[JsonProperty("verbose")] | ||
public bool Verbose { get; private set; } | ||
public ModConfig() | ||
{ | ||
Settings = new Dictionary<string, object>(); | ||
} | ||
|
||
[JsonIgnore] | ||
public string ManagedPath => $"{GamePath}/OuterWilds_Data/Managed"; | ||
public T GetSetting<T>(string key) | ||
{ | ||
if (Settings.ContainsKey(key)) | ||
{ | ||
return (T)Settings[key]; | ||
} | ||
return default; | ||
} | ||
|
||
[JsonProperty("owmlPath")] | ||
public string OWMLPath { get; set; } | ||
|
||
[JsonIgnore] | ||
public string LogFilePath => $"{OWMLPath}Logs/OWML.Log.txt"; | ||
|
||
[JsonIgnore] | ||
public string OutputFilePath => $"{OWMLPath}Logs/OWML.Output.txt"; | ||
|
||
[JsonIgnore] | ||
public string ModsPath => $"{OWMLPath}Mods"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.