diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5b80ff7..8d50716 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -82,6 +82,15 @@ + + + + diff --git a/app/src/main/java/tonio/noa/TutorialScene4Activity.java b/app/src/main/java/tonio/noa/TutorialScene4Activity.java index 88c43bc..9a2efdc 100644 --- a/app/src/main/java/tonio/noa/TutorialScene4Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene4Activity.java @@ -30,18 +30,20 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); - setContentView(R.layout.tutorial3_display); + setContentView(R.layout.tutorial4_display); findViewById(R.id.blue_rectangle41).setOnTouchListener(this); findViewById(R.id.blue_rectangle42).setOnTouchListener(this); findViewById(R.id.blue_rectangle43).setOnTouchListener(this); + findViewById(R.id.blue_rectangle44).setOnTouchListener(this); findViewById(R.id.red_rectangle41).setOnTouchListener(this); findViewById(R.id.red_rectangle42).setOnTouchListener(this); findViewById(R.id.red_rectangle43).setOnTouchListener(this); + findViewById(R.id.red_rectangle44).setOnTouchListener(this); findViewById(R.id.green_rectangle41).setOnTouchListener(this); findViewById(R.id.green_rectangle42).setOnTouchListener(this); findViewById(R.id.green_rectangle43).setOnTouchListener(this); - + findViewById(R.id.green_rectangle44).setOnTouchListener(this); findViewById(R.id.anchor_blue_rectangle).setOnDragListener(this); findViewById(R.id.anchor_red_rectangle).setOnDragListener(this); @@ -49,12 +51,15 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou findViewById(R.id.blue_rectangle41).setOnDragListener(this); findViewById(R.id.blue_rectangle42).setOnDragListener(this); findViewById(R.id.blue_rectangle43).setOnDragListener(this); + findViewById(R.id.blue_rectangle44).setOnDragListener(this); findViewById(R.id.red_rectangle41).setOnDragListener(this); findViewById(R.id.red_rectangle42).setOnDragListener(this); findViewById(R.id.red_rectangle43).setOnDragListener(this); + findViewById(R.id.red_rectangle44).setOnDragListener(this); findViewById(R.id.green_rectangle41).setOnDragListener(this); findViewById(R.id.green_rectangle42).setOnDragListener(this); findViewById(R.id.green_rectangle43).setOnDragListener(this); + findViewById(R.id.green_rectangle44).setOnDragListener(this); } @@ -105,7 +110,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou if (v == findViewById(R.id.anchor_red_rectangle)) { if (view == findViewById(R.id.red_rectangle41) || view == findViewById(R.id.red_rectangle42) - || view == findViewById(R.id.red_rectangle43)) { + || view == findViewById(R.id.red_rectangle43) + || view == findViewById(R.id.red_rectangle44)) { //stop displaying the view where it was before it was dragged view.setVisibility(View.INVISIBLE); win_counter++; @@ -113,7 +119,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou } else if (v == findViewById(R.id.anchor_blue_rectangle)) { if (view == findViewById(R.id.blue_rectangle41) || view == findViewById(R.id.blue_rectangle42) - || view == findViewById(R.id.blue_rectangle43)) { + || view == findViewById(R.id.blue_rectangle43) + || view == findViewById(R.id.blue_rectangle44)) { //stop displaying the view where it was before it was dragged view.setVisibility(View.INVISIBLE); win_counter++; @@ -121,7 +128,8 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou } else if (v == findViewById(R.id.anchor_green_rectangle)) { if (view == findViewById(R.id.green_rectangle41) || view == findViewById(R.id.green_rectangle42) - || view == findViewById(R.id.green_rectangle43)) { + || view == findViewById(R.id.green_rectangle43) + || view == findViewById(R.id.green_rectangle44)) { //stop displaying the view where it was before it was dragged view.setVisibility(View.INVISIBLE); win_counter++; @@ -134,6 +142,6 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou @Override protected void next() { - this.backHome(null); + startActivity(new Intent(this, TutorialScene5Activity.class)); } } diff --git a/app/src/main/java/tonio/noa/TutorialScene5Activity.java b/app/src/main/java/tonio/noa/TutorialScene5Activity.java index e69de29..bbe03d6 100644 --- a/app/src/main/java/tonio/noa/TutorialScene5Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene5Activity.java @@ -0,0 +1,70 @@ +package tonio.noa; + +import android.content.Intent; +import android.os.Bundle; +import android.view.MotionEvent; +import android.view.View; + +/** + * Created by psyk on 24/01/18. + */ + +public class TutorialScene5Activity extends MyPlayActivity implements View.OnTouchListener { + + private int win_counter = 0; + + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + Intent i = new Intent(this, ConsigneActivity.class); + i.putExtra("keyConsigne", "Cette fois\ntu dois cliquer sur les carrés verts!\nC'est ta dernière mission ;)"); + int requestCode = 0; + startActivityForResult(i, requestCode); + + } + + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + setContentView(R.layout.tutorial5_display); + + findViewById(R.id.blue_rectangle51).setOnTouchListener(this); + findViewById(R.id.blue_rectangle52).setOnTouchListener(this); + findViewById(R.id.blue_rectangle53).setOnTouchListener(this); + findViewById(R.id.blue_rectangle54).setOnTouchListener(this); + findViewById(R.id.red_rectangle51).setOnTouchListener(this); + findViewById(R.id.red_rectangle52).setOnTouchListener(this); + findViewById(R.id.red_rectangle53).setOnTouchListener(this); + findViewById(R.id.red_rectangle54).setOnTouchListener(this); + findViewById(R.id.green_rectangle51).setOnTouchListener(this); + findViewById(R.id.green_rectangle52).setOnTouchListener(this); + findViewById(R.id.green_rectangle53).setOnTouchListener(this); + findViewById(R.id.green_rectangle54).setOnTouchListener(this); + + } + + @Override + public boolean onTouch(View view, MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + if (view == findViewById(R.id.green_rectangle51) + || view == findViewById(R.id.green_rectangle52) + || view == findViewById(R.id.green_rectangle53) + || view == findViewById(R.id.green_rectangle54)) { + view.setVisibility(View.INVISIBLE); + win_counter++; + } else view.setBackgroundColor(0xff888888); + return true; + } + if (win_counter == 4) { + this.bravoPage(null); + return true; + } else + return false; + } + + @Override + protected void next() { + this.backHome(null); + } +} -- libgit2 0.21.2