Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PanelStudio 0.2.1 #24

Merged
merged 2 commits into from
Oct 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example-mod12/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion example-mod12/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions example-mod16-fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
3 changes: 2 additions & 1 deletion example-mod16-fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions example-mod16-forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion example-mod16-forge/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions example-mod17/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
3 changes: 2 additions & 1 deletion example-mod17/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions example-mod8-fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
3 changes: 2 additions & 1 deletion example-mod8-fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions example-mod8-forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion example-mod8-forge/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.jvmargs = -Xmx2500m
version = 0.2.0
version = 0.2.1

forgeGradle3 = 3.0.195
mappings12 = 39-1.12
Expand Down
2 changes: 1 addition & 1 deletion panelstudio-mc17/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.jvmargs = -Xmx2500m
version = 0.2.0
version = 0.2.1

loomVersion = 0.9.46
minecraft17 = 1.17.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -90,13 +94,33 @@ public class CSGOLayout implements ILayout,IScrollSize {
* @param popupType child util instance
*/
public CSGOLayout (ILabeled label, Point position, int width, int popupWidth, Supplier<Animation> 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> animation, String enabledButton, boolean horizontal, boolean moduleColumn, int columnWidth, int weight, ChildMode colorType, PopupTuple popupType) {
this.label=label;
this.position=position;
this.width=width;
this.animation=animation;
this.enabledButton=enabledButton;
this.horizontal=horizontal;
this.moduleColumn=moduleColumn;
this.columnWidth=columnWidth;
this.weight=weight;
this.colorType=colorType;
util=new ChildUtil(popupWidth,animation,popupType);
Expand All @@ -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() {
Expand All @@ -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;
Expand Down Expand Up @@ -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<ScrollBarComponent<Void,IComponent>> wrapColumn (IComponent button, ThemeTuple theme, int weight) {
protected HorizontalComponent<ScrollBarComponent<Void,IComponent>> wrapColumn (IComponent button, ThemeTuple theme, int width, int weight) {
return new HorizontalComponent<ScrollBarComponent<Void,IComponent>>(new ScrollBarComponent<Void,IComponent>(button,theme.getScrollBarRenderer(Void.class),theme.getEmptySpaceRenderer(Void.class,false),theme.getEmptySpaceRenderer(Void.class,true)) {
@Override
public int getScrollHeight (Context context, int componentHeight) {
Expand All @@ -282,7 +307,7 @@ public int getScrollHeight (Context context, int componentHeight) {
protected Void getState() {
return null;
}
},0,weight);
},width,weight);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public ChildUtil (int width, Supplier<Animation> animation, PopupTuple popupType
* @param theme the theme to be used
* @param mode the child mode to be used
*/
protected <T> void addContainer (ILabeled label, IComponent title, IComponent container, Supplier<T> state, Class<T> stateClass, VerticalContainer parent, IComponentAdder gui, ThemeTuple theme, ChildMode mode) {
public <T> void addContainer (ILabeled label, IComponent title, IComponent container, Supplier<T> state, Class<T> 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:
Expand All @@ -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
Expand Down