Ad wrinkle achievement and layout fixes

This commit is contained in:
Ruben 2016-09-22 00:24:03 +01:00
parent c91f7cbc21
commit 958780b57e
16 changed files with 159 additions and 63 deletions

View File

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -9,8 +9,8 @@ android {
applicationId 'com.rubenvandeven.emotion_hero'
minSdkVersion 16
targetSdkVersion 24
versionCode 6
versionName '0.5'
versionCode 7
versionName '0.9'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
renderscriptTargetApi 16

View File

@ -54,7 +54,7 @@
<activity android:name=".MirrorMenuActivity" />
<activity
android:name=".ReviewAchievementsActivity"
android:theme="@style/AppTheme.NoActionBar">
android:theme="@style/AchievementTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.rubenvandeven.emotionhero.ReviewActivity" />

View File

@ -331,13 +331,14 @@ public class AchievementCollection {
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("...");
textView.setText("\"Emotion work is understood as the art of trying to change in degree or quality an emotion or feeling. "+
"It may be defined as the management of one's own feelings or as work done in a conscious effort to maintain the well being of a relationship;\" (Wikipedia)");
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"Emotion work: evocation",
"Emotional labour: evocation",
null,
new Achievement.AchievementListener() {
@Override
@ -364,18 +365,30 @@ public class AchievementCollection {
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("...");
textView.setText("\"Emotional labor is the process of managing feelings and expressions in order to fulfill emotional requirements as part of the job role.[1][2] More specifically, workers are expected to regulate their emotions during interactions with customers, co-workers and superiors. This includes analysis and decision making in terms of the expression of emotion, whether actually felt or not, as well as its opposite: the suppression of emotions that are felt but not expressed.\" (Wikipedia)");
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"The game's on you", // ??(mixed feelings/complex emotions)
"Wrinkle alarm",//"The game's on you", // ??(mixed feelings/complex emotions)
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// ????
// lots of joy
float requiredJoy = 0;
float hasJoy = 0;
for(Hit hit: game.hits.values()) {
if(hit.target.emotion == Emotion.JOY) {
requiredJoy += hit.target.value;
}
hasJoy += hit.emotions.get(Emotion.JOY);
}
if(hasJoy >= requiredJoy * 2) {
return true;
}
return false;
}
@ -383,7 +396,7 @@ public class AchievementCollection {
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("...");
textView.setText("Besides tracking only points in the face, the intensity of wrinkles next to the eyes provides a clue as to how much someone is smiling.");
descriptionLayout.addView(textView);
}
})
@ -424,7 +437,7 @@ public class AchievementCollection {
boolean missedATarget = false;
// Add Kuleshov's target... person managers to do it
for(int target_id: game.scenario.kuleshovTargetIds) {
if(game.hits.get(target_id).bonus < 5) { // needs at least a little bonus on all
if(game.hits.get(target_id).bonus < 1) { // needs at least a little bonus on all
missedATarget = true;
}
}
@ -473,12 +486,16 @@ public class AchievementCollection {
public boolean hasGotAchievement(Player player, Game game) {
// on average an overexecaration??
int niceOnes = 0;
int applicableHits = 0;
for(Hit hit: game.hits.values()) {
if(hit.score >= 80) {
niceOnes ++;
if(hit.target.value > 75) {
applicableHits++;
if(hit.score >= 80) {
niceOnes ++;
}
}
}
if(niceOnes >= game.hits.size() * 0.8) {
if(niceOnes >= applicableHits * 0.8) {
return true;
}
return false;
@ -488,8 +505,8 @@ public class AchievementCollection {
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("You are remarkably good at posing, just like this guy:");
// TODO: ad MS image
textView.setText("You are remarkably good at posing for the requested emotion!");
// TODO: ad MS image "just like this guy"
descriptionLayout.addView(textView);
}
})

View File

@ -79,7 +79,7 @@ public class EndingActivity extends AppCompatActivity {
if(rank == 1) {
textSuccess.setVisibility(View.VISIBLE);
logoEmotionHero.setVisibility(View.VISIBLE);
// logoEmotionHero.setVisibility(View.VISIBLE);
} else {
textFailure.setVisibility(View.VISIBLE);
}

View File

@ -2,6 +2,7 @@ package com.rubenvandeven.emotionhero;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
@ -15,7 +16,9 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.text.Layout;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -32,6 +35,8 @@ import org.ocpsoft.prettytime.PrettyTime;
import java.util.UUID;
import static android.view.View.TEXT_ALIGNMENT_TEXT_END;
public class HighscoreActivity extends AppCompatActivity {
@ -201,7 +206,10 @@ public class HighscoreActivity extends AppCompatActivity {
TextView levelName = (TextView) rootView.findViewById(R.id.levelName);
levelName.setText("\""+scenario.toString()+"\"");
levelName.setText(scenario.toString());
Typeface font = Typeface.createFromAsset(getContext().getAssets(), "unifont-9.0.02.ttf");
levelName.setTypeface(font);
startLvlButton.setTypeface(font);
LinearLayout topscoreList = (LinearLayout) rootView.findViewById(R.id.topscoreList);
@ -223,11 +231,26 @@ public class HighscoreActivity extends AppCompatActivity {
for(Game game: games) {
final long itemGameId = game.id;
i++;
String highscoreText = String.format("%1$d. %2$.4f", i, game.score+game.bonus); //make line by line elements
String highscoreScoreText = String.format("%1$.2f", game.score+game.bonus); //make line by line elements
String highscorePositionText = String.format("%1$d.", i); //make line by line elements
LinearLayout scoreLayout = new LinearLayout(getContext());
scoreLayout.setOrientation(LinearLayout.HORIZONTAL);
TextView scoreItem = new TextView(getContext());
scoreItem.setText(highscoreText);
scoreItem.setTextColor(ContextCompat.getColor(getContext(), R.color.highscore));
scoreItem.setOnClickListener(new View.OnClickListener() {
TextView scorePos = new TextView(getContext());
scoreItem.setGravity(Gravity.RIGHT);
scoreItem.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
scoreItem.setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));
scoreItem.setText(highscoreScoreText );
scorePos.setText(highscorePositionText);
// scoreItem.setTextColor(ContextCompat.getColor(getContext(), R.color.highscore));
scoreItem.setTextColor(ContextCompat.getColor(getContext(), R.color.textPrimary));
scorePos.setTextColor(ContextCompat.getColor(getContext(), R.color.textHighlight));
scoreLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getContext(), ReviewActivity.class);
@ -239,17 +262,39 @@ public class HighscoreActivity extends AppCompatActivity {
float multiplier = i <= 5 ? 1 + (5-i)/5f : 1f;
scoreItem.setTextSize(getResources().getDimension(R.dimen.highscore_textsize) * multiplier);
scoreItem.setTypeface(Typeface.DEFAULT_BOLD);
topscoreList.addView(scoreItem);
scorePos.setTextSize(getResources().getDimension(R.dimen.highscore_textsize) * multiplier);
scoreLayout.addView(scorePos);
scoreLayout.addView(scoreItem);
topscoreList.addView(scoreLayout);
LinearLayout detailLayout = new LinearLayout(getContext());
detailLayout.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
llp.setMargins(0, -20, 0, 0); // llp.setMargins(left, top, right, bottom);
detailLayout.setLayoutParams(llp);
TextView dateItem = new TextView(getContext());
dateItem.setText(prettyTime.format(game.time));
dateItem.setTextColor(ContextCompat.getColor(getContext(), R.color.textSecondary));
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
llp.setMargins(0, -20, 0, 0); // llp.setMargins(left, top, right, bottom);
dateItem.setLayoutParams(llp);
dateItem.setTypeface(Typeface.DEFAULT);
topscoreList.addView(dateItem);
TextView achievementText = new TextView(getContext());
achievementText.setText(String.format("+%1$d achievements", game.achievements.size()));
achievementText.setTextColor(getResources().getColor(R.color.textPrimary));
achievementText.setGravity(Gravity.RIGHT);
achievementText.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
detailLayout.addView(dateItem);
detailLayout.addView(achievementText);
topscoreList.addView(detailLayout);
if(currentGame != null && currentGame.id == game.id) {
foundScore = true;
@ -273,6 +318,7 @@ public class HighscoreActivity extends AppCompatActivity {
if(player.getPlayerInfo().hasAccessToLevel(lvl_id)) {
if(currentGame != null) { // if we come from the level itself.. show retry!
startLvlButton.setText("Retry");
}

View File

@ -81,7 +81,7 @@ public class ReviewAchievementsActivity extends AppCompatActivity {
titleText.setText(achievement.title);
// titleText.setText("mwa");
titleText.setTextColor(getResources().getColor(R.color.textHighlight));
titleText.setTextColor(getResources().getColor(R.color.colorPrimary));
titleText.setTextSize(getResources().getDimensionPixelSize(R.dimen.highscore_textsize));
titleText.setLayoutParams(params);

View File

@ -172,21 +172,30 @@ public class ReviewActivity extends AppCompatActivity {
nextLvlText.setVisibility(View.GONE);
nextLvlLayout.setVisibility(View.GONE);
TextView improveTitle= (TextView) findViewById(R.id.improveTitle);
TextView retryTitle = (TextView) findViewById(R.id.retryTitle );
TextView nextLvlTitle = (TextView) findViewById(R.id.nextLvlTitle);
checkAchievements();
Typeface font = Typeface.createFromAsset(getAssets(), "unifont-9.0.02.ttf");
lvlNameText.setTypeface(font);
overallScorePercText.setTypeface(font);
achievementArrow.setTypeface(font);
achievementText.setTypeface(font);
// achievementText.setTypeface(font);
retryArrow.setTypeface(font);
// improveArrow.setTypeface(font);
nextLvlArrow.setTypeface(font);
achievementTitle.setTypeface(font);
improveTitle.setTypeface(font);
retryTitle.setTypeface(font);
nextLvlTitle.setTypeface(font);
lvlNameText.setText("\""+game.scenario.toString()+"\"");
lvlNameText.setText(game.scenario.toString());
PrettyTime p = new PrettyTime();
dateText.setText(p.format(game.time));
scoreText.setText(String.format("%1$.4f", game.score+game.bonus));
scoreText.setText(String.format("%1$.2f", game.score+game.bonus));
// overallScorePercText.setText(String.format("%1$.0f%%", 30f));
loadRemoteInfo.run();

View File

@ -684,10 +684,10 @@ public class Scenario {
setMinimumScoreFromPercentage(40);
minimumAchievements = 2;
achievements.add(achievementCollection.get(8));
achievements.add(achievementCollection.get(9));
achievements.add(achievementCollection.get(10));
achievements.add(achievementCollection.get(11));
achievements.add(achievementCollection.get(12));
achievements.add(achievementCollection.get(13));
achievements.add(achievementCollection.get(14));
break;
case LVL_ACTNORMAL:
@ -733,20 +733,21 @@ public class Scenario {
setTarget(Emotion.CONTEMPT, 10, a);
setTarget(Emotion.SURPRISE, 10, a);
setTarget(Emotion.DISGUST, 5, a++);
setTarget(Emotion.CONTEMPT, 5, a);
setTarget(Emotion.SURPRISE, 5, a);
setTarget(Emotion.DISGUST, 10, a++);
setTarget(Emotion.CONTEMPT, 10, a);
setTarget(Emotion.SURPRISE, 10, a);
// Kuleshov's target:
kuleshovTargetIds = new int[3];
kuleshovTargetIds[0] = setTarget(Emotion.DISGUST, 1, a++);
kuleshovTargetIds[1] = setTarget(Emotion.CONTEMPT, 1, a);
kuleshovTargetIds[2] = setTarget(Emotion.SURPRISE, 1, a);
// use 3% instead of 0.2% as it otherwise becomes invisible!
kuleshovTargetIds[0] = setTarget(Emotion.DISGUST, 3, a++);
kuleshovTargetIds[1] = setTarget(Emotion.CONTEMPT, 3, a);
kuleshovTargetIds[2] = setTarget(Emotion.SURPRISE, 3, a);
// END OF KULESHOV
setTarget(Emotion.DISGUST, 1, a++);
setTarget(Emotion.CONTEMPT, 1, a);
setTarget(Emotion.SURPRISE, 1, a);
setTarget(Emotion.DISGUST, 3, a++);
setTarget(Emotion.CONTEMPT, 3, a);
setTarget(Emotion.SURPRISE, 3, a);
setTarget(Emotion.ANGER, 1, a++);
@ -759,9 +760,9 @@ public class Scenario {
setMinimumScoreFromPercentage(40);
minimumAchievements = 2;
achievements.add(achievementCollection.get(12));
achievements.add(achievementCollection.get(13));
achievements.add(achievementCollection.get(14));
achievements.add(achievementCollection.get(15));
achievements.add(achievementCollection.get(16));
achievements.add(achievementCollection.get(17));
break;
}

View File

@ -56,8 +56,9 @@
android:textSize="30sp"
android:textColor="@color/textPrimary" />
<!--If you encounter them in a conversation, not only remember your training, but remember that they had their training as well. / they have a better mask/can control better-->
<TextView
android:text="You seek desperately to become the Emotion Hero. However, you are not yet there. \nDespite finishing all steps in the training, your peers have done the same. They are better at employing this technology for their own benefit, so you are still one step behind.\nKeep on training young padawan, and eventually, you might become the one and only..."
android:text="@string/ending_loser"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textFailure"
@ -65,8 +66,9 @@
android:textColor="@color/textPrimary"
android:visibility="gone"/>
<!-- Next time you have a conversation, remember your training: you are better at adapting yourself to the requirements of a situation than any other. / mask?-->
<TextView
android:text="You are the one and only Emotion Hero. As number one in the general ranklist, you are the 'Master of the face'."
android:text="@string/ending_winner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textSuccess"

View File

@ -27,7 +27,8 @@
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
app:popupTheme="@style/AppTheme.PopupOverlay"
app:titleTextColor="@color/textHighlight">
</android.support.v7.widget.Toolbar>

View File

@ -89,13 +89,12 @@
android:layout_alignLeft="@+id/dateText"
android:layout_alignStart="@+id/dateText"
android:layout_marginTop="40dp"
android:layout_toStartOf="@+id/scoreText"
android:layout_width="wrap_content"
android:layout_width="100dp"
android:layout_alignBottom="@+id/scoreText"
android:layout_marginLeft="0dp"
android:layout_marginBottom="-10dp"
android:layout_alignRight="@+id/dateText"
android:layout_alignEnd="@+id/dateText" />
android:adjustViewBounds="false"
android:cropToPadding="true" />
<TextView
android:text="..."
@ -116,6 +115,7 @@
<TextView
android:text="overall position"
android:layout_marginTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView"
@ -144,7 +144,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/emotion_joy"
android:background="@color/highscore"
android:padding="@dimen/fab_margin"
android:layout_below="@+id/achievementTitle"
android:layout_alignParentLeft="true"
@ -159,7 +159,7 @@
android:id="@+id/achievementText"
android:layout_toLeftOf="@+id/achievementArrow"
android:layout_centerInParent="true"
android:textColor="@color/textPrimary"
android:textColor="@color/textSecondary"
tools:text="No achievements." />
@ -170,7 +170,7 @@
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="@+id/achievementArrow"
android:textColor="@color/textPrimary"
android:textColor="@color/textSecondary"
android:textSize="36sp"
android:layout_centerInParent="true" />
</RelativeLayout>

View File

@ -20,7 +20,6 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:titleTextColor="@color/textHighlight">

View File

@ -33,9 +33,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/levelName"
android:textSize="15sp"
android:textColor="@color/highscore"
android:textStyle="normal|bold" />
android:textSize="24sp"
android:textColor="@color/textPrimary"
android:textStyle="normal"
android:fontFamily="monospace"
tools:text="&quot;Please don't cry&quot;" />
</LinearLayout>
@ -55,7 +57,10 @@
android:layout_height="wrap_content"
android:text="Start"
android:id="@+id/startLvlButton"
android:layout_weight="1"/>
android:layout_weight="1"
android:fontFamily="monospace"
android:textSize="24sp"
android:textColor="@color/textHighlight" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -16,9 +16,11 @@
<string name="section_format">Hello World from section: %1$d</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">The bar belows shows your current feelings.\nFeel the emotions as they are given by the dots on screen. If <i>you</i> feel them, <i>we</i> detect them!</string>
<string name="game_intro_text2">The bar belows shows your current feelings.\nFeel the emotions as they are given by the dots that come down on the screen. If <i>you</i> feel them, <i>we</i> detect them!</string>
<string name="permission_description">When you play this game, it can collect fragments of your face which are contributed to a shared artwork. See the example image below, emotionhero.com.\nAre you ok with this?</string>
<string name="permission_no">Rather not</string>
<string name="permission_yes">Sure!</string>
<string name="ending_winner">You are the one and only <i>Emotion Hero</i>!</string>
<string name="ending_loser">You have finished all steps in the training, and many peers have done the same. It is too bad that many scored better than you. Try smiling better next time!</string>
</resources>

View File

@ -12,6 +12,20 @@
<item name="android:colorBackground">@color/colorPrimary</item>
</style>
<style name="AchievementTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorScenarioLine</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/textSecondary</item>
<item name="android:textColorPrimary">@color/colorPrimary</item>
<item name="android:windowBackground">@color/highscore</item>
<item name="android:textColorSecondary">@color/colorPrimaryDark</item>
<item name="android:colorBackground">@color/highscore</item>
</style>
<style name="FullscreenTheme" parent="AppTheme">
<item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
<item name="android:windowActionBarOverlay">true</item>