Skip to content
Snippets Groups Projects
Commit 5ac6c573 authored by diegval's avatar diegval
Browse files

Feature: Layout ciudad inicial

parent 483823a0
Branches
No related tags found
2 merge requests!65Feature:,!45Ciudad
Showing
with 95 additions and 104 deletions
...@@ -40,6 +40,8 @@ class AuthActivity : AppCompatActivity() { ...@@ -40,6 +40,8 @@ class AuthActivity : AppCompatActivity() {
showAlert() showAlert()
} }
} }
}else{
showAlert()
} }
} }
......
...@@ -6,11 +6,14 @@ import android.widget.Button ...@@ -6,11 +6,14 @@ import android.widget.Button
import android.widget.ImageView import android.widget.ImageView
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.example.ellegadodepintia.exploradoresDePintia.model.GameState
import com.example.ellegadodepintia.exploradoresDePintia.model.Jugador
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
GameState.jugador = Jugador()
val signInButton = findViewById<Button>(R.id.signInButton) val signInButton = findViewById<Button>(R.id.signInButton)
signInButton.setOnClickListener { signInButton.setOnClickListener {
......
...@@ -3,15 +3,12 @@ package com.example.ellegadodepintia ...@@ -3,15 +3,12 @@ package com.example.ellegadodepintia
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.widget.Button
import android.widget.ImageButton import android.widget.ImageButton
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.example.ellegadodepintia.minijuego1.InicioMinijuego1
import com.example.ellegadodepintia.exploradoresDePintia.ExploradoresDePintia import com.example.ellegadodepintia.exploradoresDePintia.ExploradoresDePintia
import com.example.ellegadodepintia.exploradoresDePintia.model.GameState import com.example.ellegadodepintia.exploradoresDePintia.model.GameState
import com.example.ellegadodepintia.minijuego2.Minijuego2
import com.example.ellegadodepintia.minijuego3.Minijuego3
class MapActivity : AppCompatActivity() { class MapActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
...@@ -34,25 +31,7 @@ class MapActivity : AppCompatActivity() { ...@@ -34,25 +31,7 @@ class MapActivity : AppCompatActivity() {
leaderboardButton.setBackgroundColor(Color.TRANSPARENT) leaderboardButton.setBackgroundColor(Color.TRANSPARENT)
shopButton.setBackgroundColor(Color.TRANSPARENT) shopButton.setBackgroundColor(Color.TRANSPARENT)
val minijuego1Button = findViewById<Button>(R.id.minijuego1) val minijuego4Button = findViewById<ImageButton>(R.id.minijuego4)
minijuego1Button.setOnClickListener {
val intent = Intent(this, InicioMinijuego1::class.java)
startActivity(intent)
}
val minijuego2Button = findViewById<Button>(R.id.minijuego2)
minijuego2Button.setOnClickListener {
val intent = Intent(this, Minijuego2::class.java)
startActivity(intent)
}
val minijuego3Button = findViewById<Button>(R.id.minijuego3)
minijuego3Button.setOnClickListener {
val intent = Intent(this, Minijuego3::class.java)
startActivity(intent)
}
val minijuego4Button = findViewById<Button>(R.id.minijuego4)
minijuego4Button.setOnClickListener { minijuego4Button.setOnClickListener {
val intent = Intent(this, ExploradoresDePintia::class.java) val intent = Intent(this, ExploradoresDePintia::class.java)
startActivity(intent) startActivity(intent)
......
...@@ -17,6 +17,7 @@ import com.example.ellegadodepintia.exploradoresDePintia.model.objeto.ObjetoUtil ...@@ -17,6 +17,7 @@ import com.example.ellegadodepintia.exploradoresDePintia.model.objeto.ObjetoUtil
import com.example.ellegadodepintia.exploradoresDePintia.model.objeto.efectoObjeto.EfectoEquipableAumento import com.example.ellegadodepintia.exploradoresDePintia.model.objeto.efectoObjeto.EfectoEquipableAumento
class Jugador { class Jugador {
var nivelCiudad = 1
var atributos: MutableMap<Atributo, Int> = mutableMapOf() var atributos: MutableMap<Atributo, Int> = mutableMapOf()
var vidaMax = 10 var vidaMax = 10
var energiaMax = 10 var energiaMax = 10
......
...@@ -13,7 +13,7 @@ class TrampaFactory : EventoFactory { ...@@ -13,7 +13,7 @@ class TrampaFactory : EventoFactory {
"Un estruendoso derrumbe de piedras bloquea el camino, dejando un montón de rocas caídas que impiden tu avance." to Pair( "Un estruendoso derrumbe de piedras bloquea el camino, dejando un montón de rocas caídas que impiden tu avance." to Pair(
R.drawable.asi_exploradores_trampa_piedras, listOf( R.drawable.asi_exploradores_trampa_piedras, listOf(
Opcion( Opcion(
descripcion = "Fuerza Bruta", descripcion = "Mover",
atributoRequerida = Atributo.Vida, atributoRequerida = Atributo.Vida,
EfectoFuerzaBruta() EfectoFuerzaBruta()
), Opcion( ), Opcion(
...@@ -31,7 +31,6 @@ class TrampaFactory : EventoFactory { ...@@ -31,7 +31,6 @@ class TrampaFactory : EventoFactory {
) )
) )
), ),
) )
override fun generarDescripcion(): String { override fun generarDescripcion(): String {
......
...@@ -2,8 +2,8 @@ package com.example.ellegadodepintia.repositorios ...@@ -2,8 +2,8 @@ package com.example.ellegadodepintia.repositorios
import com.example.ellegadodepintia.PlayerLeaderBoard import com.example.ellegadodepintia.PlayerLeaderBoard
import com.example.ellegadodepintia.exploradoresDePintia.model.GameState import com.example.ellegadodepintia.exploradoresDePintia.model.GameState
import com.example.ellegadodepintia.exploradoresDePintia.model.Jugador
import com.google.firebase.firestore.FirebaseFirestore import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.SetOptions
object RepositorioJugador { object RepositorioJugador {
private val db by lazy { FirebaseFirestore.getInstance() } private val db by lazy { FirebaseFirestore.getInstance() }
...@@ -12,22 +12,22 @@ object RepositorioJugador { ...@@ -12,22 +12,22 @@ object RepositorioJugador {
fun cargarJugador(email: String) { fun cargarJugador(email: String) {
RepositorioJugador.email = email RepositorioJugador.email = email
db.collection("users").document(email).get().addOnSuccessListener { db.collection("users").document(email).get().addOnSuccessListener {
GameState.jugador = Jugador()
GameState.jugador.monedas = (it.get("monedas") as Long).toInt() GameState.jugador.monedas = (it.get("monedas") as Long).toInt()
GameState.jugador.nivelCiudad = (it.get("nivelCiudad") as Long).toInt()
} }
} }
fun addJugador(email: String, username: String) { fun addJugador(email: String, username: String) {
db.collection("users").document(email).set( db.collection("users").document(email).set(
hashMapOf("monedas" to 0, hashMapOf("monedas" to 0,
"username" to username) "username" to username,
"nivelCiudad" to 1)
) )
} }
fun setMonedas(monedas: Int) { fun setMonedas(monedas: Int) {
db.collection("users").document(email).set( val userRef = db.collection("users").document(email)
hashMapOf("monedas" to monedas) userRef.set(hashMapOf("monedas" to monedas), SetOptions.merge())
)
} }
fun cargarJugadores(callback: (List<PlayerLeaderBoard>) -> Unit) { fun cargarJugadores(callback: (List<PlayerLeaderBoard>) -> Unit) {
......
app/src/main/res/drawable/asi_exploradores_cartel.png

209 KiB

app/src/main/res/drawable/background_ciudad.png

4.17 MiB

app/src/main/res/drawable/icon_shop_village.png

117 KiB

...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/pintiaBackground" android:background="@drawable/background_minijuego_reparar"
android:padding="16dp"
tools:ignore="HardcodedText"> tools:ignore="HardcodedText">
<TextView <TextView
...@@ -13,9 +12,10 @@ ...@@ -13,9 +12,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:layout_marginTop="20dp"
android:text="Clasificación" android:text="Clasificación"
android:textSize="24sp" android:textSize="24sp"
android:textColor="#6A0000" android:textColor="@color/white"
android:fontFamily="@font/pixeled" android:fontFamily="@font/pixeled"
android:textStyle="bold" /> android:textStyle="bold" />
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_below="@id/leaderboardTitle" android:layout_below="@id/leaderboardTitle"
android:layout_above="@id/bottom_navigation" android:layout_above="@id/bottom_navigation"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:divider="@android:color/darker_gray" android:divider="@android:color/darker_gray"
android:dividerHeight="1dp" /> android:dividerHeight="1dp" />
...@@ -35,6 +38,7 @@ ...@@ -35,6 +38,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="@drawable/style_background_gradiente"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageButton <ImageButton
......
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/pintiaBackground" android:background="@color/pintiaBackground"
android:padding="16dp"
tools:ignore="HardcodedText"> tools:ignore="HardcodedText">
<ImageView
android:id="@+id/tituloJuego"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:layout_centerHorizontal="true"
android:contentDescription="Titulo del minijuego"
android:elevation="10dp"
android:src="@drawable/texto_exploradores_de_pintia"
android:text="Exploradores de Pintia"
android:textColor="#401201" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="Imagen que sobresale de Slot 1"
android:scaleType="centerCrop"
android:src="@drawable/background_ciudad" />
<ImageButton
android:id="@+id/minijuego4"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="150dp"
android:layout_height="80dp"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="79dp"
android:layout_marginBottom="117dp"
android:contentDescription="cartel aventura"
android:elevation="100dp"
android:fontFamily="@font/pixeled"
android:scaleType="centerCrop"
android:src="@drawable/asi_exploradores_cartel"
android:textColor="@color/pintiaTitleText"
android:textSize="24sp" />
<ImageButton
android:id="@+id/tiendaCiudad"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="84dp"
android:layout_height="130dp"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="-3dp"
android:layout_marginBottom="390dp"
android:contentDescription="cartel tienda"
android:elevation="-100dp"
android:fontFamily="@font/pixeled"
android:scaleType="centerCrop"
android:src="@drawable/icon_shop_village"
android:textColor="@color/pintiaTitleText"
android:textSize="24sp" />
<LinearLayout <LinearLayout
android:id="@+id/top_navigation" android:id="@+id/top_navigation"
style="?android:attr/buttonBarStyle" style="?android:attr/buttonBarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="36dp" android:layout_height="36dp"
android:layout_marginTop="10dp" android:layout_below="@id/tituloJuego"
android:elevation="10dp"
android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/moneyLayout" android:id="@+id/moneyLayout"
android:layout_width="153dp" android:layout_width="200dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/style_texto_border" android:background="@drawable/style_texto_border"
android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
...@@ -34,8 +88,9 @@ ...@@ -34,8 +88,9 @@
<TextView <TextView
android:id="@+id/moneyText" android:id="@+id/moneyText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
android:fontFamily="@font/pixeled"
android:text="1200" android:text="1200"
android:textColor="@color/pintiaTitleText" android:textColor="@color/pintiaTitleText"
android:textSize="24sp" android:textSize="24sp"
...@@ -44,18 +99,6 @@ ...@@ -44,18 +99,6 @@
</LinearLayout> </LinearLayout>
<ImageButton
android:id="@+id/settings"
android:layout_width="0dp"
android:layout_height="match_parent"
style="?android:attr/buttonBarStyle"
android:layout_weight="1"
android:contentDescription="Abre las opciones"
android:scaleType="fitCenter"
android:layout_marginStart="180dp"
android:padding="5dp"
android:src="@drawable/icon_settings" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
...@@ -63,59 +106,20 @@ ...@@ -63,59 +106,20 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:background="@drawable/style_texto_border"
android:orientation="horizontal"> android:orientation="horizontal">
<Button
android:id="@+id/minijuego1"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="1"
android:textSize="24sp"
android:layout_margin="4dp"
android:textColor="@color/pintiaTitleText"/>
<Button
android:id="@+id/minijuego2"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="2"
android:textSize="24sp"
android:layout_margin="4dp"
android:textColor="@color/pintiaTitleText"/>
<Button
android:id="@+id/minijuego3"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="3"
android:textSize="24sp"
android:layout_margin="4dp"
android:textColor="@color/pintiaTitleText"/>
<Button
android:id="@+id/minijuego4"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="4"
android:textSize="24sp"
android:layout_margin="4dp"
android:textColor="@color/pintiaTitleText"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/bottom_navigation" android:id="@+id/bottom_navigation"
style="?android:attr/buttonBarStyle" style="?android:attr/buttonBarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="@drawable/style_background_gradiente"
android:elevation="10dp"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageButton <ImageButton
...@@ -124,22 +128,22 @@ ...@@ -124,22 +128,22 @@
android:layout_height="60dp" android:layout_height="60dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:src="@drawable/icon_leaderboard"
android:contentDescription="Abre el mapa" android:contentDescription="Abre el mapa"
android:padding="5dp" android:padding="5dp"
android:scaleType="fitCenter"/> android:scaleType="fitCenter"
android:src="@drawable/icon_leaderboard" />
<ImageButton <ImageButton
android:id="@+id/mapButton" android:id="@+id/mapButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:src="@drawable/icon_map"
android:contentDescription="Abre el ranking" android:contentDescription="Abre el ranking"
android:layout_marginEnd="40dp" android:scaleType="fitCenter"
android:layout_marginStart="40dp" android:src="@drawable/icon_map" />
android:scaleType="fitCenter"/>
<ImageButton <ImageButton
android:id="@+id/shopButton" android:id="@+id/shopButton"
...@@ -147,13 +151,12 @@ ...@@ -147,13 +151,12 @@
android:layout_height="60dp" android:layout_height="60dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:src="@drawable/icon_shop"
android:contentDescription="Abre la tienda" android:contentDescription="Abre la tienda"
android:padding="5dp" android:padding="5dp"
android:scaleType="fitCenter"/> android:scaleType="fitCenter"
android:src="@drawable/icon_shop" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment