Skip to content

Commit

Permalink
translation supprt
Browse files Browse the repository at this point in the history
  • Loading branch information
krypto5863 committed Nov 2, 2021
1 parent 5be0565 commit 8a42a60
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 12 deletions.
8 changes: 8 additions & 0 deletions ChoosyPreset/ChoosyPreset.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Desktop\Game Related Files\Meido Related Stuff\Meido Assemblies\COM Assemblies\BepinEx\BepInEx.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\Desktop\Game Related Files\Meido Related Stuff\Meido Assemblies\COM Assemblies\GameOriginal 3.10\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
Expand All @@ -60,6 +64,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="Translations\english.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del "G:\KISS\COM3D2Test\BepinEx\plugins\$(TargetFileName)"
Expand Down
24 changes: 23 additions & 1 deletion ChoosyPreset/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using UnityEngine;

//These two lines tell your plugin to not give a flying fuck about accessing private variables/classes whatever. It requires a publicized stubb of the library with those private objects though.
Expand All @@ -28,9 +35,12 @@ public class Main : BaseUnityPlugin

//Config entry variable. You set your configs to this.
internal static ConfigEntry<bool> AdvancedMode;
internal static ConfigEntry<string> LanguageFile;
public static bool PresetPanelOpen { get; private set; }
public static bool ViewMode { get; private set; }

internal static Dictionary<string, string> Translations;

private void Awake()
{
//Useful for engaging coroutines or accessing variables non-static variables. Completely optional though.
Expand All @@ -39,13 +49,25 @@ private void Awake()
//pushes the logger to a public static var so you can use the bepinex logger from other classes.
logger = Logger;

if (!Directory.Exists(BepInEx.Paths.ConfigPath + $"\\ChoosyPreset"))
{
Directory.CreateDirectory(BepInEx.Paths.ConfigPath + $"\\ChoosyPreset");
}

//Binds the configuration. In other words it sets your ConfigEntry var to your config setup.
AdvancedMode = Config.Bind("General", "Advanced Mode", false, "This mode lets you switch individual slots for your items. It's way more confusing than simple mode.");

AcceptableValueList<string> translationFile = new AcceptableValueList<string>(Directory.GetFiles(BepInEx.Paths.ConfigPath + $"\\ChoosyPreset\\", "*.json").Select(file => Path.GetFileName(file)).ToArray());

LanguageFile = Config.Bind("General", "Language File", "en_us.json", new ConfigDescription("This denotes the translation file to use in ChoosyPreset.", translationFile));

LanguageFile.SettingChanged += (e, s) => { Translations = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(BepInEx.Paths.ConfigPath + $"\\ChoosyPreset\\" + LanguageFile.Value)); };

Translations = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(BepInEx.Paths.ConfigPath + $"\\ChoosyPreset\\" + LanguageFile.Value));

foreach (string s in Enum.GetNames(typeof(MPN)))
{
UI.ButtonsMPN[s] = true;

#if DEBUG
var KeyVal = UI.Categories.FirstOrDefault(kv => kv.Value.Contains(s.ToLower())).Key;
if (KeyVal == null)
Expand Down
163 changes: 163 additions & 0 deletions ChoosyPreset/Translations/english.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
"null_mpn": "Null Value (Pointless)",
"Clothes": "Clothes",
"Accesories": "Accessories",
"Body": "Body",
"Face": "Face",
"Hair": "Hair",
"Custom Hair Colors": "Custom Hair Colors",
"Custom Eye Colors": "Custom Eye Colors",
"Custom Body Colors": "Custom Body Colors",
"AddModsSlider Settings": "AddModsSlider Settings",
"Disable All": "Disable All",
"Enable All": "Enable All",
"Advanced Mode": "Advanced Mode",
"Slots": "Slots",
"Colors": "Colors",
"MuneL": "Chest Size",
"MuneS": "Chest Flatness",
"MuneTare": "Chest Drop",
"RegFat": "Leg Thickness",
"ArmL": "Arm Thickness",
"Hara": "Stomach Size",
"RegMeet": "Leg Definition",
"KubiScl": "Neck Size",
"UdeScl": "Arm Length",
"EyeScl": "Eye Size",
"EyeSclX": "Eye Width",
"EyeSclY": "Eye Height",
"EyePosX": "Eye Seperation",
"EyePosY": "Eye Vertical Position",
"EyeClose": "Eye Closedness",
"EyeBallPosX": "Eyeball Position X",
"EyeBallPosY": "Eyeball Position Y",
"EyeBallSclX": "Eyeball Width",
"EyeBallSclY": "Eyeball Height",
"EarNone": "Ear Type",
"EarElf": "Elf Ear",
"EarRot": "Ear Rotation",
"EarScl": "Ear Size",
"NosePos": "Nose Height",
"NoseScl": "Nose Size",
"FaceShape": "Face Shape",
"FaceShapeSlim": "Face Slimness",
"MayuShapeIn": "Eyebrow Inner Shape",
"MayuShapeOut": "Eyebrow Outter Shape",
"MayuX": "Eyebrow X Position",
"MayuY": "Eyebrow Y Position",
"MayuRot": "Eyebrow Rotation",
"HeadX": "Head Width",
"HeadY": "Head Height",
"DouPer": "Leg Length",
"sintyou": "Height",
"koshi": "Hip Size",
"kata": "Shoulder Width",
"west": "Waist",
"MuneUpDown": "Nipple Height",
"MuneYori": "Breast Direction",
"MuneYawaraka": "Breast Shaking Level",
"MayuThick": "Eyebrow Thickness",
"MayuLong": "Eyebrow Length",
"Yorime": "Eye Direction",
"MabutaUpIn": "Top Eye Shape In",
"MabutaUpIn2": "Top Eye Shape In 2",
"MabutaUpMiddle": "Top Eye Shape Middle",
"MabutaUpOut": "Top Eye Shape Outter",
"MabutaUpOut2": "Top Eye Shape Outter 2",
"MabutaLowIn": "Bottom Eye Shape Inner",
"MabutaLowUpMiddle": "Bottom Eye Shape Middle",
"MabutaLowUpOut": "Bottom Eye Shape Outter",
"body": "Body",
"moza": "Mosaic",
"head": "Face",
"hairf": "Front Hair",
"hairr": "Back Hair",
"hairt": "Hair Extension",
"hairs": "Side Hair",
"hairaho": "Ahoge",
"haircolor": "Hair Color",
"skin": "Skin",
"acctatoo": "Tattoo",
"accnail": "Nails",
"underhair": "Underhair",
"hokuro": "Beauty Mark",
"mayu": "Eyebrow",
"lip": "Lips",
"eye": "Eye",
"eye_hi": "Eye Highlight",
"eye_hi_r": "Eye Highlight Right",
"chikubi": "Nipple",
"chikubicolor": "Nipple Color",
"eyewhite": "Sclera Color",
"nose": "Nose Line",
"facegloss": "Face Shine",
"matsuge_up": "Upper Eyelash",
"matsuge_low": "Lower Eyelash",
"futae": "Eye Folds",
"wear": "Top",
"skirt": "Bottom",
"mizugi": "Swimsuit",
"bra": "Bra",
"panz": "Panties",
"stkg": "Stocking",
"shoes": "Shoes",
"headset": "Headset",
"glove": "Gloves",
"acchead": "Head Accessory",
"accha": "Teeth",
"acchana": "Nose Accessory",
"acckamisub": "Ribbon",
"acckami": "Front Hair Accessory",
"accmimi": "Earrings",
"accnip": "Nipple Accessory",
"acckubi": "Necklace",
"acckubiwa": "Choker",
"accheso": "Belly Button Accessory",
"accude": "Arm Accessory",
"accashi": "Ankle Accessory",
"accsenaka": "Back",
"accshippo": "Tail",
"accanl": "Anal",
"accvag": "Vaginal",
"megane": "Glasses",
"accxxx": "Vaginal Accessory",
"handitem": "Hand Item",
"acchat": "Hat",
"onepiece": "Onepiece",
"set_maidwear": "Maidwear Set",
"set_mywear": "Costume Set",
"set_underwear": "Underwear Set",
"set_body": "Body Type",
"folder_eye": "Eyes Folder",
"folder_mayu": "Eyebrow Folder",
"folder_underhair": "Underhair Folder",
"folder_skin": "Skin Folder",
"folder_eyewhite": "Sclera Folder",
"folder_matsuge_up": "Upper Eyelash Folder",
"folder_matsuge_low": "Lower Eyelash Folder",
"folder_futae": "Eye Folds Folder",
"kousoku_upper": "Arm Restraints",
"kousoku_lower": "Leg Restraints",
"seieki_naka": "Semen Genitals",
"seieki_hara": "Semen Stomach",
"seieki_face": "Semen Face",
"seieki_mune": "Semen Chest",
"seieki_hip": "Semen Hips",
"seieki_ude": "Semen Arms",
"seieki_ashi": "Semen Legs",
"EYE_L": "Left Eye Free Color",
"EYE_R": "Right Eye Free Color",
"HAIR": "Hair Free Color",
"EYE_BROW": "Eyebrow Free Color",
"UNDER_HAIR": "Underhair Free Color",
"SKIN": "Skin Free Color",
"NIPPLE": "Nipple Free Color",
"HAIR_OUTLINE": "Hair Outline Free Color",
"SKIN_OUTLINE": "Skin Outline Free Color",
"EYE_WHITE": "Sclera Free Color",
"MATSUGE_UP": "Upper Eyelash Free Color",
"MATSUGE_LOW": "Lower Eyelash Free Color",
"FUTAE": "Eye Folds Free Color",
"MAX": "Max (Pointless)",
"NONE": "None (Pointless)"
}
21 changes: 10 additions & 11 deletions ChoosyPreset/UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,20 @@ static void GuiWindowControls(int windowID)

scrollPosition = GUILayout.BeginScrollView(scrollPosition);


if (Main.AdvancedMode.Value)
{
ShowAdvancedMode();
}
else
else
{
ShowSimpleMode();
}

SkipMaidVoiceXML = GUILayout.Toggle(SkipMaidVoiceXML, "AddModsSlider Settings");
SkipMaidVoiceXML = GUILayout.Toggle(SkipMaidVoiceXML, Main.Translations["AddModsSlider Settings"]);

GUILayout.EndScrollView();

if (GUILayout.Button("Disable All"))
if (GUILayout.Button(Main.Translations["Disable All"]))
{
var keys = ButtonsMPN.Keys.ToArray();

Expand All @@ -89,7 +88,7 @@ static void GuiWindowControls(int windowID)

SkipMaidVoiceXML = false;
}
if (GUILayout.Button("Enable All"))
if (GUILayout.Button(Main.Translations["Enable All"]))
{
var keys = ButtonsMPN.Keys.ToArray();

Expand All @@ -115,15 +114,15 @@ static void GuiWindowControls(int windowID)
SkipMaidVoiceXML = true;
}

Main.AdvancedMode.Value = GUILayout.Toggle(Main.AdvancedMode.Value, "Advanced Mode");
Main.AdvancedMode.Value = GUILayout.Toggle(Main.AdvancedMode.Value , Main.Translations["Advanced Mode"]);

ChkMouseClick(windowRect);
}
internal static void ShowSimpleMode()
{
foreach (string s in UI.Categories.Keys)
{
SimpleModeToggles[s] = GUILayout.Toggle(SimpleModeToggles[s], s);
SimpleModeToggles[s] = GUILayout.Toggle(SimpleModeToggles[s], Main.Translations[s]);
}
}
internal static void ShowAdvancedMode()
Expand All @@ -132,27 +131,27 @@ internal static void ShowAdvancedMode()

GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Label("Slots");
GUILayout.Label(Main.Translations["Slots"]);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

foreach (string s in Enum.GetNames(typeof(MPN)))
{
ButtonsMPN[s] = GUILayout.Toggle(ButtonsMPN[s], s);
ButtonsMPN[s] = GUILayout.Toggle(ButtonsMPN[s], Main.Translations[s]);
}

GUILayout.EndVertical();
GUILayout.BeginVertical();

GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Label("Colors");
GUILayout.Label(Main.Translations["Colors"]);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

foreach (string s in Enum.GetNames(typeof(MaidParts.PARTS_COLOR)))
{
ColorParts[(MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), s)] = GUILayout.Toggle(ColorParts[(MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), s)], s);
ColorParts[(MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), s)] = GUILayout.Toggle(ColorParts[(MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), s)], Main.Translations[s]);
}

GUILayout.EndVertical();
Expand Down

0 comments on commit 8a42a60

Please sign in to comment.