use of kml.game.profile.ProfileIcon in project Krothium-Launcher by DarkLBP.
the class MainFX method loadIcons.
/**
* Loads the profile icons
*/
private void loadIcons() {
console.print("Loading icons...");
ObservableList<ImageView> icons = FXCollections.observableArrayList();
for (ProfileIcon p : ProfileIcon.values()) {
if (p != ProfileIcon.CRAFTING_TABLE && p != ProfileIcon.GRASS) {
ImageView imv = new ImageView(kernel.getProfileIcon(p));
imv.setFitHeight(68);
imv.setFitWidth(68);
imv.setId(p.name());
icons.add(imv);
}
}
iconList.setItems(icons);
console.print("Icons loaded.");
}
use of kml.game.profile.ProfileIcon in project Krothium-Launcher by DarkLBP.
the class MainFX method getProfileList.
/**
* Generates an ObservableList of Labels representing each profile
* @return The profiles ObservableList
*/
private ObservableList<Label> getProfileList() {
ObservableList<Label> profileListItems = FXCollections.observableArrayList();
Profiles ps = kernel.getProfiles();
Label l;
ImageView iv;
String text;
for (Profile p : ps.getProfiles()) {
if (p.getType() == ProfileType.SNAPSHOT && !settings.getEnableSnapshots()) {
continue;
}
switch(p.getType()) {
case RELEASE:
iv = new ImageView(kernel.getProfileIcon(ProfileIcon.GRASS));
text = Language.get(59);
break;
case SNAPSHOT:
iv = new ImageView(kernel.getProfileIcon(ProfileIcon.CRAFTING_TABLE));
text = Language.get(60);
break;
default:
text = p.hasName() ? p.getName() : Language.get(70);
ProfileIcon pi = p.hasIcon() ? p.getIcon() : ProfileIcon.FURNACE;
iv = new ImageView(kernel.getProfileIcon(pi));
break;
}
iv.setFitWidth(68);
iv.setFitHeight(68);
l = new Label(text, iv);
// Fetch Minecraft version used by the profile
VersionMeta verID;
switch(p.getType()) {
case CUSTOM:
Versions versions = kernel.getVersions();
verID = p.hasVersion() ? p.getVersionID() : versions.getLatestRelease();
break;
case RELEASE:
verID = kernel.getVersions().getLatestRelease();
break;
default:
verID = kernel.getVersions().getLatestSnapshot();
break;
}
l.setId(p.getID());
if (verID != null) {
// If profile has any known version just show it below the profile name
if (verID.getType() == VersionType.SNAPSHOT && !settings.getEnableSnapshots()) {
continue;
}
if ((verID.getType() == VersionType.OLD_ALPHA || verID.getType() == VersionType.OLD_BETA) && !settings.getEnableHistorical()) {
continue;
}
l.setText(l.getText() + '\n' + verID.getID());
}
if (ps.getSelectedProfile().equals(p)) {
l.getStyleClass().add("selectedProfile");
}
profileListItems.add(l);
}
return profileListItems;
}
Aggregations