help
This commit is contained in:
parent
ef0bfec587
commit
e758d2b787
3 changed files with 156 additions and 0 deletions
|
|
@ -188,6 +188,8 @@ dependencies {
|
|||
implementation fg.deobf("curse.maven:alexs-mobs-426558:3853078") // wold plushie effects
|
||||
implementation fg.deobf("curse.maven:citadel-331936:3783096") // alex mobs dep
|
||||
|
||||
implementation fg.deobf("curse.maven:create-328085:4550986") // config
|
||||
|
||||
//faster loading
|
||||
implementation fg.deobf("curse.maven:lazydfu-433518:3209972")
|
||||
implementation fg.deobf("curse.maven:modernfix-790626:4565795")
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
package com.radimous.vhatcaniroll.ui;
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import com.radimous.vhatcaniroll.Config;
|
||||
import com.radimous.vhatcaniroll.logic.Items;
|
||||
|
||||
import com.radimous.vhatcaniroll.logic.ModifierCategory;
|
||||
import com.simibubi.create.foundation.config.ui.SubMenuConfigScreen;
|
||||
import iskallia.vault.client.gui.framework.ScreenRenderers;
|
||||
import iskallia.vault.client.gui.framework.ScreenTextures;
|
||||
import iskallia.vault.client.gui.framework.element.ButtonElement;
|
||||
import iskallia.vault.client.gui.framework.element.FakeItemSlotElement;
|
||||
import iskallia.vault.client.gui.framework.element.LabelElement;
|
||||
import iskallia.vault.client.gui.framework.element.NineSliceButtonElement;
|
||||
|
|
@ -14,6 +17,8 @@ import iskallia.vault.client.gui.framework.element.TabElement;
|
|||
import iskallia.vault.client.gui.framework.element.TextureAtlasElement;
|
||||
import iskallia.vault.client.gui.framework.element.spi.ILayoutStrategy;
|
||||
import iskallia.vault.client.gui.framework.render.ScreenTooltipRenderer;
|
||||
import iskallia.vault.client.gui.framework.render.TooltipDirection;
|
||||
import iskallia.vault.client.gui.framework.render.Tooltips;
|
||||
import iskallia.vault.client.gui.framework.screen.AbstractElementScreen;
|
||||
import iskallia.vault.client.gui.framework.screen.layout.ScreenLayout;
|
||||
import iskallia.vault.client.gui.framework.spatial.Spatials;
|
||||
|
|
@ -25,6 +30,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -36,6 +42,7 @@ public class GearModifierScreen extends AbstractElementScreen {
|
|||
private final ScrollableLvlInputElement lvlInput;
|
||||
private ModifierCategory modifierCategory = ModifierCategory.NORMAL;
|
||||
private LabelElement<?> modifierCategoryLabel;
|
||||
private HelpContainer helpContainer;
|
||||
|
||||
private int currIndex = 0;
|
||||
private final List<TabElement<?>> tabs = new ArrayList<>();
|
||||
|
|
@ -71,11 +78,17 @@ public class GearModifierScreen extends AbstractElementScreen {
|
|||
|
||||
createLvlButtons(lvlInput);
|
||||
createModifierCategoryButton();
|
||||
createConfigButton();
|
||||
|
||||
// inner black window
|
||||
ISpatial modListSpatial = Spatials.positionXY(7, 50).size(this.getGuiSpatial().width() - 14, this.getGuiSpatial().height() - 57);
|
||||
this.modifierList = new ModifierListContainer(modListSpatial, lvlInput.getValue(), modifierCategory, getCurrGear()).layout(this.translateWorldSpatial());
|
||||
this.addElement(this.modifierList);
|
||||
|
||||
// help container will overlay the modifier list
|
||||
this.helpContainer = new HelpContainer(Spatials.positionXY(0, 0).size(0, 0), this.getGuiSpatial());
|
||||
createHelpButton(helpContainer);
|
||||
this.addElement(helpContainer);
|
||||
}
|
||||
|
||||
// helper methods
|
||||
|
|
@ -244,6 +257,28 @@ public class GearModifierScreen extends AbstractElementScreen {
|
|||
this.addElement(btnLegend);
|
||||
}
|
||||
|
||||
private void createConfigButton(){
|
||||
this.addElement(new ButtonElement<>(Spatials.positionXY(-3, 3), ScreenTextures.BUTTON_HISTORY_TEXTURES, () -> {
|
||||
SubMenuConfigScreen screen = new SubMenuConfigScreen(this, "VHat Can I Roll? Configuration", ModConfig.Type.CLIENT, Config.SPEC, Config.SPEC.getValues());
|
||||
Minecraft.getInstance().setScreen(screen);
|
||||
|
||||
})).layout((screen, gui, parent, world) -> {
|
||||
world.width(21).height(21).translateX(gui.left() - 18).translateY(this.getGuiSpatial().bottom() - 26);
|
||||
}).tooltip(
|
||||
Tooltips.single(TooltipDirection.LEFT,() -> new TextComponent("Configuration"))
|
||||
);
|
||||
}
|
||||
|
||||
private void createHelpButton(HelpContainer hc) {
|
||||
this.addElement(new ButtonElement<>(Spatials.positionXY(-3, 3), ScreenTextures.BUTTON_QUEST_TEXTURES, () -> {
|
||||
hc.setVisible(!hc.isVisible());
|
||||
})).layout((screen, gui, parent, world) -> {
|
||||
world.width(21).height(21).translateX(gui.left() - 18).translateY(this.getGuiSpatial().bottom() - 48);
|
||||
}).tooltip(
|
||||
Tooltips.single(TooltipDirection.LEFT, () -> new TextComponent("Help"))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||
// left/right to increase/decrease lvl
|
||||
|
|
|
|||
119
src/main/java/com/radimous/vhatcaniroll/ui/HelpContainer.java
Normal file
119
src/main/java/com/radimous/vhatcaniroll/ui/HelpContainer.java
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
package com.radimous.vhatcaniroll.ui;
|
||||
|
||||
import com.radimous.vhatcaniroll.logic.ModifierCategory;
|
||||
import iskallia.vault.client.gui.framework.element.ContainerElement;
|
||||
import iskallia.vault.client.gui.framework.element.LabelElement;
|
||||
import iskallia.vault.client.gui.framework.spatial.Spatials;
|
||||
import iskallia.vault.client.gui.framework.spatial.spi.ISpatial;
|
||||
import iskallia.vault.client.gui.framework.text.LabelTextStyle;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
public class HelpContainer extends ContainerElement<HelpContainer> {
|
||||
public HelpContainer(ISpatial spatial, ISpatial parentSpatial) {
|
||||
// TODO: make this size agnostic
|
||||
super(spatial);
|
||||
this.setVisible(false); // Hide by default
|
||||
|
||||
int labelX = 9;
|
||||
int labelY = 120;
|
||||
|
||||
var tabLabel = new LabelElement<>(
|
||||
Spatials.positionXY(490, 24).width(16).height(16),
|
||||
new TextComponent("TAB").withStyle(ChatFormatting.GOLD),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(tabLabel);
|
||||
|
||||
var shiftTabLabel = new LabelElement<>(
|
||||
Spatials.positionXY(84, 24).width(16).height(16),
|
||||
new TextComponent("SHIFT + TAB").withStyle(ChatFormatting.GOLD),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
|
||||
var arrows = new LabelElement<>(
|
||||
Spatials.positionXY(408, 62).width(16).height(16),
|
||||
new TextComponent("← ").withStyle(ChatFormatting.GOLD)
|
||||
.append(new TextComponent("scroll").withStyle(ChatFormatting.BLUE))
|
||||
.append(new TextComponent(" →").withStyle(ChatFormatting.GOLD)),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(arrows);
|
||||
|
||||
var vimArrows = new LabelElement<>(
|
||||
Spatials.positionXY(410, 72).width(16).height(16),
|
||||
new TextComponent("h ").withStyle(ChatFormatting.GOLD)
|
||||
.append(new TextComponent("lvl").withStyle(ChatFormatting.BLUE))
|
||||
.append(new TextComponent(" l").withStyle(ChatFormatting.GOLD)),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(vimArrows);
|
||||
|
||||
var ctrlLabel = new LabelElement<>(
|
||||
Spatials.positionXY(494, 46).width(16).height(16),
|
||||
new TextComponent("CTRL").withStyle(ChatFormatting.GOLD),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(ctrlLabel);
|
||||
|
||||
var categoryLabelNormal = new LabelElement<>(
|
||||
Spatials.positionXY(510, 56).width(16).height(16),
|
||||
new TextComponent(ModifierCategory.NORMAL.name()).withStyle(ModifierCategory.NORMAL.getStyle()),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(categoryLabelNormal);
|
||||
|
||||
var categoryLabelGreater = new LabelElement<>(
|
||||
Spatials.positionXY(510, 66).width(16).height(16),
|
||||
new TextComponent(ModifierCategory.GREATER.name()).withStyle(ModifierCategory.GREATER.getStyle()),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(categoryLabelGreater);
|
||||
|
||||
var categoryLabelLegendary = new LabelElement<>(
|
||||
Spatials.positionXY(510, 76).width(16).height(16),
|
||||
new TextComponent(ModifierCategory.LEGENDARY.name()).withStyle(ModifierCategory.LEGENDARY.getStyle()),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(categoryLabelLegendary);
|
||||
|
||||
var upLabel = new LabelElement<>(
|
||||
Spatials.positionXY(494, 150).width(16).height(16),
|
||||
new TextComponent("↑ k").withStyle(ChatFormatting.GOLD),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(upLabel);
|
||||
var downLabel = new LabelElement<>(
|
||||
Spatials.positionXY(494, 164).width(16).height(16),
|
||||
new TextComponent("↓ j").withStyle(ChatFormatting.GOLD),
|
||||
LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(downLabel);
|
||||
|
||||
this.addElement(shiftTabLabel);
|
||||
|
||||
|
||||
String text = """
|
||||
Colored triangles
|
||||
represent groups
|
||||
of attributes
|
||||
|
||||
If 2 attributes are
|
||||
in the same group,
|
||||
they can't be
|
||||
rolled together
|
||||
""";
|
||||
|
||||
var array = text.split("\n");
|
||||
for (String s : array) {
|
||||
var textLabel = new LabelElement<>(
|
||||
Spatials.positionXY(labelX, labelY).width(20).height(15),
|
||||
new TextComponent(s).withStyle(ChatFormatting.GOLD), LabelTextStyle.shadow()
|
||||
);
|
||||
this.addElement(textLabel);
|
||||
labelY += 10;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue