static bool Prefix(UIReplicatorWindow __instance, RecipeProto ___selectedRecipe, MechaForge ___mechaForge) { if (___selectedRecipe == null) { return(false); } if (!___selectedRecipe.Handcraft) { UIRealtimeTip.Popup("该配方".Translate() + ___selectedRecipe.madeFromString + "生产".Translate(), true, 0); } else { int id = ___selectedRecipe.ID; if (!GameMain.history.RecipeUnlocked(id)) { UIRealtimeTip.Popup("配方未解锁".Translate(), true, 0); } else { int num = ___mechaForge.PredictTaskCount(___selectedRecipe.ID, 500); var count = 1; if (Input.GetKey(KeyCode.LeftControl)) { count *= 10; } if (Input.GetKey(KeyCode.LeftShift)) { count *= 100; } if (Input.GetKey(KeyCode.LeftAlt)) { count *= num; } if (count > num) { count = num; } if (count == 0) { UIRealtimeTip.Popup("材料不足".Translate(), true, 0); } else if (___mechaForge.AddTask(id, count) == null) { UIRealtimeTip.Popup("材料不足".Translate(), true, 0); } else { GameMain.history.RegFeatureKey(1000104); } } } return(false); }
public static bool OnMinusButtonClick(UIReplicatorWindow __instance, ref RecipeProto ___selectedRecipe, ref Dictionary <int, int> ___multipliers, ref Text ___multiValueText, ref MechaForge ___mechaForge) { if (___selectedRecipe == null) { return(false); } var stepModifier = 1; if (Input.GetKey(KeyCode.LeftControl)) { stepModifier = 10; } if (Input.GetKey(KeyCode.LeftShift)) { stepModifier = 100; } if (Input.GetKey(KeyCode.LeftAlt)) { stepModifier = ___mechaForge.PredictTaskCount(___selectedRecipe.ID, 1000000) - 1; } if (!__instance.multipliers.ContainsKey(___selectedRecipe.ID)) { __instance.multipliers[___selectedRecipe.ID] = 1; } int num = __instance.multipliers[___selectedRecipe.ID] - 1 * stepModifier; if (num < 1) { num = 1; } __instance.multipliers[___selectedRecipe.ID] = num; ___multiValueText.text = num.ToString() + "x"; return(false); }
public static void OnOkButtonClick(UIReplicatorWindow __instance, ref RecipeProto ___selectedRecipe, ref Dictionary <int, int> ___multipliers, ref MechaForge ___mechaForge) { if (___selectedRecipe != null) { int num = 1; if (___multipliers.ContainsKey(___selectedRecipe.ID)) { num = ___multipliers[___selectedRecipe.ID]; } if (num < 1) { num = 1; } int num2 = ___mechaForge.PredictTaskCount(___selectedRecipe.ID, 99); if (num > num2) { num = num2; } ___mechaForge.AddTask(___selectedRecipe.ID, num); } }