Introduction, also changed startmenu
This commit is contained in:
parent
4fe13ba57c
commit
ddd0764e19
9 changed files with 179 additions and 20 deletions
|
@ -67,6 +67,7 @@
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="com.rubenvandeven.emotionhero.MirrorMenuActivity" />
|
android:value="com.rubenvandeven.emotionhero.MirrorMenuActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name=".IntroductionActivity"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -376,10 +376,17 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
|
||||||
|
|
||||||
// check whether this is the highest reached level by the player
|
// check whether this is the highest reached level by the player
|
||||||
// ... used by 'continue' button in main menu
|
// ... used by 'continue' button in main menu
|
||||||
Scenario nextScenario = new Scenario(currentScenario.getNextLevelId(), this);
|
|
||||||
if(currentScenario.minimumScore < currentScenario.game.score && nextScenario.isHigherThen(playerInfo.reachedLevelId)) {
|
if(currentScenario.minimumScore < currentScenario.game.score) {
|
||||||
// allow player to continue to next level :-)
|
if(currentScenario.isFinalLevel()) {
|
||||||
playerInfo.reachedLevelId = nextScenario.id;
|
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);
|
// scores.add(score);
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,6 +55,8 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
||||||
|
|
||||||
RenderScript rs;
|
RenderScript rs;
|
||||||
|
|
||||||
|
Player player;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -64,6 +66,8 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
||||||
}
|
}
|
||||||
setContentView(R.layout.activity_mirror_menu);
|
setContentView(R.layout.activity_mirror_menu);
|
||||||
|
|
||||||
|
player = Player.getInstance(this);
|
||||||
|
|
||||||
RelativeLayout videoContentLayout = (RelativeLayout) findViewById(R.id.videoContent);
|
RelativeLayout videoContentLayout = (RelativeLayout) findViewById(R.id.videoContent);
|
||||||
ImageView logoEmotionHero = (ImageView) findViewById(R.id.logoEmotionHero);
|
ImageView logoEmotionHero = (ImageView) findViewById(R.id.logoEmotionHero);
|
||||||
messageText = (TextView) findViewById(R.id.messageText);
|
messageText = (TextView) findViewById(R.id.messageText);
|
||||||
|
@ -161,9 +165,14 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
||||||
startButton.setOnClickListener(new View.OnClickListener() {
|
startButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
loadGameDialog = ProgressDialog.show(MirrorMenuActivity.this, "",
|
Intent intent;
|
||||||
MirrorMenuActivity.this.getResources().getString(R.string.load_game_activity), true);
|
if(!player.getPlayerInfo().canContinueLevel()) {
|
||||||
Intent intent = new Intent(MirrorMenuActivity.this, GamingActivity.class);
|
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);
|
startActivity(intent);
|
||||||
detector.stop();
|
detector.stop();
|
||||||
detector = null;
|
detector = null;
|
||||||
|
@ -171,14 +180,19 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
highscoresButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
if(!player.getPlayerInfo().canContinueLevel()) {
|
||||||
public void onClick(View v) {
|
highscoresButton.setVisibility(View.GONE);
|
||||||
Intent intent = new Intent(MirrorMenuActivity.this, ProgressActivity.class);
|
} else {
|
||||||
// intent.putExtra(HighscoreActivity.INTENT_EXTRA_LEVEL, player.getPlayerInfo().reachedLevelId);
|
highscoresButton.setOnClickListener(new View.OnClickListener() {
|
||||||
startActivity(intent);
|
@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() {
|
creditsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -189,6 +203,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
||||||
});
|
});
|
||||||
|
|
||||||
rs = RenderScript.create(this);
|
rs = RenderScript.create(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.UUID;
|
||||||
public class PlayerInfo {
|
public class PlayerInfo {
|
||||||
public Map<Integer, ScoreList> levelScores = new HashMap<>();
|
public Map<Integer, ScoreList> levelScores = new HashMap<>();
|
||||||
public int reachedLevelId = -1;
|
public int reachedLevelId = -1;
|
||||||
|
public boolean completedAll = false;
|
||||||
|
|
||||||
public ScoreList getScoresForLevel(int lvl_id) {
|
public ScoreList getScoresForLevel(int lvl_id) {
|
||||||
ScoreList scoreList;
|
ScoreList scoreList;
|
||||||
|
@ -69,6 +70,10 @@ public class PlayerInfo {
|
||||||
if(lvl_id == reachedLevelId) {
|
if(lvl_id == reachedLevelId) {
|
||||||
return true;
|
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);
|
return Scenario.isHigherLevel(reachedLevelId, lvl_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class ProgressActivity extends AppCompatActivity {
|
||||||
introText.setOnClickListener(new View.OnClickListener() {
|
introText.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(ProgressActivity.this, IntroActivity.class);
|
Intent intent = new Intent(ProgressActivity.this, IntroductionActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -145,16 +145,25 @@ public class ProgressActivity extends AppCompatActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean completedAll = player.getPlayerInfo().completedAll;
|
||||||
|
|
||||||
TextView outroText = new TextView(this);
|
TextView outroText = new TextView(this);
|
||||||
outroText.setText(String.format("Ending: %1$s", "\"All hail the Emotion Hero!\""));
|
outroText.setText(String.format("Ending: %1$s", "\"All hail the Emotion Hero!\""));
|
||||||
// outroText.setText(String.format("%1$d. %2$s", si, "Em07i0n H3r0!"));
|
// outroText.setText(String.format("%1$d. %2$s", si, "Em07i0n H3r0!"));
|
||||||
outroText.setTextSize(getResources().getDimensionPixelSize(R.dimen.gametitle_textsize));
|
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.setPadding(defaultMargin,defaultMargin,defaultMargin,defaultMargin);
|
||||||
outroText.setId(R.id.textView);
|
outroText.setId(R.id.textView);
|
||||||
outroText.setTypeface(font);
|
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);
|
levelsLayout.addView(outroText);
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,9 +221,12 @@ public class ReviewActivity extends AppCompatActivity {
|
||||||
achievementTitle.setVisibility(View.VISIBLE);
|
achievementTitle.setVisibility(View.VISIBLE);
|
||||||
achievementLayout.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) {
|
for(Achievement achievement: game.achievements) {
|
||||||
if(achievementString.length() > 0) {
|
if(firstAchievement ) {
|
||||||
|
firstAchievement = false;
|
||||||
|
} else {
|
||||||
achievementString += "\n";
|
achievementString += "\n";
|
||||||
}
|
}
|
||||||
achievementString += String.format("%1$s", achievement.title);
|
achievementString += String.format("%1$s", achievement.title);
|
||||||
|
|
59
app/src/main/res/layout/activity_introduction.xml
Normal file
59
app/src/main/res/layout/activity_introduction.xml
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/activity_introduction"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
tools:context="com.rubenvandeven.emotionhero.IntroductionActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:id="@+id/introText1"
|
||||||
|
android:text="@string/game_intro_text"
|
||||||
|
android:textColor="@color/textPrimary"
|
||||||
|
android:textSize="30sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="Yes!"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:id="@+id/nextButton"
|
||||||
|
android:textSize="40sp"
|
||||||
|
android:textColor="@color/textHighlight"
|
||||||
|
android:layout_marginBottom="20dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:id="@+id/introText2"
|
||||||
|
android:text="@string/game_intro_text2"
|
||||||
|
android:textColor="@color/textPrimary"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="I'm ready!"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:id="@+id/readyButton"
|
||||||
|
android:textSize="40sp"
|
||||||
|
android:textColor="@color/textHighlight"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</RelativeLayout>
|
|
@ -14,4 +14,6 @@
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="section_format">Hello World from section: %1$d</string>
|
<string name="section_format">Hello World from section: %1$d</string>
|
||||||
<string name="load_game_activity">Loading training...</string>
|
<string name="load_game_activity">Loading training...</string>
|
||||||
|
<string name="game_intro_text">Are you ready to become the next <b>Emotion Hero</b>? With this program you train for the right emotional response in <i>every</i> situation.</string>
|
||||||
|
<string name="game_intro_text2">Feel the emotions as they are given by the dots on screen. If <i>you</i> feel them, <i>we</i> detect them.\nNote that you do not always need to go full throttle, we can detect eg. a 47% surprise score!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue