Search in sources :

Example 1 with TextTexture

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);
}
Also used : java.awt(java.awt) JsonObject(com.google.gson.JsonObject) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget) TerminalTheme(gregtech.api.terminal.os.TerminalTheme) TextTexture(gregtech.api.gui.resources.TextTexture) TextFieldWidget(gregtech.api.gui.widgets.TextFieldWidget) DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) TextTexture(gregtech.api.gui.resources.TextTexture) TextFieldWidget(gregtech.api.gui.widgets.TextFieldWidget) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget)

Example 2 with TextTexture

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;
}
Also used : TextTexture(gregtech.api.gui.resources.TextTexture) IGuiTextureTabInfo(gregtech.api.gui.widgets.tab.IGuiTextureTabInfo) RGContainer(gregtech.common.terminal.app.recipechart.widget.RGContainer)

Example 3 with TextTexture

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);
    }
}
Also used : ITabInfo(gregtech.api.gui.widgets.tab.ITabInfo) TextTexture(gregtech.api.gui.resources.TextTexture) IGuiTextureTabInfo(gregtech.api.gui.widgets.tab.IGuiTextureTabInfo)

Example 4 with TextTexture

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);
}
Also used : JsonObject(com.google.gson.JsonObject) TankListWidget(gregtech.common.terminal.app.guide.widget.TankListWidget) TerminalTheme(gregtech.api.terminal.os.TerminalTheme) TextTexture(gregtech.api.gui.resources.TextTexture) DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) GuiTextures(gregtech.api.gui.GuiTextures) ArrayList(java.util.ArrayList) JsonElement(com.google.gson.JsonElement) java.awt(java.awt) List(java.util.List) gregtech.api.gui.widgets(gregtech.api.gui.widgets) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget) Gson(com.google.gson.Gson) DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) TextTexture(gregtech.api.gui.resources.TextTexture) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget)

Example 5 with TextTexture

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));
}
Also used : JsonElement(com.google.gson.JsonElement) TextTexture(gregtech.api.gui.resources.TextTexture) ImageWidget(gregtech.api.gui.widgets.ImageWidget) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget) SimpleTextWidget(gregtech.api.gui.widgets.SimpleTextWidget)

Aggregations

TextTexture (gregtech.api.gui.resources.TextTexture)12 RectButtonWidget (gregtech.api.terminal.gui.widgets.RectButtonWidget)8 DraggableScrollableWidgetGroup (gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup)7 JsonElement (com.google.gson.JsonElement)4 ImageWidget (gregtech.api.gui.widgets.ImageWidget)4 TerminalTheme (gregtech.api.terminal.os.TerminalTheme)4 Gson (com.google.gson.Gson)3 GuiTextures (gregtech.api.gui.GuiTextures)3 IGuiTextureTabInfo (gregtech.api.gui.widgets.tab.IGuiTextureTabInfo)3 JsonObject (com.google.gson.JsonObject)2 gregtech.api.gui.widgets (gregtech.api.gui.widgets)2 LabelWidget (gregtech.api.gui.widgets.LabelWidget)2 SimpleTextWidget (gregtech.api.gui.widgets.SimpleTextWidget)2 WidgetGroup (gregtech.api.gui.widgets.WidgetGroup)2 ITabInfo (gregtech.api.gui.widgets.tab.ITabInfo)2 AbstractApplication (gregtech.api.terminal.app.AbstractApplication)2 java.awt (java.awt)2 PacketBuffer (net.minecraft.network.PacketBuffer)2 GregtechTileCapabilities (gregtech.api.capability.GregtechTileCapabilities)1 IControllable (gregtech.api.capability.IControllable)1