ScenarioAnger split and added emotion labels to ScenarioView

This commit is contained in:
Ruben 2016-08-17 19:52:27 +02:00
parent ffe51902a3
commit 1dcb08a932
3 changed files with 32 additions and 17 deletions

View file

@ -155,19 +155,3 @@ abstract public class Scenario {
// TODO: create a 'tick' that checks all current values with requirements and increases the timer etc
// TODO: ... if scenario is running. This internal times makes it easier to pause etc.
}
class ScenarioAnger extends Scenario{
void createScenario()
{
Log.d(GamingActivity.LOG_TAG, "CREATE SCENARIO: anger");
setTarget(Emotion.ANGER, 10, 1);
setTarget(Emotion.ANGER, 20, 2);
setTarget(Emotion.ANGER, 40, 3);
setTarget(Emotion.ANGER, 70, 4);
setTarget(Emotion.ANGER, 100, 5);
setTarget(Emotion.JOY, 100, 8);
setTarget(Emotion.ANGER, 100, 10);
setTarget(Emotion.JOY, 100, 15);
setTarget(Emotion.ANGER, 100, 20);
}
}

View file

@ -0,0 +1,23 @@
package com.rubenvandeven.emotionhero;
import android.util.Log;
/**
* Created by ruben on 17/08/16.
*/
public class ScenarioAnger extends Scenario {
void createScenario()
{
Log.d(GamingActivity.LOG_TAG, "CREATE SCENARIO: anger");
setTarget(Emotion.ANGER, 10, 1);
setTarget(Emotion.ANGER, 20, 2);
setTarget(Emotion.ANGER, 40, 3);
setTarget(Emotion.ANGER, 70, 4);
setTarget(Emotion.ANGER, 100, 5);
setTarget(Emotion.JOY, 100, 8);
setTarget(Emotion.ANGER, 100, 10);
setTarget(Emotion.JOY, 100, 15);
setTarget(Emotion.ANGER, 100, 20);
}
}

View file

@ -107,6 +107,7 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
linePaint.setStrokeWidth(5);
// canvas.drawLine(0, bottomline_height, width, bottomline_height, linePaint);
for(Emotion emotion: Emotion.values())
{
float value = 0;
@ -118,6 +119,7 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
}
Paint emoPaint = new Paint();
Paint emoPaintOutline = new Paint();
emoPaint.setTextSize(20);
emoPaint.setColor(emotion.getColor());
emoPaintOutline.setColor(emotion.getColor());
emoPaintOutline.setStyle(Paint.Style.STROKE);
@ -132,8 +134,14 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
canvas.drawCircle(cx, cy, max_ball_radius * value/100, emoPaint);
Path emoNamePath = new Path();
emoNamePath.moveTo(cx, cy + max_ball_radius * 1.5f);
// more curly line to draw on:
// emoNamePath.rCubicTo(width*0.1f,0, width*0.1f, height*0.2f,width*0.2f,height*0.2f);
emoNamePath.rLineTo(1000,1000);
canvas.drawText(emotion.toString(), cx, cy + max_ball_radius * (float) 1.3, emoPaint);
// canvas.drawText(emotion.toString(), cx, cy + max_ball_radius * (float) 1.3, emoPaint);
canvas.drawTextOnPath(emotion.toString(), emoNamePath, 0, 0, emoPaint);
}
// Draw targets: