use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.
the class StringConfigurator method init.
protected void init() {
this.addWidget(new RectButtonWidget(76, 15, 40, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> updateString()).setIcon(new TextTexture("terminal.guide_editor.update", -1)));
textFieldWidget = new TextFieldWidget(0, 15, 76, 20, TerminalTheme.COLOR_B_2, null, null).setMaxStringLength(Integer.MAX_VALUE).setValidator(s -> true);
if (config.has(name) && config.get(name).isJsonPrimitive()) {
textFieldWidget.setCurrentString(config.get(name).getAsString());
}
this.addWidget(textFieldWidget);
}
use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.
the class RecipeChartApp method addTab.
private RGContainer addTab(String name) {
name = name.isEmpty() ? "default" : name;
RGContainer container = new RGContainer(0, 0, 333, 222, getOs());
container.setBackground(TerminalTheme.COLOR_B_3);
tabGroup.addTab(new IGuiTextureTabInfo(new TextTexture(name, -1).setWidth(333 / getMaxPages() - 5).setType(tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), name), container);
return container;
}
use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.
the class RecipeChartApp method onPagesChanged.
private void onPagesChanged(int oldPage, int newPage) {
ITabInfo tabInfo = tabGroup.getTabInfo(newPage);
if (tabInfo instanceof IGuiTextureTabInfo && ((IGuiTextureTabInfo) tabInfo).texture instanceof TextTexture) {
((TextTexture) ((IGuiTextureTabInfo) tabInfo).texture).setType(TextTexture.TextType.ROLL);
}
tabInfo = tabGroup.getTabInfo(oldPage);
if (tabInfo instanceof IGuiTextureTabInfo && ((IGuiTextureTabInfo) tabInfo).texture instanceof TextTexture) {
((TextTexture) ((IGuiTextureTabInfo) tabInfo).texture).setType(TextTexture.TextType.HIDE);
}
}
use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.
the class FluidStackConfigurator method addSlot.
private void addSlot(DraggableScrollableWidgetGroup container, TankListWidget.FluidStackInfo fluidStackInfo) {
WidgetGroup group = new WidgetGroup(0, tanks.size() * 20, 116, 20);
tanks.add(fluidStackInfo);
group.addWidget(new PhantomFluidWidget(1, 1, 18, 18, null, null).setBackgroundTexture(TerminalTheme.COLOR_B_2).setFluidStackSupplier(fluidStackInfo::getInstance, true).setFluidStackUpdater(fluidStack -> {
fluidStackInfo.update(fluidStack);
updateValue();
}, true));
group.addWidget(new RectButtonWidget(20, 0, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> {
fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount - (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick ? 100 : 1));
updateValue();
}).setHoverText("Shift -10|Ctrl -100|Shift+Ctrl -1000").setIcon(new TextTexture("-1", -1)));
group.addWidget(new RectButtonWidget(76, 0, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> {
fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount + (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick ? 100 : 1));
updateValue();
}).setHoverText("Shift +10|Ctrl +100|Shift+Ctrl +1000").setIcon(new TextTexture("+1", -1)));
group.addWidget(new ImageWidget(40, 0, 36, 20, TerminalTheme.COLOR_B_2));
group.addWidget(new SimpleTextWidget(58, 10, "", 0xFFFFFF, () -> Integer.toString(fluidStackInfo.amount), true));
group.addWidget(new RectButtonWidget(96, 0, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> {
container.waitToRemoved(group);
tanks.remove(fluidStackInfo);
int index = container.widgets.indexOf(group);
for (int i = container.widgets.size() - 1; i > index; i--) {
container.widgets.get(i).addSelfPosition(0, -20);
}
updateValue();
}).setIcon(GuiTextures.ICON_REMOVE));
container.addWidget(group);
}
use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.
the class NumberConfigurator method init.
protected void init() {
int y = 15;
this.addWidget(new RectButtonWidget(0, y, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> adjustTransferRate(data.isShiftClick ? -100 : -10)).setIcon(new TextTexture("-10", -1)));
this.addWidget(new RectButtonWidget(96, y, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> adjustTransferRate(data.isShiftClick ? +100 : +10)).setIcon(new TextTexture("+10", -1)));
this.addWidget(new RectButtonWidget(20, y, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> adjustTransferRate(data.isShiftClick ? -5 : -1)).setIcon(new TextTexture("-1", -1)));
this.addWidget(new RectButtonWidget(76, y, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> adjustTransferRate(data.isShiftClick ? +5 : +1)).setIcon(new TextTexture("+1", -1)));
this.addWidget(new ImageWidget(40, y, 36, 20, TerminalTheme.COLOR_B_2));
this.addWidget(new SimpleTextWidget(58, 25, "", 0xFFFFFF, () -> {
JsonElement element = config.get(name);
if (element.isJsonNull()) {
return Integer.toString(defaultValue);
}
return element.getAsString();
}, true));
}
Aggregations