From 5ec2dfc49ad7c1396043769c5774ed3264eb50f1 Mon Sep 17 00:00:00 2001 From: ManlyMarco Date: Fri, 28 May 2021 23:33:11 +0200 Subject: [PATCH] Added initial KKS port --- src/KKAPI.sln | 9 + src/KKSAPI/KKSAPI.csproj | 176 ++++++++++++++++++ src/KKSAPI/KoikatuAPI.cs | 62 ++++++ src/KKSAPI/Maker/AccessoryCopyEventArgs.cs | 35 ++++ src/KKSAPI/Properties/AssemblyInfo.cs | 33 ++++ src/KKSAPI/packages.config | 18 ++ .../Studio/UI/CurrentStateCategoryDropdown.cs | 6 +- .../Studio/UI/SceneEffectsCategory.cs | 4 +- .../Studio/UI/SceneEffectsCategorySlider.cs | 2 +- .../Studio/UI/SceneEffectsCategoryToggle.cs | 2 +- .../Chara/CharaCustomFunctionController.cs | 10 +- .../CharacterApi.ControllerRegistration.cs | 2 +- src/Shared.Core/Chara/CharacterApi.cs | 2 +- src/Shared.Core/Maker/MakerAPI.cs | 20 +- .../Maker/UI/BaseEditableGuiEntry.cs | 2 +- src/Shared.Core/Utilities/Extensions.cs | 2 +- src/Shared.Core/Utilities/HSceneUtils.cs | 2 +- src/Shared.Core/Utilities/IMGUIUtils.cs | 2 +- .../Utilities/ObservableExtensions.cs | 4 +- src/Shared.KKalike/CardAuthorData.cs | 2 +- .../Chara/CharacterApi.Hooks.KK.cs | 4 +- .../Maker/AccessoriesApi.Hooks.KK.cs | 2 +- src/Shared.KKalike/Maker/AccessoriesApi.KK.cs | 4 +- .../Maker/AccessoryControlWrapper.KK.cs | 8 +- src/Shared.KKalike/Maker/MakerCardSave.cs | 2 +- src/Shared.KKalike/Maker/MakerConstants.KK.cs | 4 +- .../Maker/MakerInterfaceCreator.KK.cs | 4 +- 27 files changed, 382 insertions(+), 41 deletions(-) create mode 100644 src/KKSAPI/KKSAPI.csproj create mode 100644 src/KKSAPI/KoikatuAPI.cs create mode 100644 src/KKSAPI/Maker/AccessoryCopyEventArgs.cs create mode 100644 src/KKSAPI/Properties/AssemblyInfo.cs create mode 100644 src/KKSAPI/packages.config diff --git a/src/KKAPI.sln b/src/KKAPI.sln index 9a3cbe7..14dc312 100644 --- a/src/KKAPI.sln +++ b/src/KKAPI.sln @@ -26,6 +26,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KKSAPI", "KKSAPI\KKSAPI.csproj", "{C275954F-05F9-4AFF-8290-E8190B54A602}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution Shared.KKalike\Shared.KKalike.projitems*{16441a78-1945-4d7c-b3f4-333bab848211}*SharedItemsImports = 13 @@ -42,6 +44,9 @@ Global Shared.CharaStudio\Shared.CharaStudio.projitems*{b0aa6926-d9a2-40b8-8100-cceb9a17ff10}*SharedItemsImports = 4 Shared.Core\Shared.Core.projitems*{bd697c6c-a7d7-4307-a227-ccafc95c8744}*SharedItemsImports = 13 Shared.AIalike\Shared.AIalike.projitems*{bed55866-7531-4cc4-ba58-f406d901d3e8}*SharedItemsImports = 13 + Shared.CharaStudio\Shared.CharaStudio.projitems*{c275954f-05f9-4aff-8290-e8190b54a602}*SharedItemsImports = 4 + Shared.Core\Shared.Core.projitems*{c275954f-05f9-4aff-8290-e8190b54a602}*SharedItemsImports = 4 + Shared.KKalike\Shared.KKalike.projitems*{c275954f-05f9-4aff-8290-e8190b54a602}*SharedItemsImports = 4 Shared.Core\Shared.Core.projitems*{f4928b3c-e2b0-4aec-9fbc-327bb2a0e6bb}*SharedItemsImports = 4 Shared.KKalike\Shared.KKalike.projitems*{f4928b3c-e2b0-4aec-9fbc-327bb2a0e6bb}*SharedItemsImports = 4 EndGlobalSection @@ -70,6 +75,10 @@ Global {32333D00-1E55-4714-AD80-291B514A4F6E}.Debug|Any CPU.Build.0 = Debug|Any CPU {32333D00-1E55-4714-AD80-291B514A4F6E}.Release|Any CPU.ActiveCfg = Release|Any CPU {32333D00-1E55-4714-AD80-291B514A4F6E}.Release|Any CPU.Build.0 = Release|Any CPU + {C275954F-05F9-4AFF-8290-E8190B54A602}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C275954F-05F9-4AFF-8290-E8190B54A602}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C275954F-05F9-4AFF-8290-E8190B54A602}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C275954F-05F9-4AFF-8290-E8190B54A602}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/KKSAPI/KKSAPI.csproj b/src/KKSAPI/KKSAPI.csproj new file mode 100644 index 0000000..0b418bf --- /dev/null +++ b/src/KKSAPI/KKSAPI.csproj @@ -0,0 +1,176 @@ + + + + + Debug + AnyCPU + {C275954F-05F9-4AFF-8290-E8190B54A602} + Library + KKAPI + KKSAPI + v4.6 + 512 + false + true + + + + + AnyCPU + true + embedded + false + ..\..\bin\ + TRACE;DEBUG;KKS + prompt + 4 + true + ..\..\bin\KKSAPI.xml + + + AnyCPU + embedded + true + ..\..\bin\ + TRACE;KKS + prompt + 4 + true + ..\..\bin\KKSAPI.xml + true + + + + + + + ..\packages\IllusionLibs.BepInEx.Harmony.2.3.2\lib\net35\0Harmony.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.2021.5.28\lib\net46\Assembly-CSharp.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.Assembly-CSharp-firstpass.2021.5.28\lib\net46\Assembly-CSharp-firstpass.dll + False + + + ..\packages\IllusionLibs.BepInEx.5.4.8\lib\net35\BepInEx.dll + False + + + ..\packages\IllusionLibs.BepInEx.Harmony.2.3.2\lib\net35\BepInEx.Harmony.dll + False + + + ..\..\..\BepisPlugins\bin\BepInEx\plugins\KKS_BepisPlugins\KKS_ExtensibleSaveFormat.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\lib\net46\Sirenix.Serialization.dll + False + + + + + + + + + + + ..\packages\IllusionLibs.KoikatsuSunshine.UniRx.2021.5.28\lib\net46\UniRx.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.Unity.TextMeshPro.2019.4.9\lib\net46\Unity.TextMeshPro.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\lib\net46\UnityEngine.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.AudioModule.2019.4.9\lib\net46\UnityEngine.AudioModule.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\lib\net46\UnityEngine.CoreModule.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.ImageConversionModule.2019.4.9\lib\net46\UnityEngine.ImageConversionModule.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.IMGUIModule.2019.4.9\lib\net46\UnityEngine.IMGUIModule.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.InputLegacyModule.2019.4.9\lib\net46\UnityEngine.InputLegacyModule.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.TextRenderingModule.2019.4.9\lib\net46\UnityEngine.TextRenderingModule.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.UI.2019.4.9\lib\net46\UnityEngine.UI.dll + False + + + ..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.UIModule.2019.4.9\lib\net46\UnityEngine.UIModule.dll + False + + + ..\packages\IllusionLibs.XUnity.AutoTranslator.Plugin.Core.4.16.0\lib\net46\XUnity.AutoTranslator.Plugin.Core.dll + False + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/KKSAPI/KoikatuAPI.cs b/src/KKSAPI/KoikatuAPI.cs new file mode 100644 index 0000000..de3ff2e --- /dev/null +++ b/src/KKSAPI/KoikatuAPI.cs @@ -0,0 +1,62 @@ +using System; +using BepInEx; +using HarmonyLib; +using KKAPI.Chara; +using KKAPI.MainGame; +using KKAPI.Maker; +using KKAPI.Studio; +using Manager; +using UnityEngine; + +namespace KKAPI +{ + [BepInPlugin(GUID, "Modding API", VersionConst)] + public partial class KoikatuAPI : BaseUnityPlugin + { + private void Awake() + { + BaseAwake(); + + var insideStudio = Application.productName == "CharaStudio"; + MakerAPI.Init(insideStudio); + StudioAPI.Init(insideStudio); + CharacterApi.Init(); + //todo GameAPI.Init(insideStudio); + } + + private void Start() + { + // Needs to be called after moreaccessories has a chance to load + AccessoriesApi.Init(); + } + + /// + /// Get current game mode. + /// + public static GameMode GetCurrentGameMode() + { + if (StudioAPI.InsideStudio) return GameMode.Studio; + if (MakerAPI.InsideMaker) return GameMode.Maker; + if (Game.initialized) return GameMode.MainGame; + return GameMode.Unknown; + } + + /// + /// Get current version of the game. + /// + public static Version GetGameVersion() + { + return Game.Version; + } + + /// + /// Check if the game is the Steam release instead of the original Japanese release. + /// It's best to not rely on this and instead make the same code work in both versions (if possible). + /// + [Obsolete("Not implemented yet, always false")] + public static bool IsSteamRelease() + { + return false; //typeof(DownloadScene).GetProperty("isSteam", AccessTools.all) != null; //todo + } + } +} diff --git a/src/KKSAPI/Maker/AccessoryCopyEventArgs.cs b/src/KKSAPI/Maker/AccessoryCopyEventArgs.cs new file mode 100644 index 0000000..9234a4a --- /dev/null +++ b/src/KKSAPI/Maker/AccessoryCopyEventArgs.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; + +namespace KKAPI.Maker +{ + /// + /// Event args for accessory copy events. + /// + public class AccessoryCopyEventArgs : EventArgs + { + /// + public AccessoryCopyEventArgs(IEnumerable copiedSlotIndexes, + ChaFileDefine.CoordinateType copySource, ChaFileDefine.CoordinateType copyDestination) + { + CopiedSlotIndexes = copiedSlotIndexes ?? throw new ArgumentNullException(nameof(copiedSlotIndexes)); + CopySource = copySource; + CopyDestination = copyDestination; + } + + /// + /// Indexes of accessories that were selected to be copied. + /// + public IEnumerable CopiedSlotIndexes { get; } + + /// + /// Coordinate the accessories are copied from. + /// + public ChaFileDefine.CoordinateType CopySource { get; } + + /// + /// Coordinate the accessories are copied into. + /// + public ChaFileDefine.CoordinateType CopyDestination { get; } + } +} diff --git a/src/KKSAPI/Properties/AssemblyInfo.cs b/src/KKSAPI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c684c2f --- /dev/null +++ b/src/KKSAPI/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.InteropServices; +using KKAPI; + +// 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("KKSAPI")] +[assembly: AssemblyDescription("Modding API for Koikatsu Sunshine")] +[assembly: AssemblyCompany("ManlyMarco")] +[assembly: AssemblyProduct("KKSAPI")] +[assembly: AssemblyCopyright("Copyright © 2021")] + +// 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("74c2db86-55bb-47b4-9805-51b5b992ef35")] + +// 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: AssemblyFileVersion(KoikatuAPI.VersionConst)] +[assembly: AssemblyVersion(KoikatuAPI.VersionConst)] \ No newline at end of file diff --git a/src/KKSAPI/packages.config b/src/KKSAPI/packages.config new file mode 100644 index 0000000..f840bcf --- /dev/null +++ b/src/KKSAPI/packages.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Shared.CharaStudio/Studio/UI/CurrentStateCategoryDropdown.cs b/src/Shared.CharaStudio/Studio/UI/CurrentStateCategoryDropdown.cs index f21f1ab..0f9d14d 100644 --- a/src/Shared.CharaStudio/Studio/UI/CurrentStateCategoryDropdown.cs +++ b/src/Shared.CharaStudio/Studio/UI/CurrentStateCategoryDropdown.cs @@ -1,4 +1,4 @@ -#if KK || AI || HS2 +#if KK || KKS || AI || HS2 #define TMP #endif @@ -20,7 +20,7 @@ public class CurrentStateCategoryDropdown : BaseCurrentStateEditableGuiEntry().Where(t => t.name.StartsWith("Toggle"))) Object.DestroyImmediate(tr.gameObject); diff --git a/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategory.cs b/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategory.cs index 868dd28..eca62b3 100644 --- a/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategory.cs +++ b/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategory.cs @@ -1,4 +1,4 @@ -#if KK || AI || HS2 +#if KK || KKS || AI || HS2 #define TMP #endif @@ -40,7 +40,7 @@ private static void Initialize() const string headerSourcePath = "Screen Effect/Viewport/Content/Image Depth of Field"; const string contentSourcePath = "Screen Effect/Viewport/Content/Depth of Field"; -#if KK +#if KK || KKS const string labelSourcePath = "Screen Effect/Viewport/Content/Depth of Field/TextMeshPro Draw"; const string toggleSourcePath = "Screen Effect/Viewport/Content/Depth of Field/Toggle Draw"; const string sliderSourcePath = "Screen Effect/Viewport/Content/Depth of Field/Slider Focal Size"; diff --git a/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategorySlider.cs b/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategorySlider.cs index 55be58e..6be6195 100644 --- a/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategorySlider.cs +++ b/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategorySlider.cs @@ -1,4 +1,4 @@ -#if KK || AI || HS2 +#if KK || KKS || AI || HS2 #define TMP #endif diff --git a/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategoryToggle.cs b/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategoryToggle.cs index d1bf8f9..9d9ebc8 100644 --- a/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategoryToggle.cs +++ b/src/Shared.CharaStudio/Studio/UI/SceneEffectsCategoryToggle.cs @@ -1,4 +1,4 @@ -#if KK || AI || HS2 +#if KK || KKS || AI || HS2 #define TMP #endif diff --git a/src/Shared.Core/Chara/CharaCustomFunctionController.cs b/src/Shared.Core/Chara/CharaCustomFunctionController.cs index 9ef81bd..8b2d0f5 100644 --- a/src/Shared.Core/Chara/CharaCustomFunctionController.cs +++ b/src/Shared.Core/Chara/CharaCustomFunctionController.cs @@ -2,7 +2,7 @@ using KKAPI.Utilities; using System; using System.Collections; -#if KK +#if KK || KKS using KKAPI.MainGame; using UniRx; #elif AI || HS2 @@ -82,7 +82,7 @@ public void SetExtendedData(PluginData data) if (ExtendedDataId == null) throw new ArgumentException(nameof(ExtendedDataId)); ExtendedSave.SetExtendedDataById(ChaFileControl, ExtendedDataId, data); -#if KK +#if KK //todo || KKS // Needed for propagating changes back to the original charFile since they don't get copied back. var heroine = ChaControl.GetHeroine(); if (heroine != null) @@ -284,7 +284,7 @@ internal void OnCoordinateBeingLoadedInternal(ChaFileCoordinate coordinate) } } -#if KK +#if KK || KKS /// /// Currently selected clothes on this character. Can subscribe to listen for changes. /// @@ -304,7 +304,7 @@ protected virtual void Update() /// protected virtual void OnDestroy() { -#if KK +#if KK || KKS CurrentCoordinate.Dispose(); #endif } @@ -325,7 +325,7 @@ protected virtual void OnEnable() protected virtual void Awake() { ChaControl = GetComponent(); -#if KK +#if KK || KKS CurrentCoordinate = new BehaviorSubject((ChaFileDefine.CoordinateType)ChaControl.fileStatus.coordinateType); #endif } diff --git a/src/Shared.Core/Chara/CharacterApi.ControllerRegistration.cs b/src/Shared.Core/Chara/CharacterApi.ControllerRegistration.cs index 605b3c4..e477275 100644 --- a/src/Shared.Core/Chara/CharacterApi.ControllerRegistration.cs +++ b/src/Shared.Core/Chara/CharacterApi.ControllerRegistration.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -#if KK || EC +#if KK || KKS || EC using UniRx; #elif AI || HS2 using AIChara; diff --git a/src/Shared.Core/Chara/CharacterApi.cs b/src/Shared.Core/Chara/CharacterApi.cs index 66e4655..20321ab 100644 --- a/src/Shared.Core/Chara/CharacterApi.cs +++ b/src/Shared.Core/Chara/CharacterApi.cs @@ -240,7 +240,7 @@ private static void CreateOrAddBehaviours(ChaControl target) } } -#if KK +#if KK || KKS var controllers = target.GetComponents(); target.UpdateAsObservable().Subscribe( _ => diff --git a/src/Shared.Core/Maker/MakerAPI.cs b/src/Shared.Core/Maker/MakerAPI.cs index b1740a2..a78817e 100644 --- a/src/Shared.Core/Maker/MakerAPI.cs +++ b/src/Shared.Core/Maker/MakerAPI.cs @@ -4,7 +4,7 @@ using KKAPI.Maker.UI; using KKAPI.Maker.UI.Sidebar; using UnityEngine; -#if KK || EC +#if KK || KKS || EC using ChaCustom; #elif AI || HS2 using CharaCustom; @@ -77,7 +77,7 @@ internal static void AddSubCategory(MakerCategory category) /// 0 is male, 1 is female /// public static int GetMakerSex() -#if KK || EC +#if KK || KKS || EC => GetMakerBase().modeSex; #elif AI || HS2 => CharaCustom.CharaCustom.modeSex; @@ -100,7 +100,15 @@ public static int GetMakerSex() /// Check if the maker was loaded from within classroom select screen in main game /// public static bool IsInsideClassMaker() => InsideMaker && Manager.Scene.Instance.NowSceneNames.Contains("ClassRoomSelect"); +#elif KKS + /// + /// Check if the maker was loaded from within classroom select screen in main game + /// + [Obsolete("Not implemented, always false")] + public static bool IsInsideClassMaker() => false; +#endif +#if KK || KKS /// /// Currently selected maker coordinate /// @@ -228,7 +236,7 @@ private static void OnCreateCustomControls() { MakerInterfaceCreator.CreateCustomControls(); -#if KK +#if KK || KKS // Fix some plugins failing to update interface and losing state if (IsInsideClassMaker()) { @@ -413,7 +421,7 @@ public static bool IsInterfaceVisible() if (GetIsNowLoadingFade()) return false; -#if KK || EC +#if KK || KKS || EC // Check if UI is hidden (by pressing space) if (mbase.customCtrl.hideFrontUI) return false; @@ -430,7 +438,7 @@ public static bool IsInterfaceVisible() private static string GetAddSceneName() { -#if HS2 +#if HS2 || KKS return Manager.Scene.AddSceneName; #else return Manager.Scene.Instance.AddSceneName; @@ -439,7 +447,7 @@ private static string GetAddSceneName() private static bool GetIsNowLoadingFade() { -#if HS2 +#if HS2 || KKS return Manager.Scene.IsNowLoadingFade; #else return Manager.Scene.Instance.IsNowLoadingFade; diff --git a/src/Shared.Core/Maker/UI/BaseEditableGuiEntry.cs b/src/Shared.Core/Maker/UI/BaseEditableGuiEntry.cs index be8a26b..0c4f7ab 100644 --- a/src/Shared.Core/Maker/UI/BaseEditableGuiEntry.cs +++ b/src/Shared.Core/Maker/UI/BaseEditableGuiEntry.cs @@ -1,4 +1,4 @@ -#if AI || HS2 +#if AI || HS2 || KKS using System; #endif using BepInEx; diff --git a/src/Shared.Core/Utilities/Extensions.cs b/src/Shared.Core/Utilities/Extensions.cs index 22aca5e..52bdf1b 100644 --- a/src/Shared.Core/Utilities/Extensions.cs +++ b/src/Shared.Core/Utilities/Extensions.cs @@ -146,7 +146,7 @@ public static bool IsDestroyed(this UnityEngine.Object obj) return !ReferenceEquals(obj, null) && !obj; } -#if KK||EC +#if KK || KKS||EC /// /// Get value of the aaWeightsBody field /// diff --git a/src/Shared.Core/Utilities/HSceneUtils.cs b/src/Shared.Core/Utilities/HSceneUtils.cs index a97e36a..6b184f4 100644 --- a/src/Shared.Core/Utilities/HSceneUtils.cs +++ b/src/Shared.Core/Utilities/HSceneUtils.cs @@ -7,7 +7,7 @@ namespace KKAPI.Utilities /// public static class HSceneUtils { -#if KK +#if KK || KKS /// /// Get the heroine that is currently in leading position in the h scene. /// In 3P returns the heroine the cum options affect. Outside of 3P it gets the single heroine. diff --git a/src/Shared.Core/Utilities/IMGUIUtils.cs b/src/Shared.Core/Utilities/IMGUIUtils.cs index f05da53..9079a14 100644 --- a/src/Shared.Core/Utilities/IMGUIUtils.cs +++ b/src/Shared.Core/Utilities/IMGUIUtils.cs @@ -24,7 +24,7 @@ public static void DrawSolidBox(Rect boxRect) if (SolidBoxTex == null) { var windowBackground = new Texture2D(1, 1, TextureFormat.ARGB32, false); -#if KK || EC // Take the color correction filter into account +#if KK || KKS || EC // Take the color correction filter into account windowBackground.SetPixel(0, 0, new Color(0.84f, 0.84f, 0.84f)); #else windowBackground.SetPixel(0, 0, new Color(0.4f, 0.4f, 0.4f)); diff --git a/src/Shared.Core/Utilities/ObservableExtensions.cs b/src/Shared.Core/Utilities/ObservableExtensions.cs index c5d11b0..f4b1593 100644 --- a/src/Shared.Core/Utilities/ObservableExtensions.cs +++ b/src/Shared.Core/Utilities/ObservableExtensions.cs @@ -1,4 +1,4 @@ -#if HS2 || AI +#if HS2 || AI || KKS using System; #endif using UniRx; @@ -42,7 +42,7 @@ public IObservable OnGUIAsObservable() } /// - protected override void RaiseOnCompletedOnDestroy() + public override void RaiseOnCompletedOnDestroy() { _onGui?.OnCompleted(); } diff --git a/src/Shared.KKalike/CardAuthorData.cs b/src/Shared.KKalike/CardAuthorData.cs index a84c110..ec8f9a4 100644 --- a/src/Shared.KKalike/CardAuthorData.cs +++ b/src/Shared.KKalike/CardAuthorData.cs @@ -60,7 +60,7 @@ private static string FilenameModifier(string currentCardName) var param = MakerAPI.GetCharacterControl().fileParam; var charaName = param.fullname.Trim(); -#if KK +#if KK || KKS if (charaName.Length == 0) charaName = param.nickname.Trim(); #endif var addStr = $"_{charaName}"; diff --git a/src/Shared.KKalike/Chara/CharacterApi.Hooks.KK.cs b/src/Shared.KKalike/Chara/CharacterApi.Hooks.KK.cs index 3f3b405..2433da4 100644 --- a/src/Shared.KKalike/Chara/CharacterApi.Hooks.KK.cs +++ b/src/Shared.KKalike/Chara/CharacterApi.Hooks.KK.cs @@ -29,7 +29,7 @@ public static void InitHooks() var target3 = typeof(ChaFile).GetMethods().Single(info => info.Name == nameof(ChaFile.CopyAll)); i.Patch(target3, null, new HarmonyMethod(typeof(Hooks), nameof(ChaFile_CopyChaFileHook))); -#if KK +#if KK //todo || KKS // Find the ADV character Start lambda to hook for extended data copying. The inner type names change between versions so try them all. var transpiler = new HarmonyMethod(typeof(Hooks), nameof(FixEventSceneLambdaTpl)); var lambdaOuter = AccessTools.Inner(typeof(FixEventSceneEx), "c__AnonStorey1"); @@ -101,7 +101,7 @@ private static void OnCopyChaFile(ChaFile destination, ChaFile source) } } -#if KK +#if KK || KKS /// /// Fix extended data being lost in ADV by copying it over when chara data is copied /// diff --git a/src/Shared.KKalike/Maker/AccessoriesApi.Hooks.KK.cs b/src/Shared.KKalike/Maker/AccessoriesApi.Hooks.KK.cs index 635e487..4c74e2f 100644 --- a/src/Shared.KKalike/Maker/AccessoriesApi.Hooks.KK.cs +++ b/src/Shared.KKalike/Maker/AccessoriesApi.Hooks.KK.cs @@ -33,7 +33,7 @@ public static void UpdateSelectAccessoryKindPostfix(CvsAccessory __instance, ref OnAccessoryKindChanged(__instance, (int)__instance.slotNo); } -#if KK +#if KK || KKS [HarmonyPostfix] [HarmonyPatch(typeof(CvsAccessoryCopy), "CopyAcs")] public static void CopyCopyAcsPostfix(CvsAccessoryCopy __instance) diff --git a/src/Shared.KKalike/Maker/AccessoriesApi.KK.cs b/src/Shared.KKalike/Maker/AccessoriesApi.KK.cs index 36064d7..e4b3758 100644 --- a/src/Shared.KKalike/Maker/AccessoriesApi.KK.cs +++ b/src/Shared.KKalike/Maker/AccessoriesApi.KK.cs @@ -64,7 +64,7 @@ public static partial class AccessoriesApi /// public static event EventHandler AccessoryKindChanged; -#if KK +#if KK || KKS /// /// Fires after user copies accessories between coordinates by using the Copy window. /// @@ -366,7 +366,7 @@ private static void OnAccessoryKindChanged(object source, int slotNo) } } -#if KK +#if KK || KKS private static void OnCopyAcs(CvsAccessoryCopy instance) { if (AccessoriesCopied == null && !KoikatuAPI.EnableDebugLogging) return; diff --git a/src/Shared.KKalike/Maker/AccessoryControlWrapper.KK.cs b/src/Shared.KKalike/Maker/AccessoryControlWrapper.KK.cs index f23232d..7676eac 100644 --- a/src/Shared.KKalike/Maker/AccessoryControlWrapper.KK.cs +++ b/src/Shared.KKalike/Maker/AccessoryControlWrapper.KK.cs @@ -28,7 +28,7 @@ public AccessoryControlWrapper(T control) AccessoriesApi.SelectedMakerAccSlotChanged += OnSelectedMakerAccSlotChanged; AccessoriesApi.AccessoryKindChanged += OnAccessoryKindChanged; -#if KK +#if KK || KKS AccessoriesApi.AccessoriesCopied += OnAccessoriesCopied; #endif AccessoriesApi.AccessoryTransferred += OnAccessoryTransferred; @@ -40,7 +40,7 @@ private void OnAccessoryTransferred(object sender, AccessoryTransferEventArgs e) AccessoryTransferred?.Invoke(sender, e); } -#if KK +#if KK || KKS private void OnAccessoriesCopied(object sender, AccessoryCopyEventArgs e) { if (CheckDisposed()) return; @@ -163,7 +163,7 @@ public void SetSelectedValue(TVal value, bool fireEvents) /// public event EventHandler AccessoryKindChanged; -#if KK +#if KK || KKS /// /// Fires after user copies accessories between coordinates by using the Copy window. /// @@ -206,7 +206,7 @@ private bool CheckDisposed() AccessoriesApi.AccessoryKindChanged -= OnAccessoryKindChanged; AccessoriesApi.AccessoryTransferred -= OnAccessoryTransferred; -#if KK +#if KK || KKS AccessoriesCopied = null; AccessoriesApi.AccessoriesCopied -= OnAccessoriesCopied; #endif diff --git a/src/Shared.KKalike/Maker/MakerCardSave.cs b/src/Shared.KKalike/Maker/MakerCardSave.cs index 154740e..f6c2953 100644 --- a/src/Shared.KKalike/Maker/MakerCardSave.cs +++ b/src/Shared.KKalike/Maker/MakerCardSave.cs @@ -96,7 +96,7 @@ private static bool CardSavePatch(CustomControl __instance) var folder = UserData.Path + (isMale ? "chara/male/" : "chara/female/"); var fileName = __instance.saveNew ? -#if KK +#if KK || KKS $"Koikatu_{(isMale ? "M" : "F")}_{DateTime.Now:yyyyMMddHHmmssfff}" #elif EC $"Emocre_{(isMale ? "M" : "F")}_{DateTime.Now:yyyyMMddHHmmssfff}" diff --git a/src/Shared.KKalike/Maker/MakerConstants.KK.cs b/src/Shared.KKalike/Maker/MakerConstants.KK.cs index 751ca21..91a04bb 100644 --- a/src/Shared.KKalike/Maker/MakerConstants.KK.cs +++ b/src/Shared.KKalike/Maker/MakerConstants.KK.cs @@ -55,7 +55,7 @@ public static class MakerConstants new MakerCategory("03_ClothesTop", "tglGloves", 50), new MakerCategory("03_ClothesTop", "tglPanst", 60), new MakerCategory("03_ClothesTop", "tglSocks", 70), -#if KK +#if KK || KKS new MakerCategory("03_ClothesTop", "tglInnerShoes", 80), new MakerCategory("03_ClothesTop", "tglOuterShoes", 90), #elif EC @@ -155,7 +155,7 @@ public static class Clothes public static MakerCategory Gloves => GetBuiltInCategory("03_ClothesTop", "tglGloves"); public static MakerCategory Panst => GetBuiltInCategory("03_ClothesTop", "tglPanst"); public static MakerCategory Socks => GetBuiltInCategory("03_ClothesTop", "tglSocks"); -#if KK +#if KK || KKS public static MakerCategory InnerShoes => GetBuiltInCategory("03_ClothesTop", "tglInnerShoes"); public static MakerCategory OuterShoes => GetBuiltInCategory("03_ClothesTop", "tglOuterShoes"); #elif EC diff --git a/src/Shared.KKalike/Maker/MakerInterfaceCreator.KK.cs b/src/Shared.KKalike/Maker/MakerInterfaceCreator.KK.cs index ba8c07a..f6d014e 100644 --- a/src/Shared.KKalike/Maker/MakerInterfaceCreator.KK.cs +++ b/src/Shared.KKalike/Maker/MakerInterfaceCreator.KK.cs @@ -267,7 +267,7 @@ private static void CreateCustomAccessoryWindowControls() } } CreateCustomControlsInSubCategory(slotTransform, _accessoryWindowEntries); -#if KK +#if KK || KKS var listParent = slotTransform.Cast().Where(x => x.name.EndsWith("Top")).First(); var elements = new List(); foreach (Transform t in listParent) @@ -314,7 +314,7 @@ private static void CreateCustomAccessoryWindowControls() internal static void OnMakerAccSlotAdded(Transform newSlotTransform) { // Necessary because MoreAccessories copies existing slot, so controls get copied but with no events hooked up -#if KK +#if KK || KKS //KeelsChildNeglect(newSlotTransform, 0); //used to print children paths in case it's needed in the future, like horizontal support or something if (!MakerAPI.InsideAndLoaded) {