Skip to content

Commit

Permalink
Minor fixes and adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
lukflug committed Apr 19, 2021
1 parent 1b455b9 commit ab97639
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ minecraft16fabric = 1.16.5
mappings16fabric = 1.16.5+build.4

mappings16forge = 1.16.5
minecraft16forge = 1.16.5-36.0.46
minecraft16forge = 1.16.5-36.1.0

minecraft8fabric = 1.8.9
mappings8fabric = 1.8.9+build.202102062228
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.lukflug.panelstudio.setting.IEnumSetting;
import com.lukflug.panelstudio.setting.ILabeled;
import com.lukflug.panelstudio.setting.ISetting;
import com.lukflug.panelstudio.setting.Labeled;
import com.lukflug.panelstudio.theme.ITheme;
import com.lukflug.panelstudio.theme.ThemeTuple;
import com.lukflug.panelstudio.widget.Button;
Expand All @@ -33,16 +34,18 @@ public class CSGOLayout implements ILayout,IScrollSize {
protected Point position;
protected int width;
protected Supplier<Animation> animation;
protected String enabledButton;
protected boolean horizontal,moduleColumn;
protected int weight;
protected ChildMode colorType;
protected ChildUtil util;

public CSGOLayout (ILabeled label, Point position, int width, int popupWidth, Supplier<Animation> animation, boolean horizontal, boolean moduleColumn, int weight, ChildMode colorType, PopupTuple popupType) {
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=label;
this.position=position;
this.width=width;
this.animation=animation;
this.enabledButton=enabledButton;
this.horizontal=horizontal;
this.moduleColumn=moduleColumn;
this.weight=weight;
Expand All @@ -53,7 +56,7 @@ public CSGOLayout (ILabeled label, Point position, int width, int popupWidth, Su
@Override
public void populateGUI (IComponentAdder gui, IComponentGenerator components, IClient client, ITheme theme) {
Button title=new Button(label,theme.getButtonRenderer(Void.class,0,0,true));
HorizontalContainer window=new HorizontalContainer(label,theme.getContainerRenderer(0,0,true));
HorizontalContainer window=new HorizontalContainer(label,theme.getContainerRenderer(0,horizontal?1:0,true));
IEnumSetting catSelect;
if (horizontal) {
VerticalContainer container=new VerticalContainer(label,theme.getContainerRenderer(0,0,false));
Expand All @@ -66,10 +69,11 @@ public void populateGUI (IComponentAdder gui, IComponentGenerator components, IC
}
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,1,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),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());
if (module.isEnabled()!=null) container.addComponent(new ToggleButton(new Labeled(enabledButton,null,()->true),module.isEnabled(),theme.getButtonRenderer(Boolean.class,1,2,false)));
module.getSettings().forEach(setting->addSettingsComponent(setting,container,gui,components,new ThemeTuple(theme,2,2)));
});
} else {
Expand Down

0 comments on commit ab97639

Please sign in to comment.