Feature/3d hud #18
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user