shift + click/ctrl to go to prev category
This commit is contained in:
parent
5d9b8c9e5b
commit
a8d188d641
2 changed files with 23 additions and 3 deletions
|
|
@ -39,4 +39,8 @@ public enum ModifierCategory {
|
|||
return values()[(this.ordinal() + 1) % values().length];
|
||||
}
|
||||
|
||||
public ModifierCategory previous() {
|
||||
return values()[(this.ordinal() + values().length - 1) % values().length];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,12 +235,18 @@ public class GearModifierScreen extends AbstractElementScreen {
|
|||
this.addElement(btnPlus);
|
||||
}
|
||||
|
||||
private void cycleModifierCategories() {
|
||||
private void nextModifierCategory() {
|
||||
this.modifierCategory = modifierCategory.next();
|
||||
updateModifierCategoryButtonLabel();
|
||||
updateModifierList(true);
|
||||
}
|
||||
|
||||
private void previousModifierCategory() {
|
||||
this.modifierCategory = modifierCategory.previous();
|
||||
updateModifierCategoryButtonLabel();
|
||||
updateModifierList(true);
|
||||
}
|
||||
|
||||
private void updateModifierCategoryButtonLabel() {
|
||||
if (this.modifierCategoryLabel != null) {
|
||||
this.removeElement(this.modifierCategoryLabel);
|
||||
|
|
@ -255,7 +261,13 @@ public class GearModifierScreen extends AbstractElementScreen {
|
|||
updateModifierCategoryButtonLabel();
|
||||
NineSliceButtonElement<?> btnLegend =
|
||||
new NineSliceButtonElement<>(Spatials.positionXY(this.getGuiSpatial().width() - 8 - 13, 35).size(14, 14),
|
||||
ScreenTextures.BUTTON_EMPTY_TEXTURES, this::cycleModifierCategories).layout(this.translateWorldSpatial());
|
||||
ScreenTextures.BUTTON_EMPTY_TEXTURES, () -> {
|
||||
if (hasShiftDown()) {
|
||||
previousModifierCategory();
|
||||
} else {
|
||||
nextModifierCategory();
|
||||
}
|
||||
}).layout(this.translateWorldSpatial());
|
||||
this.addElement(btnLegend);
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +320,11 @@ public class GearModifierScreen extends AbstractElementScreen {
|
|||
}
|
||||
// ctrl to change modifier category (normal, greater, legendary)
|
||||
if (keyCode == InputConstants.KEY_LCONTROL || keyCode == InputConstants.KEY_RCONTROL) {
|
||||
cycleModifierCategories();
|
||||
if (hasShiftDown()) {
|
||||
previousModifierCategory();
|
||||
} else {
|
||||
nextModifierCategory();
|
||||
}
|
||||
}
|
||||
return super.keyPressed(keyCode, scanCode, modifiers);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue