Commit aaefb55f11805d1c8631d74d4a499fca616d5099
1 parent
48365340
scène 4 : débogguée
scène 5 : fonctionelle
Showing
3 changed files
with
93 additions
and
6 deletions
Show diff stats
app/src/main/AndroidManifest.xml
@@ -82,6 +82,15 @@ | @@ -82,6 +82,15 @@ | ||
82 | </activity> | 82 | </activity> |
83 | 83 | ||
84 | <activity | 84 | <activity |
85 | + android:name=".TutorialScene5Activity" | ||
86 | + android:parentActivityName=".TutorialScene4Activity" | ||
87 | + android:screenOrientation="userLandscape"> | ||
88 | + <meta-data | ||
89 | + android:name="android.support.PARENT_ACTIVITY" | ||
90 | + android:value=".MainActivity" /> | ||
91 | + </activity> | ||
92 | + | ||
93 | + <activity | ||
85 | android:name=".BravoActivity" | 94 | android:name=".BravoActivity" |
86 | android:screenOrientation="userLandscape"></activity> | 95 | android:screenOrientation="userLandscape"></activity> |
87 | 96 |
app/src/main/java/tonio/noa/TutorialScene4Activity.java
@@ -30,18 +30,20 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | @@ -30,18 +30,20 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | ||
30 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 30 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
31 | super.onActivityResult(requestCode, resultCode, data); | 31 | super.onActivityResult(requestCode, resultCode, data); |
32 | 32 | ||
33 | - setContentView(R.layout.tutorial3_display); | 33 | + setContentView(R.layout.tutorial4_display); |
34 | 34 | ||
35 | findViewById(R.id.blue_rectangle41).setOnTouchListener(this); | 35 | findViewById(R.id.blue_rectangle41).setOnTouchListener(this); |
36 | findViewById(R.id.blue_rectangle42).setOnTouchListener(this); | 36 | findViewById(R.id.blue_rectangle42).setOnTouchListener(this); |
37 | findViewById(R.id.blue_rectangle43).setOnTouchListener(this); | 37 | findViewById(R.id.blue_rectangle43).setOnTouchListener(this); |
38 | + findViewById(R.id.blue_rectangle44).setOnTouchListener(this); | ||
38 | findViewById(R.id.red_rectangle41).setOnTouchListener(this); | 39 | findViewById(R.id.red_rectangle41).setOnTouchListener(this); |
39 | findViewById(R.id.red_rectangle42).setOnTouchListener(this); | 40 | findViewById(R.id.red_rectangle42).setOnTouchListener(this); |
40 | findViewById(R.id.red_rectangle43).setOnTouchListener(this); | 41 | findViewById(R.id.red_rectangle43).setOnTouchListener(this); |
42 | + findViewById(R.id.red_rectangle44).setOnTouchListener(this); | ||
41 | findViewById(R.id.green_rectangle41).setOnTouchListener(this); | 43 | findViewById(R.id.green_rectangle41).setOnTouchListener(this); |
42 | findViewById(R.id.green_rectangle42).setOnTouchListener(this); | 44 | findViewById(R.id.green_rectangle42).setOnTouchListener(this); |
43 | findViewById(R.id.green_rectangle43).setOnTouchListener(this); | 45 | findViewById(R.id.green_rectangle43).setOnTouchListener(this); |
44 | - | 46 | + findViewById(R.id.green_rectangle44).setOnTouchListener(this); |
45 | 47 | ||
46 | findViewById(R.id.anchor_blue_rectangle).setOnDragListener(this); | 48 | findViewById(R.id.anchor_blue_rectangle).setOnDragListener(this); |
47 | findViewById(R.id.anchor_red_rectangle).setOnDragListener(this); | 49 | findViewById(R.id.anchor_red_rectangle).setOnDragListener(this); |
@@ -49,12 +51,15 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | @@ -49,12 +51,15 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | ||
49 | findViewById(R.id.blue_rectangle41).setOnDragListener(this); | 51 | findViewById(R.id.blue_rectangle41).setOnDragListener(this); |
50 | findViewById(R.id.blue_rectangle42).setOnDragListener(this); | 52 | findViewById(R.id.blue_rectangle42).setOnDragListener(this); |
51 | findViewById(R.id.blue_rectangle43).setOnDragListener(this); | 53 | findViewById(R.id.blue_rectangle43).setOnDragListener(this); |
54 | + findViewById(R.id.blue_rectangle44).setOnDragListener(this); | ||
52 | findViewById(R.id.red_rectangle41).setOnDragListener(this); | 55 | findViewById(R.id.red_rectangle41).setOnDragListener(this); |
53 | findViewById(R.id.red_rectangle42).setOnDragListener(this); | 56 | findViewById(R.id.red_rectangle42).setOnDragListener(this); |
54 | findViewById(R.id.red_rectangle43).setOnDragListener(this); | 57 | findViewById(R.id.red_rectangle43).setOnDragListener(this); |
58 | + findViewById(R.id.red_rectangle44).setOnDragListener(this); | ||
55 | findViewById(R.id.green_rectangle41).setOnDragListener(this); | 59 | findViewById(R.id.green_rectangle41).setOnDragListener(this); |
56 | findViewById(R.id.green_rectangle42).setOnDragListener(this); | 60 | findViewById(R.id.green_rectangle42).setOnDragListener(this); |
57 | findViewById(R.id.green_rectangle43).setOnDragListener(this); | 61 | findViewById(R.id.green_rectangle43).setOnDragListener(this); |
62 | + findViewById(R.id.green_rectangle44).setOnDragListener(this); | ||
58 | 63 | ||
59 | } | 64 | } |
60 | 65 | ||
@@ -105,7 +110,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | @@ -105,7 +110,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | ||
105 | if (v == findViewById(R.id.anchor_red_rectangle)) { | 110 | if (v == findViewById(R.id.anchor_red_rectangle)) { |
106 | if (view == findViewById(R.id.red_rectangle41) | 111 | if (view == findViewById(R.id.red_rectangle41) |
107 | || view == findViewById(R.id.red_rectangle42) | 112 | || view == findViewById(R.id.red_rectangle42) |
108 | - || view == findViewById(R.id.red_rectangle43)) { | 113 | + || view == findViewById(R.id.red_rectangle43) |
114 | + || view == findViewById(R.id.red_rectangle44)) { | ||
109 | //stop displaying the view where it was before it was dragged | 115 | //stop displaying the view where it was before it was dragged |
110 | view.setVisibility(View.INVISIBLE); | 116 | view.setVisibility(View.INVISIBLE); |
111 | win_counter++; | 117 | win_counter++; |
@@ -113,7 +119,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | @@ -113,7 +119,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | ||
113 | } else if (v == findViewById(R.id.anchor_blue_rectangle)) { | 119 | } else if (v == findViewById(R.id.anchor_blue_rectangle)) { |
114 | if (view == findViewById(R.id.blue_rectangle41) | 120 | if (view == findViewById(R.id.blue_rectangle41) |
115 | || view == findViewById(R.id.blue_rectangle42) | 121 | || view == findViewById(R.id.blue_rectangle42) |
116 | - || view == findViewById(R.id.blue_rectangle43)) { | 122 | + || view == findViewById(R.id.blue_rectangle43) |
123 | + || view == findViewById(R.id.blue_rectangle44)) { | ||
117 | //stop displaying the view where it was before it was dragged | 124 | //stop displaying the view where it was before it was dragged |
118 | view.setVisibility(View.INVISIBLE); | 125 | view.setVisibility(View.INVISIBLE); |
119 | win_counter++; | 126 | win_counter++; |
@@ -121,7 +128,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | @@ -121,7 +128,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | ||
121 | } else if (v == findViewById(R.id.anchor_green_rectangle)) { | 128 | } else if (v == findViewById(R.id.anchor_green_rectangle)) { |
122 | if (view == findViewById(R.id.green_rectangle41) | 129 | if (view == findViewById(R.id.green_rectangle41) |
123 | || view == findViewById(R.id.green_rectangle42) | 130 | || view == findViewById(R.id.green_rectangle42) |
124 | - || view == findViewById(R.id.green_rectangle43)) { | 131 | + || view == findViewById(R.id.green_rectangle43) |
132 | + || view == findViewById(R.id.green_rectangle44)) { | ||
125 | //stop displaying the view where it was before it was dragged | 133 | //stop displaying the view where it was before it was dragged |
126 | view.setVisibility(View.INVISIBLE); | 134 | view.setVisibility(View.INVISIBLE); |
127 | win_counter++; | 135 | win_counter++; |
@@ -134,6 +142,6 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | @@ -134,6 +142,6 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou | ||
134 | 142 | ||
135 | @Override | 143 | @Override |
136 | protected void next() { | 144 | protected void next() { |
137 | - this.backHome(null); | 145 | + startActivity(new Intent(this, TutorialScene5Activity.class)); |
138 | } | 146 | } |
139 | } | 147 | } |
app/src/main/java/tonio/noa/TutorialScene5Activity.java
@@ -0,0 +1,70 @@ | @@ -0,0 +1,70 @@ | ||
1 | +package tonio.noa; | ||
2 | + | ||
3 | +import android.content.Intent; | ||
4 | +import android.os.Bundle; | ||
5 | +import android.view.MotionEvent; | ||
6 | +import android.view.View; | ||
7 | + | ||
8 | +/** | ||
9 | + * Created by psyk on 24/01/18. | ||
10 | + */ | ||
11 | + | ||
12 | +public class TutorialScene5Activity extends MyPlayActivity implements View.OnTouchListener { | ||
13 | + | ||
14 | + private int win_counter = 0; | ||
15 | + | ||
16 | + @Override | ||
17 | + protected void onCreate(Bundle savedInstanceState) { | ||
18 | + | ||
19 | + super.onCreate(savedInstanceState); | ||
20 | + Intent i = new Intent(this, ConsigneActivity.class); | ||
21 | + i.putExtra("keyConsigne", "Cette fois\ntu dois cliquer sur les carrés verts!\nC'est ta dernière mission ;)"); | ||
22 | + int requestCode = 0; | ||
23 | + startActivityForResult(i, requestCode); | ||
24 | + | ||
25 | + } | ||
26 | + | ||
27 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
28 | + super.onActivityResult(requestCode, resultCode, data); | ||
29 | + | ||
30 | + setContentView(R.layout.tutorial5_display); | ||
31 | + | ||
32 | + findViewById(R.id.blue_rectangle51).setOnTouchListener(this); | ||
33 | + findViewById(R.id.blue_rectangle52).setOnTouchListener(this); | ||
34 | + findViewById(R.id.blue_rectangle53).setOnTouchListener(this); | ||
35 | + findViewById(R.id.blue_rectangle54).setOnTouchListener(this); | ||
36 | + findViewById(R.id.red_rectangle51).setOnTouchListener(this); | ||
37 | + findViewById(R.id.red_rectangle52).setOnTouchListener(this); | ||
38 | + findViewById(R.id.red_rectangle53).setOnTouchListener(this); | ||
39 | + findViewById(R.id.red_rectangle54).setOnTouchListener(this); | ||
40 | + findViewById(R.id.green_rectangle51).setOnTouchListener(this); | ||
41 | + findViewById(R.id.green_rectangle52).setOnTouchListener(this); | ||
42 | + findViewById(R.id.green_rectangle53).setOnTouchListener(this); | ||
43 | + findViewById(R.id.green_rectangle54).setOnTouchListener(this); | ||
44 | + | ||
45 | + } | ||
46 | + | ||
47 | + @Override | ||
48 | + public boolean onTouch(View view, MotionEvent event) { | ||
49 | + if (event.getAction() == MotionEvent.ACTION_DOWN) { | ||
50 | + if (view == findViewById(R.id.green_rectangle51) | ||
51 | + || view == findViewById(R.id.green_rectangle52) | ||
52 | + || view == findViewById(R.id.green_rectangle53) | ||
53 | + || view == findViewById(R.id.green_rectangle54)) { | ||
54 | + view.setVisibility(View.INVISIBLE); | ||
55 | + win_counter++; | ||
56 | + } else view.setBackgroundColor(0xff888888); | ||
57 | + return true; | ||
58 | + } | ||
59 | + if (win_counter == 4) { | ||
60 | + this.bravoPage(null); | ||
61 | + return true; | ||
62 | + } else | ||
63 | + return false; | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + protected void next() { | ||
68 | + this.backHome(null); | ||
69 | + } | ||
70 | +} |