/// <summary> /// 取得動態字體清單 /// </summary> /// <returns>動態字體清單</returns> public static List <string> GetDynamicFontNames() { List <string> output; if (DisablePreview) { output = FontList.ToList(); } else { output = DynamicFonts.Keys.ToList(); } if (output.Count == 0) { Logger.LogDebug("Empty font list. Try generating..."); if (CreateDynamicFonts() == 0) { Logger.LogError("Empty font list or generated failed."); } else { output = GetDynamicFontNames(); } } return(output); }
public static bool LoadAssembly() { if (null != Extension.Extension.TryGetPluginInstance("com.jim60105.kk.charaoverlaysbasedoncoordinate", new System.Version(20, 4, 28, 0))) { Logger.LogDebug("KK_CharaOverlayBasedOnCoordinate found"); return(true); } else { Logger.LogDebug("Load assembly FAILED: KK_CharaOverlayBasedOnCoordinate"); return(false); } }
public override void Load() { Logger = Log; _harmony.PatchAll(); Logger.LogDebug("Applied Harmony patches!"); }
public override void Load() { Logger = Log; _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "andruzzzhka.customserversclient"); Logger.LogDebug("Applied Harmony patches!"); }
public static void ObjectDB_Awake_DebugPatch(ref ObjectDB __instance) { if (!IsObjectDBGood()) { return; } if (!TripleBronze.DebugMessagesEnabled) { return; } foreach (var i in __instance.m_items) { var item = i.GetComponent <ItemDrop>(); logger.LogDebug($"Item \"{i.name}\": \"{item.m_itemData.m_shared.m_name}\""); } foreach (var r in __instance.m_recipes.Where(r => r.m_item?.m_itemData?.m_shared?.m_name != null && r.m_resources.Length != 0)) { logger.LogDebug($"Recipe: \"{r.m_item.m_itemData.m_shared.m_name} (x{r.m_amount})\" requires:" + string.Join( ", ", r.m_resources .Where(res => res.m_resItem?.m_itemData?.m_shared?.m_name != null) .Select(res => $"\"{res.m_resItem.m_itemData.m_shared.m_name}\" (x{res.m_amount})") ) ); } List <CraftingStation> craftingStations = __instance.m_recipes .Where(r => r != null) .Select(i => i.m_craftingStation) .Where(r => r != null) .Distinct() .ToList(); foreach (var cs in craftingStations) { logger.LogDebug($"Crafting station: \"{cs.m_name}\""); } }
public static void Prefix(Perishable __instance) { Item item = __instance.Item; if (item != null && item.IsFood) { if (__instance.DepletionRate != 0f) { __instance.SetDurabilityDepletion(0f); LOGGER.LogDebug(string.Format("StopFoodDecay::Perishable.ItemParentChanged: {0}, SetDurabilityDepletion set to {1}.", __instance.name, 0f)); } if (!__instance.DontPerishInWorld) { __instance.DontPerishInWorld = true; LOGGER.LogDebug(string.Format("StopFoodDecay::Perishable.ItemParentChanged: {0}, DontPerishInWorld is now {1}.", __instance.name, __instance.DontPerishInWorld)); } if (!__instance.DontPerishSkipTime) { __instance.DontPerishSkipTime = true; LOGGER.LogDebug(string.Format("StopFoodDecay::Perishable.ItemParentChanged: {0}, DontPerishSkipTime is now {1}.", __instance.name, __instance.DontPerishSkipTime)); } } }
internal bool LoadAssembly(out string path, Version version = null) { try { path = KoikatuHelper.TryGetPluginInstance(GUID, version)?.Info.Location; if (!File.Exists(path)) { throw new Exception($"Load assembly FAILED: {CCFCName}"); } Logger.LogDebug($"{CCFCName} found"); isExist = true; } catch (Exception ex) { Logger.LogDebug(ex.Message); path = ""; isExist = false; } return(isExist); }
public void Awake() { maxGridHeight = Config.Bind("General.Constants", "MaxGridHeight", 15, "Sets a maximum value for grid height, if over 50 can impact performance."); newGridWidth = Config.Bind("General", "GridWidth", 10, "Width in number of columns of the build grid, maximum value of 10."); disableScrollCategories = Config.Bind("General.Toggles", "DisableScrollCategories", true, "Should the mousewheel stop scrolling categories, RECOMMEND TRUE."); isEnabled = Config.Bind("General.Toggles", "EnableExpansion", true, "Whether or not to expand the build grid."); if (newGridWidth.Value > 10) { newGridWidth.Value = 10; } harmony = new Harmony(ID); harmony.PatchAll(); buildFilterLogger = Logger; buildFilterLogger.LogDebug("Build Expansion loaded."); }
public static bool LoadAssembly() { try { string path = Extension.Extension.TryGetPluginInstance("com.joan6694.illusionplugins.moreaccessories")?.Info.Location; Assembly ass = Assembly.LoadFrom(path); MoreAccessories = ass.GetType("MoreAccessoriesKOI.MoreAccessories"); if (null == MoreAccessories) { throw new Exception("Load assembly FAILED: MoreAccessories"); } MoreAccObj = MoreAccessories.GetField("_self", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy | BindingFlags.Instance)?.GetValue(null); return(true); } catch (Exception ex) { Logger.LogDebug(ex.Message); return(false); } }
private static IEnumerable <string> TellBepinAbsolutelyNothingBecauseThePluginsFolderIsntManaged() { Logger.LogInfo($"Collecting information for new MMHook"); string oldHash = null; int modsWithRefs = 0; foreach (string path in PluginPaths) { foreach (var pluginDll in Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories)) { try { using (var ass = AssemblyDefinition.ReadAssembly(pluginDll)) { if (ass.Name.Name == "MMHOOK_Assembly-CSharp") { oldHash = CollectHash(ass); mmhLocation = pluginDll; continue; } foreach (var refer in ass.MainModule.AssemblyReferences) { if (refer.Name == "MMHOOK_Assembly-CSharp") { CollectMethodDefinitions(ass); modsWithRefs++; break; } } } } catch (Exception e) { Logger.LogError($"Error on: {pluginDll}"); Logger.LogError(e); } } } if (mmhLocation == null) { Logger.LogMessage("No MMHOOK found. I can't make lighter what's already 0."); return(Array.Empty <string>()); } if (modsWithRefs == 0) { Logger.LogMessage("No plugins to patch MMHook for."); mmhLocation = null; return(Array.Empty <string>()); } Logger.LogMessage($"Found {modsWithRefs} mods with a MMHook dependency."); Logger.LogInfo($"Number of neededtypes for hooks : {neededTypes.Count}"); neededTypes.Sort(); hash = neededTypes.MakeContentHashCode(); if (oldHash == hash.ToString()) { Logger.LogMessage($"LighterhHook has already run for these mods. Using that old file again."); mmhLocation = null; } else { if (oldHash == null) { Logger.LogDebug("Backing up vanilla MMHook"); File.Delete(mmhLocation + ".backup"); File.Move(mmhLocation, mmhLocation + ".backup"); } } return(Array.Empty <string>()); }
public static void ExperimentalAllPairsMod(bool specialsToo = false) { Dictionary <int, GirlPairDefinition> allPairs = (Dictionary <int, GirlPairDefinition>)AccessTools.Field(typeof(GirlPairData), "_definitions").GetValue(Game.Data.GirlPairs); if (specialsToo) { foreach (GirlDefinition g in Game.Data.Girls.GetAll()) { g.specialCharacter = false; g.baggageItemDefs.Add(Game.Data.Ailments.Get(UnityEngine.Random.Range(1, 37)).itemDefinition); g.baggageItemDefs.Add(Game.Data.Ailments.Get(UnityEngine.Random.Range(1, 37)).itemDefinition); g.baggageItemDefs.Add(Game.Data.Ailments.Get(UnityEngine.Random.Range(1, 37)).itemDefinition); if (g.cellphoneHead == null) { g.cellphoneHead = g.cellphonePortrait; } } } List <GirlPairDefinition> stockPairs = Game.Data.GirlPairs.GetAllBySpecial(false); int startingID = 27; int maxGirls = 12; if (specialsToo) { startingID = 69; maxGirls = 15; } for (int i = 1; i <= maxGirls - 1; i++) { for (int j = i + 1; j <= maxGirls; j++) { bool addThis = true; for (int k = 0; k < stockPairs.Count; k++) { if (stockPairs[k].HasGirlDef(Game.Data.Girls.Get(i)) && stockPairs[k].HasGirlDef(Game.Data.Girls.Get(j))) { addThis = false; } } if (addThis) { GirlPairDefinition gpd = ScriptableObject.CreateInstance <GirlPairDefinition>(); gpd.girlDefinitionOne = Game.Data.Girls.Get(i); gpd.girlDefinitionTwo = Game.Data.Girls.Get(j); gpd.id = startingID; startingID++; gpd.specialPair = false; gpd.introductionPair = false; gpd.introSidesFlipped = false; gpd.photoDefinition = Game.Data.Photos.Get(1); gpd.meetingLocationDefinition = Game.Data.Locations.GetAllByLocationType(LocationType.SIM)[0]; gpd.hasMeetingStyleOne = false; gpd.meetingStyleTypeOne = GirlStyleType.SEXY; gpd.meetingStyleTypeTwo = GirlStyleType.SEXY; gpd.hasMeetingStyleTwo = false; gpd.sexDaytime = ClockDaytimeType.AFTERNOON; gpd.sexLocationDefinition = Game.Data.Locations.GetAllByLocationType(LocationType.DATE)[0]; gpd.sexStyleTypeOne = GirlStyleType.SEXY; gpd.sexStyleTypeTwo = GirlStyleType.SEXY; gpd.relationshipCutsceneDefinitions = Game.Data.GirlPairs.Get(1).relationshipCutsceneDefinitions; List <GirlPairFavQuestionSubDefinition> Qs = new List <GirlPairFavQuestionSubDefinition>(); //oops all this code was actually useless, no unused pairs have any similarities /* * for (int answer = 0; answer < gpd.girlDefinitionOne.favAnswers.Count && answer < gpd.girlDefinitionTwo.favAnswers.Count; answer++) * { * if (gpd.girlDefinitionOne.favAnswers[answer] == gpd.girlDefinitionTwo.favAnswers[answer]) * { * GirlPairFavQuestionSubDefinition q = new GirlPairFavQuestionSubDefinition(); * q.questionDefinition = Game.Data.Questions.Get(answer + 1); * q.girlResponseIndexOne = Qs.Count; * q.girlResponseIndexTwo = Qs.Count; * Qs.Add(q); * } * }*/ //add a "random" favorite question just so the game doesn't crash if (Qs.Count == 0) { GirlPairFavQuestionSubDefinition q = new GirlPairFavQuestionSubDefinition(); q.questionDefinition = Game.Data.Questions.Get(gpd.id % 20 + 1); q.girlResponseIndexOne = Qs.Count; q.girlResponseIndexTwo = Qs.Count; Qs.Add(q); } gpd.favQuestions = Qs; allPairs.Add(gpd.id, gpd); } } } GirlPairDefinition test = Game.Data.GirlPairs.GetAllBySpecial(false)[Game.Data.GirlPairs.GetAllBySpecial(false).Count - 1]; Logger.LogDebug("pair count: " + Game.Data.GirlPairs.GetAllBySpecial(false).Count); foreach (GirlPairDefinition tester in Game.Data.GirlPairs.GetAllBySpecial(false)) { Logger.LogDebug(tester.girlDefinitionOne.girlName + " " + tester.girlDefinitionTwo.girlName + " " + tester.id); } }
/// <summary> /// 繪製轉場圖片 /// </summary> /// <param name="_step">繪製完後要進入的腳本位置</param> /// <param name="sceneName">Scene名稱</param> private static void DrawSlidePic(int _step) { GameObject parent; switch (KK_FBIOpenUp.nowGameMode) { case KK_FBIOpenUp.GameMode.Studio: parent = GameObject.Find("StudioScene/Canvas Main Menu"); break; case KK_FBIOpenUp.GameMode.MainGame: parent = GameObject.Find("ActionScene/UI/ActionMenuCanvas/ModeAnimation"); break; case KK_FBIOpenUp.GameMode.Maker: parent = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsCoordinateType/redBagBtn"); break; //FreeH死都不成功,放棄 //case KK_FBIOpenUp.GameMode.FreeH: // parent = GameObject.Find("CommonSpace"); // break; default: parent = GameObject.FindObjectsOfType <GameObject>()[0]; //Not tested break; } GameObject gameObject = new GameObject(); gameObject.transform.SetParent(parent.transform, false); gameObject.SetActive(false); if (null != shiftPicture) { GameObject.Destroy(shiftPicture.Transform.parent.gameObject); shiftPicture.image = null; shiftPicture.video = null; shiftPicture = null; } shiftPicture = new ShiftPicture(); //如果影片不存在,用熊吉代替 bool noVideoFallback = _step == 20 && null == KK_FBIOpenUp.videoPath; if (noVideoFallback) { _step = 2; } switch (_step) { case 1: //小學生真是太棒了 shiftPicture.type = ShiftPicture.Type.picture; shiftPicture.image = UIUtility.CreateImage("", gameObject.transform, Extension.Extension.LoadNewSprite("KK_FBIOpenUp.Resources.saikodaze.jpg", 800, 657)); shiftPicture.image.rectTransform.sizeDelta = new Vector2(Screen.height / 1.5f * 800 / 657, Screen.height / 1.5f); Right2Center(); break; case 2: //熊吉逮捕 shiftPicture.type = ShiftPicture.Type.picture; shiftPicture.image = UIUtility.CreateImage("", gameObject.transform, Extension.Extension.LoadNewSprite("KK_FBIOpenUp.Resources.Kumakichi.jpg", 640, 480)); shiftPicture.image.rectTransform.sizeDelta = new Vector2(Screen.height / 1.5f * 640 / 480, Screen.height / 1.5f); Left2Center(); break; case 10: //幼女退光線 shiftPicture.type = ShiftPicture.Type.picture; shiftPicture.image = UIUtility.CreateImage("", gameObject.transform, Extension.Extension.LoadNewSprite("KK_FBIOpenUp.Resources.beam.png", 700, 700)); shiftPicture.image.rectTransform.sizeDelta = new Vector2(Screen.height / 1.25f, Screen.height / 1.25f); Right2Center(); break; case 20: //FBI Open Up影片 shiftPicture.type = ShiftPicture.Type.video; shiftPicture.video = UIUtility.CreateRawImage("", gameObject.transform); shiftPicture.video.rectTransform.sizeDelta = new Vector2(Screen.height / 1.5f, Screen.height / 1.5f); UnityEngine.Video.VideoPlayer videoPlayer = gameObject.AddComponent <UnityEngine.Video.VideoPlayer>(); AudioSource audioSource = gameObject.AddComponent <AudioSource>(); videoPlayer.playOnAwake = false; audioSource.playOnAwake = false; videoPlayer.renderMode = UnityEngine.Video.VideoRenderMode.APIOnly; //videoPlayer.url= "../UserData/audio/FBI.mp4"; videoPlayer.url = KK_FBIOpenUp.videoPath; //Set Audio Output to AudioSource videoPlayer.audioOutputMode = UnityEngine.Video.VideoAudioOutputMode.AudioSource; //Assign the Audio from Video to AudioSource to be played videoPlayer.EnableAudioTrack(0, true); videoPlayer.SetTargetAudioSource(0, audioSource); Logger.LogDebug($"{videoPlayer.url}"); videoPlayer.isLooping = true; //先把他移到螢幕外啟用,否則未啟用無法Prepare,而直接啟用會出現白色畫面 shiftPicture.Transform.position = new Vector3(-2 * Screen.width, Screen.height / 2); gameObject.SetActive(true); videoPlayer.Prepare(); videoPlayer.prepareCompleted += (source) => { ///TODO 這實際上沒有辦法真的catch到錯誤,待修 if (videoPlayer.texture == null) { Logger.LogError("Video not found"); GameObject.Destroy(shiftPicture.Transform.parent.gameObject); shiftPicture.video = null; shiftPicture = null; _step = 0; return; } shiftPicture.video.texture = videoPlayer.texture; videoTimer = 2; videoPlayer.Play(); audioSource.Play(); //影片太大聲QQ audioSource.volume = KK_FBIOpenUp.videoVolume; Left2Center(); }; break; } //如果影片不存在,用熊吉代替 if (noVideoFallback) { _step = 20; } step = _step; Logger.LogDebug("Draw Slide Pic"); void Right2Center() { //Right To Center shiftPicture.Transform.position = new Vector3(Screen.width + shiftPicture.Width / 2, Screen.height / 2); shiftPicture.targetPosition = new Vector3(Screen.width / 2, Screen.height / 2); gameObject.SetActive(true); } void Left2Center() { //Left To Center shiftPicture.Transform.position = new Vector3(-1 * (Screen.width + shiftPicture.Width / 2), Screen.height / 2); shiftPicture.targetPosition = new Vector3(Screen.width / 2, Screen.height / 2); gameObject.SetActive(true); } }
public static bool LoadAssembly() { try { string path = Extension.Extension.TryGetPluginInstance("KKABMX.Core", new Version(3, 3))?.Info.Location; if (File.Exists(path)) { BoneModifierType = Assembly.LoadFrom(path).GetType("KKABMX.Core.BoneModifier"); } else { throw new Exception("Load assembly FAILED: KKABMX"); } Logger.LogDebug("KKABMX found"); return(true); } catch (Exception ex) { Logger.LogDebug(ex.Message); return(false); } }
public static bool LoadAssembly() { if (null != Extension.Extension.TryGetPluginInstance("KCOX", new System.Version(5, 2))) { Logger.LogDebug("KCOX found"); return(true); } else { Logger.LogDebug("Load assembly FAILED: KCOX"); return(false); } }
public static bool LoadAssembly() { if (null != Extension.Extension.TryGetPluginInstance(GUID, new Version(1, 1, 2))) { Logger.LogDebug("Hair Accessory Customizer found"); return(true); } else { Logger.LogDebug("Load assembly FAILED: Hair Accessory Customizer"); return(false); } }
public static bool LoadAssembly() { try { string path = Extension.Extension.TryGetPluginInstance("com.deathweasel.bepinex.materialeditor", new Version(2, 0, 7))?.Info.Location; Assembly ass = Assembly.LoadFrom(path); MaterialAPI = ass.GetType("KK_Plugins.MaterialEditor.MaterialAPI"); if (null == MaterialAPI) { throw new Exception("Load assembly FAILED: MaterialEditor"); } Logger.LogDebug("MaterialEditor found"); CacheDirectory = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), KK_StudioCoordinateLoadOption.GUID)); foreach (FileInfo file in CacheDirectory.GetFiles()) { file.Delete(); } foreach (DirectoryInfo subDirectory in CacheDirectory.GetDirectories()) { subDirectory.Delete(true); } Logger.LogDebug("Clean cache folder"); return(true); } catch (Exception ex) { Logger.LogDebug(ex.Message); return(false); } }