Skip to content

Commit

Permalink
Merge pull request #6 from scify/feature/new-langs
Browse files Browse the repository at this point in the history
Added Spanish and Italian languages
  • Loading branch information
PavlosIsaris authored Oct 26, 2023
2 parents 835c625 + 1c0c3d8 commit bbb07b4
Show file tree
Hide file tree
Showing 1,008 changed files with 1,711 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

# Memor-i
# Memor-i | Memory Game for the visually impaired

<p align="center">
<img src="https://raw.githubusercontent.com/scify/Memor-i/master/src/main/resources/img/memori.png" width="400" alt="Gameplay">
</p>
<br>

A Memory card game especially tailored to meet the needs of blind people.
A Memory card game especially tailored to meet the needs of visually impaired people.
Check out our [YouTube video](https://www.youtube.com/watch?v=M2DqT5e975w)

![Memor-i gameplay](https://raw.githubusercontent.com/scify/Memor-i/master/src/main/resources/img/memori_gameplay.gif)
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
<version>2.14.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
Expand All @@ -37,12 +37,12 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.0</version>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.15</version>
<version>4.4.16</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand Down Expand Up @@ -72,7 +72,7 @@
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
<version>6.9.2</version>
<version>6.26.0</version>
</dependency>
</dependencies>
<build>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/scify/memori/fx/FXAudioEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ protected void playSoundFromFileSystem(String soundFilePath, boolean isBlocking)
try {
String pathToOpen = Objects.requireNonNull(FXAudioEngine.class.getResource(fileResourcePath)).toExternalForm();
audioClip = new AudioClip(pathToOpen);
MemoriLogger.LOGGER.log(Level.INFO, "loading sound for: " + soundFilePath + ". Queried path is: " + fileResourcePath);
audioClip.play();
} catch (Exception e) {
// MemoriLogger.LOGGER.log(Level.SEVERE, "error loading sound for: " + soundFilePath + ". Queried path was: " + fileResourcePath);
MemoriLogger.LOGGER.log(Level.SEVERE, "error loading sound for: " + soundFilePath + ". Queried path was: " + fileResourcePath);
return;
}
playingAudios.add(audioClip);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/scify/memori/fx/FXRenderingEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void setUpFXComponents() throws IOException {
vBox = (VBox) root.lookup("#vBox");
gridPane = ((GridPane) vBox.lookup("#gameGrid"));
backBtn = (Button) vBox.lookup("#backBtn");
if (!MemoriConfiguration.inputMethodIsKeyboard()) {
if (MemoriConfiguration.inputMethodIsMouseOrTouch()) {
backBtn.setOnTouchPressed(this::exitGame);
backBtn.setOnMouseClicked(this::exitGame);
} else {
Expand Down
21 changes: 13 additions & 8 deletions src/main/java/org/scify/memori/helper/MemoriConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Arrays;
import java.util.Properties;

Expand Down Expand Up @@ -83,7 +84,7 @@ public void setDataPackProperty(String propertyKey, String newPropertyValue) {
}

public void setProperty(String key, String value) {
if (value != null && !value.equals(""))
if (value != null && !value.isEmpty())
this.props.setProperty(key, value);
}

Expand All @@ -103,20 +104,24 @@ public void setLang(String langCode) throws Exception {
if (!Arrays.asList(acceptedLanguageCodes).contains(langCode))
throw new Exception("Language incorrect! Code: " + langCode);
setDataPackProperty("APP_LANG", langCode);
if (langCode.equals("en") || langCode.equals("el"))
updateDefaultDataPackageForLang(langCode);
else
updateDefaultDataPackageForLang("en");
updateDataPackageForLang(langCode);
}

protected void updateDefaultDataPackageForLang(String langCode) {
protected void updateDataPackageForLang(String langCode) {
String currentDataPack = getDataPackProperty("DATA_PACKAGE");
String currentDataPackNoLang = StringUtils.substringBeforeLast(currentDataPack, "_");
String currentDataPackNew = currentDataPackNoLang + "_" + langCode;
URL url = MemoriConfiguration.class.getResource("/" + currentDataPackNew);
if (url != null)
setDataPackProperty("DATA_PACKAGE", currentDataPackNew);

String currentDefaultDataPack = getDataPackProperty("DATA_PACKAGE_DEFAULT");
String currentDefaultDataPackNoLang = StringUtils.substringBeforeLast(currentDefaultDataPack, "_");
setDataPackProperty("DATA_PACKAGE_DEFAULT", currentDefaultDataPackNoLang + "_" + langCode);
ResourceLocator.getInstance().loadRootDataPaths();
}

public static boolean inputMethodIsKeyboard() {
return !MemoriConfiguration.getInstance().getDataPackProperty("INPUT_METHOD").equals("mouse_touch");
public static boolean inputMethodIsMouseOrTouch() {
return MemoriConfiguration.getInstance().getDataPackProperty("INPUT_METHOD").equals("mouse_touch");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.scify.memori.screens;

import io.sentry.Sentry;
import javafx.event.Event;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
Expand All @@ -32,7 +31,6 @@
import org.scify.memori.fx.FXSceneHandler;
import org.scify.memori.helper.DefaultExceptionHandler;
import org.scify.memori.helper.MemoriConfiguration;
import org.scify.memori.helper.MemoriLogger;
import org.scify.memori.helper.Utils;
import org.scify.memori.interfaces.AudioEngine;

Expand All @@ -42,7 +40,6 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;

import static javafx.scene.input.KeyCode.SPACE;

Expand Down Expand Up @@ -72,7 +69,7 @@ public void initialize(URL location, ResourceBundle resources) {
} else {
btnContainer.getChildren().remove(versus_computer);
}
if (!MemoriConfiguration.inputMethodIsKeyboard())
if (MemoriConfiguration.inputMethodIsMouseOrTouch())
tutorialBtn.setVisible(false);
}

Expand All @@ -84,7 +81,7 @@ public void setParameters(FXSceneHandler sceneHandler, Scene scene) {
}

/**
* Attaches focus handlers to fixed buttons (tutorial, exit, etc)
* Attaches focus handlers to fixed buttons (tutorial, exit, etc.)
*/
protected void attachButtonFocusHandlers() {

Expand Down Expand Up @@ -184,7 +181,7 @@ protected void goToSponsorsPageEventHandler(Event evt) {

protected void openSponsorsPage() {
String url = "https://memoristudio.scify.org/about#memori-game";
if(Utils.isWindows()) {
if (Utils.isWindows()) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
Desktop.getDesktop().browse(new URI(url));
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit bbb07b4

Please sign in to comment.