Skip to content

Commit

Permalink
加个列表显示
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyRespawnanchor committed Oct 7, 2024
1 parent 1376aef commit b8bb6e6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
import net.minecraft.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.client.gui.components.WidgetSprites;
import net.minecraft.client.gui.components.*;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -161,6 +158,11 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta)
withAyameNamespace("opendir"),
withAyameNamespace("opendir_enabled_focused")
);
WidgetSprites listmodeSprites = new WidgetSprites(
withAyameNamespace("listmode"),
withAyameNamespace("listmode"),
withAyameNamespace("listmode_enabled_focused")
);
ImageButton opendirButton = new ImageButton(
getAlignedX(BACKGROUND_TEXTURE_WIDTH, MINI_BUTTON_SIZE, 0, Alignment.RIGHT) - 125,
getAlignedY(BACKGROUND_TEXTURE_HEIGHT, MINI_BUTTON_SIZE, 0, Alignment.BOTTOM) - 3,
Expand All @@ -172,8 +174,21 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta)
},
Component.translatable("ayame.button.opendir.tooltip")
);
ImageButton listmodeButton = new ImageButton(
getAlignedX(BACKGROUND_TEXTURE_WIDTH, MINI_BUTTON_SIZE, 0, Alignment.LEFT) + 35,
getAlignedY(BACKGROUND_TEXTURE_HEIGHT, MINI_BUTTON_SIZE, 0, Alignment.BOTTOM) - 3,
MINI_BUTTON_SIZE,
MINI_BUTTON_SIZE,
listmodeSprites,
button -> {
//Util.getPlatform().openPath(MODEL_DIR);
},
Component.translatable("ayame.button.listmode.tooltip")
);
opendirButton.setTooltip(Tooltip.create(Component.translatable("ayame.button.opendir.tooltip")));
listmodeButton.setTooltip(Tooltip.create(Component.translatable("ayame.button.listmode.tooltip")));
addRenderableWidget(opendirButton);
addRenderableWidget(listmodeButton);
}


Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/assets/ayame/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"ayame.screen.warningscreen.modelselectscreen.title": "Select Model",
"ayame.screen.warningscreen.settingsscreen.title": "Ayame Settings",
"ayame.button.opendir.tooltip": "Open Model Folder\n(Place model files here)",
"ayame.button.listmode.tooltip": "List Mode",
"ayame.widget.searchBox": "Search..."
}
1 change: 1 addition & 0 deletions common/src/main/resources/assets/ayame/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"ayame.screen.warningscreen.modelselectscreen.title": "选择模型",
"ayame.screen.warningscreen.settingsscreen.title": "Ayame 设置",
"ayame.button.opendir.tooltip": "打开模型文件夹\n(请将模型文件放在这里)",
"ayame.button.listmode.tooltip": "列表模式",
"ayame.widget.searchBox": "搜索..."
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b8bb6e6

Please sign in to comment.