Skip to content

Commit

Permalink
SCOLB: feat: Add compatibility with AdditionalFKNodes v1.4.4
Browse files Browse the repository at this point in the history
Currently there is no AdditionalFKNodes for KKS.
This update is to keep it consistent with the KK version.
  • Loading branch information
jim60105 committed Sep 30, 2023
1 parent dc7df58 commit d9adc39
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions StudioCharaOnlyLoadBody/StudioCharaOnlyLoadBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ namespace KK_StudioCharaOnlyLoadBody
[BepInPlugin(GUID, PLUGIN_NAME, PLUGIN_VERSION)]
[BepInProcess("CharaStudio")]
[BepInDependency("com.joan6694.illusionplugins.moreaccessories", BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency("com.animal42069.additionalfknodes", BepInDependency.DependencyFlags.SoftDependency)]
public class StudioCharaOnlyLoadBody : BaseUnityPlugin
{
internal const string PLUGIN_NAME = "Studio Chara Only Load Body";
internal const string GUID = "com.jim60105.kks.studiocharaonlyloadbody";
internal const string PLUGIN_VERSION = "21.12.23.0";
internal const string PLUGIN_RELEASE_VERSION = "1.4.3";
internal const string PLUGIN_VERSION = "23.10.01.0";
internal const string PLUGIN_RELEASE_VERSION = "1.4.4";

public static ConfigEntry<string> ExtendedDataToCopySetting { get; private set; }
public static string[] ExtendedDataToCopy;
Expand Down Expand Up @@ -170,6 +171,7 @@ class Model
private static readonly ManualLogSource Logger = StudioCharaOnlyLoadBody.Logger;
internal static Type ChaFile_CopyAll_Patches = null;
internal static Type MoreAccessories = null;
internal static Type AdditionalFKNodes = null;

internal static void Awake()
{
Expand All @@ -180,6 +182,19 @@ internal static void Awake()
Assembly ass = Assembly.LoadFrom(path);
MoreAccessories = ass.GetType("MoreAccessoriesKOI.MoreAccessories");
}

//AdditionalFKNodes
//Currently there is no AdditionalFKNodes for KKS, so this should be null.
PluginInfo info2 = KoikatuHelper.TryGetPluginInstance("com.animal42069.additionalfknodes")?.Info;
if (info2 != null && info2.Metadata.Version >= new Version(1, 0, 0, 0))
{
string path2 = info2.Location;
if (!string.IsNullOrEmpty(path2))
{
Assembly ass = Assembly.LoadFrom(path2);
AdditionalFKNodes = ass.GetType("AdditionalFKNodes.AdditionalFKNodes");
}
}
}

//按鈕邏輯
Expand Down Expand Up @@ -262,6 +277,7 @@ internal static void OnButtonClick(CharaList __instance, int sex)
ocichar.ChangeBlink(ocichar.charFileStatus.eyesBlink);
ocichar.ChangeMouthOpen(ocichar.oiCharInfo.mouthOpen);

AddAdditionalFKNodes(ocichar);
Logger.LogInfo($"Load Body: {oldName} -> {ocichar.charInfo.chaFile.parameter.fullname}");
}

Expand Down Expand Up @@ -492,6 +508,13 @@ public static void UpdateMoreAccessoriesData(ChaControl targetChaCtrl)
Logger.LogDebug("Update MoreAccessories Finish");
}

/// <summary>
/// Refresh AdditionalFKNodes
/// </summary>
/// <param name="oCIChar">更新對象</param>
public static void AddAdditionalFKNodes(OCIChar oCIChar)
=> AdditionalFKNodes?.InvokeStatic("AddFKCtrlInfo", new object[] { oCIChar });

/// <summary>
/// 右側選單的名字更新
/// </summary>
Expand Down

0 comments on commit d9adc39

Please sign in to comment.