protected override void OnEndH(HSceneProc proc, bool freeH) { if (freeH || !SkinEffectsPlugin.EnablePersistence.Value) { return; } var isShower = proc.flags.IsShowerPeeping(); foreach (var heroine in proc.flags.lstHeroine) { if (isShower) { // Clear effects after a shower, save them after other types of h scenes _persistentCharaState.Remove(heroine); } else { var controller = heroine.chaCtrl.GetComponent <SkinEffectsController>(); SavePersistData(heroine, controller); if (controller.DisableDeflowering) { _disableDeflowering.Add(heroine); } } StartCoroutine(RefreshOnSceneChangeCo(heroine, true)); } }
private static void OnHEnd(HSceneProc proc) { foreach (var behaviour in _registeredHandlers) { try { behaviour.Key.OnEndH(proc, proc.flags.isFreeH); } catch (Exception e) { KoikatuAPI.Logger.LogError(e); } } try { EndH?.Invoke(KoikatuAPI.Instance, EventArgs.Empty); } catch (Exception e) { KoikatuAPI.Logger.LogError(e); } InsideHScene = false; }
public static bool HarmonyPatch_HSceneProc_CreateListAnimationFileName(HSceneProc __instance, ref bool _isAnimListCreate, ref int _list) { var traverse = Traverse.Create(__instance); if (_isAnimListCreate) { traverse.Method("CreateAllAnimationList").GetValue(); } var lstAnimInfo = traverse.Field("lstAnimInfo").GetValue <List <HSceneProc.AnimationListInfo>[]>(); var lstUseAnimInfo = traverse.Field("lstUseAnimInfo").GetValue <List <HSceneProc.AnimationListInfo>[]>(); for (int i = 0; i < lstAnimInfo.Length; i++) { lstUseAnimInfo[i] = new List <HSceneProc.AnimationListInfo>(); if (_list == -1 || i == _list) { for (int j = 0; j < lstAnimInfo[i].Count; j++) { if (UnlockAll.Value || lstAnimInfo[i][j].lstCategory.Any(c => __instance.categorys.Contains(c.category))) { lstUseAnimInfo[i].Add(lstAnimInfo[i][j]); } } } } return(false); }
private static IEnumerator OnHStart(HSceneProc proc) { InsideHScene = true; yield return(null); foreach (var behaviour in _registeredHandlers) { try { behaviour.Key.OnStartH(proc, proc.flags.isFreeH); } catch (Exception e) { KoikatuAPI.Logger.LogError(e); } } try { StartH?.Invoke(KoikatuAPI.Instance, EventArgs.Empty); } catch (Exception e) { KoikatuAPI.Logger.LogError(e); } }
internal static void GotoPointMoveScene(HSceneProc __instance) { foreach (var heroine in __instance.flags.lstHeroine) { GetController(heroine.chaCtrl).HideGuideObject(); } }
internal static void ChangeCategory(HSceneProc __instance) { foreach (var heroine in __instance.flags.lstHeroine) { GetController(heroine.chaCtrl).SetGuideObjectOriginalPosition(); } }
private static void SceneManager_sceneUnloaded(Scene scene) { Console.WriteLine($"SceneManager_sceneUnloaded {scene.name}"); if (!patched || scene.name != "HProc") { return; } CoreGame.OnEndScene(); harmony.UnpatchAll(nameof(KK_BetterPenetration)); patched = false; inHScene = false; if (hSceneProc == null) { return; } if (hSceneProc.lookDan != null) { hSceneProc.lookDan.transLookAtNull = null; } if (hSceneProc.lookDan1 != null) { hSceneProc.lookDan1.transLookAtNull = null; } hSceneProc = null; }
public static void HSpriteUpdatePre(HSceneProc __instance) { // Adjust help sprite location so it doesn't cover the back button var rt = __instance.sprite.objFirstHHelpBase.transform.parent.GetComponent<RectTransform>(); rt.anchorMin = new Vector2(0.04f, 0f); rt.offsetMax = Vector2.zero; rt.offsetMin = Vector2.zero; }
/// <summary> /// Create a copy of the H scene guide object for each character /// </summary> internal void CreateGuideObject(HSceneProc hSceneProc, CharacterType characterType) { ChaType = characterType; if (GuideObject == null) { GuideObject = Instantiate(hSceneProc.guideObject); } }
public static void MapSameObjectDisable(HSceneProc __instance) { foreach (var heroine in __instance.flags.lstHeroine) { GetController(heroine.chaCtrl)?.SetJuice(); } GetController(__instance.flags.player.chaCtrl)?.SetJuice(); }
public static void HScene_PostStart(HSceneProc __instance) { hSceneProc = __instance; hSceneProcTraverse = Traverse.Create(__instance); hSceneStarted = true; inHScene = false; }
private static void GotoPointMoveScene(HSceneProc __instance) { var heroines = __instance.flags.lstHeroine; for (var i = 0; i < heroines.Count; i++) { GetController(heroines[i].chaCtrl).HideGuideObject(); } }
private static void OnHEnd(HSceneProc proc) { // If girl is stil a virgin, keep her first time status foreach (var heroine in proc.flags.lstHeroine) { if (heroine.isVirgin && heroine.isAnalVirgin) heroine.hCount = 0; } }
private static void ChangeCategory(HSceneProc __instance) { var heroines = __instance.flags.lstHeroine; for (var i = 0; i < heroines.Count; i++) { GetController(heroines[i].chaCtrl).SetGuideObjectOriginalPosition(); } }
protected override void OnStartH(HSceneProc proc, bool freeH) { StopAllCoroutines(); // Prevent the HymenRegen taking effect every time H is done in a day foreach (var heroine in proc.flags.lstHeroine) { heroine.chaCtrl.GetComponent <SkinEffectsController>().DisableDeflowering = _disableDeflowering.Contains(heroine); } }
private static void HSceneProc_Start(HSceneProc __instance) { if (IsStudio) { return; } if (StudioSceneFile != null) { __instance.dataH.mapNoFreeH = -1; } }
public static void MapSameObjectDisable(HSceneProc __instance) { var map = (ActionMap)AccessTools.Field(typeof(HSceneProc), "map").GetValue(Singleton <HSceneProc> .Instance); if (map.no == 52) //shower { var lstFemale = (List <ChaControl>)AccessTools.Field(typeof(HSceneProc), "lstFemale").GetValue(Singleton <HSceneProc> .Instance); //Turn accessories back on and then turn off only Sub accessories lstFemale[0].SetAccessoryStateAll(true); lstFemale[0].SetAccessoryStateCategory(1, false); } }
internal static void SetClothStateStartMotionPostfix(HSceneProc __instance) { foreach (var heroine in __instance.flags.lstHeroine) { ChaControl chaCtrl = heroine.chaCtrl; Logger.Log(DebugLogLevel, $"[Harmony][HSceneProc][SetClothStateStartMotion][Postfix][{chaCtrl.chaFile.parameter?.fullname}]"); AccStateSyncController controller = GetController(chaCtrl); if (controller != null) { controller.SyncAllAccToggle(); } } }
protected override void OnEndH(HSceneProc proc, bool freeH) { InsideHScene = false; Destroy(proc.GetComponent <LactationController>()); // Figure out if conception happened at end of h scene // bug Don't know which character is which if (proc.flags.mode == HFlag.EMode.houshi3P || proc.flags.mode == HFlag.EMode.sonyu3P) { return; } var heroine = proc.flags.lstHeroine.First(x => x != null); var isDangerousDay = HFlag.GetMenstruation(heroine.MenstruationDay) == HFlag.MenstruationType.危険日; if (!isDangerousDay) { return; } var cameInside = PregnancyPlugin.ConceptionEnabled.Value && proc.flags.count.sonyuInside > 0; var cameInsideAnal = PregnancyPlugin.AnalConceptionEnabled.Value && proc.flags.count.sonyuAnalInside > 0; if (cameInside || cameInsideAnal) { var controller = heroine.chaCtrl.GetComponent <PregnancyCharaController>(); if (controller == null) { throw new ArgumentNullException(nameof(controller)); } //Allow pregnancy if enabled, or overridden, and is not currently pregnant if (!controller.Data.GameplayEnabled || controller.Data.IsPregnant) { return; } var fertility = Mathf.Max(PregnancyPlugin.FertilityOverride.Value, controller.Data.Fertility); var winThreshold = Mathf.RoundToInt(fertility * 100); var childLottery = Random.Range(1, 100); //Logger.Log(LogLevel.Debug, $"Preg - OnEndH calc pregnancy chance {childLottery} to {winThreshold}"); var wonAChild = winThreshold >= childLottery; if (wonAChild) { //Logger.Log(LogLevel.Debug, "Preg - child lottery won, pregnancy will start"); _startedPregnancies.Add(heroine); } } }
private static void HookHSceneValues(HSceneProc __instance) { __instance.flags.ctrlCamera.CameraFov = saveData.Fov; __instance.flags.isAibuSelect = saveData.isAibuSelect; __instance.gameObject.GetComponent <ShortcutKey>().procList .First(x => x.keyCode == KeyCode.A).call.AddListener(() => { saveData.isAibuSelect = __instance.flags.isAibuSelect; SaveXml(); }); __instance.StartCoroutine(DetectFovChange(__instance.flags.ctrlCamera)); }
public static void HSceneProc_ShortCut_CreateLightLockButton(HSceneProc __instance) { if (!inH || __instance.sprite.isFade || __instance.sprite.GetFadeKindProc() == HSprite.FadeKindProc.OutEnd) { return; } if (preButtonCreated) { return; } preButtonCreated = true; CreateButton(); }
private static void HSceneProc_SetShortcutKey(HSceneProc __instance) { for (int i = 0; i < __instance.flags.lstHeroine.Count; i++) { if (i == 0) { GetController(__instance.flags.lstHeroine[i].chaCtrl).CreateGuideObject(__instance, HCharaAdjustmentController.CharacterType.Female1); } else if (i == 1) { GetController(__instance.flags.lstHeroine[i].chaCtrl).CreateGuideObject(__instance, HCharaAdjustmentController.CharacterType.Female2); } } GetController(__instance.flags.player.chaCtrl).CreateGuideObject(__instance, HCharaAdjustmentController.CharacterType.Male); }
public static void LateShortCut(HSceneProc __instance) { ChaControl heroine = __instance.flags.lstHeroine[0].chaCtrl; if (Input.GetKeyDown(KeyCode.P)) { AdjustmentX += 0.01f; } if (Input.GetKeyDown(KeyCode.O)) { AdjustmentX -= 0.01f; } if (Input.GetKeyDown(KeyCode.I)) { AdjustmentX = 0f; } if (Input.GetKeyDown(KeyCode.L)) { AdjustmentY += 0.01f; } if (Input.GetKeyDown(KeyCode.K)) { AdjustmentY -= 0.01f; } if (Input.GetKeyDown(KeyCode.J)) { AdjustmentY = 0f; } if (Input.GetKeyDown(KeyCode.M)) { AdjustmentZ += 0.01f; } if (Input.GetKeyDown(KeyCode.N)) { AdjustmentZ -= 0.01f; } if (Input.GetKeyDown(KeyCode.B)) { AdjustmentZ = 0f; } Vector3 pos = heroine.GetPosition(); pos.x += AdjustmentX; pos.y += AdjustmentY; pos.z += AdjustmentZ; heroine.SetPosition(pos); }
internal static void LateShortCut(HSceneProc __instance) { ChaControl heroine = __instance.flags.lstHeroine[0].chaCtrl; if (AdjustmentXPlus.Value.IsDown()) { AdjustmentX += 0.01f; } if (AdjustmentXMinus.Value.IsDown()) { AdjustmentX -= 0.01f; } if (AdjustmentXReset.Value.IsDown()) { AdjustmentX = 0f; } if (AdjustmentYPlus.Value.IsDown()) { AdjustmentY += 0.01f; } if (AdjustmentYMinus.Value.IsDown()) { AdjustmentY -= 0.01f; } if (AdjustmentYReset.Value.IsDown()) { AdjustmentY = 0f; } if (AdjustmentZPlus.Value.IsDown()) { AdjustmentZ += 0.01f; } if (AdjustmentZMinus.Value.IsDown()) { AdjustmentZ -= 0.01f; } if (AdjustmentZReset.Value.IsDown()) { AdjustmentZ = 0f; } Vector3 pos = heroine.GetPosition(); pos.x += AdjustmentX; pos.y += AdjustmentY; pos.z += AdjustmentZ; heroine.SetPosition(pos); }
public static void HSceneProcLoadPostfix(HSceneProc __instance) { var females = (List <ChaControl>)Traverse.Create(__instance).Field("lstFemale").GetValue(); sprites.Clear(); sprites.Add(__instance.sprite); lstmMale = new List <ChaControl> { Traverse.Create(__instance).Field("male").GetValue <ChaControl>() }; if (isDarkness) { lstmMale.Add(Traverse.Create(__instance).Field("male1").GetValue <ChaControl>()); } lstmMale = lstmMale.FindAll(male => male != null); lstFemale = females; lstProc = (List <HActionBase>)Traverse.Create(__instance).Field("lstProc").GetValue(); flags = __instance.flags; voice = __instance.voice; hands[0] = __instance.hand; hands[1] = __instance.hand1; EquipAllAccessories(females); foreach (HSprite sprite in sprites) { LockGaugesAction(sprite); } if (HideMaleShadow.Value) { MaleShadow(); } if (HideFemaleShadow.Value) { FemaleShadow(); } if (SpeechControlMode.Value == SpeechMode.Timer) { SetVoiceTimer(); } animationToggle = __instance.gameObject.AddComponent <AnimationToggle>(); speechControl = __instance.gameObject.AddComponent <SpeechControl>(); }
protected override void OnStartH(HSceneProc proc, bool freeH) { _hSceneProc = proc; _hSceneHeroines = proc.flags.lstHeroine.Select(x => new HsceneHeroineInfo(x)).ToArray(); foreach (var heroine in _hSceneHeroines) { if (heroine.CrestType == CrestType.regrowth) { var prop = heroine.GetRegenProp(); if (prop != null && !prop.Value) { prop.Value = true; heroine.NeedsRegenRestored = true; } } } }
// Figure out if conception happened at end of h scene protected override void OnEndH(HSceneProc proc, bool freeH) { // Don't know which girl player came inside if (proc.flags.mode == HFlag.EMode.houshi3P || proc.flags.mode == HFlag.EMode.sonyu3P) { return; } var heroine = proc.flags.lstHeroine.First(x => x != null); var isDangerousDay = HFlag.GetMenstruation(heroine.MenstruationDay) == HFlag.MenstruationType.危険日; if (!isDangerousDay) { return; } var cameInside = PregnancyPlugin.ConceptionEnabled.Value && proc.flags.count.sonyuInside > 0; var cameInsideAnal = PregnancyPlugin.AnalConceptionEnabled.Value && proc.flags.count.sonyuAnalInside > 0; if (cameInside || cameInsideAnal) { var controller = heroine.chaCtrl.GetComponent <PregnancyCharaController>(); if (controller == null) { throw new ArgumentNullException(nameof(controller)); } if (!controller.GameplayEnabled || controller.IsDuringPregnancy()) { return; } var winThreshold = Mathf.RoundToInt(controller.Fertility * 100); var childLottery = Random.Range(1, 100); //Logger.Log(LogLevel.Debug, $"Preg - OnEndH calc pregnancy chance {childLottery} to {winThreshold}"); var wonAChild = winThreshold >= childLottery; if (wonAChild) { //Logger.Log(LogLevel.Debug, "Preg - child lottery won, pregnancy will start"); _startedPregnancies.Add(heroine); } } }
public static void HScene_PostUpdate(HSceneProc __instance, List <ChaControl> ___lstFemale, ChaControl ___male, ChaControl ___male1) { if (!hSceneStarted || !__instance.enabled || inHScene) { return; } hSceneProc = __instance; List <DanOptions> danOptions = PopulateDanOptionsList(); List <CollisionOptions> collisionOptions = PopulateCollisionOptionsList(); if (___lstFemale == null || ___lstFemale.Count == 0) { return; } List <ChaControl> femaleList = new List <ChaControl>(); foreach (var female in ___lstFemale) { if (female != null) { femaleList.Add(female); } } List <ChaControl> maleList = new List <ChaControl>(); if (___male != null) { maleList.Add(___male); } if (___male1 != null) { maleList.Add(___male1); } CoreGame.InitializeAgents(maleList, femaleList, danOptions, collisionOptions); inHScene = true; hSceneStarted = false; }
internal static void MapSameObjectDisable(HSceneProc __instance) { for (int i = 0; i < __instance.flags.lstHeroine.Count; i++) { if (i == 0) { GetController(__instance.flags.lstHeroine[i].chaCtrl).CreateGuideObject(__instance, HCharaAdjustmentController.CharacterType.Female1); } else if (i == 1) { GetController(__instance.flags.lstHeroine[i].chaCtrl).CreateGuideObject(__instance, HCharaAdjustmentController.CharacterType.Female2); } else { continue; } } GetController(__instance.flags.player.chaCtrl).CreateGuideObject(__instance, HCharaAdjustmentController.CharacterType.Male); }
internal static void HSceneProc_EndProc() { CoreGame.SetAgentsBPBoneWeights(0f); CoreGame.OnEndScene(); inHScene = false; if (hSceneProc == null) { return; } if (hSceneProc.lookDan != null) { hSceneProc.lookDan.transLookAtNull = null; } hSceneProcTraverse = null; hSceneProc = null; }