Редкий PvE-торговец: синий кристалл за 30 000 / 60 000 золота, не больше 2 за 7 суток (регламент валют, разд. 3)

- CrystalTrader (без Unity) + 5 тестов из раздела 12
- Входит в недельный PvE-предел; нет квоты, места или покупок -- блок, золото не списывается
- Магазин: карточка «Редкий торговец»; DEV «Золото 100 000» для проверки

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alexander
2026-11-06 16:27:27 +01:00
co-authored by Claude Opus 5.5
parent 277afdf84e
commit b51ad41925
9 changed files with 288 additions and 3 deletions
+28 -2
View File
@@ -1,8 +1,8 @@
using UnityEngine;
using TMPro;
// МАГАЗИН: бесплатный сундук раз в день, пакеты ресурсов за кристаллы, обмен золота,
// витрина платных наборов (пока "скоро"). Лимиты покупок сбрасываются в полночь.
// МАГАЗИН: редкий PvE-торговец (синий кристалл за золото), бесплатный сундук раз в день, пакеты ресурсов за золото.
// Лимиты пакетов сбрасываются в полночь; у торговца -- свои: не больше 2 кристаллов за 7 реальных суток.
public class ShopPanel : BasePanel
{
TextMeshProUGUI timer;
@@ -15,6 +15,8 @@ public class ShopPanel : BasePanel
WalletItem(wallet, ResourceType.Gems);
WalletItem(wallet, ResourceType.Gold);
TraderCard(list);
timer = UIKit.Text(list, "", 24, UIKit.Theme.TextDim, TextAlignmentOptions.Center, 40);
Tick();
@@ -52,6 +54,30 @@ public class ShopPanel : BasePanel
}
}
// Редкий PvE-торговец (регламент валют 05.11, разд. 3): дорогой обмен золота на синий кристалл
void TraderCard(Transform list)
{
var gp = GameProgress.Instance;
int price = gp.TraderPrice;
string block = gp.TraderBlockReason();
bool enough = price >= 0 && gp.Res(ResourceType.Gold) >= price;
var card = UIKit.Card(list, UIKit.Theme.CardDark);
var row = UIKit.Row(card, 150, 16);
UIKit.Icon(row, GameData.ResColor(ResourceType.Gems), "", 110);
var info = UIKit.Card(row, new Color(0, 0, 0, 0), 0, 4);
UIKit.Size(info, -1, -1, 1);
var title = UIKit.Text(info, "Редкий торговец: синий кристалл", 30);
title.fontStyle = FontStyles.Bold;
UIKit.Text(info, $"Куплено за 7 дней: {gp.TraderBought} / {gp.TraderMaxPurchases}. Входит в недельный предел новых кристаллов " +
$"({gp.CrystalQuotaUsed} / {gp.CrystalQuotaLimit})", 22, UIKit.Theme.TextDim);
if (block != null) UIKit.Text(info, block, 22, UIKit.Theme.Gold);
string label = price < 0 ? "Недоступно" : price.ToString("N0") + " золота";
var b = UIKit.Button(row, label, block == null && enough ? UIKit.Theme.Blue : UIKit.Theme.Gray, () => { gp.BuyCrystalFromTrader(); RequestRebuild(); }, 260, 100, 24);
b.interactable = block == null;
}
static void WalletItem(Transform parent, ResourceType t)
{
UIKit.Icon(parent, GameData.ResColor(t), "", 40);