diff --git a/KK_EyeShaking/KK_EyeShaking.cs b/KK_EyeShaking/KK_EyeShaking.cs new file mode 100644 index 00000000..c1ba1f8f --- /dev/null +++ b/KK_EyeShaking/KK_EyeShaking.cs @@ -0,0 +1,96 @@ +using BepInEx; +using Harmony; +using KKAPI; +using KKAPI.Chara; +using System.ComponentModel; +/// +/// Adds shaking to a character's eye highlights when she is a virgin in an H scene +/// +namespace KK_EyeShaking +{ + [BepInPlugin(GUID, PluginName, Version)] + public class KK_EyeShaking : BaseUnityPlugin + { + public const string GUID = "com.deathweasel.bepinex.eyeshaking"; + public const string PluginName = "Eye Shaking"; + public const string PluginNameInternal = "KK_EyeShaking"; + public const string Version = "1.0"; + [DisplayName("Enabled")] + [Category("Config")] + [Description("When enabled, virgins in H scenes will appear to have shaking eye highlights")] + public static ConfigWrapper Enabled { get; private set; } + + void Main() + { + var harmony = HarmonyInstance.Create(GUID); + harmony.PatchAll(typeof(KK_EyeShaking)); + CharacterApi.RegisterExtraBehaviour(GUID); + Enabled = new ConfigWrapper("Enabled", PluginNameInternal, true); + } + + private static EyeShakingController GetController(ChaControl character) => character?.gameObject?.GetComponent(); + + public class EyeShakingController : CharaCustomFunctionController + { + internal bool IsVirgin { get; set; } = true; + internal bool IsVirginOrg { get; set; } = true; + internal bool IsInit { get; set; } = false; + + protected override void OnCardBeingSaved(GameMode currentGameMode) { } + protected override void OnReload(GameMode currentGameMode) { } + + internal void HSceneStart(bool virgin) + { + IsVirgin = virgin; + IsVirginOrg = virgin; + IsInit = true; + } + + internal void HSceneEnd() + { + ChaControl.ChangeEyesShaking(false); + IsInit = false; + } + + internal void OnInsert() => IsVirgin = false; + internal void AddOrgasm() => IsVirginOrg = false; + + protected override void Update() + { + if (Enabled.Value && IsInit && (IsVirgin || IsVirginOrg)) + ChaControl.ChangeEyesShaking(true); + } + } + /// + /// Insert vaginal + /// + [HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuKokanPlay))] + public static void AddSonyuKokanPlay(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).OnInsert(); + /// + /// Insert anal + /// + [HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuAnalPlay))] + public static void AddSonyuAnalPlay(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).OnInsert(); + /// + /// Something that happens at the end of H scene loading, good enough place to hook + /// + [HarmonyPrefix, HarmonyPatch(typeof(HSceneProc), "MapSameObjectDisable")] + public static void MapSameObjectDisable(HSceneProc __instance) + { + SaveData.Heroine heroine = __instance.flags.lstHeroine[0]; + GetController(heroine.chaCtrl).HSceneStart(heroine.isVirgin && heroine.isAnalVirgin); + } + + [HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuOrg))] + public static void AddSonyuOrg(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).AddOrgasm(); + [HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuSame))] + public static void AddSonyuSame(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).AddOrgasm(); + [HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuAnalOrg))] + public static void AddSonyuAnalOrg(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).AddOrgasm(); + [HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuAnalSame))] + public static void AddSonyuAnalSame(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).AddOrgasm(); + + [HarmonyPrefix, HarmonyPatch(typeof(HSceneProc), "EndProc")] + public static void EndProc(HSceneProc __instance) => GetController(__instance.flags.lstHeroine[0].chaCtrl).HSceneEnd(); + } +} \ No newline at end of file diff --git a/KK_EyeShaking/KK_EyeShaking.csproj b/KK_EyeShaking/KK_EyeShaking.csproj new file mode 100644 index 00000000..522143c0 --- /dev/null +++ b/KK_EyeShaking/KK_EyeShaking.csproj @@ -0,0 +1,72 @@ + + + + + Debug + AnyCPU + {7B514B4E-A0BC-4DA9-B2A8-0B72515E8033} + Library + Properties + KK_EyeShaking + KK_EyeShaking + v3.5 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + embedded + true + ..\bin\ + TRACE + prompt + 4 + true + + + + ..\lib\0Harmony.dll + False + + + ..\lib\Assembly-CSharp.dll + False + + + ..\lib\BepInEx.dll + False + + + ..\lib\KKAPI.dll + False + + + + + + + + + ..\lib\UnityEngine.dll + False + + + + + + + + + if exist C:\Illusion\Koikatu\BepInEx ( +copy /y $(TargetPath) C:\illusion\Koikatu\BepInEx\$(TargetFileName) +) + + \ No newline at end of file diff --git a/KK_EyeShaking/Properties/AssemblyInfo.cs b/KK_EyeShaking/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..fc73afd6 --- /dev/null +++ b/KK_EyeShaking/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("KK_EyeShaking")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("KK_EyeShaking")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("7b514b4e-a0bc-4da9-b2a8-0b72515e8033")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion(KK_EyeShaking.KK_EyeShaking.Version)] +[assembly: AssemblyFileVersion(KK_EyeShaking.KK_EyeShaking.Version)] diff --git a/KK_Plugins.sln b/KK_Plugins.sln index b4979440..2b3026a5 100644 --- a/KK_Plugins.sln +++ b/KK_Plugins.sln @@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KK_Colliders", "KK_Collider EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KK_FreeHRandom", "KK_FreeHRandom\KK_FreeHRandom.csproj", "{A59CF955-A07B-4EF1-A9B5-169E0CE750DA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KK_EyeShaking", "KK_EyeShaking\KK_EyeShaking.csproj", "{7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -123,6 +125,10 @@ Global {A59CF955-A07B-4EF1-A9B5-169E0CE750DA}.Debug|Any CPU.Build.0 = Debug|Any CPU {A59CF955-A07B-4EF1-A9B5-169E0CE750DA}.Release|Any CPU.ActiveCfg = Release|Any CPU {A59CF955-A07B-4EF1-A9B5-169E0CE750DA}.Release|Any CPU.Build.0 = Release|Any CPU + {7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE