diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index eb97023..15b50da 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -67,6 +67,7 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="com.rubenvandeven.emotionhero.MirrorMenuActivity" />
+
\ No newline at end of file
diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/GamingActivity.java b/app/src/main/java/com/rubenvandeven/emotionhero/GamingActivity.java
index 2e81b15..a2d3a92 100644
--- a/app/src/main/java/com/rubenvandeven/emotionhero/GamingActivity.java
+++ b/app/src/main/java/com/rubenvandeven/emotionhero/GamingActivity.java
@@ -376,10 +376,17 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
// check whether this is the highest reached level by the player
// ... used by 'continue' button in main menu
- Scenario nextScenario = new Scenario(currentScenario.getNextLevelId(), this);
- if(currentScenario.minimumScore < currentScenario.game.score && nextScenario.isHigherThen(playerInfo.reachedLevelId)) {
- // allow player to continue to next level :-)
- playerInfo.reachedLevelId = nextScenario.id;
+
+ if(currentScenario.minimumScore < currentScenario.game.score) {
+ if(currentScenario.isFinalLevel()) {
+ playerInfo.completedAll = true;
+ } else {
+ Scenario nextScenario = new Scenario(currentScenario.getNextLevelId(), this);
+ if(nextScenario.isHigherThen(playerInfo.reachedLevelId)) {
+ // allow player to continue to next level :-)
+ playerInfo.reachedLevelId = nextScenario.id;
+ }
+ }
}
// scores.add(score);
diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/IntroductionActivity.java b/app/src/main/java/com/rubenvandeven/emotionhero/IntroductionActivity.java
new file mode 100644
index 0000000..9eab55f
--- /dev/null
+++ b/app/src/main/java/com/rubenvandeven/emotionhero/IntroductionActivity.java
@@ -0,0 +1,58 @@
+package com.rubenvandeven.emotionhero;
+
+import android.content.Intent;
+import android.graphics.Typeface;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.support.v7.widget.Toolbar;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.TextView;
+
+/**
+ * Not to be confused with IntroActivity:
+ * this is the first game introduction (explaining the procedure etc.)
+ */
+public class IntroductionActivity extends AppCompatActivity {
+
+ TextView nextButton;
+ TextView readyButton;
+ TextView text1;
+ TextView text2;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ setContentView(R.layout.activity_introduction);
+
+
+ nextButton = (TextView) findViewById(R.id.nextButton);
+ readyButton = (TextView) findViewById(R.id.readyButton);
+ text1 = (TextView) findViewById(R.id.introText1);
+ text2 = (TextView) findViewById(R.id.introText2);
+
+ Typeface font = Typeface.createFromAsset(getAssets(), "unifont-9.0.02.ttf");
+ nextButton.setTypeface(font);
+ readyButton.setTypeface(font);
+
+ nextButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ nextButton.setVisibility(View.GONE);
+ readyButton.setVisibility(View.VISIBLE);
+ text1.setVisibility(View.GONE);
+ text2.setVisibility(View.VISIBLE);
+ }
+ });
+
+ readyButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(IntroductionActivity.this, ProgressActivity.class);
+ finish();
+ startActivity(intent);
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/MirrorMenuActivity.java b/app/src/main/java/com/rubenvandeven/emotionhero/MirrorMenuActivity.java
index 968c3e6..ac683ef 100644
--- a/app/src/main/java/com/rubenvandeven/emotionhero/MirrorMenuActivity.java
+++ b/app/src/main/java/com/rubenvandeven/emotionhero/MirrorMenuActivity.java
@@ -55,6 +55,8 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
RenderScript rs;
+ Player player;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -64,6 +66,8 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
}
setContentView(R.layout.activity_mirror_menu);
+ player = Player.getInstance(this);
+
RelativeLayout videoContentLayout = (RelativeLayout) findViewById(R.id.videoContent);
ImageView logoEmotionHero = (ImageView) findViewById(R.id.logoEmotionHero);
messageText = (TextView) findViewById(R.id.messageText);
@@ -161,9 +165,14 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
startButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- loadGameDialog = ProgressDialog.show(MirrorMenuActivity.this, "",
- MirrorMenuActivity.this.getResources().getString(R.string.load_game_activity), true);
- Intent intent = new Intent(MirrorMenuActivity.this, GamingActivity.class);
+ Intent intent;
+ if(!player.getPlayerInfo().canContinueLevel()) {
+ intent = new Intent(MirrorMenuActivity.this, IntroductionActivity.class);
+ } else {
+ loadGameDialog = ProgressDialog.show(MirrorMenuActivity.this, "",
+ MirrorMenuActivity.this.getResources().getString(R.string.load_game_activity), true);
+ intent = new Intent(MirrorMenuActivity.this, GamingActivity.class);
+ }
startActivity(intent);
detector.stop();
detector = null;
@@ -171,14 +180,19 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
}
});
- highscoresButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(MirrorMenuActivity.this, ProgressActivity.class);
-// intent.putExtra(HighscoreActivity.INTENT_EXTRA_LEVEL, player.getPlayerInfo().reachedLevelId);
- startActivity(intent);
- }
- });
+
+ if(!player.getPlayerInfo().canContinueLevel()) {
+ highscoresButton.setVisibility(View.GONE);
+ } else {
+ highscoresButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(MirrorMenuActivity.this, ProgressActivity.class);
+ // intent.putExtra(HighscoreActivity.INTENT_EXTRA_LEVEL, player.getPlayerInfo().reachedLevelId);
+ startActivity(intent);
+ }
+ });
+ }
creditsButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -189,6 +203,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
});
rs = RenderScript.create(this);
+
}
@Override
diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/PlayerInfo.java b/app/src/main/java/com/rubenvandeven/emotionhero/PlayerInfo.java
index b0bcda0..201401b 100644
--- a/app/src/main/java/com/rubenvandeven/emotionhero/PlayerInfo.java
+++ b/app/src/main/java/com/rubenvandeven/emotionhero/PlayerInfo.java
@@ -15,6 +15,7 @@ import java.util.UUID;
public class PlayerInfo {
public Map levelScores = new HashMap<>();
public int reachedLevelId = -1;
+ public boolean completedAll = false;
public ScoreList getScoresForLevel(int lvl_id) {
ScoreList scoreList;
@@ -69,6 +70,10 @@ public class PlayerInfo {
if(lvl_id == reachedLevelId) {
return true;
}
+ // always access to first level (where would one otherwise begin?)
+ if(Scenario.SCENARIOS.get(0) == lvl_id) {
+ return true;
+ }
return Scenario.isHigherLevel(reachedLevelId, lvl_id);
}
diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/ProgressActivity.java b/app/src/main/java/com/rubenvandeven/emotionhero/ProgressActivity.java
index cd24e6c..3cd1b72 100644
--- a/app/src/main/java/com/rubenvandeven/emotionhero/ProgressActivity.java
+++ b/app/src/main/java/com/rubenvandeven/emotionhero/ProgressActivity.java
@@ -62,7 +62,7 @@ public class ProgressActivity extends AppCompatActivity {
introText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Intent intent = new Intent(ProgressActivity.this, IntroActivity.class);
+ Intent intent = new Intent(ProgressActivity.this, IntroductionActivity.class);
startActivity(intent);
}
});
@@ -145,16 +145,25 @@ public class ProgressActivity extends AppCompatActivity {
}
+ boolean completedAll = player.getPlayerInfo().completedAll;
TextView outroText = new TextView(this);
outroText.setText(String.format("Ending: %1$s", "\"All hail the Emotion Hero!\""));
// outroText.setText(String.format("%1$d. %2$s", si, "Em07i0n H3r0!"));
outroText.setTextSize(getResources().getDimensionPixelSize(R.dimen.gametitle_textsize));
- outroText.setTextColor(getResources().getColor(R.color.textHighlight));
+ outroText.setTextColor(completedAll ? getResources().getColor(R.color.textHighlight) : getResources().getColor(R.color.textSecondary) );
outroText.setPadding(defaultMargin,defaultMargin,defaultMargin,defaultMargin);
outroText.setId(R.id.textView);
outroText.setTypeface(font);
- // TODO: check if last level was sufficient (minscore/achievements)
+
+ if(completedAll) {
+ outroText.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // TODO: .. handle onclick!!
+ }
+ });
+ }
levelsLayout.addView(outroText);
}
diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/ReviewActivity.java b/app/src/main/java/com/rubenvandeven/emotionhero/ReviewActivity.java
index 1df00d7..ece894d 100644
--- a/app/src/main/java/com/rubenvandeven/emotionhero/ReviewActivity.java
+++ b/app/src/main/java/com/rubenvandeven/emotionhero/ReviewActivity.java
@@ -221,9 +221,12 @@ public class ReviewActivity extends AppCompatActivity {
achievementTitle.setVisibility(View.VISIBLE);
achievementLayout.setVisibility(View.VISIBLE);
- String achievementString = "";
+ String achievementString = game.achievements.size() > 1 ? "You've obtained special achievements!\n" : "You've obtained the special achievement ";
+ boolean firstAchievement = true;
for(Achievement achievement: game.achievements) {
- if(achievementString.length() > 0) {
+ if(firstAchievement ) {
+ firstAchievement = false;
+ } else {
achievementString += "\n";
}
achievementString += String.format("%1$s", achievement.title);
diff --git a/app/src/main/res/layout/activity_introduction.xml b/app/src/main/res/layout/activity_introduction.xml
new file mode 100644
index 0000000..0165f33
--- /dev/null
+++ b/app/src/main/res/layout/activity_introduction.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 77b04b5..530f6bb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -14,4 +14,6 @@
Settings
Hello World from section: %1$d
Loading training...
+ Are you ready to become the next Emotion Hero? With this program you train for the right emotional response in every situation.
+ Feel the emotions as they are given by the dots on screen. If you feel them, we detect them.\nNote that you do not always need to go full throttle, we can detect eg. a 47% surprise score!