private static bool GetQuquWindow_LateUpdate_Prefix(GetQuquWindow __instance, MethodBase __originalMethod) { if (GetQuquWindow_LateUpdate_stopPatching) { return(true); } // 没有激活变速时不patch避免功能未激活时对原游戏功能可能产生的影响 if (!GameSpeeder.IsTimePatchEnable()) { return(true); } float realDeltaTime = Time.unscaledDeltaTime; GetQuquWindow_LateUpdate_fixDeltaTime += Time.deltaTime; float fFramePass = GetQuquWindow_LateUpdate_fixDeltaTime / realDeltaTime; int nFramePass = (int)Math.Floor(fFramePass); GetQuquWindow_LateUpdate_fixDeltaTime -= nFramePass * realDeltaTime; while (nFramePass-- > 0) { if (!__instance.getQuquWindow.activeSelf) { return(false); } GetQuquWindow_LateUpdate_stopPatching = true; __originalMethod.Invoke(__instance, null); GetQuquWindow_LateUpdate_stopPatching = false; } return(false); }
/// <summary> /// 蛐蛐修改 /// </summary> /// <param name="__instance"></param> /// <param name="index"></param> /// <returns></returns> private static bool GetQuquButton_Prefix(GetQuquWindow __instance, int index, ref bool ___startGetQuqu, ref bool ___startFirstTime, ref bool ___getQuquEnd) { if (!TaiwuEditor.enabled || !TaiwuEditor.settings.GetQuquNoMiss.Value) { return(true); } if (___startGetQuqu || ___startFirstTime) { ___startGetQuqu = false; if (RuntimeConfig.DebugMode) { int num = 10 + __instance.cricketDate[index][6] - Mathf.Min(__instance.cricketDate[index][3] * 5, 40); TaiwuEditor.Logger.LogInfo(index + ":" + __instance.cricketDate[index][6] + "|" + num); } if (TaiwuEditor.settings.GetAllQuqu.Value) { GetAllQuqu(__instance); } else { AccessTools.Method(__instance.GetType(), "GetQuqu").Invoke(__instance, new object[] { index }); } ___getQuquEnd = true; } return(false); }
private static void Postfix(GetQuquWindow __instance) { // Main.Logger.Log("start catching "); if (Main.settings.stopOnReading) { Main.ApplyTimeScale(false); } }
/// <summary> /// 如果选择yes跳过CloseGetQuquWindowDone的执行 /// </summary> /// <returns>true是执行原方法,false是跳过执行原方法</returns> static bool Prefix() { if (!Main.enabled) { return(true); } if (closeQuQuWindow) { active = false; closeQuQuWindow = false; //奇怪的bug暂时这样解决。 GetQuquWindow ququwin = GetQuquWindow.instance; ququwin.getQuquWindow.SetActive(false); ququwin.endGetQuquImage[0].gameObject.SetActive(false); YesOrNoWindow.instance.ShwoWindowMask(ququwin.getQuquWindow.transform, false, 0.75f, 0.2f, false); int ququNum = int.Parse(DateFile.instance.baseStoryDate[10006][302]); DateFile.instance.SetEvent(new int[] { 0, -1, ququNum }, true, true); } return(active); }
private static void GetAllQuqu(GetQuquWindow __instance) { int MainActorID = DateFile.instance.MianActorID(); List <int[]> QuquList = new List <int[]>(); for (int i = 0; i < __instance.placeImage.Length; i++) { int newThing = DateFile.instance.MakeNewItem(int.Parse(DateFile.instance.cricketPlaceDate[__instance.cricketDate[i][0]][102])); int colorId = __instance.cricketDate[i][1]; int partId = __instance.cricketDate[i][2]; __instance.MakeQuqu(newThing, colorId, partId); int ququDate = __instance.GetQuquDate(newThing, 93, true); DateFile.instance.getQuquTrun += ququDate; DateFile.instance.AddActorScore(501, 100 + Mathf.Abs(ququDate) * 5); int num3 = int.Parse(DateFile.instance.GetItemDate(newThing, 8, true)); if (Random.Range(0, 100) < num3 * 2) { DateFile.instance.ChangeItemHp(MainActorID, newThing, -1, 0, true); __instance.QuquAddInjurys(newThing); QuquList.Add(new int[2] { newThing, 1 }); QuquList.Add(new int[2] { 96, Random.Range(1, num3) }); } else if (Random.Range(0, 100) < 10) { int num4 = DateFile.instance.MakRandQuqu((num3 - 1) * 3); DateFile.instance.ChangeItemHp(MainActorID, newThing, -(int.Parse(DateFile.instance.GetItemDate(newThing, 901, true)) / 2), 0, true); DateFile.instance.ChangeItemHp(MainActorID, num4, -(int.Parse(DateFile.instance.GetItemDate(num4, 901, true)) / 2), 0, true); QuquList.Add(new int[2] { newThing, 1 }); QuquList.Add(new int[2] { num4, 1 }); } else { QuquList.Add(new int[2] { newThing, 1 }); } } var NewQuquList = new List <int[]>(); foreach (var i in QuquList) { if (int.Parse(DateFile.instance.GetItemDate(i[0], 8)) < (10 - TaiwuEditor.settings.CustomLockValue.Value[3])) { var value = int.Parse(Characters.GetCharProperty(MainActorID, 406)) + int.Parse(DateFile.instance.GetItemDate(i[0], 905)); Characters.SetCharProperty(MainActorID, 406, value.ToString()); Items.RemoveItem(i[0]); } else { NewQuquList.Add(i); } } DateFile.instance.GetItem(DateFile.instance.MianActorID(), NewQuquList, newItem: false, 0); }
private static void Postfix(GetQuquWindow __instance) { // Main.Logger.Log("end catching "); Main.ApplyTimeScale(Main.settings.enabled); }