Advertisement
Guest User

options

a guest
Feb 26th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. namespace COLORFABRICATOR
  2. {
  3. public static class Config
  4. {
  5. public static SerializableColor FabricatorColor = new Color(0.016f, 1.0f, 1.0f);
  6. public static float rValue;
  7. public static float gValue;
  8. public static float bValue;
  9. public static float fabricatorValue;
  10. public static float fabricatorgValue;
  11. public static float fabricatorbValue;
  12.  
  13. public static bool ToggleColor;
  14.  
  15. public static bool fabricatorColor;
  16.  
  17. public static void Load()
  18. {
  19.  
  20. rValue = PlayerPrefs.GetFloat("R", 0.016f);
  21. gValue = PlayerPrefs.GetFloat("G", 1.000f);
  22. bValue = PlayerPrefs.GetFloat("B", 1.000f);
  23. fabricatorValue = PlayerPrefs.GetFloat("fabricatorR", 0.016f);
  24. fabricatorgValue = PlayerPrefs.GetFloat("fabricatorG", 1.000f);
  25. fabricatorbValue = PlayerPrefs.GetFloat("fabricatorB", 1.000f);
  26.  
  27. ToggleColor = PlayerPrefsExtra.GetBool("ToggleColor", false);
  28. fabricatorColor = PlayerPrefsExtra.GetBool("fabricatorColor", false);
  29. }
  30. }
  31.  
  32. public class Options : ModOptions
  33. {
  34. public Options() : base("Fabricator Settings")
  35. {
  36. SliderChanged += Options_SliderChanged;
  37. ToggleChanged += Options_ToggleChanged;
  38. }
  39. public void Options_ToggleChanged(object sender, ToggleChangedEventArgs e)
  40. {
  41. if (e.Id == "toggleColor")
  42. {
  43. Config.ToggleColor = e.Value;
  44. PlayerPrefsExtra.SetBool("ToggleColor", e.Value);
  45. }
  46. else if (e.Id == "seaglidecolor")
  47. {
  48. Config.fabricatorColor = e.Value;
  49. PlayerPrefsExtra.SetBool("FabricatorColor", e.Value);
  50. }
  51. }
  52.  
  53. public void Options_SliderChanged(object sender, SliderChangedEventArgs e)
  54. {
  55. if (e.Id == "r")
  56. {
  57. Config.rValue = e.Value;
  58. PlayerPrefs.SetFloat("R", e.Value);
  59. }
  60. else if (e.Id == "g")
  61. {
  62. Config.gValue = e.Value;
  63. PlayerPrefs.SetFloat("G", e.Value);
  64. }
  65. else if (e.Id == "b")
  66. {
  67. Config.bValue = e.Value;
  68. PlayerPrefs.SetFloat("B", e.Value);
  69. }
  70.  
  71.  
  72. if (e.Id == "fabricatorr")
  73. {
  74. Config.fabricatorValue = e.Value;
  75. PlayerPrefs.SetFloat("FabricatorR", e.Value);
  76. }
  77. else if (e.Id == "fabricatorg")
  78. {
  79. Config.fabricatorgValue = e.Value;
  80. PlayerPrefs.SetFloat("FabricatorG", e.Value);
  81. }
  82. else if (e.Id == "fabricatorb")
  83. {
  84. Config.fabricatorbValue = e.Value;
  85. PlayerPrefs.SetFloat("FabricatorB", e.Value);
  86. }
  87. }
  88.  
  89.  
  90. public override void BuildModOptions()
  91. {
  92. if (Config.ToggleColor && Config.fabricatorColor == false)
  93. {
  94.  
  95. AddToggleOption("fabricatorcolor", "ColorFabricator Color Enabled", Config.fabricatorColor);
  96. AddSliderOption("r", "Red", 0, 255, Config.rValue);
  97. AddSliderOption("g", "Green", 0, 255, Config.gValue);
  98. AddSliderOption("b", "Blue", 0, 255, Config.bValue);
  99.  
  100. Config.Load();
  101. }
  102. else if (Config.fabricatorColor && Config.ToggleColor == false)
  103. {
  104.  
  105. AddToggleOption("fabricatorcolor", "ColorFabricator Color Enabled", Config.fabricatorColor);
  106.  
  107. AddSliderOption("fabricatorr", "Fabricator Red", 0, 255, Config.fabricatorValue);
  108. AddSliderOption("fabricatorg", "Fabricator Green", 0, 255, Config.fabricatorgValue);
  109. AddSliderOption("fabricatorb", "Fabricator Blue", 0, 255, Config.fabricatorbValue);
  110. Config.Load();
  111. }
  112. else if (Config.ToggleColor && Config.fabricatorColor)
  113. {
  114.  
  115. AddToggleOption("fabricatorcolor", "ColorFabricator Color Enabled", Config.fabricatorColor);
  116. AddSliderOption("r", "Red", 0, 255, Config.rValue);
  117. AddSliderOption("g", "Green", 0, 255, Config.gValue);
  118. AddSliderOption("b", "Blue", 0, 255, Config.bValue);
  119. AddSliderOption("fabricatorr", "Fabricator Red", 0, 255, Config.fabricatorValue);
  120. AddSliderOption("fabricatorg", "Fabricator Green", 0, 255, Config.fabricatorgValue);
  121. AddSliderOption("fabricatorb", "Fabricator Blue", 0, 255, Config.fabricatorbValue);
  122.  
  123. }
  124. else
  125. {
  126.  
  127. AddToggleOption("fabricatorcolor", "ColorFabricator Color Enabled", Config.fabricatorColor);
  128.  
  129. Config.Load();
  130. }
  131. }
  132. }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement