Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.cs]
dotnet_diagnostic.CS8618.severity = none
2 changes: 1 addition & 1 deletion .run/Build & Start SaveGame.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Build &amp; Start SaveGame" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="start &quot;G:\Games\GOG\Timberborn\Timberborn.exe&quot; &quot;-saveName FirstLoad -settlementName BluePrintTester&quot;" />
<option name="SCRIPT_TEXT" value="start &quot;G:\Games\GOG\Timberborn\Timberborn.exe&quot; &quot;-skipModManager -saveName TestingSaveGame -settlementName TestingWorld&quot;" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
Expand Down
2 changes: 1 addition & 1 deletion .run/Build & Start.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Build &amp; Start" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="start &quot;G:\Games\GOG\Timberborn\Timberborn.exe&quot;" />
<option name="SCRIPT_TEXT" value="start &quot;G:\Games\GOG\Timberborn\Timberborn.exe&quot; &quot;-skipModmanager&quot;" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
Expand Down
10 changes: 9 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.7.12.0
- Updated for update 7.2
- Fixed bottombar wonder icon

## 0.7.9.0
- Disabled `BottomBarSystem`, `Tools` & `BuildingSpecificationSsystem` for update 7.
- Updated `TimberApi`, `EntityLinkerSystem`, `SpecificationSystem`, `UIBuilderSystem`, `UIPresets` for update 7.

## 0.7.8.0
- Added `Scenes` to `ToolSpecification` to specify in which scene the tool should be loaded `Game` is default.
- Added `GenericTool` tool factory type to make compatibility without hard dependency possible for custom mod tools.
Expand Down Expand Up @@ -68,7 +76,7 @@
- Added BottomBarRework.
- Added ToolSpecifications.
- Enhanced ToolGroupSpecifications.
- Added Code SpecificationGeneration `ISpecificationGenerator`.
- Added Code SpecificationGeneration `ISpecGenerator`.
- Added `SceneManager`.
- Enhanced SingletonSystem (`IEarlyLoadableSingleton`, `ILateLoadableSingleton`).
- Extended `IObjectLoader` with more default fallbacks.
Expand Down
25 changes: 0 additions & 25 deletions Debug/AutoModStarter/AutoStarterPlugin.cs

This file was deleted.

1 change: 0 additions & 1 deletion Debug/TimberApi.DebugTool/SpecificationServiceLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class SpecificationServiceLogger(ObjectSaveReaderWriter objectSaveReaderW
{
public new IEnumerable<T> GetSpecifications<T>(IObjectSerializer<T> serializer)
{

var type = typeof (T).Name;

var specifications = new List<T>();
Expand Down
8 changes: 4 additions & 4 deletions Debug/TimberApi.DebugTool/TimberApi.DebugTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="System.Collections.Immutable" Version="8.0.0"/>
<PackageReference Include="UnityEngine.Modules" Version="6000.0.4" IncludeAssets="compile"/>
<PackageReference Include="Castle.Core" Version="5.1.1"/>
<!-- Needs to be updated-->
<PackageReference Include="Timberborn.GameLibs" Version="0.3.4.3-r.0" ExcludeAssets="All" Condition="$(UseLocalTimberbornSource)"/>
</ItemGroup>

<ItemGroup Condition="$(UseLocalTimberbornSource)">
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.2"/>
<ItemGroup >
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.3"/>

<Reference Include="$(SolutionDir)Timberborn\Timberborn_Data\Managed\Timberborn.*.dll" Publicize="true">
<DestinationSubDirectory>libs/</DestinationSubDirectory>
</Reference>
<Reference Include="$(SolutionDir)Timberborn\Timberborn_Data\Managed\Bindito.*.dll">
<DestinationSubDirectory>libs/</DestinationSubDirectory>
</Reference>

<Reference Include="$(SolutionDir)Libs\UnityEngine.*.dll" Publicize="true" />
</ItemGroup>

<Target Name="CopyingFilesToTimberborn" BeforeTargets="AfterBuild" Condition="$(CopyDllToPath)">
Expand Down
27 changes: 16 additions & 11 deletions Debug/TimberApi.TesterMod/Configurators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,42 @@ namespace TimberApi.TesterMod;
[Context("Game")]
[Context("MainMenu")]
[Context("MapEditor")]
public class AllConfigurator : IConfigurator
public class AllConfigurator : Configurator
{
public void Configure(IContainerDefinition containerDefinition)
protected override void Configure()
{

Bind<TestClass>().AsSingleton();
}
}

[Context("Game")]
public class GameConfigurator : IConfigurator
public class GameConfigurator : Configurator
{
public void Configure(IContainerDefinition containerDefinition)
protected override void Configure()
{

}
}

[Context("MainMenu")]
public class MainMenuConfigurator : IConfigurator
public class MainMenuConfigurator : Configurator
{
public void Configure(IContainerDefinition containerDefinition)
// protected override void Configure()
// {
// // Bind<Tester>().AsSingleton();
// // Bind<TestSpecificationDeserializer>().AsSingleton();
// // MultiBind<ISpecGenerator>().To<TestSpecificationGenerator>().AsSingleton();
// }

protected override void Configure()
{

}
}

[Context("MapEditor")]
public class MapEditorConfigurator : IConfigurator
public class MapEditorConfigurator : Configurator
{
public void Configure(IContainerDefinition containerDefinition)
protected override void Configure()
{

}
}
16 changes: 16 additions & 0 deletions Debug/TimberApi.TesterMod/ModStarter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using HarmonyLib;
using Timberborn.BlueprintSystem;
using Timberborn.ModManagerScene;
using UnityEngine;
using Object = UnityEngine.Object;

namespace TimberApi.TesterMod;

Expand All @@ -9,4 +19,10 @@ public void StartMod(IModEnvironment modEnvironment)
{
Debug.Log("Test");
}
}

[HarmonyPatch(typeof(SpecService))]
public static class TestPatch
{

}
17 changes: 9 additions & 8 deletions Debug/TimberApi.TesterMod/TimberApi.TesterMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,23 @@
<PackageReference Include="Lib.Harmony" Version="2.3.3"/>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="System.Collections.Immutable" Version="8.0.0"/>
<PackageReference Include="UnityEngine.Modules" Version="6000.0.4" IncludeAssets="compile"/>
<PackageReference Include="Castle.Core" Version="5.1.1"/>
<!-- Needs to be updated-->
<PackageReference Include="Timberborn.GameLibs" Version="0.3.4.3-r.0" ExcludeAssets="All" Condition="$(UseLocalTimberbornSource)"/>
</ItemGroup>
<PackageReference Include="System.Collections.Immutable" Version="9.0.0"/>

<ItemGroup Condition="$(UseLocalTimberbornSource)">
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.2"/>
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.3"/>

<Reference Include="$(SolutionDir)Timberborn\Timberborn_Data\Managed\Timberborn.*.dll" Publicize="true">
<DestinationSubDirectory>libs/</DestinationSubDirectory>
</Reference>
<Reference Include="$(SolutionDir)Timberborn\Timberborn_Data\Managed\Bindito.*.dll">
<DestinationSubDirectory>libs/</DestinationSubDirectory>
</Reference>

<Reference Include="$(SolutionDir)Libs\UnityEngine.*.dll" Publicize="true" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Src\TimberApi.SpecificationSystem\TimberApi.SpecificationSystem.csproj" />
<ProjectReference Include="..\..\Src\TimberApi.UIBuilderSystem\TimberApi.UIBuilderSystem.csproj" />
</ItemGroup>

<Target Name="CopyingFilesToTimberborn" BeforeTargets="AfterBuild" Condition="$(CopyDllToPath)">
Expand Down
Empty file added Libs/README.md
Empty file.
6 changes: 0 additions & 6 deletions NuGet.Config

This file was deleted.

10 changes: 4 additions & 6 deletions Src/TimberApi.BottomBarSystem/BottomBarButton.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
using System;
using Timberborn.SerializationSystem;

namespace TimberApi.BottomBarSystem;

public class BottomBarButton(
BottomBarSpec bottomBarSpec,
string id,
bool isGroup,
string? groupId,
bool hidden,
int order,
ObjectSave? buttonInformation)
int order)
: IComparable<BottomBarButton>
{
public BottomBarSpec? BottomBarSpec { get; } = bottomBarSpec;

public string Id { get; } = id;

public bool IsGroup { get; } = isGroup;
Expand All @@ -21,9 +22,6 @@ public class BottomBarButton(
public bool Hidden { get; } = hidden;

public int Order { get; } = order;

public ObjectSave? ButtonInformation { get; } = buttonInformation;

public int CompareTo(BottomBarButton other)
{
return Order.CompareTo(other.Order);
Expand Down
35 changes: 19 additions & 16 deletions Src/TimberApi.BottomBarSystem/BottomBarPanel.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using TimberApi.Extensions;
using TimberApi.Tools.ToolGroupSystem;
using TimberApi.Tools.ToolSystem;
using TimberApi.Tools.ToolUI;
using Timberborn.BottomBarSystem;
using Timberborn.Persistence;
using Timberborn.SingletonSystem;
using Timberborn.ToolSystem;
using Timberborn.UILayoutSystem;
Expand All @@ -22,9 +21,9 @@ public class BottomBarPanel : ILoadableSingleton

private readonly SortedDictionary<int, VisualElement> _mainWrapperSections = new();

private readonly ToolGroupService _toolGroupService;
private readonly TimberApi.Tools.ToolGroupSystem.ToolGroupService _toolGroupService;

private readonly ToolService _toolService;
private readonly TimberApi.Tools.ToolSystem.ToolService _toolService;

private readonly UILayout _uiLayout;

Expand All @@ -34,7 +33,7 @@ public BottomBarPanel(IEnumerable<BottomBarModule> bottomBarModules,
BottomBarService bottomBarService,
BottomBarUiService bottomBarUiService,
UILayout uiLayout,
ToolButtonFactory toolButtonFactory, ToolService toolService, ToolGroupService toolGroupService)
ToolButtonFactory toolButtonFactory, TimberApi.Tools.ToolSystem.ToolService toolService, TimberApi.Tools.ToolGroupSystem.ToolGroupService toolGroupService)
{
_bottomBarUiService = bottomBarUiService;
_uiLayout = uiLayout;
Expand All @@ -60,12 +59,18 @@ private void SetupBottomBar()

private void InitializeButtons()
{
foreach (var bottomBarButton in _bottomBarService.ToolItemButtons.Where(button => !button.Hidden)
.OrderBy(button => button.Order))
foreach (var bottomBarButton in _bottomBarService.ToolItemButtons.Where(button => !button.Hidden).OrderBy(button => button.Order))
{
if (bottomBarButton.IsGroup)
{
HandleGroupButton(bottomBarButton);
}
else
{
HandleToolButton(bottomBarButton);
}

}
}

private void HandleGroupButton(BottomBarButton bottomBarButton)
Expand All @@ -75,8 +80,7 @@ private void HandleGroupButton(BottomBarButton bottomBarButton)
var section = GetBottomBarSection(bottomBarButton);

AddElementToBottomBar(toolGroupButton.Root, _bottomBarService.GetGroupRow(bottomBarButton.Id), section);
AddElementToBottomBar(toolGroupButton.ToolButtonsElement, _bottomBarService.GetGroupRow(bottomBarButton.Id) + 1,
section);
AddElementToBottomBar(toolGroupButton.ToolButtonsElement, _bottomBarService.GetGroupRow(bottomBarButton.Id) + 1, section);

if (bottomBarButton.GroupId != null)
_toolGroupService.GetToolGroupButton(bottomBarButton.GroupId).AddToolGroupButton(toolGroupButton);
Expand All @@ -85,7 +89,7 @@ private void HandleGroupButton(BottomBarButton bottomBarButton)
private void HandleToolButton(BottomBarButton bottomBarButton)
{
var toolButton = _toolService.GetToolButton(bottomBarButton.Id);

if (bottomBarButton.GroupId is null)
{
AddElementToBottomBar(toolButton.Root, 0, GetBottomBarSection(bottomBarButton));
Expand All @@ -100,11 +104,7 @@ private void HandleToolButton(BottomBarButton bottomBarButton)

private int GetBottomBarSection(BottomBarButton bottomBarButton)
{
if (bottomBarButton.ButtonInformation == null) return 1;

var objectLoader = ObjectLoader.CreateBasicLoader(bottomBarButton.ButtonInformation);

return objectLoader.GetValueOrDefault(new PropertyKey<int>("BottomBarSection"), 1);
return bottomBarButton.BottomBarSpec?.Section ?? 1;
}

private void InitializeSections()
Expand Down Expand Up @@ -142,6 +142,9 @@ private VisualElement GetOrInsertSection(int section)

private void AddPanelsToWrapper()
{
foreach (var bottomBarPanelPair in _bottomBarPanels.Reverse()) _bottomBarWrapper.Add(bottomBarPanelPair.Value);
foreach (var bottomBarPanelPair in _bottomBarPanels.Reverse())
{
_bottomBarWrapper.Add(bottomBarPanelPair.Value);
}
}
}
Loading