Compare commits
10 Commits
f4d5182b3f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| b1c0f97c65 | |||
|
|
6f4ddfca23 | ||
|
|
d3f0a2692a | ||
| dafa6c4409 | |||
| ced7d4c946 | |||
|
|
fa728f575f | ||
| b2cb5d904f | |||
| 6c92896dfd | |||
|
|
1184a53a81 | ||
|
|
03925e1ea8 |
@@ -82,7 +82,7 @@ private static final int[][] STRATAGEMS = {
|
||||
new int[]{UP, DOWN, RIGHT, LEFT, UP}, // Reinforce
|
||||
new int[]{DOWN, DOWN, UP, RIGHT}, // Resupply
|
||||
new int[]{UP, DOWN, RIGHT, UP}, // SOS Beacon
|
||||
new int[]{DOWN, UP, LEFT, DOWN, UP, RIGHT, DOWN, UP}, // NUX-223 Hellbomb
|
||||
new int[]{DOWN, UP, LEFT, DOWN, UP, RIGHT, DOWN}, // NUX-223 Hellbomb
|
||||
new int[]{DOWN, DOWN, DOWN, UP, UP}, // SSSD Delivery
|
||||
new int[]{UP, UP, LEFT, RIGHT, DOWN, DOWN}, // Seismic Probe
|
||||
new int[]{UP, UP, LEFT, UP, RIGHT}, // Eagle Rearm
|
||||
@@ -190,7 +190,7 @@ private static final String[] NAMES = {
|
||||
private SoundManager soundManager;
|
||||
private Handler handler = new Handler();
|
||||
|
||||
private TextView tvCounter;
|
||||
private TextView tvCounter, tvFailuresCounter;
|
||||
private ImageView ivStratagemIcon;
|
||||
private LinearLayout sequenceContainer;
|
||||
private ImageButton btnUp, btnDown, btnLeft, btnRight, btnVolver;
|
||||
@@ -200,6 +200,7 @@ private static final String[] NAMES = {
|
||||
private int[] sequence;
|
||||
private int playerIndex = 0;
|
||||
private int completadas = 0;
|
||||
private int fallos = 0;
|
||||
private boolean esperando = false;
|
||||
private boolean juegoActivo = true;
|
||||
private int currentStratagemIndex = 0;
|
||||
@@ -214,6 +215,7 @@ private static final String[] NAMES = {
|
||||
catch (Exception e) { soundManager = null; }
|
||||
|
||||
tvCounter = findViewById(R.id.tv_counter);
|
||||
tvFailuresCounter = findViewById(R.id.tv_failures_counter);
|
||||
ivStratagemIcon = findViewById(R.id.iv_stratagem_icon);
|
||||
sequenceContainer = findViewById(R.id.sequence_container);
|
||||
btnUp = findViewById(R.id.btn_up);
|
||||
@@ -226,14 +228,32 @@ private static final String[] NAMES = {
|
||||
|
||||
btnVolver.setOnClickListener(v -> finish());
|
||||
|
||||
if (btnUp != null) btnUp.setOnClickListener(v -> onInputWithSound(UP));
|
||||
if (btnDown != null) btnDown.setOnClickListener(v -> onInputWithSound(DOWN));
|
||||
if (btnLeft != null) btnLeft.setOnClickListener(v -> onInputWithSound(LEFT));
|
||||
if (btnRight != null) btnRight.setOnClickListener(v -> onInputWithSound(RIGHT));
|
||||
if (btnUp != null) btnUp.setOnClickListener(v -> { animateButtonClick(v); onInputWithSound(UP); });
|
||||
if (btnDown != null) btnDown.setOnClickListener(v -> { animateButtonClick(v); onInputWithSound(DOWN); });
|
||||
if (btnLeft != null) btnLeft.setOnClickListener(v -> { animateButtonClick(v); onInputWithSound(LEFT); });
|
||||
if (btnRight != null) btnRight.setOnClickListener(v -> { animateButtonClick(v); onInputWithSound(RIGHT); });
|
||||
|
||||
nuevaRonda();
|
||||
}
|
||||
|
||||
private void animateButtonClick(View v) {
|
||||
// Feedback háptico (vibración corta)
|
||||
v.performHapticFeedback(android.view.HapticFeedbackConstants.VIRTUAL_KEY);
|
||||
|
||||
// Animación de escala más agresiva y rápida
|
||||
v.animate()
|
||||
.scaleX(0.7f)
|
||||
.scaleY(0.7f)
|
||||
.setDuration(40)
|
||||
.withEndAction(() -> v.animate()
|
||||
.scaleX(1.0f)
|
||||
.scaleY(1.0f)
|
||||
.setDuration(150)
|
||||
.setInterpolator(new android.view.animation.OvershootInterpolator(4.0f)) // Rebote más fuerte
|
||||
.start())
|
||||
.start();
|
||||
}
|
||||
|
||||
private int getArrowRotation(int dir) {
|
||||
switch(dir) {
|
||||
case UP: return 0;
|
||||
@@ -277,18 +297,20 @@ private static final String[] NAMES = {
|
||||
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);
|
||||
ImageView arrowView = new ImageView(this);
|
||||
int size = (int) (45 * getResources().getDisplayMetrics().density);
|
||||
int margin = (int) (2 * 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.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
arrowView.setGravity(Gravity.CENTER);
|
||||
arrowView.setBackgroundResource(R.drawable.arrow_white);
|
||||
|
||||
|
||||
arrowView.setImageResource(R.drawable.ic_dpad_button);
|
||||
arrowView.setBackgroundResource(R.drawable.btn_direction);
|
||||
arrowView.setRotation(getArrowRotation(sequence[i]));
|
||||
arrowView.setColorFilter(Color.WHITE);
|
||||
int padding = (int) (8 * getResources().getDisplayMetrics().density);
|
||||
arrowView.setPadding(padding, padding, padding, padding);
|
||||
|
||||
sequenceContainer.addView(arrowView);
|
||||
}
|
||||
}
|
||||
@@ -309,9 +331,9 @@ private static final String[] NAMES = {
|
||||
|
||||
if (sequenceContainer != null && playerIndex <= sequence.length) {
|
||||
View child = sequenceContainer.getChildAt(playerIndex - 1);
|
||||
if (child instanceof TextView) {
|
||||
TextView arrowView = (TextView) child;
|
||||
arrowView.setTextColor(Color.parseColor("#00FF00"));
|
||||
if (child instanceof ImageView) {
|
||||
ImageView arrowView = (ImageView) child;
|
||||
arrowView.setColorFilter(Color.parseColor("#fde902"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,8 +359,11 @@ private static final String[] NAMES = {
|
||||
try { soundManager.playFailure(); } catch (Exception e) {}
|
||||
}
|
||||
juegoActivo = false;
|
||||
if (ivFailure != null) ivFailure.setVisibility(View.VISIBLE);
|
||||
handler.postDelayed(this::nuevaRonda, 1500);
|
||||
fallos++;
|
||||
if (tvFailuresCounter != null) tvFailuresCounter.setText(String.valueOf(fallos));
|
||||
|
||||
// Delay de medio segundo antes de reiniciar
|
||||
handler.postDelayed(this::nuevaRonda, 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,14 +54,14 @@ public class ActivityQR extends AppCompatActivity {
|
||||
|
||||
int width = bitMatrix.getWidth();
|
||||
int height = bitMatrix.getHeight();
|
||||
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
|
||||
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
|
||||
int black = 0xFF000000;
|
||||
int white = 0xFFFFFFFF;
|
||||
int qrColor = 0xFFFFFFFF; // Blanco para los módulos del QR
|
||||
int transparent = 0x00000000; // Transparente para el fondo
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
bmp.setPixel(x, y, bitMatrix.get(x, y) ? black : white);
|
||||
bmp.setPixel(x, y, bitMatrix.get(x, y) ? qrColor : transparent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.helldivers.app;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@@ -13,7 +14,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
private SoundManager soundManager;
|
||||
private Button btnQrInstagram;
|
||||
private Button btnMinijuego;
|
||||
private Button btnMusic;
|
||||
private ImageButton btnUp, btnDown, btnLeft, btnRight;
|
||||
private MediaPlayer mediaPlayer;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -32,6 +35,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
btnDown = findViewById(R.id.btn_down);
|
||||
btnLeft = findViewById(R.id.btn_left);
|
||||
btnRight = findViewById(R.id.btn_right);
|
||||
btnMusic = findViewById(R.id.btn_music);
|
||||
|
||||
if (btnQrInstagram != null) {
|
||||
btnQrInstagram.setOnClickListener(v -> {
|
||||
@@ -45,6 +49,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
if (btnMusic != null) {
|
||||
btnMusic.setOnClickListener(v -> toggleMusic());
|
||||
}
|
||||
|
||||
View.OnClickListener arrowSoundListener = v -> {
|
||||
if (soundManager != null) {
|
||||
try { soundManager.playButtonClick(); } catch (Exception e) {}
|
||||
@@ -57,6 +65,31 @@ public class MainActivity extends AppCompatActivity {
|
||||
if (btnRight != null) btnRight.setOnClickListener(arrowSoundListener);
|
||||
}
|
||||
|
||||
private void toggleMusic() {
|
||||
if (mediaPlayer == null) {
|
||||
mediaPlayer = MediaPlayer.create(this, R.raw.ost);
|
||||
mediaPlayer.setOnCompletionListener(mp -> {
|
||||
stopMusic();
|
||||
});
|
||||
}
|
||||
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
stopMusic();
|
||||
} else {
|
||||
mediaPlayer.start();
|
||||
btnMusic.setAlpha(0.5f); // Efecto visual de activado
|
||||
}
|
||||
}
|
||||
|
||||
private void stopMusic() {
|
||||
if (mediaPlayer != null) {
|
||||
mediaPlayer.stop();
|
||||
mediaPlayer.release();
|
||||
mediaPlayer = null;
|
||||
btnMusic.setAlpha(1.0f); // Restaurar opacidad
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -72,6 +105,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
stopMusic();
|
||||
if (soundManager != null) soundManager.release();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Fondo con gradiente vertical azul -->
|
||||
<!-- Fondo con gradiente horizontal (oscuro en los laterales, claro en el centro) -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:startColor="@color/helldivers_dark_bg"
|
||||
android:centerColor="@color/helldivers_dark_secondary"
|
||||
android:endColor="@color/helldivers_dark_tertiary"
|
||||
android:angle="0"
|
||||
android:startColor="@color/helldivers_dark_secondary"
|
||||
android:centerColor="@color/helldivers_dark_bg"
|
||||
android:endColor="@color/helldivers_dark_secondary"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -9,20 +9,35 @@
|
||||
|
||||
<!-- Nombre de la estratagema -->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_counter"
|
||||
<LinearLayout
|
||||
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="#fde902"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
android:layout_marginBottom="180dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_counter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="#fde902"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_failures_counter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="0"
|
||||
android:textColor="#bd0000"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_stratagem_name"
|
||||
@@ -42,6 +57,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:translationY="30dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@@ -175,11 +191,11 @@
|
||||
<!-- Volver -->
|
||||
<ImageButton
|
||||
android:id="@+id/btn_volver"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_width="53dp"
|
||||
android:layout_height="53dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/btn_helldivers_secondary"
|
||||
android:contentDescription="Volver"
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="40dp"
|
||||
android:translationY="30dp"
|
||||
android:rowCount="3"
|
||||
android:columnCount="3"
|
||||
android:padding="8dp">
|
||||
@@ -128,4 +129,19 @@
|
||||
|
||||
<!-- Footer - Versión abajo centro -->
|
||||
|
||||
<!-- Botón Música - Derecha, nivelado con el botón de la derecha -->
|
||||
<Button
|
||||
android:id="@+id/btn_music"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignBottom="@id/buttons_grid"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/btn_helldivers_primary"
|
||||
android:text="♪"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_volver"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_width="53dp"
|
||||
android:layout_height="53dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/btn_helldivers_secondary"
|
||||
android:contentDescription="Volver"
|
||||
@@ -22,12 +22,10 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qr_image"
|
||||
android:layout_width="440dp"
|
||||
android:layout_height="379dp"
|
||||
android:layout_width="404dp"
|
||||
android:layout_height="344dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="#FFFFFF"
|
||||
android:contentDescription="@string/qr_description"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
</RelativeLayout>
|
||||
BIN
app/src/main/res/raw/ost.mp3
Normal file
BIN
app/src/main/res/raw/ost.mp3
Normal file
Binary file not shown.
@@ -4,9 +4,9 @@
|
||||
|
||||
<!-- Colores principales -->
|
||||
<color name="helldivers_black">#000000</color>
|
||||
<color name="helldivers_dark_bg">#006ab2</color>
|
||||
<color name="helldivers_dark_secondary">#005a96</color>
|
||||
<color name="helldivers_dark_tertiary">#004b7d</color>
|
||||
<color name="helldivers_dark_bg">#41639C</color>
|
||||
<color name="helldivers_dark_secondary">#2B4269</color>
|
||||
<color name="helldivers_dark_tertiary">#2B4269</color>
|
||||
|
||||
<!-- Colores neon/accent -->
|
||||
<color name="helldivers_yellow">#FFFFFF</color>
|
||||
@@ -23,8 +23,8 @@
|
||||
<color name="helldivers_gray_light">#C7C7CC</color>
|
||||
|
||||
<!-- Colores botones -->
|
||||
<color name="btn_bg_dark">#004b7d</color>
|
||||
<color name="btn_bg_pressed">#003c64</color>
|
||||
<color name="btn_bg_dark">#2B4269</color>
|
||||
<color name="btn_bg_pressed">#1E2E4A</color>
|
||||
<color name="btn_border_yellow">#FFFFFF</color>
|
||||
<color name="btn_border_blue">#00BFFF</color>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user