This commit is contained in:
Ben C 2022-05-21 21:24:02 -04:00
parent 0a061ecbcc
commit 09762a0f53
4 changed files with 29 additions and 3 deletions

BIN
NJsonSchema/NJsonSchema.dll Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,5 @@
using HarmonyLib; using HarmonyLib;
using NJsonSchema;
using NewHorizons.Builder.Props; using NewHorizons.Builder.Props;
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
@ -12,12 +13,15 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using Newtonsoft.Json;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons namespace NewHorizons
{ {
public class Main : ModBehaviour public class Main : ModBehaviour
{ {
public static AssetBundle NHAssetBundle { get; private set; } public static AssetBundle NHAssetBundle { get; private set; }
@ -35,6 +39,8 @@ namespace NewHorizons
public static float SecondsLeftInLoop = -1; public static float SecondsLeftInLoop = -1;
private static JsonSchema _bodySchema;
public static bool IsSystemReady { get; private set; } public static bool IsSystemReady { get; private set; }
public static float FurthestOrbit { get; set; } = 50000f; public static float FurthestOrbit { get; set; } = 50000f;
@ -108,6 +114,14 @@ namespace NewHorizons
TextTranslation.Get().SetLanguage(TextTranslation.Get().GetLanguage()); TextTranslation.Get().SetLanguage(TextTranslation.Get().GetLanguage());
} }
// TODO: Test class, delete later
[JsonObject]
public class Test
{
[JsonProperty]
public string Name;
}
public void Start() public void Start()
{ {
// Patches // Patches
@ -121,13 +135,24 @@ namespace NewHorizons
Instance = this; Instance = this;
GlobalMessenger<DeathType>.AddListener("PlayerDeath", OnDeath); GlobalMessenger<DeathType>.AddListener("PlayerDeath", OnDeath);
GlobalMessenger.AddListener("WakeUp", new Callback(OnWakeUp)); GlobalMessenger.AddListener("WakeUp", OnWakeUp);
NHAssetBundle = ModHelper.Assets.LoadBundle("AssetBundle/xen.newhorizons"); NHAssetBundle = ModHelper.Assets.LoadBundle("AssetBundle/xen.newhorizons");
ResetConfigs(resetTranslation: false); ResetConfigs(resetTranslation: false);
Logger.Log("Begin load of config files...", Logger.LogType.Log); Logger.Log("Begin load of config files...", Logger.LogType.Log);
try
{
_bodySchema = JsonSchema.FromType<Test>();
}
catch (TypeLoadException te)
{
Logger.LogError(te.ToString());
Application.Quit();
}
try try
{ {
LoadConfigs(this); LoadConfigs(this);

View File

@ -16,6 +16,7 @@
<DebugType>none</DebugType> <DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="..\NJsonSchema\*.dll" />
<PackageReference Include="HarmonyX" Version="2.10.0" /> <PackageReference Include="HarmonyX" Version="2.10.0" />
<PackageReference Include="OWML" Version="2.3.3" /> <PackageReference Include="OWML" Version="2.3.3" />
<PackageReference Include="OuterWildsGameLibs" Version="1.1.12.168" /> <PackageReference Include="OuterWildsGameLibs" Version="1.1.12.168" />