Merge branch 'v0.4.0' into v0.4.0-1.21.3
This commit is contained in:
commit
8abcd7341e
40 changed files with 233 additions and 183 deletions
|
@ -2,8 +2,10 @@ package me.kawaiizenbo.moonlight.ui.clickgui;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import me.kawaiizenbo.moonlight.Moonlight;
|
||||
import me.kawaiizenbo.moonlight.module.Category;
|
||||
import me.kawaiizenbo.moonlight.module.ModuleManager;
|
||||
import me.kawaiizenbo.moonlight.util.DrawUtils;
|
||||
import me.kawaiizenbo.moonlight.module.Module;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
|
@ -27,7 +29,7 @@ public class CategoryPane
|
|||
this.y = initialY;
|
||||
this.collapsed = collapsed;
|
||||
moduleButtons = new ArrayList<ModuleButton>();
|
||||
icon = Identifier.of("moonlight", category.name.toLowerCase());
|
||||
icon = DrawUtils.getThemedGUIIcon(category.name.toLowerCase());
|
||||
for (Module m : ModuleManager.INSTANCE.getModulesByCategory(category))
|
||||
{
|
||||
moduleButtons.add(new ModuleButton(m));
|
||||
|
@ -43,10 +45,10 @@ public class CategoryPane
|
|||
x = mouseX - startX;
|
||||
y = mouseY - startY;
|
||||
}
|
||||
drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, category.color);
|
||||
drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
|
||||
drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : category.color);
|
||||
//drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
|
||||
drawContext.drawGuiTexture(RenderLayer::getGuiTextured, icon, x+2, y+2, 12, 12);
|
||||
drawContext.drawText(textRenderer, category.name, x+16, y+4, 0xFFFFFFFF, false);
|
||||
drawContext.drawText(textRenderer, category.name, x+16, y+4, Moonlight.THEME.headerText.getRGB(), false);
|
||||
if (!collapsed)
|
||||
{
|
||||
int buttonYOffset = y+16;
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Map;
|
|||
|
||||
import me.kawaiizenbo.moonlight.Moonlight;
|
||||
import me.kawaiizenbo.moonlight.module.Category;
|
||||
import me.kawaiizenbo.moonlight.theme.Theme;
|
||||
import me.kawaiizenbo.moonlight.util.MathUtils;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
@ -35,6 +36,9 @@ public class ClickGUIScreen extends Screen
|
|||
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta)
|
||||
{
|
||||
this.renderBackground(drawContext, mouseX, mouseY, delta);
|
||||
drawContext.fill(width-80, height-16, width, height, Moonlight.THEME.border.getRGB());
|
||||
drawContext.fill(width-78, height-14, width-2, height-2, (mouseX > width-80 && mouseY > height-16) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
|
||||
drawContext.drawText(textRenderer, "Change Theme", width-75, height-12, Moonlight.THEME.text.getRGB(), false);
|
||||
for (CategoryPane category : categoryPanes)
|
||||
{
|
||||
category.render(drawContext, mouseX, mouseY, delta, textRenderer);
|
||||
|
@ -48,6 +52,12 @@ public class ClickGUIScreen extends Screen
|
|||
{
|
||||
category.mouseClicked((int) mouseX, (int) mouseY, button);
|
||||
}
|
||||
if (mouseX > width-80 && mouseY > height-16)
|
||||
{
|
||||
if (Moonlight.THEME_IDX >= Theme.THEME_LIST.length-1) Moonlight.THEME_IDX = 0;
|
||||
else Moonlight.THEME_IDX++;
|
||||
Moonlight.THEME = Theme.THEME_LIST[Moonlight.THEME_IDX];
|
||||
}
|
||||
return super.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.kawaiizenbo.moonlight.ui.clickgui;
|
||||
|
||||
import me.kawaiizenbo.moonlight.Moonlight;
|
||||
import me.kawaiizenbo.moonlight.module.Module;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
|
@ -21,8 +22,8 @@ public class ModuleButton
|
|||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
|
||||
drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? 0x55FFFF : 0xFFFFFF, false);
|
||||
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
|
||||
drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? Moonlight.THEME.accent.getRGB() : Moonlight.THEME.text.getRGB(), false);
|
||||
}
|
||||
|
||||
public boolean hovered(int mouseX, int mouseY)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.kawaiizenbo.moonlight.ui.clickgui;
|
||||
|
||||
import me.kawaiizenbo.moonlight.Moonlight;
|
||||
import me.kawaiizenbo.moonlight.module.Module;
|
||||
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
||||
import me.kawaiizenbo.moonlight.ui.SetScreenButton;
|
||||
|
@ -21,8 +22,8 @@ public class SettingsScreen extends Screen
|
|||
public SettingsScreen(Module module)
|
||||
{
|
||||
super(Text.literal("Settings"));
|
||||
backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, 0xFFFFFF, ClickGUIScreen.INSTANCE);
|
||||
editButton = new SetScreenButton(ColorUtils.underline + "Edit", x+windowWidth-22, y+4, 0xFFFFFF, HUDEditorScreen.INSTANCE);
|
||||
backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, ClickGUIScreen.INSTANCE);
|
||||
editButton = new SetScreenButton(ColorUtils.underline + "Edit", x+windowWidth-22, y+4, HUDEditorScreen.INSTANCE);
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
|
@ -37,11 +38,12 @@ public class SettingsScreen extends Screen
|
|||
x = mouseX - startX;
|
||||
y = mouseY - startY;
|
||||
}
|
||||
drawContext.fill(x, y, x+windowWidth, y+windowHeight, 0xFF222222);
|
||||
drawContext.fill(x, y, x+windowWidth, y+16, module.category.color);
|
||||
drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, 0xFF222222);
|
||||
drawContext.drawCenteredTextWithShadow(textRenderer, module.name, x+(windowWidth/2), y+4, 0xFFFFFF);
|
||||
drawContext.drawText(textRenderer, module.description, x+8, y+24, 0xFFFFFF, true);
|
||||
drawContext.fill(x, y, x+windowWidth, y+windowHeight, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : module.category.color);
|
||||
drawContext.fill(x+2, y+2, x+windowWidth-2, y+windowHeight-2, Moonlight.THEME.background.getRGB());
|
||||
drawContext.fill(x, y, x+windowWidth, y+16, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : module.category.color);
|
||||
//drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, Moonlight.THEME.background.getRGB());
|
||||
drawContext.drawText(textRenderer, module.name, x+((windowWidth/2)-(textRenderer.getWidth(module.name)/2)), y+4, Moonlight.THEME.headerText.getRGB(), false);
|
||||
drawContext.drawText(textRenderer, module.description, x+8, y+24, Moonlight.THEME.text.getRGB(), false);
|
||||
backButton.render(drawContext, textRenderer, mouseX, mouseY, x+4, y+4);
|
||||
if (module.showEditButton) editButton.render(drawContext, textRenderer, mouseX, mouseY, x+windowWidth-22, y+4);
|
||||
int yOffset = y+40;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue