Search in sources :

Example 1 with ColorChoiceEvent

use of mcjty.lib.gui.events.ColorChoiceEvent in project RFTools by McJty.

the class ScreenModuleGuiBuilder method color.

public ScreenModuleGuiBuilder color(final String tagname, String... tooltip) {
    ColorChoiceLabel colorSelector = new ColorChoiceLabel(mc, gui).setTooltips(tooltip).addColors(0xffffff, 0x888888, 0x010101, 0xff0000, 0x880000, 0x00ff00, 0x008800, 0x0000ff, 0x000088, 0xffff00, 0x888800, 0xff00ff, 0x880088, 0x00ffff, 0x008888).setDesiredWidth(20).setDesiredHeight(14).addChoiceEvent(new ColorChoiceEvent() {

        @Override
        public void choiceChanged(Widget parent, Integer newColor) {
            currentData.setInteger(tagname, newColor);
            moduleGuiChanged.updateData();
        }
    });
    row.add(colorSelector);
    if (currentData != null) {
        int currentColor = currentData.getInteger(tagname);
        if (currentColor != 0) {
            colorSelector.setCurrentColor(currentColor);
        }
    }
    return this;
}
Also used : ColorChoiceEvent(mcjty.lib.gui.events.ColorChoiceEvent)

Example 2 with ColorChoiceEvent

use of mcjty.lib.gui.events.ColorChoiceEvent in project RFTools by McJty.

the class GuiShield method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored(ForgeDirection.DOWN);
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(12, 141, 10, 76)).setShowText(false);
    energyBar.setValue(tileEntity.getCurrentRF());
    initVisibilityMode();
    initActionOptions();
    initTypeOptions();
    initRedstoneMode();
    initDamageType();
    filterList = new WidgetList(mc, this).setDesiredHeight(115).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            selectFilter();
        }
    });
    Slider filterSlider = new Slider(mc, this).setVertical().setScrollable(filterList).setDesiredWidth(11).setDesiredHeight(115);
    Panel filterPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).setLayoutHint(new PositionalLayout.PositionalHint(12, 10, 154, 119)).addChild(filterList).addChild(filterSlider).setFilledBackground(0xff9e9e9e);
    Button applyCamo = new Button(mc, this).setText("Set").setTooltips("Set the camouflage block").setLayoutHint(new PositionalLayout.PositionalHint(51, 142, 28, 16)).addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            applyCamoToShield();
        }
    });
    ColorChoiceLabel colorSelector = new ColorChoiceLabel(mc, this).addColors(0x96ffc8, 0x4698ff, 0xff6030, 0x55a0a0, 0xa055a0, 0xffffff).setTooltips("Color for the shield").setLayoutHint(new PositionalLayout.PositionalHint(31, 177, 48, 16)).addChoiceEvent(new ColorChoiceEvent() {

        @Override
        public void choiceChanged(Widget parent, Integer newColor) {
            sendServerCommand(RFToolsMessages.INSTANCE, ShieldTEBase.CMD_SETCOLOR, new Argument("color", newColor));
        }
    });
    colorSelector.setCurrentColor(tileEntity.getShieldColor());
    player = new TextField(mc, this).setTooltips("Optional player name").setLayoutHint(new PositionalLayout.PositionalHint(170, 44, 80, 14));
    addFilter = new Button(mc, this).setText("Add").setTooltips("Add selected filter").setLayoutHint(new PositionalLayout.PositionalHint(4, 6, 36, 14)).addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            addNewFilter();
        }
    });
    delFilter = new Button(mc, this).setText("Del").setTooltips("Delete selected filter").setLayoutHint(new PositionalLayout.PositionalHint(39, 6, 36, 14)).addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            removeSelectedFilter();
        }
    });
    upFilter = new Button(mc, this).setText("Up").setTooltips("Move filter up").setLayoutHint(new PositionalLayout.PositionalHint(4, 22, 36, 14)).addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            moveFilterUp();
        }
    });
    downFilter = new Button(mc, this).setText("Down").setTooltips("Move filter down").setLayoutHint(new PositionalLayout.PositionalHint(39, 22, 36, 14)).addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            moveFilterDown();
        }
    });
    Panel controlPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(170, 60, 80, 43)).addChild(addFilter).addChild(delFilter).addChild(upFilter).addChild(downFilter).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
    Widget toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(visibilityOptions).addChild(applyCamo).addChild(redstoneMode).addChild(filterPanel).addChild(actionOptions).addChild(typeOptions).addChild(player).addChild(controlPanel).addChild(damageType).addChild(colorSelector);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    listDirty = 0;
    requestFilters();
    tileEntity.requestRfFromServer(RFToolsMessages.INSTANCE);
}
Also used : Window(mcjty.lib.gui.Window) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) ButtonEvent(mcjty.lib.gui.events.ButtonEvent) TextField(mcjty.lib.gui.widgets.TextField) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) ColorChoiceEvent(mcjty.lib.gui.events.ColorChoiceEvent)

Aggregations

ColorChoiceEvent (mcjty.lib.gui.events.ColorChoiceEvent)2 Window (mcjty.lib.gui.Window)1 ButtonEvent (mcjty.lib.gui.events.ButtonEvent)1 DefaultSelectionEvent (mcjty.lib.gui.events.DefaultSelectionEvent)1 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)1 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)1 Button (mcjty.lib.gui.widgets.Button)1 Panel (mcjty.lib.gui.widgets.Panel)1 TextField (mcjty.lib.gui.widgets.TextField)1 Argument (mcjty.lib.network.Argument)1