Advertisement
ihatetn931

here

Feb 26th, 2020
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.81 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.             fabricatorValue = PlayerPrefs.GetFloat("fabricatorR", 0.016f);
  21.             fabricatorgValue = PlayerPrefs.GetFloat("fabricatorG", 1.000f);
  22.             fabricatorbValue = PlayerPrefs.GetFloat("fabricatorB", 1.000f);
  23.  
  24.             fabricatorColor = PlayerPrefsExtra.GetBool("fabricatorColor", false);
  25.         }
  26.     }
  27.  
  28.     public class Options : ModOptions
  29.     {
  30.         public Options() : base("Fabricator Settings")
  31.         {
  32.             SliderChanged += Options_SliderChanged;
  33.             ToggleChanged += Options_ToggleChanged;
  34.         }
  35.         public void Options_ToggleChanged(object sender, ToggleChangedEventArgs e)
  36.         {
  37.             if (e.Id == "toggleColor")
  38.             {
  39.                 Config.ToggleColor = e.Value;
  40.                 PlayerPrefsExtra.SetBool("ToggleColor", e.Value);
  41.             }
  42.         }
  43.  
  44.         public void Options_SliderChanged(object sender, SliderChangedEventArgs e)
  45.         {
  46.             if (e.Id == "fabricatorr")
  47.             {
  48.                 Config.fabricatorValue = e.Value;
  49.                 PlayerPrefs.SetFloat("FabricatorR", e.Value);
  50.             }
  51.             else if (e.Id == "fabricatorg")
  52.             {
  53.                 Config.fabricatorgValue = e.Value;
  54.                 PlayerPrefs.SetFloat("FabricatorG", e.Value);
  55.             }
  56.             else if (e.Id == "fabricatorb")
  57.             {
  58.                 Config.fabricatorbValue = e.Value;
  59.                 PlayerPrefs.SetFloat("FabricatorB", e.Value);
  60.             }
  61.         }
  62.  
  63.  
  64.         public override void BuildModOptions()
  65.         {
  66.             if ( Config.fabricatorColor)
  67.             {
  68.  
  69.                 AddToggleOption("fabricatorcolor", "ColorFabricator Color Enabled", Config.fabricatorColor);
  70.                 AddSliderOption("fabricatorr", "Fabricator Red", 0, 255, Config.fabricatorValue);
  71.                 AddSliderOption("fabricatorg", "Fabricator Green", 0, 255, Config.fabricatorgValue);
  72.                 AddSliderOption("fabricatorb", "Fabricator Blue", 0, 255, Config.fabricatorbValue);
  73.  
  74.                 Config.Load();
  75.             }
  76.             else
  77.             {
  78.  
  79.                 AddToggleOption("fabricatorcolor", "ColorFabricator Color Enabled", Config.fabricatorColor);
  80.  
  81.                 Config.Load();
  82.             }
  83.         }
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement