use of com.minecolonies.api.colony.ICitizenDataView in project minecolonies by ldtteam.
the class SpecialAssignmentModuleWindow method onOpened.
@Override
public void onOpened() {
super.onOpened();
final List<Tuple<String, Integer>> workers = new ArrayList<>();
for (final IAssignmentModuleView module : buildingView.getModuleViews(IAssignmentModuleView.class)) {
for (final int worker : module.getAssignedCitizens()) {
workers.add(new Tuple<>(new TranslationTextComponent(module.getJobEntry().getTranslationKey()).getString(), worker));
}
}
if (findPaneByID(LIST_WORKERS) != null) {
ScrollingList workerList = findPaneOfTypeByID(LIST_WORKERS, ScrollingList.class);
workerList.setDataProvider(new ScrollingList.DataProvider() {
@Override
public int getElementCount() {
return workers.size();
}
@Override
public void updateElement(final int index, @NotNull final Pane rowPane) {
final ICitizenDataView worker = buildingView.getColony().getCitizen(workers.get(index).getB());
if (worker != null) {
rowPane.findPaneOfTypeByID(LABEL_WORKERNAME, Text.class).setText(new TranslationTextComponent(workers.get(index).getA()).getString() + ": " + worker.getName());
}
}
});
}
}
use of com.minecolonies.api.colony.ICitizenDataView 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()));
}
Aggregations