Skip to content

Commit

Permalink
tweak config drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
katycat5e committed Jun 28, 2023
1 parent 94511af commit 63d0a54
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
17 changes: 12 additions & 5 deletions SkinManagerMod/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using DV.Localization;
using DV.ThingTypes;
using HarmonyLib;
using System.ComponentModel;
using System.IO;
using System.Reflection;
using UnityEngine;
Expand Down Expand Up @@ -69,8 +70,13 @@ public static void Error(string message)

public enum DefaultSkinsMode
{
[Description("Prefer Reskins")]
PreferReplacements,

[Description("Random For Custom Cars")]
AllowForCustomCars,

[Description("Random For All Cars")]
AllowForAllCars
}

Expand All @@ -94,14 +100,13 @@ public SkinManagerSettings(Main plugin)
"Multi-threaded texture loading");

DefaultSkinsUsage = plugin.Config.Bind(
DEFAULT_SECTION, "DefaultSkinsUsage", DefaultSkinsMode.AllowForCustomCars,
"PreferReplacements, AllowForCustomCars, AllowForAllCars");
DEFAULT_SECTION, "DefaultSkinsUsage", DefaultSkinsMode.AllowForCustomCars);

string defaultExportPath = Path.Combine(Paths.BepInExRootPath, PluginInfo.ContentFolderName, PluginInfo.DefaultExportFolderName);
var exportDescription = new ConfigDescription(
"Directory for exported default textures",
null,
new ConfigurationManagerAttributes { CustomDrawer = DrawExporter });
new ConfigurationManagerAttributes { CustomDrawer = DrawExporter, Order = 9999 });

ExportPath = plugin.Config.Bind(DEFAULT_SECTION, "ExportPath", defaultExportPath, exportDescription);
}
Expand All @@ -112,9 +117,11 @@ public SkinManagerSettings(Main plugin)

private static void DrawExporter(ConfigEntryBase entry)
{
GUILayout.Label("Texture Utility");
GUILayout.BeginVertical();

GUILayout.Label(entry.BoxedValue.ToString(), GUILayout.ExpandWidth(true));

GUILayout.BeginHorizontal(GUILayout.Width(250));
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

GUILayout.BeginVertical();

Expand Down
5 changes: 5 additions & 0 deletions SkinManagerMod/SkinManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ private static void LoadAllSkinsForType(TrainCarLivery livery, bool forceSync =
{
LoadSkinsFromFolder(folderPath, livery, forceSync);
}
else
{
// create default directories if not exist
Directory.CreateDirectory(folderPath);
}

if (Remaps.OldCarTypeIDs.TryGetValue(livery.v1, out string overhauledId))
{
Expand Down
3 changes: 1 addition & 2 deletions SkinManagerMod/SkinManagerMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.0.2.0, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="0Harmony, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="Assembly-CSharp">
<HintPath>D:\Games\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
Expand All @@ -44,7 +44,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\Games\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Utils.dll</HintPath>
</Reference>
<Reference Include="DVCustomCarLoader, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\Games\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\Newtonsoft.Json.dll</HintPath>
Expand Down

0 comments on commit 63d0a54

Please sign in to comment.