FEAT Добавление монет через сайт-панель

1. Появилась возможность добавлять монеты через сайт-панель по кнопке
2. Доработаны css стили для сайт-панели
This commit is contained in:
_sega 2026-01-28 14:57:47 +03:00
parent a8b26773e8
commit 56a9e2464b
3 changed files with 270 additions and 97 deletions

View File

@ -1,20 +1,9 @@
/* Общие стили */
* {
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.panel { padding: 16px; margin: 16px 0; border-radius: 12px; background: rgba(255,255,255,0.04); }
.coins-row { display:flex; gap:12px; align-items:center; }
.coins-input { width: 140px; }
.coins-btn { padding: 8px 14px; cursor:pointer; }
.status { margin-top: 10px; opacity: 0.85; font-size: 14px; }
.radio-row { display:flex; gap:10px; align-items:center; margin: 6px 0; }
.login-root { max-width: 360px; margin: 60px auto; padding: 18px; border-radius: 12px; background: rgba(255,255,255,0.04); }
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
@ -33,10 +22,16 @@ h1 {
font-size: 3.5rem;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
width: 100%;
max-width: 600px;
max-width: 800px; /* чуть шире, т.к. панелей теперь несколько */
}
/* Основная форма */
h2 {
color: #2d3748;
font-size: 2rem;
margin-bottom: 14px;
}
/* Основная форма (legacy) */
.form-root {
background: white;
padding: 25px;
@ -49,6 +44,22 @@ h1 {
gap: 20px;
}
/* =========================
NEW: Панели (как карточки)
========================= */
.panel {
background: white;
padding: 25px;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
width: 100%;
max-width: 800px;
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 20px;
}
/* Группы элементов формы */
.form-group {
border: 2px solid #e0e0e0 !important;
@ -58,6 +69,7 @@ h1 {
background: #f8f9fa;
}
/* hover оставляем (это не анимация появления, это реакция) */
.form-group:hover {
border-color: #667eea !important;
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
@ -182,7 +194,36 @@ input[type="radio"]:hover {
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
/* Группы радиокнопок */
/* =========================
CHANGED: радио-строки
(раньше было .form-group > div, но у тебя теперь .radio-row)
========================= */
.radio-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
padding: 10px 12px;
border-radius: 8px;
transition: background 0.2s ease;
}
.radio-row:hover {
background: rgba(102, 126, 234, 0.05);
}
.radio-row label {
margin-bottom: 0;
font-size: 1.6rem;
font-weight: 500;
}
.radio-row input[type="radio"] {
margin-right: 0;
}
/* Оставляем старую поддержку на случай других div внутри form-group */
.form-group > div {
margin-bottom: 10px;
padding: 8px 12px;
@ -194,11 +235,12 @@ input[type="radio"]:hover {
background: rgba(102, 126, 234, 0.05);
}
.form-group > div:last-child {
.form-group > div:last-child,
.radio-row:last-child {
margin-bottom: 0;
}
/* Кнопка отправки */
/* Кнопка отправки (legacy) */
input[type="submit"] {
background: linear-gradient(to right, #667eea, #764ba2);
color: white;
@ -225,86 +267,126 @@ input[type="submit"]:active {
transform: translateY(-1px);
}
/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
body {
padding: 15px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
h1 {
font-size: 1.8rem;
margin-bottom: 20px;
padding: 0 10px;
}
.form-root {
padding: 20px;
border-radius: 16px;
gap: 16px;
}
.form-group {
padding: 16px;
}
.form-group label,
.form-group p {
font-size: 1rem;
margin-bottom: 10px;
}
input[type="submit"] {
padding: 16px 30px;
font-size: 1.1rem;
}
/* Улучшаем тач-таргеты для мобильных */
input[type="checkbox"],
input[type="radio"],
input[type="range"]::-webkit-slider-thumb {
min-height: 44px;
min-width: 44px;
}
.form-group > div {
padding: 12px 16px;
margin-bottom: 8px;
}
/* =========================
NEW: кнопки и поля (монеты + логин)
========================= */
button {
font-family: inherit;
}
/* Анимация появления */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
.coins-row {
display: flex;
gap: 12px;
align-items: center;
flex-wrap: wrap;
}
.form-group {
animation: fadeIn 0.5s ease forwards;
.coins-input {
width: 160px;
border: 2px solid #e0e0e0;
border-radius: 12px;
padding: 12px 14px;
background: #f8f9fa;
font-size: 1.2rem;
transition: all 0.2s ease;
}
/* Порядок анимаций для групп */
.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }
.form-group:nth-child(6) { animation-delay: 0.6s; }
.form-group:nth-child(7) { animation-delay: 0.7s; }
.form-group:nth-child(8) { animation-delay: 0.8s; }
.form-group:nth-child(9) { animation-delay: 0.9s; }
.form-group:nth-child(10) { animation-delay: 1.0s; }
.form-group:nth-child(11) { animation-delay: 1.1s; }
.form-group:nth-child(12) { animation-delay: 1.2s; }
.form-group:nth-child(13) { animation-delay: 1.3s; }
.form-group:nth-child(14) { animation-delay: 1.4s; }
input[type="submit"] { animation-delay: 1.5s; animation: fadeIn 0.5s ease forwards; }
.coins-input:focus {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
outline: none;
}
.coins-btn,
#loginBtn {
background: linear-gradient(to right, #667eea, #764ba2);
color: white;
border: none;
padding: 14px 18px;
font-size: 1.1rem;
font-weight: 600;
border-radius: 12px;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
}
.coins-btn:hover,
#loginBtn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}
.coins-btn:active,
#loginBtn:active {
transform: translateY(-1px);
}
.status {
font-size: 1.05rem;
color: #2d3748;
opacity: 0.9;
min-height: 1.2em; /* чтобы не прыгало, когда текст появляется/исчезает */
}
/* глобальный статус снизу — визуально мягче */
#globalStatus.status {
width: 100%;
max-width: 800px;
text-align: center;
color: white;
opacity: 0.95;
margin-top: 6px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.25);
}
/* =========================
NEW: логин-страница (в стиле карточек)
========================= */
.login-root {
background: white;
padding: 25px;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
width: 100%;
max-width: 520px;
display: flex;
flex-direction: column;
gap: 18px;
}
.login-root h1 {
/* На логине свой h1 внутри белой карточки, поэтому переопределим */
color: #2d3748;
text-shadow: none;
font-size: 2.6rem;
margin-bottom: 0;
max-width: none;
}
#loginStatus {
font-size: 1.05rem;
color: #2d3748;
opacity: 0.9;
min-height: 1.2em;
}
/* Инпут пароля в стиле coins-input */
.login-root input[type="password"] {
width: 100%;
border: 2px solid #e0e0e0;
border-radius: 12px;
padding: 12px 14px;
background: #f8f9fa;
font-size: 1.2rem;
transition: all 0.2s ease;
}
.login-root input[type="password"]:focus {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
outline: none;
}
/* Улучшение читаемости на светлом фоне */
.form-group label[for],
@ -316,4 +398,91 @@ input[type="submit"] { animation-delay: 1.5s; animation: fadeIn 0.5s ease forwar
input:focus {
outline: none;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}
}
/* =========================
CHANGED: УБРАЛИ анимацию появления
========================= */
/* Удалено:
@keyframes fadeIn {...}
.form-group { animation: ... }
.form-group:nth-child(...) ...
input[type="submit"] { animation: ... }
*/
/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
body {
padding: 15px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
h1 {
font-size: 1.8rem;
margin-bottom: 20px;
padding: 0 10px;
}
h2 {
font-size: 1.3rem;
margin-bottom: 10px;
}
.form-root,
.panel {
padding: 20px;
border-radius: 16px;
gap: 16px;
}
.form-group {
padding: 16px;
}
.form-group label,
.form-group p {
font-size: 1rem;
margin-bottom: 10px;
}
/* кнопки */
.coins-btn,
#loginBtn,
input[type="submit"] {
padding: 14px 16px;
font-size: 1rem;
}
.coins-input,
.login-root input[type="password"] {
font-size: 1rem;
padding: 12px 14px;
width: 100%;
}
.coins-row {
flex-direction: column;
align-items: stretch;
}
/* тач-таргеты */
input[type="checkbox"],
input[type="radio"],
input[type="range"]::-webkit-slider-thumb {
min-height: 44px;
min-width: 44px;
}
.radio-row {
padding: 12px 16px;
margin-bottom: 8px;
}
.login-root {
max-width: 800px;
}
.login-root h1 {
font-size: 1.8rem;
}
}

View File

@ -83,6 +83,14 @@ public class ComWrapper : MonoBehaviour
onCoinAdded?.Invoke(Balance);
}
public static void AddCreditNoCounters(int amount)
{
Balance = Balance + amount;
PlayerPrefs.SetInt("CoinsCount", Balance);
onCoinAdded?.Invoke(Balance);
}
public static void ReturnCredits(GameMode gameMode)
{
string gamemodePriceKey = gameMode == GameMode.pvp ? "PricePVP" : "PricePVE";

View File

@ -317,11 +317,7 @@ public class WebServer : MonoBehaviour
}
}
private void OnAddCoins(int amount)
{
// TODO: ты сам впишешь функционал
Debug.Log($"[COINS] Add coins requested: {amount}");
}
private void OnAddCoins(int amount) => ComWrapper.AddCreditNoCounters(amount);
// =========================
// LEGACY /upd (как было)