CustomMenu.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using GadgetCore.API;
  2. using GadgetCore.API.ConfigMenu;
  3. using QuickStack.ConfigEnums;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. namespace QuickStack
  9. {
  10. public class CustomMenu : BasicGadgetConfigMenu
  11. {
  12. public CustomMenu(Gadget g)
  13. {
  14. {
  15. var param = new string[] { "Only Main Inventory", "Only Toolbar", "Both" };
  16. AddComponent(new GadgetConfigLabelComponent(this, "Take From Title", "Were should items be taken from?"));
  17. AddComponent(new GadgetConfigDropdownComponent(this, "Take From", param[(int)Core.settingStackSource], param, new Action<string>((s) =>
  18. {
  19. for (int i = 0; i < param.Length; i++)
  20. {
  21. if (param[i] == s)
  22. Core.settingStackSource = (StackSourceInventoryEnum)i;
  23. }
  24. g.Config.WriteEnum("TakeFromAll", Core.settingStackSource);
  25. g.Config.Save();
  26. })));
  27. }
  28. AddComponent(new GadgetConfigSeparatorComponent(this, "Space"));
  29. {
  30. var param = new string[] { "Only Main Inventory", "Only Toolbar", "Both", "None" };
  31. AddComponent(new GadgetConfigLabelComponent(this, "Take Potions", "Were should potions be taken from?"));
  32. AddComponent(new GadgetConfigDropdownComponent(this, "Take From", param[(int)Core.settingStackPotionsSource], param, new Action<string>((s) =>
  33. {
  34. for (int i = 0; i < param.Length; i++)
  35. {
  36. if (param[i] == s)
  37. Core.settingStackPotionsSource = (StackSourceInventoryPotionsEnum)i;
  38. }
  39. g.Config.WriteEnum("TakeFromPotions", Core.settingStackPotionsSource);
  40. g.Config.Save();
  41. })));
  42. }
  43. AddComponent(new GadgetConfigSeparatorComponent(this, "Space"));
  44. {
  45. var param = new string[] { "Stacking Only", "Fill Page Containing", "Fill Page All" };
  46. AddComponent(new GadgetConfigLabelComponent(this, "Insert Title", "How should items be inserted?"));
  47. AddComponent(new GadgetConfigDropdownComponent(this, "Insert", param[(int)Core.settingStackMode], param, new Action<string>((s) =>
  48. {
  49. for (int i = 0; i < param.Length; i++)
  50. {
  51. if (param[i] == s)
  52. Core.settingStackMode = (StackModeEnum)i;
  53. }
  54. g.Config.WriteEnum("StackMode", Core.settingStackMode);
  55. g.Config.Save();
  56. })));
  57. }
  58. AddComponent(new GadgetConfigSeparatorComponent(this, "Space"));
  59. {
  60. var param = new string[] { "All Pages", "Open Page"};
  61. AddComponent(new GadgetConfigLabelComponent(this, "Insert Title", "Were should items be inserted?"));
  62. AddComponent(new GadgetConfigDropdownComponent(this, "Insert", param[(int)Core.settingStackRange], param, new Action<string>((s) =>
  63. {
  64. for (int i = 0; i < param.Length; i++)
  65. {
  66. if (param[i] == s)
  67. Core.settingStackRange = (StackRangeEnum)i;
  68. }
  69. g.Config.WriteEnum("StackRange", Core.settingStackRange);
  70. g.Config.Save();
  71. })));
  72. }
  73. }
  74. }
  75. }