use of com.ldtteam.blockout.Pane in project minecolonies by ldtteam.
the class WindowBuilderResModule method onOpened.
@Override
public void onOpened() {
super.onOpened();
pullResourcesFromHut();
final ScrollingList resourceList = findPaneOfTypeByID(LIST_RESOURCES, ScrollingList.class);
resourceList.setDataProvider(new ScrollingList.DataProvider() {
@Override
public int getElementCount() {
return resources.size();
}
@Override
public void updateElement(final int index, @NotNull final Pane rowPane) {
updateResourcePane(index, rowPane);
}
});
// Make sure we have a fresh view
Network.getNetwork().sendToServer(new MarkBuildingDirtyMessage(this.buildingView));
findPaneOfTypeByID(LABEL_CONSTRUCTION_NAME, Text.class).setText(moduleView.getConstructionName());
findPaneOfTypeByID(STEP_PROGRESS, Text.class).setText(new TranslationTextComponent("com.minecolonies.coremod.gui.progress.step", moduleView.getCurrentStage(), moduleView.getTotalStages()));
}
use of com.ldtteam.blockout.Pane in project minecolonies by ldtteam.
the class WindowCitizenPage method fillCitizenInfo.
/**
* Executed when fill citizen is clicked.
*
* @param button the clicked button.
*/
private void fillCitizenInfo(final Button button) {
final ScrollingList citizenList = findPaneOfTypeByID(LIST_CITIZENS, ScrollingList.class);
for (final Pane pane : citizenList.getContainer().getChildren()) {
pane.findPaneOfTypeByID(NAME_LABEL, ButtonImage.class).enable();
}
final int row = citizenList.getListElementIndexByPane(button);
findPaneByID(CITIZEN_INFO).show();
button.disable();
final ICitizenDataView view = citizens.get(row);
CitizenWindowUtils.createHappinessBar(view, this);
CitizenWindowUtils.createSkillContent(view, this);
findPaneOfTypeByID(JOB_LABEL, Text.class).setText("§l" + LanguageHandler.format(view.getJob().trim().isEmpty() ? COM_MINECOLONIES_COREMOD_GUI_TOWNHALL_CITIZEN_UNEMPLOYED : view.getJob()));
findPaneOfTypeByID(HIDDEN_CITIZEN_ID, Text.class).setText(String.valueOf(view.getId()));
}
use of com.ldtteam.blockout.Pane in project minecolonies by ldtteam.
the class WindowInfoPage method fillEventsList.
private void fillEventsList() {
eventList = findPaneOfTypeByID(EVENTS_LIST, ScrollingList.class);
eventList.setDataProvider(new ScrollingList.DataProvider() {
@Override
public int getElementCount() {
return permissionEvents ? building.getPermissionEvents().size() : building.getColonyEvents().size();
}
@Override
public void updateElement(final int index, @NotNull final Pane rowPane) {
final Text nameLabel = rowPane.findPaneOfTypeByID(NAME_LABEL, Text.class);
final Text actionLabel = rowPane.findPaneOfTypeByID(ACTION_LABEL, Text.class);
if (permissionEvents) {
final PermissionEvent event = building.getPermissionEvents().get(index);
nameLabel.setText(event.getName() + (event.getId() == null ? " <fake>" : ""));
rowPane.findPaneOfTypeByID(POS_LABEL, Text.class).setText(event.getPosition().getX() + " " + event.getPosition().getY() + " " + event.getPosition().getZ());
if (event.getId() == null) {
rowPane.findPaneOfTypeByID(BUTTON_ADD_PLAYER_OR_FAKEPLAYER, Button.class).hide();
}
final String name = LanguageHandler.format(KEY_TO_PERMISSIONS + event.getAction().toString().toLowerCase(Locale.US));
if (name.contains(KEY_TO_PERMISSIONS)) {
Log.getLogger().warn("Didn't work for:" + name);
return;
}
actionLabel.setText(name);
} else {
final IColonyEventDescription event = building.getColonyEvents().get(index);
if (event instanceof CitizenDiedEvent) {
actionLabel.setText(((CitizenDiedEvent) event).getDeathCause());
} else {
actionLabel.setText(event.getName());
}
if (event instanceof ICitizenEventDescription) {
nameLabel.setText(((ICitizenEventDescription) event).getCitizenName());
} else if (event instanceof IBuildingEventDescription) {
IBuildingEventDescription buildEvent = (IBuildingEventDescription) event;
nameLabel.setText(buildEvent.getBuildingName() + " " + buildEvent.getLevel());
}
rowPane.findPaneOfTypeByID(POS_LABEL, Text.class).setText(event.getEventPos().getX() + " " + event.getEventPos().getY() + " " + event.getEventPos().getZ());
rowPane.findPaneOfTypeByID(BUTTON_ADD_PLAYER_OR_FAKEPLAYER, Button.class).hide();
}
}
});
}
use of com.ldtteam.blockout.Pane 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