diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-06 18:20:23 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-06 18:20:23 +0200 |
commit | 21d31344a151dfe94c79a20b503af55120c63b63 (patch) | |
tree | 6bae89e3532b2ed976a493ff8d6b5b7bfed94221 /src/main/java/cc/polyfrost/oneconfig/test | |
parent | 462d5976f3654f40229ff61391e7e55d0819d82d (diff) | |
download | OneConfig-21d31344a151dfe94c79a20b503af55120c63b63.tar.gz OneConfig-21d31344a151dfe94c79a20b503af55120c63b63.tar.bz2 OneConfig-21d31344a151dfe94c79a20b503af55120c63b63.zip |
rewrite config system
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/test')
4 files changed, 58 insertions, 291 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java b/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java index 3dd74dc..d7575ce 100644 --- a/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java @@ -2,7 +2,7 @@ package cc.polyfrost.oneconfig.test; import cc.polyfrost.oneconfig.gui.elements.BasicButton; import cc.polyfrost.oneconfig.gui.pages.Page; -import cc.polyfrost.oneconfig.renderer.image.SVGs; +import cc.polyfrost.oneconfig.internal.assets.SVGs; import cc.polyfrost.oneconfig.utils.color.ColorPalette; import java.util.ArrayList; diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java index 2d76a0e..8d14fb0 100644 --- a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java @@ -1,289 +1,106 @@ package cc.polyfrost.oneconfig.test; -import cc.polyfrost.oneconfig.config.annotations.ConfigPage; -import cc.polyfrost.oneconfig.config.annotations.Option; +import cc.polyfrost.oneconfig.config.annotations.*; import cc.polyfrost.oneconfig.config.core.OneColor; import cc.polyfrost.oneconfig.config.core.OneKeyBind; import cc.polyfrost.oneconfig.config.data.*; import cc.polyfrost.oneconfig.config.Config; import cc.polyfrost.oneconfig.config.data.ModType; -import cc.polyfrost.oneconfig.config.migration.vigilance.VigilanceMigrator; +import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator; +import gg.essential.universal.UKeyboard; import net.minecraftforge.fml.common.FMLCommonHandler; public class TestConfig extends Config { - @Option( - name = "Very cool HUD", - subcategory = "Test", - type = OptionType.HUD, + @Switch( + name = "Test Switch", size = 2 ) - public static TestHud TestHud = new TestHud(true, 500, 500); + boolean testSwitch = false; - @Option( - name = "This is all still in beta", - subcategory = "Test", - type = OptionType.INFO, - infoType = InfoType.INFO, + @Checkbox( + name = "Check box", size = 2 ) - public static boolean ignored; + boolean testCheckBox = true; - @Option( - name = "Keybind (1x)", - subcategory = "Test", - type = OptionType.KEYBIND - ) - public static OneKeyBind oneKeyBind = new OneKeyBind(18, 80); - - @Option( - name = "Keybind (2x)", - subcategory = "Test", - type = OptionType.KEYBIND, + @Info( + text = "Test Info", + type = InfoType.ERROR, size = 2 ) - public static OneKeyBind oneKeyBind2 = new OneKeyBind(27, 80); - - @Option( - name = "Crash game", - subcategory = "Test", - type = OptionType.BUTTON, - buttonText = "Crash!" - ) - public static Runnable runnable = () -> FMLCommonHandler.instance().exitJava(69, false); + boolean ignored; - @Option( - name = "Crash game", - subcategory = "Test", - type = OptionType.BUTTON, - size = 2, - buttonText = "Crash!" - ) - public static Runnable runnable2 = () -> FMLCommonHandler.instance().exitJava(69, false); - - @Option( - name = "Test color selector", - subcategory = "Test", - type = OptionType.COLOR, + @Header( + text = "Test Header", size = 2 ) - public static OneColor colorTest = new OneColor(126, 137, 42); - - @Option( - name = "Test dual thing", - subcategory = "Test", - min = 3f, max = 127f, - type = OptionType.SLIDER - ) - public static float sliderText; - - @Option( - name = "Test string", - subcategory = "Test", - options = {"NO", "YES"}, - type = OptionType.DUAL_OPTION - ) - public static boolean switchTest1; + boolean ignored1; - @Option( - name = "Test dual option", - subcategory = "Test", - options = {"HI", "BYE"}, - type = OptionType.DUAL_OPTION - ) - public static boolean switchTest2; - - @ConfigPage( - name = "Test Page", - location = PageLocation.TOP + @Dropdown( + name = "Test Dropdown", + options = {"option1", "option2", "option3"}, + size = 2 ) - public static TestPage testPage = new TestPage(); + int testDropdown = 0; - @ConfigPage( - name = "Test Page width description", - description = "Wow, an epic description", - location = PageLocation.BOTTOM + @Color( + name = "Test Color", + size = 2 ) - public static TestPage testPage2 = new TestPage(); + OneColor testColor = new OneColor(0, 255, 255); - @Option( - name = "Test switch", - subcategory = "Other subcategory", - type = OptionType.SWITCH + @Text( + name = "Test Text", + size = 2 ) - public static boolean switchTest4; + String testText = "Epic Text"; - @Option( - name = "Test checkbox", - subcategory = "Other subcategory", - type = OptionType.CHECKBOX + @Button( + name = "Test Button", + text = "Crash game" ) - public static boolean switchTest5; + Runnable runnable = () -> FMLCommonHandler.instance().exitJava(69, false); - @Option( - name = "Favorite food", - subcategory = "Dropdowns", - type = OptionType.DROPDOWN, - category = "Dropdowns", - options = {"Taco", "Pizza", "Hamburger", "Paimon"} + @Slider( + name = "Test Slider", + min = 25, + max = 50 ) - public static int dropdown1; + float testSlider = 50; - @Option( - name = "Favorite food", - subcategory = "Dropdowns", - type = OptionType.DROPDOWN, - category = "Dropdowns", - options = {"Taco", "Pizza", "Hamburger", "Paimon"} + @KeyBind( + name = "Test KeyBind", + size = 2 ) - public static int dropdown2; + OneKeyBind testKeyBind = new OneKeyBind(UKeyboard.KEY_LSHIFT, UKeyboard.KEY_S); - @Option( - name = "Favorite food", - subcategory = "Dropdowns", - type = OptionType.DROPDOWN, - category = "Dropdowns", - size = 2, - options = {"Taco", "Pizza", "Hamburger", "Paimon"} + @DualOption( + name = "Test Dual Option", + left = "YES", + right = "NO", + size = 2 ) - public static int dropdown3; + boolean testDualOption = false; - @Option( - name = "Slider", - subcategory = "Sliders", - type = OptionType.SLIDER, - category = "Sliders", + @Switch( + name = "Test Switch", size = 2, - min = 0, - max = 25 + category = "Category 2" ) - public static int slider1; + boolean testSwitch1 = false; - @Option( - name = "Stepped Slider", - subcategory = "Sliders", - type = OptionType.SLIDER, - category = "Sliders", + @Switch( + name = "Test Switch", size = 2, - min = 0, - max = 30, - step = 2 - ) - public static float slider2; - - @Option( - name = "Slider", - type = OptionType.SLIDER, - category = "subcategory test", - min = 5, - max = 3287 - ) - public static float slider = 26; - - @Option( - name = "Slider", - type = OptionType.SLIDER, - category = "subcategory test", - min = 5, - max = 3287 + category = "Category 2", + subcategory = "Test Subcategory" ) - public static float slider10 = 26; + boolean testSwitch2 = false; - @Option( - name = "Slider", - type = OptionType.SLIDER, - category = "subcategory test", - min = 5, - max = 3287, - subcategory = "Second subcategory" - ) - public static float slider11 = 26; - - @Option( - name = "Header Test", - type = OptionType.HEADER, - category = "subcategory test", - subcategory = "Second subcategory", - size = 2 - ) - public static boolean somethingHere; - - - @Option( - name = "Slider", - type = OptionType.SLIDER, - category = "subcategory test", - min = 5, - max = 3287, - subcategory = "Second subcategory" - ) - public static float slider12 = 26; - - @ConfigPage( - name = "Test page", - location = PageLocation.TOP, - category = "subcategory test", - subcategory = "Second subcategory" - ) - public static TestPage testPage23 = new TestPage(); - - @ConfigPage( - name = "Test page", - location = PageLocation.BOTTOM, - category = "subcategory test", - subcategory = "Second subcategory" - ) - public static TestPage testPage24 = new TestPage(); - - @Option( - name = "Slider", - type = OptionType.SLIDER, - category = "subcategory test", - min = 5, - max = 3287 - ) - public static float slider13 = 26; - - @Option( - name = "Int test", - type = OptionType.SLIDER, - category = "Migrator", - subcategory = "Test", - min = 5, - max = 3287 - ) - public static int testInt = 5; - - @Option( - name = "Float test", - type = OptionType.SLIDER, - category = "Migrator", - subcategory = "Test", - min = 5, - max = 3287 - ) - public static float floatTest = 5f; - - @Option( - name = "Boolean test", - type = OptionType.SWITCH, - category = "Migrator", - subcategory = "Test" - ) - public static boolean booleanTest = false; - - @Option( - name = "String test", - type = OptionType.TEXT, - category = "Migrator", - subcategory = "Test" - ) - public static String stringTest123 = "text"; public TestConfig() { super(new Mod("Test Mod", ModType.UTIL_QOL, new VigilanceMigrator("./config/testConfig.toml")), "hacksConfig.json"); - addDependency("switchTest5", () -> switchTest4); - addDependency("Test page.testDescription", () -> false); } } diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java b/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java index 930d827..0a59c23 100644 --- a/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java @@ -1,7 +1,5 @@ package cc.polyfrost.oneconfig.test; -import cc.polyfrost.oneconfig.config.annotations.Option; -import cc.polyfrost.oneconfig.config.data.OptionType; import cc.polyfrost.oneconfig.hud.TextHud; import net.minecraft.client.Minecraft; @@ -21,15 +19,7 @@ public class TestHud extends TextHud { return lines; } - @Option( - name = "Enable Second Line", - type = OptionType.SWITCH - ) public boolean hasSecondLine = false; - @Option( - name = "Second Line Text", - type = OptionType.TEXT - ) public String secondLine = "Epic text"; } diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java b/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java index c70610a..abb4cc7 100644 --- a/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java @@ -1,44 +1,4 @@ package cc.polyfrost.oneconfig.test; -import cc.polyfrost.oneconfig.config.annotations.Option; -import cc.polyfrost.oneconfig.config.data.OptionType; - public class TestPage { - @Option( - name = "Text field 1x", - subcategory = "Test", - type = OptionType.TEXT - ) - public static String testDescription; - - @Option( - name = "Text field 1x", - subcategory = "Test", - type = OptionType.TEXT - ) - public static String testDescription2; - - @Option( - name = "Text field 2x", - subcategory = "Test", - type = OptionType.TEXT, - size = 2 - ) - public static String testDescription3; - - @Option( - name = "Secure text field", - subcategory = "Test", - type = OptionType.TEXT, - secure = true - ) - public static String testDescription4; - - @Option( - name = "Text box", - subcategory = "Test", - type = OptionType.TEXT, - multiLine = true - ) - public static String testDescription5; } |