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 | 82 | </activity> |
83 | 83 | |
84 | 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 | 94 | android:name=".BravoActivity" |
86 | 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 | 30 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
31 | 31 | super.onActivityResult(requestCode, resultCode, data); |
32 | 32 | |
33 | - setContentView(R.layout.tutorial3_display); | |
33 | + setContentView(R.layout.tutorial4_display); | |
34 | 34 | |
35 | 35 | findViewById(R.id.blue_rectangle41).setOnTouchListener(this); |
36 | 36 | findViewById(R.id.blue_rectangle42).setOnTouchListener(this); |
37 | 37 | findViewById(R.id.blue_rectangle43).setOnTouchListener(this); |
38 | + findViewById(R.id.blue_rectangle44).setOnTouchListener(this); | |
38 | 39 | findViewById(R.id.red_rectangle41).setOnTouchListener(this); |
39 | 40 | findViewById(R.id.red_rectangle42).setOnTouchListener(this); |
40 | 41 | findViewById(R.id.red_rectangle43).setOnTouchListener(this); |
42 | + findViewById(R.id.red_rectangle44).setOnTouchListener(this); | |
41 | 43 | findViewById(R.id.green_rectangle41).setOnTouchListener(this); |
42 | 44 | findViewById(R.id.green_rectangle42).setOnTouchListener(this); |
43 | 45 | findViewById(R.id.green_rectangle43).setOnTouchListener(this); |
44 | - | |
46 | + findViewById(R.id.green_rectangle44).setOnTouchListener(this); | |
45 | 47 | |
46 | 48 | findViewById(R.id.anchor_blue_rectangle).setOnDragListener(this); |
47 | 49 | findViewById(R.id.anchor_red_rectangle).setOnDragListener(this); |
... | ... | @@ -49,12 +51,15 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou |
49 | 51 | findViewById(R.id.blue_rectangle41).setOnDragListener(this); |
50 | 52 | findViewById(R.id.blue_rectangle42).setOnDragListener(this); |
51 | 53 | findViewById(R.id.blue_rectangle43).setOnDragListener(this); |
54 | + findViewById(R.id.blue_rectangle44).setOnDragListener(this); | |
52 | 55 | findViewById(R.id.red_rectangle41).setOnDragListener(this); |
53 | 56 | findViewById(R.id.red_rectangle42).setOnDragListener(this); |
54 | 57 | findViewById(R.id.red_rectangle43).setOnDragListener(this); |
58 | + findViewById(R.id.red_rectangle44).setOnDragListener(this); | |
55 | 59 | findViewById(R.id.green_rectangle41).setOnDragListener(this); |
56 | 60 | findViewById(R.id.green_rectangle42).setOnDragListener(this); |
57 | 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 | 110 | if (v == findViewById(R.id.anchor_red_rectangle)) { |
106 | 111 | if (view == findViewById(R.id.red_rectangle41) |
107 | 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 | 115 | //stop displaying the view where it was before it was dragged |
110 | 116 | view.setVisibility(View.INVISIBLE); |
111 | 117 | win_counter++; |
... | ... | @@ -113,7 +119,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou |
113 | 119 | } else if (v == findViewById(R.id.anchor_blue_rectangle)) { |
114 | 120 | if (view == findViewById(R.id.blue_rectangle41) |
115 | 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 | 124 | //stop displaying the view where it was before it was dragged |
118 | 125 | view.setVisibility(View.INVISIBLE); |
119 | 126 | win_counter++; |
... | ... | @@ -121,7 +128,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou |
121 | 128 | } else if (v == findViewById(R.id.anchor_green_rectangle)) { |
122 | 129 | if (view == findViewById(R.id.green_rectangle41) |
123 | 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 | 133 | //stop displaying the view where it was before it was dragged |
126 | 134 | view.setVisibility(View.INVISIBLE); |
127 | 135 | win_counter++; |
... | ... | @@ -134,6 +142,6 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou |
134 | 142 | |
135 | 143 | @Override |
136 | 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 @@ |
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 | +} | ... | ... |