Browse Source

removed unneeded methode

pull/7/head
Jannik 3 years ago
parent
commit
bc36630ef2
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 79
      src/main/java/com/cemu_UI/application/MainWindowController.java

79
src/main/java/com/cemu_UI/application/MainWindowController.java

@ -952,85 +952,6 @@ public class MainWindowController {
LOGGER.info("successfully edited " + titleID + ", new name is \"" + title + "\"");
}
/**
* add game to games (ArrayList) and initialize all needed actions (start, time stamps, titleID)
* @param title : game title
* @param coverPath : path to cover (cache)
* @param romPath : path to ROM file (.rpx)
* @param titleID : game ID
*/
public void addGame(String title, String coverPath, String romPath, String titleID){
UIROMDataType uiROMElement = new UIROMDataType(romPath, titleID, title, coverPath, gameContextMenu);
uiROMElement.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
LOGGER.info("selected: " + title + "; ID: " + titleID);
// getting the selected game index by comparing event.getSource() with games.get(i).getButton()
for (int i = 0; i < games.size(); i++) {
if (games.get(i).getButton() == event.getSource()) {
selectedUIDataIndex = i;
}
}
gameExecutePath = romPath;
selectedGameTitleID = titleID;
selectedGameTitle = title;
// underlining selected Label
lastGameLabel.setStyle("-fx-underline: false;");
games.get(selectedUIDataIndex).getLabel().setStyle("-fx-underline: true;");
lastGameLabel = games.get(selectedUIDataIndex).getLabel();
// setting last played, if lastPlayed is empty game was never played before, else set correct date
if (dbController.getLastPlayed(titleID).equals("") || dbController.getLastPlayed(titleID).equals(null)) {
lastTimePlayedBtn.setText(lastPlayed + never);
totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID) + " min");
} else {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
int tToday = Integer.parseInt(dtf.format(LocalDate.now()).replaceAll("-", ""));
int tYesterday = Integer.parseInt(dtf.format(LocalDate.now().minusDays(1)).replaceAll("-", ""));
int tLastPlayedDay = Integer.parseInt(dbController.getLastPlayed(titleID).replaceAll("-", ""));
if (tLastPlayedDay == tToday) {
lastTimePlayedBtn.setText(lastPlayed + today);
} else if (tLastPlayedDay == tYesterday) {
lastTimePlayedBtn.setText(lastPlayed + yesterday);
} else {
lastTimePlayedBtn.setText(lastPlayed + dbController.getLastPlayed(titleID));
}
}
/**
* setting total playtime, if total playtime > 60 minutes, format is "x hours x
* minutes" (x h x min), else only minutes are showed
*/
if (Integer.parseInt(dbController.getTotalPlaytime(titleID)) > 60) {
int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(titleID)) / 60);
int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(titleID)) - 60 * hoursPlayed;
totalPlaytimeBtn.setText(hoursPlayed + " h " + minutesPlayed + " min");
} else {
totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID) + " min");
}
if (!playTrue) {
playBtnSlideIn();
}
if (menuTrue) {
sideMenuSlideOut();
burgerTask.setRate(-1.0);
burgerTask.play();
menuTrue = false;
}
}
});
// add uiROMElement to games list
games.add(uiROMElement);
}
/**
* add the context menu and button action for all games

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close