use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.
the class GuiSequencer method initGuiMode.
private void initGuiMode() {
mode = new ChoiceLabel(mc, this).setDesiredHeight(13).setDesiredWidth(55);
mode.addChoices(SequencerMode.MODE_ONCE1.getDescription());
mode.addChoices(SequencerMode.MODE_ONCE2.getDescription());
mode.addChoices(SequencerMode.MODE_LOOP1.getDescription());
mode.addChoices(SequencerMode.MODE_LOOP2.getDescription());
mode.addChoices(SequencerMode.MODE_LOOP3.getDescription());
mode.addChoices(SequencerMode.MODE_LOOP4.getDescription());
mode.addChoices(SequencerMode.MODE_STEP.getDescription());
mode.setChoiceTooltip(SequencerMode.MODE_ONCE1.getDescription(), "When a redstone signal is", "received, loop the cycle once.", "Ignore further pulses");
mode.setChoiceTooltip(SequencerMode.MODE_ONCE2.getDescription(), "When a redstone signal is", "received, loop the cycle once.", "Restart if new pulse arrives");
mode.setChoiceTooltip(SequencerMode.MODE_LOOP1.getDescription(), "Loop the cycle all the time.", "Ignore redstone signals");
mode.setChoiceTooltip(SequencerMode.MODE_LOOP2.getDescription(), "Loop the cycle all the time.", "Restart on redstone pulse");
mode.setChoiceTooltip(SequencerMode.MODE_LOOP3.getDescription(), "Loop the cycle when redstone.", "signal is present. Continue at current step");
mode.setChoiceTooltip(SequencerMode.MODE_LOOP4.getDescription(), "Loop the cycle when redstone.", "signal is present. Restart on no signal");
mode.setChoiceTooltip(SequencerMode.MODE_STEP.getDescription(), "Do one step in the cycle", "for every redstone pulse");
mode.setChoice(tileEntity.getMode().getDescription());
mode.addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeMode();
}
});
}
use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.
the class GuiEnvironmentalController method initGui.
@Override
public void initGui() {
super.initGui();
toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
int r = tileEntity.getRadius();
if (r < 5) {
r = 5;
} else if (r > 100) {
r = 100;
}
int miny = tileEntity.getMiny();
int maxy = tileEntity.getMaxy();
Panel radiusPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(25, 6, ENV_WIDTH - 30, 16));
ScrollableLabel radius = new ScrollableLabel(mc, this).setRealMinimum(5).setRealMaximum(100).setRealValue(r).setDesiredWidth(24).addValueEvent(new ValueEvent() {
@Override
public void valueChanged(Widget parent, int newValue) {
sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_SETRADIUS, new Argument("radius", newValue));
}
});
Slider slider = new Slider(mc, this).setHorizontal().setScrollable(radius).setMinimumKnobSize(12);
radiusPanel.addChild(new Label(mc, this).setText("Radius:")).addChild(slider).addChild(radius);
Panel minPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(25, 24, ENV_WIDTH - 30, 16));
minyTextField = new TextField(mc, this).setText(Integer.toString(miny)).addTextEvent(new TextEvent() {
@Override
public void textChanged(Widget parent, String newText) {
sendBounds(true);
}
});
maxyTextField = new TextField(mc, this).setText(Integer.toString(maxy)).addTextEvent(new TextEvent() {
@Override
public void textChanged(Widget parent, String newText) {
sendBounds(false);
}
});
minPanel.addChild(new Label(mc, this).setText("Height:")).addChild(minyTextField).addChild(maxyTextField);
playersList = new WidgetList(mc, this);
Slider playerSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(playersList);
Panel playersPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25, 42, ENV_WIDTH - 30, 72)).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(playersList).addChild(playerSlider);
Panel controlPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25, 118, ENV_WIDTH - 30, 16)).setLayout(new HorizontalLayout().setHorizontalMargin(1).setVerticalMargin(0).setSpacing(1));
ChoiceLabel blacklist = new ChoiceLabel(mc, this).addChoices(MODE_BLACKLIST, MODE_WHITELIST).setDesiredWidth(30).setDesiredHeight(15).setChoiceTooltip(MODE_BLACKLIST, "Players in the list above will not get the effects").setChoiceTooltip(MODE_WHITELIST, "Players in the list above will get the effects").addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeBlacklistMode(newChoice);
}
});
if (tileEntity.isWhitelistMode()) {
blacklist.setChoice(MODE_WHITELIST);
} else {
blacklist.setChoice(MODE_BLACKLIST);
}
addButton = new Button(mc, this).setText("+").setDesiredHeight(15).setTooltips("Add a player to the list").addButtonEvent(new ButtonEvent() {
@Override
public void buttonClicked(Widget parent) {
addPlayer();
}
});
delButton = new Button(mc, this).setText("-").setDesiredHeight(15).setTooltips("Remove selected player from the list").addButtonEvent(new ButtonEvent() {
@Override
public void buttonClicked(Widget parent) {
delPlayer();
}
});
nameField = new TextField(mc, this);
initRedstoneMode();
controlPanel.addChild(blacklist).addChild(addButton).addChild(delButton).addChild(nameField).addChild(redstoneMode);
toplevel.addChild(radiusPanel).addChild(minPanel).addChild(playersPanel).addChild(controlPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
Keyboard.enableRepeatEvents(true);
listDirty = 0;
requestPlayers();
}
use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.
the class MachineInformationClientScreenModule method addOptionPanel.
private void addOptionPanel(Minecraft mc, Gui gui, final NBTTagCompound currentData, final ModuleGuiChanged moduleGuiChanged, Panel panel) {
Panel optionPanel = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredHeight(16);
final Map<String, Integer> choiceToIndex = new HashMap<String, Integer>();
final ChoiceLabel tagButton = new ChoiceLabel(mc, gui).setDesiredHeight(16).setDesiredWidth(80);
optionPanel.addChild(tagButton);
// int dim = currentData.getInteger("dim");
int x = currentData.getInteger("monitorx");
int y = currentData.getInteger("monitory");
int z = currentData.getInteger("monitorz");
TileEntity tileEntity = mc.theWorld.getTileEntity(x, y, z);
if (tileEntity instanceof MachineInformation) {
int current = currentData.getInteger("monitorTag");
MachineInformation information = (MachineInformation) tileEntity;
String currentTag = null;
for (int i = 0; i < information.getTagCount(); i++) {
String tag = information.getTagName(i);
choiceToIndex.put(tag, i);
tagButton.addChoices(tag);
tagButton.setChoiceTooltip(tag, information.getTagDescription(i));
if (current == i) {
currentTag = tag;
}
}
if (currentTag != null) {
tagButton.setChoice(currentTag);
}
}
tagButton.addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
String choice = tagButton.getCurrentChoice();
Integer index = choiceToIndex.get(choice);
if (index != null) {
currentData.setInteger("monitorTag", index);
}
moduleGuiChanged.updateData();
}
});
panel.addChild(optionPanel);
}
use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.
the class GuiShield method initDamageType.
private void initDamageType() {
damageType = new ChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(170, 106, 80, 14));
damageType.addChoices(DAMAGETYPE_GENERIC, DAMAGETYPE_PLAYER);
damageType.setChoiceTooltip(DAMAGETYPE_GENERIC, "Generic damage type");
damageType.setChoiceTooltip(DAMAGETYPE_PLAYER, "Damage as done by a player");
damageType.addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeDamageType();
}
});
damageType.setChoice(tileEntity.getDamageMode().getDescription());
}
use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.
the class GuiShield method initVisibilityMode.
private void initVisibilityMode() {
visibilityOptions = new ChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(31, 161, 48, 14));
for (ShieldRenderingMode m : ShieldRenderingMode.values()) {
visibilityOptions.addChoices(m.getDescription());
}
visibilityOptions.setChoiceTooltip(ShieldRenderingMode.MODE_INVISIBLE.getDescription(), "Shield is completely invisible");
visibilityOptions.setChoiceTooltip(ShieldRenderingMode.MODE_SHIELD.getDescription(), "Default shield texture");
visibilityOptions.setChoiceTooltip(ShieldRenderingMode.MODE_SOLID.getDescription(), "Use the texture from the supplied block");
visibilityOptions.setChoice(tileEntity.getShieldRenderingMode().getDescription());
visibilityOptions.addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeVisibilityMode();
}
});
}
Aggregations