From c5f27d5f5e78e1b18f46859e9421341404dad92b Mon Sep 17 00:00:00 2001 From: lukflug Date: Sun, 3 Oct 2021 17:23:16 +0200 Subject: [PATCH 1/2] Version bump --- example-mod12/build.gradle | 4 ++-- example-mod12/gradle.properties | 3 ++- example-mod16-fabric/build.gradle | 4 ++-- example-mod16-fabric/gradle.properties | 3 ++- example-mod16-forge/build.gradle | 4 ++-- example-mod16-forge/gradle.properties | 3 ++- example-mod17/build.gradle | 4 ++-- example-mod17/gradle.properties | 3 ++- example-mod8-fabric/build.gradle | 4 ++-- example-mod8-fabric/gradle.properties | 3 ++- example-mod8-forge/build.gradle | 4 ++-- example-mod8-forge/gradle.properties | 3 ++- gradle.properties | 2 +- panelstudio-mc17/gradle.properties | 2 +- 14 files changed, 26 insertions(+), 20 deletions(-) diff --git a/example-mod12/build.gradle b/example-mod12/build.gradle index ca4c530..3ec6521 100644 --- a/example-mod12/build.gradle +++ b/example-mod12/build.gradle @@ -46,7 +46,7 @@ minecraft { dependencies { minecraft "net.minecraftforge:forge:${minecraft12}" shadow "com.lukflug:panelstudio:${version}" - shadow "com.lukflug:panelstudio-mc12:${version}" + shadow "com.lukflug:panelstudio-mc12:${versionmc}" } processResources { @@ -63,7 +63,7 @@ processResources { shadowJar { classifier = "" configurations = [project.configurations.shadow] - relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_0" + relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_1" } reobf { diff --git a/example-mod12/gradle.properties b/example-mod12/gradle.properties index fdbad57..1e54794 100644 --- a/example-mod12/gradle.properties +++ b/example-mod12/gradle.properties @@ -1,5 +1,6 @@ org.gradle.jvmargs = -Xmx2500m -version = 0.2.0 +version = 0.2.1 +versionmc = 0.2.0 forgeGradle3 = 3.0.195 mappings12 = 39-1.12 diff --git a/example-mod16-fabric/build.gradle b/example-mod16-fabric/build.gradle index cdab7ee..5b80547 100644 --- a/example-mod16-fabric/build.gradle +++ b/example-mod16-fabric/build.gradle @@ -43,7 +43,7 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${loader16fabric}" modImplementation "net.fabricmc.fabric-api:fabric-api:${api16fabric}" shadow "com.lukflug:panelstudio:${version}" - shadow "com.lukflug:panelstudio-mc16-fabric:${version}" + shadow "com.lukflug:panelstudio-mc16-fabric:${versionmc}" } processResources { @@ -56,7 +56,7 @@ processResources { shadowJar { classifier = "dev" configurations = [project.configurations.shadow] - relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_0" + relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_1" } remapJar.dependsOn(shadowJar) diff --git a/example-mod16-fabric/gradle.properties b/example-mod16-fabric/gradle.properties index 32da969..fa33718 100644 --- a/example-mod16-fabric/gradle.properties +++ b/example-mod16-fabric/gradle.properties @@ -1,5 +1,6 @@ org.gradle.jvmargs = -Xmx2500m -version = 0.2.0 +version = 0.2.1 +versionmc = 0.2.0 loomVersion = 0.7.33 minecraft16fabric = 1.16.5 diff --git a/example-mod16-forge/build.gradle b/example-mod16-forge/build.gradle index b67d997..7277396 100644 --- a/example-mod16-forge/build.gradle +++ b/example-mod16-forge/build.gradle @@ -53,7 +53,7 @@ minecraft { dependencies { minecraft "net.minecraftforge:forge:${minecraft16forge}" shadow "com.lukflug:panelstudio:${version}" - extract "com.lukflug:panelstudio-mc16-forge:${version}" + extract "com.lukflug:panelstudio-mc16-forge:${versionmc}" } processResources { @@ -73,7 +73,7 @@ compileJava.finalizedBy("extract") shadowJar { classifier = "" configurations = [project.configurations.shadow] - relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_0" + relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_1" } reobf { diff --git a/example-mod16-forge/gradle.properties b/example-mod16-forge/gradle.properties index bfbd232..068b483 100644 --- a/example-mod16-forge/gradle.properties +++ b/example-mod16-forge/gradle.properties @@ -1,5 +1,6 @@ org.gradle.jvmargs = -Xmx2500m -version = 0.2.0 +version = 0.2.1 +versionmc = 0.2.0 forgeGradle5 = 5.1.20 mappings16forge = 20210309-1.16.5 diff --git a/example-mod17/build.gradle b/example-mod17/build.gradle index 1563f83..03d68a7 100644 --- a/example-mod17/build.gradle +++ b/example-mod17/build.gradle @@ -38,7 +38,7 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${loader17}" modImplementation "net.fabricmc.fabric-api:fabric-api:${api17}" shadow "com.lukflug:panelstudio:${version}" - shadow "com.lukflug:panelstudio-mc17:${version}" + shadow "com.lukflug:panelstudio-mc17:${versionmc}" } processResources { @@ -51,7 +51,7 @@ processResources { shadowJar { classifier = "dev" configurations = [project.configurations.shadow] - relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_0" + relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_1" } remapJar.dependsOn(shadowJar) diff --git a/example-mod17/gradle.properties b/example-mod17/gradle.properties index ed950ad..366584c 100644 --- a/example-mod17/gradle.properties +++ b/example-mod17/gradle.properties @@ -1,5 +1,6 @@ org.gradle.jvmargs = -Xmx2500m -version = 0.2.0 +version = 0.2.1 +versionmc = 0.2.0 loomVersion = 0.9.46 minecraft17 = 1.17.1 diff --git a/example-mod8-fabric/build.gradle b/example-mod8-fabric/build.gradle index b4bcd77..fcb3104 100644 --- a/example-mod8-fabric/build.gradle +++ b/example-mod8-fabric/build.gradle @@ -53,7 +53,7 @@ dependencies { } modImplementation "net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${api8fabric}" shadow "com.lukflug:panelstudio:${version}" - shadow "com.lukflug:panelstudio-mc8-fabric:${version}" + shadow "com.lukflug:panelstudio-mc8-fabric:${versionmc}" } processResources { @@ -66,7 +66,7 @@ processResources { shadowJar { classifier = "dev" configurations = [project.configurations.shadow] - relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_0" + relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_1" } remapJar.dependsOn(shadowJar) diff --git a/example-mod8-fabric/gradle.properties b/example-mod8-fabric/gradle.properties index 4a73e1d..82fb14e 100644 --- a/example-mod8-fabric/gradle.properties +++ b/example-mod8-fabric/gradle.properties @@ -1,5 +1,6 @@ org.gradle.jvmargs = -Xmx2500m -version = 0.2.0 +version = 0.2.1 +versionmc = 0.2.0 loomVersion = 0.7.33 minecraft8fabric = 1.8.9 diff --git a/example-mod8-forge/build.gradle b/example-mod8-forge/build.gradle index 7a03e95..194aa7f 100644 --- a/example-mod8-forge/build.gradle +++ b/example-mod8-forge/build.gradle @@ -48,7 +48,7 @@ minecraft { dependencies { shadow "com.lukflug:panelstudio:${version}" - shadow "com.lukflug:panelstudio-mc8-forge:${version}" + shadow "com.lukflug:panelstudio-mc8-forge:${versionmc}" } processResources { @@ -66,7 +66,7 @@ processResources { shadowJar { classifier = "" configurations = [project.configurations.shadow] - relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_0" + relocate "com.lukflug.panelstudio","com.lukflug.panelstudio_0_2_1" } reobf { diff --git a/example-mod8-forge/gradle.properties b/example-mod8-forge/gradle.properties index 832c5b9..3bbad5a 100644 --- a/example-mod8-forge/gradle.properties +++ b/example-mod8-forge/gradle.properties @@ -1,5 +1,6 @@ org.gradle.jvmargs = -Xmx2500m -version = 0.2.0 +version = 0.2.1 +versionmc = 0.2.0 forgeGradle2 = 2.1.2 mappings8forge = stable_22 diff --git a/gradle.properties b/gradle.properties index e86684c..af3b09d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs = -Xmx2500m -version = 0.2.0 +version = 0.2.1 forgeGradle3 = 3.0.195 mappings12 = 39-1.12 diff --git a/panelstudio-mc17/gradle.properties b/panelstudio-mc17/gradle.properties index 1b3716b..3502f1f 100644 --- a/panelstudio-mc17/gradle.properties +++ b/panelstudio-mc17/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs = -Xmx2500m -version = 0.2.0 +version = 0.2.1 loomVersion = 0.9.46 minecraft17 = 1.17.1 From 990ce83a3045ed55bbaf6fa3902f44ed4526b2fc Mon Sep 17 00:00:00 2001 From: lukflug Date: Sun, 3 Oct 2021 19:17:45 +0200 Subject: [PATCH 2/2] Added some CategoryCSGO options --- .../com/lukflug/examplemod12/ExampleMod.java | 2 +- .../lukflug/examplemod8forge/ExampleMod.java | 2 +- .../panelstudio/layout/CSGOLayout.java | 37 ++++++++++++++++--- .../lukflug/panelstudio/layout/ChildUtil.java | 14 ++++++- 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/example-mod12/src/main/java/com/lukflug/examplemod12/ExampleMod.java b/example-mod12/src/main/java/com/lukflug/examplemod12/ExampleMod.java index 3cff2e9..bb475cb 100644 --- a/example-mod12/src/main/java/com/lukflug/examplemod12/ExampleMod.java +++ b/example-mod12/src/main/java/com/lukflug/examplemod12/ExampleMod.java @@ -23,7 +23,7 @@ public class ExampleMod { public static final String MODID="example-mod12"; public static final String NAME="PanelStudio-MC12 Example Mod"; - public static final String VERSION="0.2.0"; + public static final String VERSION="0.2.1"; public static Logger logger; private static ClickGUI gui; diff --git a/example-mod8-forge/src/main/java/com/lukflug/examplemod8forge/ExampleMod.java b/example-mod8-forge/src/main/java/com/lukflug/examplemod8forge/ExampleMod.java index 0fbabce..2e73731 100644 --- a/example-mod8-forge/src/main/java/com/lukflug/examplemod8forge/ExampleMod.java +++ b/example-mod8-forge/src/main/java/com/lukflug/examplemod8forge/ExampleMod.java @@ -23,7 +23,7 @@ public class ExampleMod { public static final String MODID="example-mod8-forge"; public static final String NAME="PanelStudio-MC8-Forge Example Mod"; - public static final String VERSION="0.2.0"; + public static final String VERSION="0.2.1"; public static Logger logger; private static ClickGUI gui; diff --git a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/CSGOLayout.java b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/CSGOLayout.java index 35655a9..5db2e74 100644 --- a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/CSGOLayout.java +++ b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/CSGOLayout.java @@ -62,6 +62,10 @@ public class CSGOLayout implements ILayout,IScrollSize { * Whether settings are in a separate column. */ protected boolean moduleColumn; + /** + * The width of the category column. + */ + protected int columnWidth; /** * The weight of the settings column. */ @@ -90,6 +94,25 @@ public class CSGOLayout implements ILayout,IScrollSize { * @param popupType child util instance */ public CSGOLayout (ILabeled label, Point position, int width, int popupWidth, Supplier animation, String enabledButton, boolean horizontal, boolean moduleColumn, int weight, ChildMode colorType, PopupTuple popupType) { + this(label,position,width,popupWidth,animation,enabledButton,horizontal,moduleColumn,-1,weight,colorType,popupType); + } + + /** + * Constructor. + * @param label panel label + * @param position panel position + * @param width panel width + * @param popupWidth pop-up width + * @param animation animation supplier + * @param enabledButton title for module toggles + * @param horizontal whether tab list is horizontal + * @param moduleColumn whether settings are in a separate column + * @param columnWidth the width of the category column + * @param weight weight of the module column + * @param colorType child mode to use for setting components that are containers (e.g. color components) + * @param popupType child util instance + */ + public CSGOLayout (ILabeled label, Point position, int width, int popupWidth, Supplier animation, String enabledButton, boolean horizontal, boolean moduleColumn, int columnWidth, int weight, ChildMode colorType, PopupTuple popupType) { this.label=label; this.position=position; this.width=width; @@ -97,6 +120,7 @@ public CSGOLayout (ILabeled label, Point position, int width, int popupWidth, Su this.enabledButton=enabledButton; this.horizontal=horizontal; this.moduleColumn=moduleColumn; + this.columnWidth=columnWidth; this.weight=weight; this.colorType=colorType; util=new ChildUtil(popupWidth,animation,popupType); @@ -113,15 +137,15 @@ public void populateGUI (IComponentAdder gui, IComponentGenerator components, IC container.addComponent(window); gui.addComponent(title,container,new ThemeTuple(theme,0,0),position,width,animation); } else { - catSelect=addContainer(label,client.getCategories().map(cat->cat),window,new ThemeTuple(theme,0,1),false,button->wrapColumn(button,new ThemeTuple(theme,0,1),1),()->true); + catSelect=addContainer(label,client.getCategories().map(cat->cat),window,new ThemeTuple(theme,0,1),false,button->wrapColumn(button,new ThemeTuple(theme,0,1),columnWidth>0?columnWidth:0,columnWidth>0?0:1),()->true); gui.addComponent(title,window,new ThemeTuple(theme,0,0),position,width,animation); } client.getCategories().forEach(category->{ if (moduleColumn) { - IEnumSetting modSelect=addContainer(category,category.getModules().map(mod->mod),window,new ThemeTuple(theme,1,1),false,button->wrapColumn(button,new ThemeTuple(theme,0,1),1),()->catSelect.getValueName()==category.getDisplayName()); + IEnumSetting modSelect=addContainer(category,category.getModules().map(mod->mod),window,new ThemeTuple(theme,1,1),false,button->wrapColumn(button,new ThemeTuple(theme,0,1),0,1),()->catSelect.getValueName()==category.getDisplayName()); category.getModules().forEach(module->{ VerticalContainer container=new VerticalContainer(module,theme.getContainerRenderer(1,1,false)); - window.addComponent(wrapColumn(container,new ThemeTuple(theme,1,1),weight),()->catSelect.getValueName()==category.getDisplayName()&&modSelect.getValueName()==module.getDisplayName()); + window.addComponent(wrapColumn(container,new ThemeTuple(theme,1,1),0,weight),()->catSelect.getValueName()==category.getDisplayName()&&modSelect.getValueName()==module.getDisplayName()); if (module.isEnabled()!=null) container.addComponent(components.getComponent(new IBooleanSetting() { @Override public String getDisplayName() { @@ -142,7 +166,7 @@ public boolean isOn() { }); } else { VerticalContainer categoryContent=new VerticalContainer(category,theme.getContainerRenderer(0,1,false)); - window.addComponent(wrapColumn(categoryContent,new ThemeTuple(theme,0,1),1),()->catSelect.getValueName()==category.getDisplayName()); + window.addComponent(wrapColumn(categoryContent,new ThemeTuple(theme,0,1),0,weight),()->catSelect.getValueName()==category.getDisplayName()); category.getModules().forEach(module->{ int graphicalLevel=1; FocusableComponent moduleTitle; @@ -268,10 +292,11 @@ protected boolean isDownKey (int key) { * Wrap content in a scrollable horizontal component to be added as a column. * @param button the content container * @param theme the theme to be used + * @param width the horizontal width * @param weight the horizontal weight * @return a horizontal component */ - protected HorizontalComponent> wrapColumn (IComponent button, ThemeTuple theme, int weight) { + protected HorizontalComponent> wrapColumn (IComponent button, ThemeTuple theme, int width, int weight) { return new HorizontalComponent>(new ScrollBarComponent(button,theme.getScrollBarRenderer(Void.class),theme.getEmptySpaceRenderer(Void.class,false),theme.getEmptySpaceRenderer(Void.class,true)) { @Override public int getScrollHeight (Context context, int componentHeight) { @@ -282,7 +307,7 @@ public int getScrollHeight (Context context, int componentHeight) { protected Void getState() { return null; } - },0,weight); + },width,weight); } /** diff --git a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/ChildUtil.java b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/ChildUtil.java index ce4e097..f1198cd 100644 --- a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/ChildUtil.java +++ b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/ChildUtil.java @@ -63,13 +63,13 @@ public ChildUtil (int width, Supplier animation, PopupTuple popupType * @param theme the theme to be used * @param mode the child mode to be used */ - protected void addContainer (ILabeled label, IComponent title, IComponent container, Supplier state, Class stateClass, VerticalContainer parent, IComponentAdder gui, ThemeTuple theme, ChildMode mode) { + public void addContainer (ILabeled label, IComponent title, IComponent container, Supplier state, Class stateClass, VerticalContainer parent, IComponentAdder gui, ThemeTuple theme, ChildMode mode) { IFixedComponent popup; IToggleable toggle; boolean drawTitle=mode==ChildMode.DRAG_POPUP; switch (mode) { case DOWN: - parent.addComponent(new ClosableComponent<>(title,container,state,new AnimatedToggleable(new SimpleToggleable(false),animation.get()),theme.getPanelRenderer(stateClass),false)); + parent.addComponent(new ClosableComponent<>(title,container,state,getAnimatedToggleable(animation.get()),theme.getPanelRenderer(stateClass),false)); break; case POPUP: case DRAG_POPUP: @@ -92,6 +92,16 @@ public void handleButton (Context context, int button) { } } + /** + * Get animated toggleable. + * @param animation the animation to be used + * @return the animated toggleable to be used + */ + protected AnimatedToggleable getAnimatedToggleable (Animation animation) { + return new AnimatedToggleable(new SimpleToggleable(false),animation); + } + + /** * Enum listing the ways a child component can be added. * @author lukflug