static bool Prefix(UIReplicatorWindow __instance, ref RecipeProto ___selectedRecipe, ref Text ___multiValueText) { if (___selectedRecipe == null) { return(false); } var stepModifier = 1; if (Input.GetKey(KeyCode.LeftControl)) { stepModifier = 10; } if (Input.GetKey(KeyCode.LeftShift)) { stepModifier = 100; } 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); }
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 void Prefix(UIReplicatorWindow __instance) { if (!isPatched) { var _tmp_text0 = AccessTools.Field(typeof(UIReplicatorWindow), "_tmp_text0"); // 制造队列 == "Replicating Queue" _tmp_text0.SetValue(__instance, "制造队列".Translate()); isPatched = true; } }
public static bool OnPlusButtonClick(UIReplicatorWindow __instance, ref RecipeProto ___selectedRecipe, ref Dictionary <int, int> ___multipliers, ref Text ___multiValueText) { if (___selectedRecipe != null) { // if the recipe hasn't been loaded before, set the craft amount to default value (1) if (!___multipliers.ContainsKey(___selectedRecipe.ID)) { ___multipliers[___selectedRecipe.ID] = 1; } ___multipliers[___selectedRecipe.ID]++; ___multiValueText.text = ___multipliers[___selectedRecipe.ID].ToString() + "x"; return(false); } 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); } }
static void Postfix(UIReplicatorWindow __instance, UIButton ___plusButton, UIButton ___minusButton, Text ___multiValueText) { ___plusButton.gameObject.SetActive(true); ___minusButton.gameObject.SetActive(true); ___multiValueText.gameObject.transform.parent.gameObject.SetActive(true); }