emotionhero/app/src/main/java/com/rubenvandeven/emotionhero/AchievementCollection.java

534 lines
28 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.rubenvandeven.emotionhero;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.widget.AppCompatTextView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* Created by ruben on 10/09/16.
*/
public class AchievementCollection {
private ArrayList<Achievement> achievements = new ArrayList<Achievement>(){{
// fill the collection :-)
add(new Achievement(
"Microexpressor",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// not showing intense enough? requested emo's only minisculy detected
//return false;
for(Hit hit: game.hits.values()) {
if(hit.target.value == 100) {
// if target was 100, but player only showed less
// then 13..s/he's playing with microexpressions ;-)
if(hit.emotions.get(hit.target.emotion) < 20) {
return true;
}
}
}
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("Do you have something to hide? You are not showing all requested emotions intense enough. A microexpression is a brief, involuntary facial expression shown on the face of humans according to emotions experienced.");
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"Emotional leakage",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// picking up on emotions that are not requested.
// check for all hits in the level...
for(Hit hit: game.hits.values()) {
for(Emotion emotion: Emotion.values()) {
// ... whether the emotions that are NOT scored
// still have a value
if( hit.target.emotion != emotion && hit.emotions.get(emotion) > 20) {
// if so, there is emo leakage!!
return true;
}
}
}
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("There is no sign of deceit itself. There is no gesture, facial expression, nor muscle twitch that itself indicates that a person is lying. There are only clues that the person is poorly prepared and that the clues of emotions do not fit what the person is saying. These are what provide clues of leakage or deception. (Wikipedia)");
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"A conversation with your data double",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// 2nd play is better than _PREVIOUS_ play!
Game previousGame = player.getGameOpenHelper().getPreviousGame(game);
if(previousGame == null) {
return false;
}
if(previousGame.bonus+previousGame.score < game.bonus+game.score) {
return true;
}
return false;
}
@Override
public void setDescription(Player player, Game game, final LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("You improved your performance after a retry! The 'data double' is a term coined by Mina Ruckenstein to describe how our gathered information is be figuratively reassembled for the purposes of personal reflection and interaction.");
descriptionLayout.addView(textView);
/*AppCompatTextView seeAlsoView = new AppCompatTextView(c);
seeAlsoView.setTextSize(12);
seeAlsoView.setText("See also: Ruckenstein, Mina (2014) Visualized and Interacted Life: Personal Analytics and Engagements with Data Doubles");
seeAlsoView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String url = "https://www.researchgate.net/publication/260792107_Visualized_and_Interacted_Life_Personal_Analytics_and_Engagements_with_Data_Doubles";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
descriptionLayout.getContext().startActivity(i);
}
});
descriptionLayout.addView(seeAlsoView);*/
}
})
);
add(new Achievement(
"Named emotions",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// have expressed all named emotions!
Map<Emotion, Boolean> showedEmotions = new HashMap<Emotion, Boolean>();
for(Hit hit: game.hits.values()) {
if(hit.score > 50) {
showedEmotions.put(hit.target.emotion, true);
}
}
if(showedEmotions.size() == Emotion.values().length) {
return true;
}
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("\"We do not have names for all the possible combinations of " +
"primary and background focuses. No one culture has a monopoly on emotions, and each culture may offer its own unique feelings.\" (Hochschild, 1983)");
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"Augustine",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// all hit emotions are > 80%
boolean hasLowerItem = false;
for(Hit hit: game.hits.values()) {
if(hit.emotions.get(hit.target.emotion) <= 80) {
hasLowerItem = true;
}
}
return !hasLowerItem; // reverse
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("You are HYSTERICAL!!! Augustine is one of Jean-Martin Charcot's proofs cases for hysteria. Read 'The Invention Of Hysteria' by George Didi-Huberman on how Charcot contributed to her performance of hysteria.");
descriptionLayout.addView(textView);
AppCompatTextView seeAlsoView = new AppCompatTextView(c);
// seeAlsoView.setTextSize(12);
seeAlsoView.setText("Hysteria, in the colloquial use of the term, means ungovernable emotional excess. Generally, modern medical professionals have abandoned using the term \"hysteria\" to denote a diagnostic category, replacing it with more precisely defined categories. (Wikipedia)");
descriptionLayout.addView(seeAlsoView);
}
})
);
add(new Achievement(
"Steward(ess)", //Emotional labour
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("...");
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"Stuff", // trouble recognising
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// have 10 times in which another emotion is expressed most pronounced then the one that is requested
int timesWrong = 0;
for(Hit hit: game.hits.values()) {
Emotion mostPronouncedEmotion = null;
for(Emotion emotion: hit.emotions.keySet()) {
if(mostPronouncedEmotion == null || hit.emotions.get(mostPronouncedEmotion) < hit.emotions.get(emotion)) {
mostPronouncedEmotion = emotion;
}
}
if(mostPronouncedEmotion != hit.target.emotion) {
timesWrong++;
}
}
return timesWrong >= 10;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("Have you been on drugs? You're making a mess of things!");
descriptionLayout.addView(textView);
AppCompatTextView seeAlsoView = new AppCompatTextView(c);
seeAlsoView.setText("\"[...] Participants were tested between 1 and 2h after treatment with oral cocaine (300mg) or placebo. Emotion recognition of low and high intensity expressions of basic emotions (fear, anger, disgust, sadness, and happiness) was tested. Findings show that cocaine impaired recognition of negative emotions; this was mediated by the intensity of the presented emotions.\" (Kuypers, 2015)");
descriptionLayout.addView(seeAlsoView);
}
})
);
add(new Achievement(
"Perfect CEO",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// you score anger, disgust, contempt on moments where it is not needed
for(Hit hit: game.hits.values()) {
if(hit.target.emotion == Emotion.ANGER || hit.target.emotion == Emotion.DISGUST|| hit.target.emotion == Emotion.FEAR){
continue;
}
if(hit.emotions.get(Emotion.ANGER) > 20 || hit.emotions.get(Emotion.DISGUST) > 20 || hit.emotions.get(Emotion.FEAR) > 20) {
return true;
}
}
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("You would be a great CEO! You'll be able to convice shareholders, even if the company is in chaos!");
descriptionLayout.addView(textView);
AppCompatTextView seeAlsoView = new AppCompatTextView(c);
seeAlsoView.setText("\"Although fear, anger, and disgust are negative emotions, Dr. Cicon found they correlated positively with financial performance. CEOs whose faces during a media interview showed disgustas evidenced by lowered eyebrows and eyes, and a closed, pursed mouthwere associated with a 9.3% boost in overall profits in the following quarter. CEOs who expressed fearraised eyebrows, widened eyes and mouth, and lips pulled in at the cornerssaw their companies stock rise .4% in the following week.\" (The Wall Street Journal, 17 Feb 2016)");
descriptionLayout.addView(seeAlsoView);
}
})
);
add(new Achievement(
"You've got the job",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// ???
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("...");
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"Commercial",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// ???
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("...");
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"Emotion work: suppression",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// You score good on the surpressed (<70%) targets (bonus points there!)
int suppressedTotal=0;
int suppressedGood=0;
for(Hit hit: game.hits.values()) {
if(hit.target.value > 70) {
continue;
}
suppressedTotal++;
if(hit.bonus > 10) {
suppressedGood++;
}
}
if(suppressedTotal*0.8 <= suppressedGood) {
return true;
}
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
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(
"Emotional labour: evocation",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// You score good on the high ranked (>70%) targets (requires bonus points)
int evocedTotal=0;
int evocedGood=0;
for(Hit hit: game.hits.values()) {
if(hit.target.value <= 70) {
continue;
}
evocedTotal++;
if(hit.bonus > 10) {
evocedGood++;
}
}
if(evocedTotal*0.8 <= evocedGood) {
return true;
}
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
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(
"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;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
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);
}
})
);
add(new Achievement(
"CV dazzler",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// high lostFaceTime
if(game.lostFaceTime > 20) {
return true;
}
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("\"CV Dazzle explores how fashion can be used as camouflage from face-detection technology, the first step in automated face recognition. ");
descriptionLayout.addView(textView);
// TODO: add image
AppCompatTextView seeAlsoView = new AppCompatTextView(c);
seeAlsoView.setText("\"The name is derived from a type of World War I naval camouflage called Dazzle, which used cubist-inspired designs to break apart the visual continuity of a battleship and conceal its orientation and size. Likewise, CV Dazzle uses avant-garde hairstyling and makeup designs to break apart the continuity of a face. Since facial-recognition algorithms rely on the identification and spatial relationship of key facial features, like symmetry and tonal contours, one can block detection by creating an “anti-face”.\" (cvdazzle.com)");
descriptionLayout.addView(seeAlsoView);
// cvdazzle image (something on skincolor?
}
})
);
add(new Achievement(
"Kuleshov",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
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 < 1) { // needs at least a little bonus on all
missedATarget = true;
}
}
return !missedATarget;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("In the beginning of the 20th century filmmaker Lev Kuleshov did an experiment\n" +
"for which he edited three sequences. Each sequence showed the same neutral face\n" +
"of a man, followed by the image of either a dead man, a plate of soup or a woman.\n" +
"When these sequences were shown, the audience “raved about the acting”(Pudovkin,\n" +
"1974, p. 184), believing the man who looked at either the dead man, the soup or\n" +
"the woman, was expressing grief, hunger or desire.");
// TODO: kuleshov image/video?
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"Soap opera ",
null,
new Achievement.AchievementListener() {
@Override
public boolean hasGotAchievement(Player player, Game game) {
// Confirm exactly (many bonus points?)
return false;
}
@Override
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
Context c = descriptionLayout.getContext();
AppCompatTextView textView = new AppCompatTextView(c);
textView.setText("...");
descriptionLayout.addView(textView);
}
})
);
add(new Achievement(
"Stock photo model",
null,
new Achievement.AchievementListener() {
@Override
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.target.value > 75) {
applicableHits++;
if(hit.score >= 80) {
niceOnes ++;
}
}
}
if(niceOnes >= applicableHits * 0.8) {
return true;
}
return false;
}
@Override
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 for the requested emotion!");
// TODO: ad MS image "just like this guy"
descriptionLayout.addView(textView);
}
})
);
}};
private static AchievementCollection ourInstance = new AchievementCollection();
public static AchievementCollection getInstance() {
return ourInstance;
}
private AchievementCollection() {
}
// ids start at one
public Achievement get(int id) {
return achievements.get(id-1);
}
public int getId(Achievement a){
return achievements.indexOf(a) + 1;
}
}