diff --git a/AudioSettings.csproj b/AudioSettings.csproj
index c143783..2c5c2b2 100644
--- a/AudioSettings.csproj
+++ b/AudioSettings.csproj
@@ -4,7 +4,7 @@
netstandard2.1
AudioSettings
My first plugin
- 1.0.0
+ 1.1.0
true
latest
diff --git a/AudioVolumeSlider.cs b/AudioVolumeSlider.cs
index 5348387..bb4876a 100644
--- a/AudioVolumeSlider.cs
+++ b/AudioVolumeSlider.cs
@@ -19,6 +19,8 @@ namespace AudioSettings
SliderCount = 0;
}
public ConfigEntry Volume { get; set; }
+ public ConfigEntry TranslatedName { get; set; }
+ public ConfigEntry TranslatedDescription { get; set; }
public void Add(AudioSource source, float multiplier)
{
if (Sources.Any(x => x.source == source))
@@ -44,6 +46,8 @@ namespace AudioSettings
Description = description;
Console.WriteLine("Volume slider \"" + name + "\" initiated.");
Volume = Config.Bind(name, "Volume", 1f, description + "\nValue goes from 0 to 1.");
+ TranslatedName = Translator.Config.Bind(name, "Name", name);
+ TranslatedDescription = Translator.Config.Bind(name, "Description", description);
Volume.SettingChanged += Volume_SettingChanged;
ValueLastTick = Volume.Value;
}
@@ -67,9 +71,9 @@ namespace AudioSettings
var rectDescLabel = new Rect(10, SliderCount * 50 + 30, width, 25);
var rectPercLabel = new Rect(width * (2f / 7f), SliderCount * 50 + 10, width * (0.5f / 7f), 25);
- GUI.Label(rectNameLabel, Name, new GUIStyle { alignment = TextAnchor.MiddleLeft, normal = font });
+ GUI.Label(rectNameLabel, TranslatedName.Value, new GUIStyle { alignment = TextAnchor.MiddleLeft, normal = font });
GUI.Label(rectPercLabel, Volume.Value.ToString("##0%"), new GUIStyle { alignment = TextAnchor.MiddleRight, normal = font });
- GUI.Label(rectDescLabel, Description, new GUIStyle { alignment = TextAnchor.MiddleLeft, normal = font });
+ GUI.Label(rectDescLabel, TranslatedDescription.Value, new GUIStyle { alignment = TextAnchor.MiddleLeft, normal = font });
var rect = new Rect(width * (2.5f / 7f) + 10, SliderCount * 50 + 16, width * (4.5f / 7f), 25);
var style = new GUIStyle(GUI.skin.horizontalSlider);
diff --git a/Plugin.cs b/Plugin.cs
index 6b4f270..1144520 100644
--- a/Plugin.cs
+++ b/Plugin.cs
@@ -1,4 +1,5 @@
using BepInEx;
+using BepInEx.Configuration;
using HarmonyLib;
using MyBox;
using System;
@@ -10,6 +11,19 @@ using UnityEngine.UIElements;
namespace AudioSettings
{
+ [BepInPlugin(TRANSLATOR_GUID, TRANSLATOR_NAME, TRANSLATOR_VERSION)]
+ public class Translator : BaseUnityPlugin
+ {
+ public const string TRANSLATOR_GUID = PluginInfo.PLUGIN_GUID + ".Translations";
+ public const string TRANSLATOR_NAME = PluginInfo.PLUGIN_NAME + " Translations";
+ public const string TRANSLATOR_VERSION = PluginInfo.PLUGIN_VERSION;
+ public static ConfigFile Config { get; private set; }
+ public void Awake()
+ {
+ //Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
+ Config = base.Config;
+ }
+ }
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{