From 4fe2dced7684ba0b87f8b656caf9387eb4afd7b2 Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 5 Nov 2026 17:27:58 +0100 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BA=D0=BD=D0=BE=20=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F:=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0=20?= =?UTF-8?q?=C2=AB=D0=A6=D0=B5=D0=BD=D0=B0=C2=BB=20=D0=BE=D0=B1=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D1=8F=D0=B5=D1=82=D1=81=D1=8F=20=D0=B2=D0=BC=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B5=20=D1=81=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA?= =?UTF-8?q?=D0=BE=D0=B9;=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=203D-=D1=81=D1=86?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B5=20=D1=80=D0=B8=D1=81=D1=83?= =?UTF-8?q?=D1=8E=D1=82=D1=81=D1=8F=20=D0=BF=D0=BE=D0=B2=D0=B5=D1=80=D1=85?= =?UTF-8?q?=20=D0=BE=D0=BA=D0=BE=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- Assets/Scripts/App/BuildingWindow.cs | 17 +++++++++++++++-- Assets/Scripts/City3D/City3DController.cs | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/App/BuildingWindow.cs b/Assets/Scripts/App/BuildingWindow.cs index 20bdb75..7d9e9b1 100644 --- a/Assets/Scripts/App/BuildingWindow.cs +++ b/Assets/Scripts/App/BuildingWindow.cs @@ -302,7 +302,7 @@ public static class BuildingWindow if (TimerRunning(townHall.gameObject)) return; // улучшение уже идёт -- полоска сверху var cost = BuildingData.ToAmounts(townHall.GetUpgradeCost()); - UIKit.Text(card, "Цена: " + CostText(cost), 24, UIKit.Theme.Text, TextAlignmentOptions.Center); + LiveCost(card, cost); long ms = config.ConstructionMs(true, next); TimeText(card, ms); bool canPay = townHall.CanUpgrade(); @@ -529,7 +529,7 @@ public static class BuildingWindow UIKit.Text(card, effect, 24, UIKit.Theme.Text, TextAlignmentOptions.Center); if (focus != null && TimerRunning(focus)) return; // улучшение уже идёт -- полоска сверху var cost = config.UpgradeCost(level); - UIKit.Text(card, "Цена: " + CostText(cost), 24, UIKit.Theme.Text, TextAlignmentOptions.Center); + LiveCost(card, cost); long ms = config.ConstructionMs(false, level + 1); TimeText(card, ms); var building = focus; @@ -633,6 +633,19 @@ public static class BuildingWindow } // Цена: чего хватает -- зелёным, чего нет -- красным, со сколько есть + // Строка «Цена: …» обновляется, пока окно открыто: хватает ресурса -- зелёная цифра, нет -- красная и «есть N» (05.11) + static void LiveCost(Transform card, ResourceAmount[] cost) + { + var text = UIKit.Text(card, "Цена: " + CostText(cost), 24, UIKit.Theme.Text, TextAlignmentOptions.Center); + string shown = text.text; + live.Add(() => + { + if (text == null) return; + string now = "Цена: " + CostText(cost); + if (now != shown) { shown = now; text.text = now; } + }); + } + static string CostText(ResourceAmount[] cost) { GameServices.TryGet(out IEconomy economy); diff --git a/Assets/Scripts/City3D/City3DController.cs b/Assets/Scripts/City3D/City3DController.cs index 2c38e37..c599a9d 100644 --- a/Assets/Scripts/City3D/City3DController.cs +++ b/Assets/Scripts/City3D/City3DController.cs @@ -931,6 +931,19 @@ public class City3DController : MonoBehaviour, City3DSave.ILive return label; } + // Открыто модальное окно UIKit (окно здания, отчёт, подтверждение) -- проверка раз в кадр + int modalCheckedFrame = -1; + bool modalOpen; + bool ModalOpen() + { + if (modalCheckedFrame != Time.frameCount) + { + modalCheckedFrame = Time.frameCount; + modalOpen = GameObject.Find("Modal") != null; + } + return modalOpen; + } + bool OverGui(Vector3 screen) { var p = new Vector2(screen.x / guiScale, (Screen.height - screen.y) / guiScale); @@ -967,6 +980,7 @@ public class City3DController : MonoBehaviour, City3DSave.ILive // Окно HUD открыто -- временные кнопки сцены не показываем (и не ловим нажатия) if (UIPanelManager.Instance != null && UIPanelManager.Instance.CurrentId != "") return; + if (ModalOpen()) return; // и окно здания / сообщение (UIKit.Modal): тестовые кнопки сцены не рисуются поверх него (05.11) // Под верхней панелью HUD, справа: Ратуша −/+ -- только в редакторе и отладочной сборке (тест зон), редактирование if (Application.isEditor || Debug.isDebugBuild)