Botones bien orientados y minijuego funcionando

This commit is contained in:
2026-04-15 12:05:34 +02:00
parent 8fcb266a42
commit e03def7e2e
5 changed files with 366 additions and 210 deletions

View File

@@ -34,20 +34,6 @@ El APK se generará en: `app/build/outputs/apk/release/app-release.apk`
adb install -r app/build/outputs/apk/release/app-release.apk adb install -r app/build/outputs/apk/release/app-release.apk
``` ```
## Pipeline CI/CD
El proyecto incluye pipeline automático para Gitea que compila releases al crear tags:
```bash
git tag v1.0.0
git push origin v1.0.0
```
- **Trigger**: Tags con formato `v*`
- **JDK**: 21
- **Android SDK**: API 34, build-tools 34.0.0
- **Salida**: APK en artifacts
## Estructura del Proyecto ## Estructura del Proyecto
``` ```
@@ -69,19 +55,19 @@ Helldivers/
├── settings.gradle ├── settings.gradle
├── gradle.properties ├── gradle.properties
├── gradlew / gradlew.bat ├── gradlew / gradlew.bat
└── .gitea/workflows/android.yml # Pipeline CI/CD └── .gitea/workflows/android.yml
``` ```
## Configuración Técnica ## Configuración Técnica
|属性|Valor| | Atributo | Valor |
|---|---| |---|---|
|minSdk|18 (Android 4.3)| | minSdk | 18 (Android 4.3) |
|targetSdk|21 (Android 5.0)| | targetSdk | 21 (Android 5.0) |
|compileSdk|34| | compileSdk | 34 |
|Java|21 con desugaring| | Java | 21 con desugaring |
|AGP|8.3.0| | AGP | 8.3.0 |
|Resolución|720x1280 xhdpi (landscape)| | Resolución | 720x1280 xhdpi (landscape) |
## Contribución ## Contribución

View File

@@ -3,103 +3,188 @@ package com.helldivers.app;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.widget.Button; import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
public class ActivityGame extends AppCompatActivity { public class ActivityGame extends AppCompatActivity {
private static final String[] ARROWS = new String[]{"\u2191", "\u2193", "\u2190", "\u2192"};
private static final int UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3; private static final int UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3;
private static final int[][] STRATAGEMS = new int[][]{ private static final int[][] STRATAGEMS = {
new int[]{UP, DOWN, RIGHT, LEFT, UP}, // Support Weapons (0-30)
new int[]{DOWN, DOWN, UP, RIGHT},
new int[]{UP, DOWN, RIGHT, UP},
new int[]{RIGHT, UP, UP, DOWN},
new int[]{DOWN, UP, LEFT, DOWN, UP, RIGHT, DOWN, UP},
new int[]{DOWN, UP, DOWN, UP},
new int[]{DOWN, LEFT, DOWN, UP, RIGHT}, new int[]{DOWN, LEFT, DOWN, UP, RIGHT},
new int[]{DOWN, LEFT, RIGHT, UP, DOWN},
new int[]{DOWN, LEFT, DOWN, UP, UP, LEFT},
new int[]{DOWN, DOWN, LEFT, UP, RIGHT}, new int[]{DOWN, DOWN, LEFT, UP, RIGHT},
new int[]{DOWN, LEFT, DOWN, UP, UP, LEFT},
new int[]{DOWN, LEFT, DOWN, UP, LEFT},
new int[]{DOWN, LEFT, RIGHT, UP, DOWN},
new int[]{DOWN, LEFT, RIGHT, RIGHT, LEFT}, new int[]{DOWN, LEFT, RIGHT, RIGHT, LEFT},
new int[]{DOWN, LEFT, UP, LEFT, DOWN},
new int[]{DOWN, LEFT, UP, DOWN, UP}, new int[]{DOWN, LEFT, UP, DOWN, UP},
new int[]{DOWN, LEFT, UP, DOWN, DOWN},
new int[]{DOWN, LEFT, DOWN, UP, UP, RIGHT}, new int[]{DOWN, LEFT, DOWN, UP, UP, RIGHT},
new int[]{DOWN, RIGHT, DOWN, UP, LEFT, RIGHT}, new int[]{DOWN, RIGHT, DOWN, UP, LEFT, LEFT},
new int[]{DOWN, DOWN, UP, LEFT, RIGHT},
new int[]{UP, UP, LEFT, RIGHT},
new int[]{DOWN, LEFT, UP, DOWN, RIGHT},
new int[]{DOWN, DOWN, UP, DOWN, DOWN}, new int[]{DOWN, DOWN, UP, DOWN, DOWN},
new int[]{RIGHT, DOWN, UP, LEFT, RIGHT},
new int[]{DOWN, DOWN, UP, DOWN, RIGHT},
new int[]{DOWN, LEFT, RIGHT, LEFT, UP},
new int[]{DOWN, LEFT, UP, LEFT, RIGHT},
new int[]{RIGHT, DOWN, LEFT, UP, RIGHT},
new int[]{DOWN, DOWN, LEFT, UP, LEFT},
new int[]{DOWN, DOWN, LEFT, UP, DOWN},
new int[]{RIGHT, UP, LEFT, RIGHT},
new int[]{DOWN, LEFT, RIGHT, RIGHT, DOWN},
new int[]{DOWN, LEFT, UP, DOWN, LEFT},
new int[]{DOWN, LEFT, UP, LEFT, UP, UP},
new int[]{UP, RIGHT, DOWN, LEFT, DOWN},
new int[]{DOWN, DOWN, LEFT, UP, UP, LEFT},
new int[]{DOWN, LEFT, RIGHT, LEFT, UP, UP},
new int[]{UP, DOWN, DOWN, UP, UP, DOWN},
// Orbital Strikes (31-42)
new int[]{RIGHT, RIGHT, UP},
new int[]{RIGHT, DOWN, LEFT, UP, UP}, new int[]{RIGHT, DOWN, LEFT, UP, UP},
new int[]{RIGHT, RIGHT, RIGHT}, new int[]{RIGHT, RIGHT, DOWN, RIGHT},
new int[]{RIGHT, RIGHT, DOWN, LEFT, RIGHT, DOWN}, new int[]{RIGHT, RIGHT, DOWN, LEFT, RIGHT, DOWN},
new int[]{RIGHT, RIGHT, RIGHT},
new int[]{RIGHT, RIGHT, DOWN, UP},
new int[]{RIGHT, RIGHT, LEFT, DOWN},
new int[]{RIGHT, DOWN, UP, UP, LEFT, DOWN, DOWN}, new int[]{RIGHT, DOWN, UP, UP, LEFT, DOWN, DOWN},
new int[]{RIGHT, DOWN, RIGHT, DOWN, RIGHT, DOWN}, new int[]{RIGHT, DOWN, RIGHT, DOWN, RIGHT, DOWN},
new int[]{RIGHT, DOWN, UP, RIGHT, DOWN}, new int[]{RIGHT, DOWN, UP, RIGHT, DOWN},
new int[]{RIGHT, UP, DOWN, DOWN, RIGHT}, new int[]{RIGHT, RIGHT, DOWN, LEFT, RIGHT, UP},
new int[]{UP, DOWN, DOWN, UP, RIGHT},
// Eagle Strikes (43-49)
new int[]{UP, RIGHT, RIGHT}, new int[]{UP, RIGHT, RIGHT},
new int[]{UP, RIGHT, DOWN, RIGHT}, new int[]{UP, RIGHT, DOWN, RIGHT},
new int[]{UP, RIGHT, DOWN, DOWN, RIGHT}, new int[]{UP, RIGHT, DOWN, DOWN, RIGHT},
new int[]{UP, RIGHT, DOWN, UP}, new int[]{UP, RIGHT, UP, DOWN},
new int[]{DOWN, UP, UP, DOWN, UP},
new int[]{UP, RIGHT, DOWN, UP}, new int[]{UP, RIGHT, DOWN, UP},
new int[]{UP, RIGHT, UP, LEFT}, new int[]{UP, RIGHT, UP, LEFT},
new int[]{UP, RIGHT, DOWN, DOWN, DOWN}, new int[]{UP, RIGHT, DOWN, DOWN, DOWN},
new int[]{UP, UP, LEFT, UP, RIGHT}, // Emplacements (50-57)
new int[]{RIGHT, RIGHT, UP},
new int[]{RIGHT, RIGHT, DOWN, RIGHT},
new int[]{RIGHT, RIGHT, LEFT, DOWN},
new int[]{RIGHT, RIGHT, DOWN, UP},
new int[]{DOWN, UP, LEFT, RIGHT, RIGHT, LEFT},
new int[]{DOWN, DOWN, LEFT, RIGHT, LEFT, RIGHT},
new int[]{DOWN, UP, RIGHT, UP, LEFT, RIGHT},
new int[]{DOWN, LEFT, UP, RIGHT}, new int[]{DOWN, LEFT, UP, RIGHT},
new int[]{DOWN, LEFT, DOWN, UP, UP, DOWN},
new int[]{DOWN, LEFT, UP, LEFT, DOWN},
new int[]{DOWN, LEFT, DOWN, UP, LEFT},
new int[]{DOWN, LEFT, LEFT, DOWN}, new int[]{DOWN, LEFT, LEFT, DOWN},
new int[]{UP, DOWN, LEFT, UP, RIGHT, RIGHT}, new int[]{DOWN, LEFT, UP, UP},
new int[]{DOWN, LEFT, DOWN, DOWN, UP, LEFT}, new int[]{DOWN, DOWN, LEFT, RIGHT, LEFT, RIGHT},
new int[]{DOWN, RIGHT, DOWN, UP, LEFT, LEFT}, new int[]{UP, LEFT, RIGHT, RIGHT, LEFT},
new int[]{DOWN, UP, LEFT, RIGHT, LEFT, RIGHT}, new int[]{RIGHT, DOWN, LEFT, RIGHT},
new int[]{DOWN, UP, RIGHT, RIGHT, UP}, new int[]{DOWN, LEFT, LEFT, RIGHT},
new int[]{DOWN, UP, RIGHT, LEFT}, new int[]{UP, LEFT, RIGHT, RIGHT, RIGHT},
new int[]{DOWN, UP, RIGHT, RIGHT, DOWN}, // Sentries (58-67)
new int[]{DOWN, UP, LEFT, UP, RIGHT, DOWN}, new int[]{UP, RIGHT, RIGHT, UP},
new int[]{DOWN, UP, RIGHT, UP, LEFT, UP}, new int[]{UP, RIGHT, LEFT},
new int[]{DOWN, UP, RIGHT, RIGHT, LEFT}, new int[]{UP, RIGHT, LEFT, UP, LEFT},
new int[]{DOWN, UP, RIGHT, DOWN, RIGHT} new int[]{UP, RIGHT, RIGHT, LEFT},
new int[]{UP, RIGHT, RIGHT, LEFT, RIGHT},
new int[]{UP, RIGHT, UP, LEFT, RIGHT},
new int[]{UP, RIGHT, UP, LEFT, DOWN},
new int[]{UP, RIGHT, UP, UP, LEFT},
new int[]{UP, RIGHT, UP, DOWN},
new int[]{UP, RIGHT, UP, DOWN, LEFT},
// Backpacks (68-80)
new int[]{DOWN, LEFT, DOWN, UP, UP, LEFT},
new int[]{UP, DOWN, UP, LEFT},
new int[]{DOWN, LEFT, DOWN, DOWN, RIGHT},
new int[]{LEFT, RIGHT, LEFT, RIGHT},
new int[]{LEFT, RIGHT, UP, DOWN},
new int[]{LEFT, RIGHT, RIGHT, LEFT},
new int[]{LEFT, RIGHT, UP, DOWN, LEFT},
new int[]{LEFT, RIGHT, UP, RIGHT, RIGHT},
new int[]{RIGHT, DOWN, UP, UP, UP},
new int[]{LEFT, RIGHT, UP, DOWN, UP},
new int[]{LEFT, UP, LEFT, RIGHT},
new int[]{LEFT, RIGHT, LEFT, UP},
new int[]{LEFT, RIGHT, LEFT, RIGHT, LEFT},
// Vehicles (81-84)
new int[]{LEFT, DOWN, RIGHT, UP, LEFT, LEFT, UP},
new int[]{LEFT, DOWN, RIGHT, UP, LEFT, LEFT, DOWN},
new int[]{LEFT, DOWN, RIGHT, DOWN, LEFT, LEFT, DOWN},
new int[]{LEFT, DOWN, RIGHT, DOWN, LEFT, DOWN, UP, DOWN},
// Mission (85-103)
new int[]{UP, DOWN, LEFT, UP, UP, LEFT, LEFT},
new int[]{DOWN, DOWN, UP, LEFT, RIGHT},
new int[]{UP, DOWN, LEFT, UP},
new int[]{DOWN, LEFT, DOWN, UP, RIGHT, RIGHT},
new int[]{RIGHT, RIGHT, RIGHT, RIGHT, UP, UP, LEFT, LEFT},
new int[]{DOWN, UP, LEFT, DOWN, UP, RIGHT, DOWN, LEFT},
new int[]{LEFT, RIGHT, UP, DOWN, UP},
new int[]{DOWN, RIGHT, DOWN, RIGHT, DOWN},
new int[]{RIGHT, UP, UP, LEFT, UP},
new int[]{UP, UP, LEFT, RIGHT, LEFT},
new int[]{DOWN, DOWN, LEFT, RIGHT, LEFT},
new int[]{LEFT, RIGHT, UP, DOWN, LEFT, LEFT, UP},
new int[]{LEFT, DOWN, UP, DOWN},
// Other
new int[]{RIGHT, RIGHT, DOWN, DOWN, UP}
}; };
private static final String[] NAMES = new String[]{ private static final String[] NAMES = {
"Reforzamiento", "Reabastecimiento", "Baliza SOS", "Artilleria", "Bomba Infernal", "Machine Gun", "EAT", "Stalwart", "Laser Cannon", "Anti-Materiel Rifle", "Recoilless Rifle",
"Bandera", "Ametralladora", "Rifle material", "Leal", "Antitanque", "Grenade Launcher", "Flamethrower", "Heavy Machine Gun", "Autocannon", "Arc Thrower",
"Rifle retroceso", "Echador llama", "Canon auto", "Canon riel", "Lanza", "Quasar Cannon", "Airburst Rocket", "Commando", "Spear", "Railgun", "W.A.S.P.",
"Bombardeo", "Ataque aereo", "HE 120mm", "HE 380mm", "Aluvion", "Breaching Hammer", "Epoch", "Speargun", "Expendable Napalm", "Leveller", "De-Escalator",
"Laser orbital", "Riel orbital", "Carrera", "Ataque", "Racimo", "Defoliation", "Sterilizer", "Belt-Fed GL", "Solo Silo", "Cremator", "Maxigun",
"Napalm", "Salto", "Humo", "Cohetes", "Bomba 500kg", "C4 Pack", "One True Flag",
"Rearme", "Precision", "Gas", "EMS", "Humo2", "Orbital Precision", "Orbital Gatling", "Orbital Gas", "Orbital 120mm", "Orbital Airburst",
"HMG", "Escudo", "Tesla", "Minas", "Suministros", "Orbital Smoke", "Orbital EMS", "Orbital 380mm", "Orbital Walking", "Orbital Laser",
"Granadas", "Laser", "Incendiarias", "Rover", "Balistico", "Orbital Napalm", "Orbital Railcannon",
"Arco", "Escudo2", "Centinela1", "Centinela2", "Centinela3", "Eagle Strafing", "Eagle Airstrike", "Eagle Cluster", "Eagle Smoke", "Eagle Napalm",
"Guardian", "Centinela4", "Centinela5", "Centinela6", "Centinela7" "Eagle Rocket", "Eagle 500kg",
"Anti-Personnel Mines", "Incendiary Mines", "Anti-Tank Mines", "Shield Relay", "HMG Emplacement",
"Grenadier", "Gas Mines", "Anti-Tank Emplacement",
"MG Sentry", "Gatling Sentry", "Autocannon Sentry", "Mortar Sentry", "Rocket Sentry",
"Tesla Tower", "EMS Mortar", "Laser Sentry", "Flame Sentry", "Gas Mortar",
"Supply Pack", "Jump Pack", "Ballistic Shield", "Guard Dog", "Rover", "Shield Generator",
"Directional Shield", "Hot Dog", "Hellbomb", "K-9", "Hover Pack", "Dog Breath", "Warp Pack",
"Patriot Exosuit", "Emancipator", "Fast Recon", "Bastion",
"Reinforce", "Resupply", "SOS Beacon", "Eagle Rearm", "Super Destroyer",
"Hellbomb", "Upload Data", "SSSD", "Super Earth Flag", "Seismic Probe", "Prospecting Drill",
"Dark Fluid", "Tectonic Drill", "Hive Breaker", "Cargo Container", "Reinforcement", "SEAF Artillery",
"Illumination Flare"
};
private static final int[] ICONS = new int[]{
R.drawable.support_1, R.drawable.support_2, R.drawable.support_3, R.drawable.support_4, R.drawable.support_5,
R.drawable.support_6, R.drawable.support_7, R.drawable.support_8, R.drawable.support_9, R.drawable.support_10,
R.drawable.class_1, R.drawable.class_2, R.drawable.class_3, R.drawable.class_4, R.drawable.class_5,
R.drawable.offensive_1, R.drawable.offensive_2, R.drawable.offensive_3, R.drawable.offensive_4, R.drawable.offensive_5,
R.drawable.offensive_6, R.drawable.offensive_7, R.drawable.offensive_8, R.drawable.offensive_9, R.drawable.offensive_10,
R.drawable.supply_1, R.drawable.supply_2, R.drawable.supply_3, R.drawable.supply_4, R.drawable.supply_5,
R.drawable.supply_6, R.drawable.supply_7, R.drawable.supply_8, R.drawable.supply_9, R.drawable.supply_10,
R.drawable.supply_11, R.drawable.supply_12, R.drawable.supply_13, R.drawable.supply_14, R.drawable.supply_15,
R.drawable.defensive_1, R.drawable.defensive_2, R.drawable.defensive_3, R.drawable.defensive_4, R.drawable.defensive_5,
R.drawable.defensive_6, R.drawable.defensive_7, R.drawable.defensive_8, R.drawable.defensive_9, R.drawable.defensive_10,
R.drawable.defensive_11
};
private static final int[] ARROW_ICONS = new int[]{
R.drawable.stepforward, R.drawable.stepforward, R.drawable.stepforward, R.drawable.stepforward
}; };
private SoundManager soundManager; private SoundManager soundManager;
private Handler handler = new Handler(); private Handler handler = new Handler();
private TextView tvStratagemName;
private TextView tvCounter; private TextView tvCounter;
private ImageView ivStratagemIcon;
private LinearLayout sequenceContainer;
private ImageButton btnUp, btnDown, btnLeft, btnRight; private ImageButton btnUp, btnDown, btnLeft, btnRight;
private Button btnVolver; private android.widget.Button btnVolver;
private int[] sequence; private int[] sequence;
private int playerIndex = 0; private int playerIndex = 0;
private int completadas = 0; private int completadas = 0;
private boolean esperando = false; private boolean esperando = false;
private boolean juegoActivo = true; private boolean juegoActivo = true;
private String[] ultimosArrows; private int currentStratagemIndex = 0;
private String ultimosArrowsStratagem;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -109,8 +194,9 @@ public class ActivityGame extends AppCompatActivity {
try { soundManager = new SoundManager(this); } try { soundManager = new SoundManager(this); }
catch (Exception e) { soundManager = null; } catch (Exception e) { soundManager = null; }
tvStratagemName = findViewById(R.id.tv_stratagem_name);
tvCounter = findViewById(R.id.tv_counter); tvCounter = findViewById(R.id.tv_counter);
ivStratagemIcon = findViewById(R.id.iv_stratagem_icon);
sequenceContainer = findViewById(R.id.sequence_container);
btnUp = findViewById(R.id.btn_up); btnUp = findViewById(R.id.btn_up);
btnDown = findViewById(R.id.btn_down); btnDown = findViewById(R.id.btn_down);
btnLeft = findViewById(R.id.btn_left); btnLeft = findViewById(R.id.btn_left);
@@ -127,23 +213,62 @@ public class ActivityGame extends AppCompatActivity {
nuevaRonda(); nuevaRonda();
} }
private int getArrowRotation(int dir) {
switch(dir) {
case UP: return 0;
case DOWN: return 180;
case LEFT: return -90;
case RIGHT: return 90;
default: return 0;
}
}
private void nuevaRonda() { private void nuevaRonda() {
int idx = (int)(Math.random() * STRATAGEMS.length); int idx = (int)(Math.random() * STRATAGEMS.length);
sequence = STRATAGEMS[idx]; sequence = STRATAGEMS[idx];
currentStratagemIndex = idx;
playerIndex = 0; playerIndex = 0;
juegoActivo = true; juegoActivo = true;
ultimosArrows = new String[sequence.length];
ultimosArrowsStratagem = NAMES[idx];
if (tvStratagemName != null) { if (ivStratagemIcon != null) {
tvStratagemName.setText(ultimosArrowsStratagem); try {
tvStratagemName.setTextColor(Color.parseColor("#FFD700")); int iconIndex = idx % ICONS.length;
ivStratagemIcon.setImageResource(ICONS[iconIndex]);
} catch (Exception e) {
ivStratagemIcon.setImageResource(R.drawable.stratagemas_icon);
}
} }
secuenciaMostrar();
handler.removeCallbacksAndMessages(null); handler.removeCallbacksAndMessages(null);
handler.postDelayed(() -> { esperando = true; }, 1200); handler.postDelayed(() -> { esperando = true; }, 1200);
} }
private static final String ARROW_CHARS = "\u2191\u2193\u2190\u2192";
private void secuenciaMostrar() {
if (sequenceContainer == null) return;
sequenceContainer.removeAllViews();
for (int i = 0; i < sequence.length; i++) {
TextView arrowView = new TextView(this);
int size = (int)(56 * getResources().getDisplayMetrics().density);
int margin = (int)(4 * getResources().getDisplayMetrics().density);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(size, size);
params.setMargins(margin, margin, margin, margin);
arrowView.setLayoutParams(params);
arrowView.setText(String.valueOf(ARROW_CHARS.charAt(sequence[i])));
arrowView.setTextSize(36);
arrowView.setTextColor(Color.parseColor("#FFD700"));
arrowView.setGravity(Gravity.CENTER);
arrowView.setBackgroundResource(R.drawable.arrow_white);
sequenceContainer.addView(arrowView);
}
}
private void onInputWithSound(int dir) { private void onInputWithSound(int dir) {
if (soundManager != null) { if (soundManager != null) {
try { soundManager.playTone(dir); } catch (Exception e) {} try { soundManager.playTone(dir); } catch (Exception e) {}
@@ -157,19 +282,11 @@ public class ActivityGame extends AppCompatActivity {
if (dir == sequence[playerIndex]) { if (dir == sequence[playerIndex]) {
playerIndex++; playerIndex++;
if (tvStratagemName != null) { if (sequenceContainer != null && playerIndex <= sequence.length) {
StringBuilder sb = new StringBuilder(); View child = sequenceContainer.getChildAt(playerIndex - 1);
for (int i = 0; i < sequence.length; i++) { if (child instanceof TextView) {
if (i < playerIndex) { TextView arrowView = (TextView) child;
sb.append("<font color='#00FF00'>").append(ultimosArrows[i]).append("</font> "); arrowView.setTextColor(Color.parseColor("#00FF00"));
} else {
sb.append(ultimosArrows[i]).append(" ");
}
}
try {
tvStratagemName.setText(android.text.Html.fromHtml(sb.toString()));
} catch (Exception e) {
tvStratagemName.setText(sb.toString().replaceAll("<[^>]*>", ""));
} }
} }
@@ -179,10 +296,6 @@ public class ActivityGame extends AppCompatActivity {
} }
completadas++; completadas++;
if (tvCounter != null) tvCounter.setText(String.valueOf(completadas)); if (tvCounter != null) tvCounter.setText(String.valueOf(completadas));
if (tvStratagemName != null) {
tvStratagemName.setText("OK!");
tvStratagemName.setTextColor(Color.parseColor("#00FF00"));
}
esperando = false; esperando = false;
handler.postDelayed(this::nuevaRonda, 1200); handler.postDelayed(this::nuevaRonda, 1200);
} }
@@ -190,10 +303,6 @@ public class ActivityGame extends AppCompatActivity {
if (soundManager != null) { if (soundManager != null) {
try { soundManager.playFailure(); } catch (Exception e) {} try { soundManager.playFailure(); } catch (Exception e) {}
} }
if (tvStratagemName != null) {
tvStratagemName.setText("X");
tvStratagemName.setTextColor(Color.parseColor("#FF0000"));
}
juegoActivo = false; juegoActivo = false;
handler.postDelayed(this::nuevaRonda, 1500); handler.postDelayed(this::nuevaRonda, 1500);
} }

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#232830" />
<corners android:radius="6dp" />
<stroke android:width="2dp" android:color="#FFD700" />
</shape>
</item>
<item android:top="4dp" android:bottom="4dp" android:left="4dp" android:right="4dp">
<shape android:shape="rectangle">
<solid android:color="#1B1F25" />
<corners android:radius="4dp" />
</shape>
</item>
</layer-list>

View File

@@ -5,17 +5,8 @@
android:background="@drawable/bg_helldivers_gradient"> android:background="@drawable/bg_helldivers_gradient">
<!-- Contador --> <!-- Contador -->
<TextView
android:id="@+id/tv_counter" <!-- Nombre de la estratagema -->
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_margin="8dp"
android:text="0"
android:textSize="24sp"
android:textStyle="bold"
android:textColor="#00FF00" />
<TextView <TextView
android:id="@+id/tv_counter_label" android:id="@+id/tv_counter_label"
@@ -23,13 +14,27 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@id/tv_counter" android:layout_alignTop="@id/tv_counter"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="24dp"
android:layout_toStartOf="@id/tv_counter" android:layout_toStartOf="@id/tv_counter"
android:text="ESTRATAGEMAS: " android:text="ESTRATAGEMAS: "
android:textColor="#00FF00" android:textColor="#00FF00"
android:textSize="16sp" /> android:textSize="16sp" />
<!-- Nombre de la estratagema --> <TextView
android:id="@+id/tv_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="207dp"
android:text="0"
android:textColor="#00FF00"
android:textSize="24sp"
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_stratagem_name" android:id="@+id/tv_stratagem_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -42,109 +47,137 @@
android:textStyle="bold" android:textStyle="bold"
android:textColor="#FFD700" /> android:textColor="#FFD700" />
<!-- Secuencia displayed as images --> <!-- Contenedor principal: Icono + Secuencia + Grid flechas -->
<LinearLayout <LinearLayout
android:id="@+id/sequence_container" android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_above="@id/buttons_grid"
android:layout_marginBottom="8dp"
android:orientation="horizontal"
android:gravity="center" />
<!-- Grid de Flechas - Centro -->
<GridLayout
android:id="@+id/buttons_grid"
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:rowCount="3" android:gravity="center_vertical"
android:columnCount="3" android:orientation="horizontal">
android:padding="16dp">
<Space <!-- Icono de la estratagema - Izquierda -->
android:layout_width="80dp" <LinearLayout
android:layout_height="80dp" android:layout_width="wrap_content"
android:layout_row="0" android:layout_height="wrap_content"
android:layout_column="0" /> android:layout_marginEnd="24dp"
android:gravity="center"
android:orientation="vertical">
<ImageButton </LinearLayout>
android:id="@+id/btn_up"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="1"
android:src="@drawable/stepforward"
android:scaleType="centerInside"
android:background="@android:color/transparent"
android:contentDescription="Up"
android:layout_margin="6dp" />
<Space <!-- Centro: Secuencia de flechas -->
android:layout_width="80dp" <LinearLayout
android:layout_height="80dp" android:layout_width="wrap_content"
android:layout_row="0" android:layout_height="wrap_content"
android:layout_column="2" /> android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/btn_left"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="0"
android:src="@drawable/stepforward"
android:scaleType="centerInside"
android:rotation="-90"
android:background="@android:color/transparent"
android:contentDescription="Left"
android:layout_margin="6dp" />
<ImageButton <LinearLayout
android:id="@+id/btn_down" android:id="@+id/sequence_container"
android:layout_width="80dp" android:layout_width="wrap_content"
android:layout_height="80dp" android:layout_height="wrap_content"
android:layout_row="1" android:layout_marginBottom="12dp"
android:layout_column="1" android:gravity="center"
android:src="@drawable/stepforward" android:orientation="horizontal" />
android:scaleType="centerInside"
android:rotation="180"
android:background="@android:color/transparent"
android:contentDescription="Down"
android:layout_margin="6dp" />
<ImageButton <!-- Grid de Flechas - Input -->
android:id="@+id/btn_right" <GridLayout
android:layout_width="80dp" android:id="@+id/buttons_grid"
android:layout_height="80dp" android:layout_width="wrap_content"
android:layout_row="1" android:layout_height="wrap_content"
android:layout_column="2" android:columnCount="3"
android:src="@drawable/stepforward" android:padding="8dp"
android:scaleType="centerInside" android:rowCount="3">
android:rotation="90"
android:background="@android:color/transparent"
android:contentDescription="Right"
android:layout_margin="6dp" />
<Space <Space
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_row="2" android:layout_row="0"
android:layout_column="0" /> android:layout_column="0" />
<Space <ImageButton
android:layout_width="80dp" android:id="@+id/btn_up"
android:layout_height="80dp" android:layout_width="80dp"
android:layout_row="2" android:layout_height="80dp"
android:layout_column="1" /> android:layout_row="0"
android:layout_column="1"
android:layout_margin="4dp"
android:background="@drawable/btn_direction"
android:contentDescription="Up"
android:rotation="-90"
android:scaleType="centerInside"
android:src="@drawable/stepforward" />
<Space <Space
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_row="2" android:layout_row="0"
android:layout_column="2" /> android:layout_column="2" />
</GridLayout> <ImageButton
android:id="@+id/btn_left"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="0"
android:layout_margin="4dp"
android:background="@drawable/btn_direction"
android:contentDescription="Left"
android:rotation="180"
android:scaleType="centerInside"
android:src="@drawable/stepforward" />
<ImageButton
android:id="@+id/btn_down"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="1"
android:layout_margin="4dp"
android:background="@drawable/btn_direction"
android:contentDescription="Down"
android:rotation="90"
android:scaleType="centerInside"
android:src="@drawable/stepforward" />
<ImageButton
android:id="@+id/btn_right"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="2"
android:layout_margin="4dp"
android:background="@drawable/btn_direction"
android:contentDescription="Right"
android:rotation="0"
android:scaleType="centerInside"
android:src="@drawable/stepforward" />
<Space
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="0" />
<Space
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="1" />
<Space
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="2" />
</GridLayout>
</LinearLayout>
</LinearLayout>
<!-- Volver --> <!-- Volver -->
<Button <Button
@@ -161,4 +194,15 @@
android:paddingHorizontal="24dp" android:paddingHorizontal="24dp"
android:paddingVertical="8dp" /> android:paddingVertical="8dp" />
<ImageView
android:id="@+id/iv_stratagem_icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="53dp"
android:layout_marginTop="93dp"
android:scaleType="fitCenter"
android:src="@drawable/stratagemas_icon" />
</RelativeLayout> </RelativeLayout>

View File

@@ -73,6 +73,7 @@
android:layout_column="1" android:layout_column="1"
android:background="@drawable/btn_direction" android:background="@drawable/btn_direction"
android:contentDescription="Up" android:contentDescription="Up"
android:rotation="-90"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/stepforward" /> android:src="@drawable/stepforward" />
@@ -86,7 +87,7 @@
android:layout_column="0" android:layout_column="0"
android:background="@drawable/btn_direction" android:background="@drawable/btn_direction"
android:contentDescription="Left" android:contentDescription="Left"
android:rotation="-90" android:rotation="180"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/stepforward" /> android:src="@drawable/stepforward" />
@@ -98,7 +99,7 @@
android:layout_column="1" android:layout_column="1"
android:background="@drawable/btn_direction" android:background="@drawable/btn_direction"
android:contentDescription="Down" android:contentDescription="Down"
android:rotation="180" android:rotation="90"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/stepforward" /> android:src="@drawable/stepforward" />
@@ -110,7 +111,7 @@
android:layout_column="2" android:layout_column="2"
android:background="@drawable/btn_direction" android:background="@drawable/btn_direction"
android:contentDescription="Right" android:contentDescription="Right"
android:rotation="90" android:rotation="0"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/stepforward" /> android:src="@drawable/stepforward" />