diff --git b/JuegoTocame/.gitignore a/JuegoTocame/.gitignore new file mode 100644 index 0000000..603b140 --- /dev/null +++ a/JuegoTocame/.gitignore @@ -0,0 +1,14 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx diff --git b/JuegoTocame/.idea/codeStyles/Project.xml a/JuegoTocame/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..88ea3aa --- /dev/null +++ a/JuegoTocame/.idea/codeStyles/Project.xml @@ -0,0 +1,122 @@ + + + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+ + +
+
\ No newline at end of file diff --git b/JuegoTocame/.idea/codeStyles/codeStyleConfig.xml a/JuegoTocame/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ a/JuegoTocame/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git b/JuegoTocame/.idea/gradle.xml a/JuegoTocame/.idea/gradle.xml new file mode 100644 index 0000000..5cd135a --- /dev/null +++ a/JuegoTocame/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git b/JuegoTocame/.idea/misc.xml a/JuegoTocame/.idea/misc.xml new file mode 100644 index 0000000..7bfef59 --- /dev/null +++ a/JuegoTocame/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git b/JuegoTocame/.idea/runConfigurations.xml a/JuegoTocame/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ a/JuegoTocame/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git b/JuegoTocame/app/.gitignore a/JuegoTocame/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ a/JuegoTocame/app/.gitignore @@ -0,0 +1 @@ +/build diff --git b/JuegoTocame/app/build.gradle a/JuegoTocame/app/build.gradle new file mode 100644 index 0000000..88c1001 --- /dev/null +++ a/JuegoTocame/app/build.gradle @@ -0,0 +1,46 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.3" + + defaultConfig { + applicationId "com.example.juegotocame" + minSdkVersion 16 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + /** poner compilador version actual !!! prueba **/ + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } +} + + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.core:core-ktx:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} diff --git b/JuegoTocame/app/proguard-rules.pro a/JuegoTocame/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ a/JuegoTocame/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git b/JuegoTocame/app/src/androidTest/java/com/example/juegotocame/ExampleInstrumentedTest.kt a/JuegoTocame/app/src/androidTest/java/com/example/juegotocame/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..423efbe --- /dev/null +++ a/JuegoTocame/app/src/androidTest/java/com/example/juegotocame/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.juegotocame + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.juegotocame", appContext.packageName) + } +} diff --git b/JuegoTocame/app/src/main/AndroidManifest.xml a/JuegoTocame/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..6550828 --- /dev/null +++ a/JuegoTocame/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git b/JuegoTocame/app/src/main/java/com/example/juegotocame/JuegoMatameActivity.kt a/JuegoTocame/app/src/main/java/com/example/juegotocame/JuegoMatameActivity.kt new file mode 100644 index 0000000..0689950 --- /dev/null +++ a/JuegoTocame/app/src/main/java/com/example/juegotocame/JuegoMatameActivity.kt @@ -0,0 +1,142 @@ +package com.example.juegotocame + +import android.animation.ObjectAnimator +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import android.os.CountDownTimer +import android.util.DisplayMetrics +import android.view.ViewGroup +import android.widget.Button +import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.isVisible +import kotlinx.android.synthetic.main.activity_juego_matame.* + + +class JuegoMatameActivity : AppCompatActivity() { + + internal val tiempo : Long = 15_000 + internal var puntos : Int = 0 + internal var vida : Int = 100 + internal var jugadorPuntajeRecord = 0 + internal lateinit var jugadorRecord : String + internal lateinit var jugadorActual : String + private val ALTO = 3 + private val ANCHO = 4 + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_juego_matame) + + val intentRecibido : Intent = intent + /**Recibe Intent**/ + jugadorActual = intentRecibido.getStringExtra("jugador") + jugadorRecord = intentRecibido.getStringExtra("jugadorAntiguo") + jugadorPuntajeRecord = intentRecibido.getIntExtra("jugadorRecordA", 0) + jugadorIngresado3.text = "Bienvenido $jugadorActual" + campeon3.text = "Record Anterior \n$jugadorRecord: $jugadorPuntajeRecord" + + matame.isVisible = false + matame.setText("100%") + + jugar3.setOnClickListener { + matame.isVisible = true + matame.isEnabled =true + volverInicio3.isVisible = false + campeon3.isVisible = false + jugar3.isVisible = false + puntos = 0 + + empiezaConteo() + } + + + + matame.setOnClickListener { + puntos+=1 + vida-=5 + matame.setText("${vida}") + puntajeJuego3.setText("Puntos Alcanzados: $puntos") + adjustButtonSize(matame) + ObjectAnimator.ofFloat(matame, "translationX", ((-200..200).random()).toFloat()).apply { + duration = 100 + start() + } + ObjectAnimator.ofFloat(matame, "translationY", ((-200..700).random()).toFloat()).apply { + duration = 100 + start() + } + + + } + + volverInicio3.setOnClickListener { + val devolverCampeon : Intent = Intent() + devolverCampeon.putExtra("jugador_finalizo",jugadorActual) + devolverCampeon.putExtra("puntaje", puntos) + devolverCampeon.putExtra("campeonNuevo", jugadorRecord) + devolverCampeon.putExtra("campeonRecord", jugadorPuntajeRecord) + setResult(Activity.RESULT_OK,devolverCampeon) + finish() + } + + }//fin de onCreate + + private fun adjustButtonSize(button : Button ) { + //var displayMetrics : DisplayMetrics = getResources().getDisplayMetrics() + //var width : Int = displayMetrics.widthPixels + //var height : Int = displayMetrics.heightPixels + var params : ViewGroup.LayoutParams = matame.getLayoutParams() + params.height -= (ALTO) + params.width -= (ANCHO) + button.setLayoutParams(params); + } + + private fun empiezaConteo() + { + object : CountDownTimer(tiempo, 1000) { + /**onTick se encarga de que el contador disminuya relacion a 1000 ms**/ + + override fun onTick(millisUntilFinished: Long) { + if (vida == 0) { + finish() + } + tiempoTexto3.setText("00:${millisUntilFinished / 1000}") + jugar3.isEnabled = false + + } + + + + + /**onFinish es un metodo que al terminar de contar puede realizar algun procedimiento **/ + override fun onFinish() { + termino() + } + + }.start() + + }// Fin Conteo + + fun termino(){ + + + if (vida <= 0) tiempoTexto3.setText("Haz vencido con $puntos hits al pobre boton") + else tiempoTexto3.setText("El boton a uido!") + jugar3.isEnabled = true + matame.isEnabled = false + + if (jugadorPuntajeRecord < puntos) { + puntajeJuego3.setText("$jugadorActual: $puntos\nSupero el Record de $jugadorRecord: $jugadorPuntajeRecord") + jugadorRecord = jugadorActual + jugadorPuntajeRecord = puntos + } else { + puntajeJuego3.setText("$jugadorActual: $puntos") + } + matame.isVisible = false + volverInicio3.isVisible = true + jugar3.isVisible = true + + } + +} diff --git b/JuegoTocame/app/src/main/java/com/example/juegotocame/JuegoPersiguemeActivity.kt a/JuegoTocame/app/src/main/java/com/example/juegotocame/JuegoPersiguemeActivity.kt new file mode 100644 index 0000000..b85766e --- /dev/null +++ a/JuegoTocame/app/src/main/java/com/example/juegotocame/JuegoPersiguemeActivity.kt @@ -0,0 +1,98 @@ + package com.example.juegotocame + +import android.animation.ObjectAnimator +import android.app.Activity +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.os.CountDownTimer +import androidx.core.view.isVisible +import kotlinx.android.synthetic.main.activity_juego_persigueme.* + + class JuegoPersiguemeActivity : AppCompatActivity() { + + internal val tiempo : Long = 15_000 + internal var puntos : Int = 0 + internal var jugadorPuntajeRecord = 0 + internal lateinit var jugadorRecord : String + internal lateinit var jugadorActual : String + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_juego_persigueme) + + val intentRecibido : Intent = intent + /**Recibe Intent**/ + jugadorActual = intentRecibido.getStringExtra("jugador") + jugadorRecord = intentRecibido.getStringExtra("jugadorAntiguo") + jugadorPuntajeRecord = intentRecibido.getIntExtra("jugadorRecordA", 0) + jugadorIngresado2.text = "Bienvenido $jugadorActual" + campeon2.text = "Record Anterior \n$jugadorRecord: $jugadorPuntajeRecord" + + jugar2.setOnClickListener { + botonEscurridizo.isVisible = true + botonEscurridizo.isEnabled =true + volverInicio2.isVisible = false + campeon2.isVisible = false + jugar2.isVisible = false + puntos = 0 + + empiezaConteo() + } + + botonEscurridizo.setOnClickListener { + puntos += 1 + puntajeJuego2.setText("Puntos Acumulados: ${puntos}") + + ObjectAnimator.ofFloat(botonEscurridizo, "translationX", ((-200..200).random()).toFloat()).apply { + duration = 100 + start() + } + ObjectAnimator.ofFloat(botonEscurridizo, "translationY", ((-200..700).random()).toFloat()).apply { + duration = 100 + start() + } + + } + volverInicio2.setOnClickListener { + val devolverCampeon : Intent = Intent() + devolverCampeon.putExtra("jugador_finalizo",jugadorActual) + devolverCampeon.putExtra("puntaje", puntos) + devolverCampeon.putExtra("campeonNuevo", jugadorRecord) + devolverCampeon.putExtra("campeonRecord", jugadorPuntajeRecord) + setResult(Activity.RESULT_OK,devolverCampeon) + finish() + } + + }//fin de onCreate + fun empiezaConteo() + { + object : CountDownTimer(tiempo, 1000) { + /**onTick se encarga de que el contador disminuya relacion a 1000 ms**/ + override fun onTick(millisUntilFinished: Long) { + tiempoTexto2.setText("00:${millisUntilFinished / 1000}") + jugar2.isEnabled = false + if (millisUntilFinished <= tiempo * 0.6) seAcabaElTiempo2.setText("Se te acaba el tiempo Crack!") + } + + /**onFinish es un metodo que al terminar de contar puede realizar algun procedimiento **/ + override fun onFinish() { + tiempoTexto2.setText("Opama che KP!") + jugar2.isEnabled = true + botonEscurridizo.isEnabled = false + if (jugadorPuntajeRecord < puntos) { + puntajeJuego2.setText ("$jugadorActual: $puntos\nSupero el Record de $jugadorRecord: $jugadorPuntajeRecord") + jugadorRecord = jugadorActual + jugadorPuntajeRecord = puntos + } else { + puntajeJuego2.setText("$jugadorActual: $puntos") + } + botonEscurridizo.isVisible = false + volverInicio2.isVisible = true + jugar2.isVisible = true + + } + + }.start() + } +} diff --git b/JuegoTocame/app/src/main/java/com/example/juegotocame/JuegoTocameActivity.kt a/JuegoTocame/app/src/main/java/com/example/juegotocame/JuegoTocameActivity.kt new file mode 100644 index 0000000..1b27dae --- /dev/null +++ a/JuegoTocame/app/src/main/java/com/example/juegotocame/JuegoTocameActivity.kt @@ -0,0 +1,88 @@ +package com.example.juegotocame + +import android.app.Activity +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.os.CountDownTimer +import androidx.core.view.isVisible +import kotlinx.android.synthetic.main.activity_juego_tocame.* + +class JuegoTocameActivity : AppCompatActivity() { + + internal val tiempo : Long = 15_000 + internal var puntos : Int = 0 + internal var jugadorPuntajeRecord = 0 + internal lateinit var jugadorRecord : String + internal lateinit var jugadorActual : String + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_juego_tocame) + val intentRecibido : Intent = intent + /**Recibe Intent**/ + jugadorActual = intentRecibido.getStringExtra("jugador") + jugadorRecord = intentRecibido.getStringExtra("jugadorAntiguo") + jugadorPuntajeRecord = intentRecibido.getIntExtra("jugadorRecordA", 0) + jugadorIngresado.text = "Bienvenido $jugadorActual" + campeon.text = "Record Anterior \n$jugadorRecord: $jugadorPuntajeRecord" + + jugar.setOnClickListener { + botonTorturado.isVisible = true + botonTorturado.isEnabled = true + volverInicio.isVisible = false + campeon.isVisible = false + puntos = 0 + + empiezaConteo() + } + + botonTorturado.setOnClickListener { + puntos = puntos + 1 + puntajeJuego.setText("Puntos Acumulados: ${puntos}") + } + + volverInicio.setOnClickListener { + val devolverCampeon : Intent = Intent() + devolverCampeon.putExtra("jugador_finalizo",jugadorActual) + devolverCampeon.putExtra("puntaje", puntos) + devolverCampeon.putExtra("campeonNuevo", jugadorRecord) + devolverCampeon.putExtra("campeonRecord", jugadorPuntajeRecord) + setResult(Activity.RESULT_OK,devolverCampeon) + finish() + } + + }//fin onCreate + + + fun empiezaConteo() + { + object : CountDownTimer(tiempo, 1000) { + /**onTick se encarga de que el contador disminuya relacion a 1000 ms**/ + override fun onTick(millisUntilFinished: Long) { + tiempoTexto.setText("00:${millisUntilFinished / 1000}") + jugar.isEnabled = false + if (millisUntilFinished <= tiempo * 0.6) seAcabaElTiempo.setText("Se te acaba el tiempo Crack!") + } + + /**onFinish es un metodo que al terminar de contar puede realizar algun procedimiento **/ + override fun onFinish() { + tiempoTexto.setText("Opama che KP!") + jugar.isEnabled = true + botonTorturado.isEnabled = false + if (jugadorPuntajeRecord < puntos) { + puntajeJuego.setText ("$jugadorActual: $puntos\nSupero el Record de $jugadorRecord: $jugadorPuntajeRecord") + jugadorRecord = jugadorActual + jugadorPuntajeRecord = puntos + + } else { + puntajeJuego.setText("$jugadorActual: $puntos") + } + botonTorturado.isEnabled = false + volverInicio.isVisible = true + + } + + }.start() + } +} diff --git b/JuegoTocame/app/src/main/java/com/example/juegotocame/MainActivity.kt a/JuegoTocame/app/src/main/java/com/example/juegotocame/MainActivity.kt new file mode 100644 index 0000000..f61cc55 --- /dev/null +++ a/JuegoTocame/app/src/main/java/com/example/juegotocame/MainActivity.kt @@ -0,0 +1,136 @@ +package com.example.juegotocame + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import android.util.Log +import android.view.ActionMode +import android.view.Gravity +import android.view.View +import android.widget.Button +import android.widget.EditText +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import kotlinx.android.synthetic.main.activity_main.* + +class MainActivity : AppCompatActivity() { + /**Textos**/ + internal lateinit var jugadorNuevo : EditText + + /**Botones**/ + internal lateinit var registrarJugador : Button + + /**Entidades**/ + internal var jugadorAntiguo : String ="Android" + internal var jugadorRecordA : Int = 1 + internal val EMPTY_VALUE = "" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + configView() + + /**Capturas**/ + jugadorNuevo = findViewById(R.id.jugadorNuevo) + registrarJugador = findViewById(R.id.registrarJugador) + + + registrarJugador.setOnClickListener{ + if(jugadorNuevo.text.toString() == ""){ + val mensaje = Toast.makeText( + applicationContext, + "Por favor Ingrese algun Alias\n\t\t\t\t\tNo sea flojo", + Toast.LENGTH_LONG + ) + mensaje.setGravity(Gravity.TOP, 0, 100) + mensaje.show() + }else { + SharedApp.prefs.name = jugadorNuevo.text.toString() + configView() + + } + }//fin de registrar Jugador Prueba de captura Nombre + borrarJugador.setOnClickListener { + borrarJugador() + configView() + } + + juegoTocame.setOnClickListener{ + val intentJuegoTocame : Intent = Intent(this, JuegoTocameActivity::class.java) + intentJuegoTocame.putExtra("jugador", jugadorNuevo.text.toString()) + intentJuegoTocame.putExtra("jugadorAntiguo", jugadorAntiguo) + intentJuegoTocame.putExtra("jugadorRecordA", jugadorRecordA) + startActivityForResult(intentJuegoTocame, 10) + } + + juegoSigueme.setOnClickListener{ + val intentJuegoPersigueme : Intent = Intent(this, JuegoPersiguemeActivity::class.java) + intentJuegoPersigueme.putExtra("jugador", jugadorNuevo.text.toString()) + intentJuegoPersigueme.putExtra("jugadorAntiguo", jugadorAntiguo) + intentJuegoPersigueme.putExtra("jugadorRecordA", jugadorRecordA) + startActivityForResult(intentJuegoPersigueme, 20) + } + + juegoMatame.setOnClickListener{ + val intentJuegoMatame : Intent = Intent(this, JuegoMatameActivity::class.java) + intentJuegoMatame.putExtra("jugador", jugadorNuevo.text.toString()) + intentJuegoMatame.putExtra("jugadorAntiguo", jugadorAntiguo) + intentJuegoMatame.putExtra("jugadorRecordA", jugadorRecordA) + startActivityForResult(intentJuegoMatame, 30) + } + + + }//fin de onCreate + + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + + if(data != null){ + if(resultCode == Activity.RESULT_OK){ + jugadorRegistrado.setText("El jugador ${data.getStringExtra("jugador_finalizo")}, hizo ${data.getIntExtra("puntaje", 0)} puntos!") + jugadorAntiguo = data.getStringExtra("campeonNuevo")!! + if(jugadorRecordA < data.getIntExtra("campeonRecord", 0)) SharedApp.prefs.puntos = data.getIntExtra("campeonRecord", 0) + jugadorRecordA = data.getIntExtra("campeonRecord", 0) + } + } + + } + + private fun showProfile(){ + jugadorRegistrado.setText("El jugador ${SharedApp.prefs.name}, hizo ${SharedApp.prefs.puntos} puntos!") + //tvName.text = "Hola ${SharedApp.prefs.name}" + //btnDeleteValue.visibility = View.VISIBLE + //campoUsuario.visibility = View.INVISIBLE + //registrar.visibility = View.INVISIBLE + } + + private fun showGuest(){ + //jugadorRegistrado.setText("El jugador ${SharedApp.prefs.name}, hizo ${SharedApp.prefs.name} puntos!") + //tvName.visibility = View.INVISIBLE + //btnDeleteValue.visibility = View.INVISIBLE + //campoUsuario.visibility = View.VISIBLE + //registrar.visibility = View.VISIBL + if (SharedApp.prefs.name != "") { + val mensaje = Toast.makeText( + applicationContext, + "Bienvenido ${jugadorNuevo.text}", + Toast.LENGTH_LONG + ) + mensaje.setGravity(Gravity.TOP, 0, 100) + mensaje.show() + } + } + private fun configView(){ + if(isSavedName()) showProfile() else showGuest() + } + + private fun isSavedName():Boolean{ + val myName = SharedApp.prefs.name + return myName != EMPTY_VALUE + } + private fun borrarJugador(){ + SharedApp.prefs.name = EMPTY_VALUE + configView() + } +} diff --git b/JuegoTocame/app/src/main/java/com/example/juegotocame/Prefs.kt a/JuegoTocame/app/src/main/java/com/example/juegotocame/Prefs.kt new file mode 100644 index 0000000..a94b96d --- /dev/null +++ a/JuegoTocame/app/src/main/java/com/example/juegotocame/Prefs.kt @@ -0,0 +1,18 @@ +package com.example.juegotocame + +import android.content.Context +import android.content.SharedPreferences + +class Prefs (context : Context) { + val PREF_NAME ="com.example.juegotocame" + val SHARED_NAME = "Android" + val SHARED_PUNTOS = "Puntos" + val prefs: SharedPreferences = context.getSharedPreferences(PREF_NAME, 0) + + var name: String? + get() = prefs.getString(SHARED_NAME, "ANDROID") + set(value) = prefs.edit().putString(SHARED_NAME, value).apply() + var puntos: Int + get() = prefs.getInt(SHARED_PUNTOS, 0) + set(value) = prefs.edit().putInt(SHARED_PUNTOS, value).apply() +} \ No newline at end of file diff --git b/JuegoTocame/app/src/main/java/com/example/juegotocame/SharedApp.kt a/JuegoTocame/app/src/main/java/com/example/juegotocame/SharedApp.kt new file mode 100644 index 0000000..2916f6f --- /dev/null +++ a/JuegoTocame/app/src/main/java/com/example/juegotocame/SharedApp.kt @@ -0,0 +1,16 @@ +package com.example.juegotocame + +import android.app.Application + +class SharedApp : Application() { + + companion object{ + lateinit var prefs: Prefs + } + + override fun onCreate() { + super.onCreate() + prefs=Prefs(applicationContext) + } +} + diff --git b/JuegoTocame/app/src/main/res/anim/animacion.xml a/JuegoTocame/app/src/main/res/anim/animacion.xml new file mode 100644 index 0000000..51f5ec7 --- /dev/null +++ a/JuegoTocame/app/src/main/res/anim/animacion.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git b/JuegoTocame/app/src/main/res/drawable-v24/ic_launcher_foreground.xml a/JuegoTocame/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ a/JuegoTocame/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git b/JuegoTocame/app/src/main/res/drawable/ic_launcher_background.xml a/JuegoTocame/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ a/JuegoTocame/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git b/JuegoTocame/app/src/main/res/layout/activity_juego_matame.xml a/JuegoTocame/app/src/main/res/layout/activity_juego_matame.xml new file mode 100644 index 0000000..18fd763 --- /dev/null +++ a/JuegoTocame/app/src/main/res/layout/activity_juego_matame.xml @@ -0,0 +1,91 @@ + + + + + + + + + +