Слита ветка товарища feature/storage-workers: склады и лимиты, добыча через рабочих

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	Assets/Scripts/App/DebugPanel.cs
#	Docs/Modules/Core.md
#	Docs/Modules/README.md
#	Docs/Modules/Save.md
This commit is contained in:
Alexander
2026-10-27 16:57:28 +01:00
37 changed files with 1545 additions and 219 deletions
+14 -2
View File
@@ -80,6 +80,7 @@ public class DebugPanel : MonoBehaviour
Btn(row3, "Сбросить перемотку", UIKit.Theme.Gray, () => { GameClock.ResetOffset(); Refresh(); });
var row4 = UIKit.Row(card, 70, 10);
Btn(row4, "Рабочие", UIKit.Theme.Blue, () => BuildingWindow.Open(null));
Btn(row4, "Закрыть", UIKit.Theme.Gray, () => panel.SetActive(false));
panel.SetActive(false);
@@ -112,14 +113,19 @@ public class DebugPanel : MonoBehaviour
if (GameServices.TryGet(out IPopulation p))
{
sb.Append($"Население: <b>{p.Total}</b> / {p.HousingCap}\n");
sb.Append($" жители {p.Civilians} (рабочие {p.Workers}, остальные {p.Idle}), воины {p.Soldiers}\n");
sb.Append($" жители {p.Civilians}: на работе {p.Workers}, свободно {p.FreeWorkers} из {p.Workforce}; воины {p.Soldiers}\n");
sb.Append($"Еда в час: <color=#ff8a80>-{p.FoodPerHour:0.#}</color> прирост в час: +{p.GrowthPerHour:0.#}\n");
if (p.IsStarving) sb.Append("<color=#ff5252><b>ГОЛОД: еды не хватает, прирост остановлен</b></color>\n");
}
else sb.Append("Модуль Населения не зарегистрирован\n");
if (GameServices.TryGet(out IProduction prod))
sb.Append($"Добыча в час: еда +{prod.RatePerHour(ResourceType.Food):0.#}, дерево +{prod.RatePerHour(ResourceType.Wood):0.#}, " +
$"камень +{prod.RatePerHour(ResourceType.Stone):0.#}, металл +{prod.RatePerHour(ResourceType.Iron):0.#}, золото +{prod.RatePerHour(ResourceType.Gold):0.#}\n");
if (GameServices.TryGet(out IEconomy e))
sb.Append($"Еда: {e.Get(ResourceType.Food):0.#} дерево {e.Get(ResourceType.Wood):0} камень {e.Get(ResourceType.Stone):0}\n");
sb.Append($"Склад: еда {e.Get(ResourceType.Food):0}/{Cap(e, ResourceType.Food)} дерево {e.Get(ResourceType.Wood):0}/{Cap(e, ResourceType.Wood)} " +
$"камень {e.Get(ResourceType.Stone):0}/{Cap(e, ResourceType.Stone)}\n");
else sb.Append("Экономика не найдена (нет ResourceManager на сцене)\n");
long off = GameClock.OffsetSeconds;
@@ -127,6 +133,12 @@ public class DebugPanel : MonoBehaviour
info.text = sb.ToString();
}
static string Cap(IEconomy e, ResourceType t)
{
float c = e.GetCapacity(t);
return float.IsInfinity(c) ? "∞" : c.ToString("0");
}
void AddAllResources()
{
ResourceType[] types = { ResourceType.Wood, ResourceType.Food, ResourceType.Stone, ResourceType.Iron, ResourceType.Gold, ResourceType.Gems };