use of mcjty.xnet.api.channels.IChannelType in project XNet by McJty.
the class GuiController method refreshChannelEditor.
private void refreshChannelEditor() {
if (!listsReady()) {
return;
}
if (editingChannel != -1 && showingChannel != editingChannel) {
showingChannel = editingChannel;
channelButtons[editingChannel].setPressed(true);
channelEditPanel.removeChildren();
if (channelButtons[editingChannel].isPressed()) {
ChannelClientInfo info = fromServer_channels.get(editingChannel);
if (info != null) {
ChannelEditorPanel editor = new ChannelEditorPanel(channelEditPanel, mc, this, editingChannel);
editor.label("Channel " + (editingChannel + 1)).shift(5).toggle(TAG_ENABLED, "Enable processing on this channel", info.isEnabled()).shift(5).text(TAG_NAME, "Channel name", info.getChannelName(), 65);
info.getChannelSettings().createGui(editor);
Button remove = new Button(mc, this).setText("x").setTextOffset(0, -1).setTooltips("Remove this channel").setLayoutHint(new PositionalLayout.PositionalHint(151, 1, 9, 10)).addButtonEvent(parent -> removeChannel());
channelEditPanel.addChild(remove);
editor.setState(info.getChannelSettings());
} else {
ChoiceLabel type = new ChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(5, 12, 95, 14));
for (IChannelType channelType : XNet.xNetApi.getChannels().values()) {
// Show names?
type.addChoices(channelType.getID());
}
Button create = new Button(mc, this).setText("Create").setLayoutHint(new PositionalLayout.PositionalHint(100, 12, 53, 14)).addButtonEvent(parent -> createChannel(type.getCurrentChoice()));
channelEditPanel.addChild(type).addChild(create);
}
}
} else if (showingChannel != -1 && editingChannel == -1) {
showingChannel = -1;
channelEditPanel.removeChildren();
}
}
Aggregations