Skip to content

Commit

Permalink
fixed verbose mode bug
Browse files Browse the repository at this point in the history
  • Loading branch information
amazingalek committed Dec 20, 2019
1 parent 2079bb3 commit 29d4980
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
13 changes: 0 additions & 13 deletions OWML.Common/ModBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@ public void Init(IModHelper modHelper)
{
ModHelper = modHelper;
DontDestroyOnLoad(gameObject);
if (modHelper.Config.Verbose)
{
Application.logMessageReceived += OnLogMessageReceived;
}
}

private void OnLogMessageReceived(string message, string stackTrace, LogType type)
{
ModHelper.Logger.Log($"{type}: {message}");
if (type == LogType.Error || type == LogType.Exception)
{
ModHelper.Console.WriteLine($"{type}: {message}");
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion OWML.Launcher/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace OWML.Launcher
{
public class App
{
private const string OWMLVersion = "0.1.5";
private const string OWMLVersion = "0.1.6";

private readonly string[] _filesToCopy = { "UnityEngine.CoreModule.dll", "Assembly-CSharp.dll" };

Expand Down
15 changes: 14 additions & 1 deletion OWML.ModLoader/Owo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,32 @@ public Owo(IModHelper helper, IModFinder modFinder)
public void LoadMods()
{
_helper.Logger.Log($"{nameof(Owo)}: {nameof(LoadMods)}");
if (_helper.Config.Verbose)
{
Application.logMessageReceived += OnLogMessageReceived;
}
var manifests = _modFinder.GetManifests();
foreach (var manifest in manifests)
{
LoadMod(manifest);
}
}

private void OnLogMessageReceived(string message, string stackTrace, LogType type)
{
_helper.Logger.Log($"{type}: {message}");
if (type == LogType.Error || type == LogType.Exception)
{
_helper.Console.WriteLine($"{type}: {message}");
}
}

private void LoadMod(IModManifest manifest)
{
var modType = LoadModType(manifest);
if (modType == null)
{
_helper.Logger.Log($"Mod type is null, skipping");
_helper.Logger.Log("Mod type is null, skipping");
return;
}
_helper.Logger.Log($"Loading {manifest.UniqueName} ({manifest.Version})...");
Expand Down
2 changes: 1 addition & 1 deletion OWML.SampleMods/OWML.EnableDebugMode/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"name": "EnableDebugMode",
"uniqueName": "Alek.EnableDebugMode",
"version": "0.1",
"owmlVersion": "0.1.5",
"owmlVersion": "0.1.6",
"enabled": true
}
2 changes: 1 addition & 1 deletion OWML.SampleMods/OWML.TestMod/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"name": "TestMod",
"uniqueName": "Alek.TestMod",
"version": "0.1",
"owmlVersion": "0.1.5",
"owmlVersion": "0.1.6",
"enabled": false
}
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Add a manifest file called manifest.json. Example:
"name": "EnableDebugMode",
"uniqueName": "Alek.EnableDebugMode",
"version": "0.1",
"owmlVersion": "0.1.5",
"owmlVersion": "0.1.6",
"enabled": true
}
~~~~
Expand Down

0 comments on commit 29d4980

Please sign in to comment.