Skip to content

Commit

Permalink
Fixed for timberborn 0.5.0.0 (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
KYPremco authored Sep 29, 2023
1 parent f1decf4 commit a9e714a
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 101 deletions.
6 changes: 3 additions & 3 deletions Core/TimberApi.Core/ConfiguratorSystem/ConfiguratorPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public class ConfiguratorPatcher : BaseHarmonyPatcher

public override void Apply(Harmony harmony)
{
harmony.Patch(AccessTools.Method(typeof(GameSceneConfigurator), "Configure"),
harmony.Patch(AccessTools.Method(typeof(GameSceneInstaller), nameof(GameSceneInstaller.Configure)),
new HarmonyMethod(AccessTools.Method(typeof(ConfiguratorPatcher), nameof(PatchMasterSceneConfigurator))));

harmony.Patch(AccessTools.Method(typeof(MainMenuSceneConfigurator), "Configure"),
harmony.Patch(AccessTools.Method(typeof(MainMenuSceneConfigurator), nameof(MainMenuSceneConfigurator.Configure)),
new HarmonyMethod(AccessTools.Method(typeof(ConfiguratorPatcher), nameof(PatchMainMenuSceneConfigurator))));

harmony.Patch(AccessTools.Method(typeof(MapEditorSceneConfigurator), "Configure"),
harmony.Patch(AccessTools.Method(typeof(MapEditorSceneConfigurator), nameof(MainMenuSceneConfigurator.Configure)),
new HarmonyMethod(AccessTools.Method(typeof(ConfiguratorPatcher), nameof(PatchMapEditorSceneConfigurator))));
}

Expand Down
72 changes: 0 additions & 72 deletions Core/TimberApi.Core/ConsoleSystem/ConsoleMonitor.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ internal class ConsoleSystemConfigurator : PrefabConfigurator
{
public override void Configure(IContainerDefinition containerDefinition)
{
containerDefinition.MultiBind<ILogListener>().ToInstance(GetInstanceFromPrefab<ConsoleMonitor>());
containerDefinition.Bind<IInternalConsoleWriter>().To<InternalConsoleWriter>().AsSingleton();
containerDefinition.Bind<IConsoleWriter>().To<ConsoleWriter>().AsSingleton();
}

public static void Prefab(GameObject parent)
{
PrefabBuilder.Create<ConsoleSystemConfigurator>("ConsoleSystemConfigurator")
.AddGameObject("ConsoleMonitor", consoleMonitor => consoleMonitor.AddComponent<UIDocument>().AddComponent<KeyboardController>().AddComponent<ConsoleMonitor>())
.FinishAndSetParent(parent);
PrefabBuilder.Create<ConsoleSystemConfigurator>("ConsoleSystemConfigurator").FinishAndSetParent(parent);
}
}
}
2 changes: 1 addition & 1 deletion Core/TimberApi.Core/ModLoaderSystem/ModLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using TimberApi.Core.ModLoaderSystem.ObjectDeserializers;
using TimberApi.ModSystem;
using Timberborn.Persistence;
using Timberborn.WorldSerialization;
using Timberborn.SerializationSystem;
using UnityEngine;
using Logger = TimberApi.Core.LoggingSystem.Logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using TimberApi.Common.Helpers;
using TimberApi.Core.ModLoaderSystem.ObjectDeserializers;
using TimberApi.ModSystem;
using Timberborn.WorldSerialization;
using Timberborn.SerializationSystem;
using UnityEngine;

namespace TimberApi.Core.ModLoaderSystem
Expand Down
3 changes: 2 additions & 1 deletion Core/TimberApi/AssetSystem/AssetSpecificationDeserializer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Immutable;
using TimberApi.Common.Extensions;
using Timberborn.Persistence;

namespace TimberApi.AssetSystem
Expand All @@ -13,7 +14,7 @@ public void Serialize(AssetSpecification value, IObjectSaver objectSaver)
public Obsoletable<AssetSpecification> Deserialize(IObjectLoader objectLoader)
{
return new AssetSpecification(
objectLoader.GetValueOrDefault(new ListKey<string>("IgnoreDirectoryPrefixes")).ToImmutableArray()
objectLoader.GetValueOrEmpty(new ListKey<string>("IgnoreDirectoryPrefixes")).ToImmutableArray()
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Core/TimberApi/BottomBarSystem/BottomBarButton.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using Timberborn.WorldSerialization;
using Timberborn.SerializationSystem;

namespace TimberApi.BottomBarSystem
{
Expand Down
2 changes: 1 addition & 1 deletion Core/TimberApi/ObjectSelectionSystem/PickObjectTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public bool ProcessInput()
{
_highlighter.HighlightSecondary(hitObject, _colors.EntitySelection);
_warning = _validateCandidate(hitObject.GameObjectFast);
if (_inputService is { SelectionStart: true, MouseOverUI: false })
if (_inputService is { MainMouseButtonDown: true, MouseOverUI: false })
{
_toolManager.SwitchToDefaultTool();
_callback(hitObject.GameObjectFast);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Linq;
using Newtonsoft.Json.Linq;
using Timberborn.Persistence;
using Timberborn.WorldSerialization;
using Timberborn.SerializationSystem;

namespace TimberApi.SpecificationSystem
{
Expand Down
2 changes: 1 addition & 1 deletion Core/TimberApi/ToolGroupSystem/ToolGroupSpecification.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Timberborn.WorldSerialization;
using Timberborn.SerializationSystem;
using UnityEngine;

namespace TimberApi.ToolGroupSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using TimberApi.Common.Extensions;
using Timberborn.AssetSystem;
using Timberborn.Persistence;
using Timberborn.WorldSerialization;
using Timberborn.SerializationSystem;
using UnityEngine;

namespace TimberApi.ToolGroupSystem
Expand Down
2 changes: 1 addition & 1 deletion Core/TimberApi/ToolSystem/ToolSpecification.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Timberborn.WorldSerialization;
using Timberborn.SerializationSystem;
using UnityEngine;

namespace TimberApi.ToolSystem
Expand Down
2 changes: 1 addition & 1 deletion Core/TimberApi/ToolSystem/ToolSpecificationDeserliaser.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using TimberApi.Common.Extensions;
using Timberborn.Persistence;
using Timberborn.WorldSerialization;
using Timberborn.SerializationSystem;

namespace TimberApi.ToolSystem
{
Expand Down
11 changes: 5 additions & 6 deletions Core/TimberApi/ToolSystem/Tools/SettingBox/SettingBoxTool.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
using TimberApi.ToolGroupSystem;
using Timberborn.Options;
using Timberborn.SingletonSystem;
using Timberborn.ToolSystem;

namespace TimberApi.ToolSystem.Tools.SettingBox
{
public class SettingBoxTool : Tool
{
private readonly EventBus _eventBus;

private readonly ToolGroupManager _toolGroupManager;

public SettingBoxTool(ToolGroup? toolGroup, EventBus eventBus, ToolGroupManager toolGroupManager)
private readonly IOptionsBox _optionsBox;

public SettingBoxTool(ToolGroup? toolGroup, ToolGroupManager toolGroupManager, IOptionsBox optionsBox)
{
ToolGroup = toolGroup;
_eventBus = eventBus;
_toolGroupManager = toolGroupManager;
_optionsBox = optionsBox;
}

public override void Enter()
{
_toolGroupManager.SwitchToolGroup(new ExitingToolGroup());
_eventBus.Post(new ShowOptionsEvent());
_optionsBox.Show();
}

public override void Exit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
using Timberborn.SingletonSystem;
using Timberborn.Options;
using Timberborn.ToolSystem;

namespace TimberApi.ToolSystem.Tools.SettingBox
{
public class SettingBoxToolFactory : IToolFactory
{
private readonly EventBus _eventBus;
private readonly IOptionsBox _optionsBox;

private readonly ToolGroupManager _toolGroupManager;

public SettingBoxToolFactory(EventBus eventBus, ToolGroupManager toolGroupManager)
public SettingBoxToolFactory(ToolGroupManager toolGroupManager, IOptionsBox optionsBox)
{
_eventBus = eventBus;
_toolGroupManager = toolGroupManager;
_optionsBox = optionsBox;
}

public string Id => "SettingBoxTool";

public Tool Create(ToolSpecification toolSpecification, ToolGroup? toolGroup = null)
{
return new SettingBoxTool(toolGroup, _eventBus, _toolGroupManager);
return new SettingBoxTool(toolGroup, _toolGroupManager, _optionsBox);
}
}
}
2 changes: 1 addition & 1 deletion GameImports.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
<PackageReference Include="UnityEngine.Modules" Version="2022.1.6" IncludeAssets="compile" />
<PackageReference Include="Timberborn.GameLibs" Version="0.4.4-r.0" Condition="$(UseLocalTimberbornSource) == false" />
<PackageReference Include="Timberborn.GameLibs" Version="0.5.0-r.0" Condition="$(UseLocalTimberbornSource) == false" />
</ItemGroup>

<!-- Import dll's from Timberborn's symlink in solution folder-->
Expand Down

0 comments on commit a9e714a

Please sign in to comment.