use of com.ldtteam.blockout.controls.ButtonImage in project minecolonies by Minecolonies.
the class GuardTaskSetting method render.
@Override
public void render(final ISettingKey<?> key, final Pane pane, final ISettingsModuleView settingsModuleView, final IBuildingView building, final Window window) {
final String setting = getSettings().get(getCurrentIndex());
final ButtonImage targetButton = pane.findPaneOfTypeByID("setTarget", ButtonImage.class);
final Text mineLabel = pane.findPaneOfTypeByID("minePos", Text.class);
if (setting.equals(PATROL_MINE) && building instanceof AbstractBuildingGuards.View) {
mineLabel.setVisible(true);
if (((AbstractBuildingGuards.View) building).getMinePos() != null) {
mineLabel.setText(new TranslationTextComponent("com.minecolonies.coremod.gui.worherhuts.patrollingmine", ((AbstractBuildingGuards.View) building).getMinePos().toShortString()));
} else {
mineLabel.setText(new TranslationTextComponent("com.minecolonies.coremod.job.guard.assignmine"));
}
targetButton.setVisible(false);
} else if (!setting.equals(FOLLOW)) {
mineLabel.setVisible(false);
targetButton.setVisible(true);
if (setting.equals(PATROL)) {
if (!settingsModuleView.getSetting(AbstractBuildingGuards.PATROL_MODE).getValue().equals(PatrolModeSetting.MANUAL)) {
targetButton.setVisible(false);
} else {
targetButton.setText(new TranslationTextComponent("com.minecolonies.coremod.gui.workerhuts.targetpatrol"));
}
} else {
targetButton.setText(new TranslationTextComponent("com.minecolonies.coremod.gui.workerhuts.targetguard"));
}
targetButton.setHandler(button -> building.getModuleView(ToolModuleView.class).getWindow().open());
} else {
mineLabel.setVisible(false);
targetButton.setVisible(false);
}
pane.findPaneOfTypeByID("trigger", ButtonImage.class).setText(new TranslationTextComponent(setting));
}
use of com.ldtteam.blockout.controls.ButtonImage in project minecolonies by ldtteam.
the class RecruitmentInteraction method onWindowOpened.
@Override
@OnlyIn(Dist.CLIENT)
public void onWindowOpened(final Window window, final ICitizenDataView dataView) {
final ButtonImage recruitButton = window.findPaneOfTypeByID(BUTTON_RESPONSE_ID + 2, ButtonImage.class);
final Box group = window.findPaneOfTypeByID(RESPONSE_BOX_ID, Box.class);
if (recruitButton != null && dataView instanceof IVisitorViewData) {
final ItemStack recruitCost = ((IVisitorViewData) dataView).getRecruitCost();
final IColonyView colony = ((IVisitorViewData) dataView).getColonyView();
window.findPaneOfTypeByID(CHAT_LABEL_ID, Text.class).setText(PaneBuilders.textBuilder().append(new StringTextComponent(dataView.getName() + ": ")).append(this.getInquiry()).emptyLines(1).append(new TranslationTextComponent(colony.getCitizens().size() < colony.getCitizenCountLimit() ? "com.minecolonies.coremod.gui.chat.recruitcost" : "com.minecolonies.coremod.gui.chat.nospacerecruit", dataView.getName().split(" ")[0], recruitCost.getCount() + " " + recruitCost.getHoverName().getString())).getText());
int iconPosX = recruitButton.getX() + recruitButton.getWidth() - 28;
int iconPosY = recruitButton.getY() + recruitButton.getHeight() - 18;
ItemIcon icon = new ItemIcon();
icon.setID(RECRUITMENT_ICON);
icon.setSize(15, 15);
group.addChild(icon);
icon.setItem(((IVisitorViewData) dataView).getRecruitCost());
icon.setPosition(iconPosX, iconPosY);
icon.setVisible(true);
}
}
use of com.ldtteam.blockout.controls.ButtonImage in project minecolonies by ldtteam.
the class GuardTaskSetting method render.
@Override
public void render(final ISettingKey<?> key, final Pane pane, final ISettingsModuleView settingsModuleView, final IBuildingView building, final Window window) {
final String setting = getSettings().get(getCurrentIndex());
final ButtonImage targetButton = pane.findPaneOfTypeByID("setTarget", ButtonImage.class);
final Text mineLabel = pane.findPaneOfTypeByID("minePos", Text.class);
if (setting.equals(PATROL_MINE) && building instanceof AbstractBuildingGuards.View) {
mineLabel.setVisible(true);
if (((AbstractBuildingGuards.View) building).getMinePos() != null) {
mineLabel.setText(new TranslationTextComponent("com.minecolonies.coremod.gui.worherhuts.patrollingmine", ((AbstractBuildingGuards.View) building).getMinePos().toShortString()));
} else {
mineLabel.setText(new TranslationTextComponent("com.minecolonies.coremod.job.guard.assignmine"));
}
targetButton.setVisible(false);
} else if (!setting.equals(FOLLOW)) {
mineLabel.setVisible(false);
targetButton.setVisible(true);
if (setting.equals(PATROL)) {
if (!settingsModuleView.getSetting(AbstractBuildingGuards.PATROL_MODE).getValue().equals(PatrolModeSetting.MANUAL)) {
targetButton.setVisible(false);
} else {
targetButton.setText(new TranslationTextComponent("com.minecolonies.coremod.gui.workerhuts.targetpatrol"));
}
} else {
targetButton.setText(new TranslationTextComponent("com.minecolonies.coremod.gui.workerhuts.targetguard"));
}
targetButton.setHandler(button -> building.getModuleView(ToolModuleView.class).getWindow().open());
} else {
mineLabel.setVisible(false);
targetButton.setVisible(false);
}
pane.findPaneOfTypeByID("trigger", ButtonImage.class).setText(new TranslationTextComponent(setting));
}
Aggregations