Add backend projects with core models and tests, setup Godot frontend

This commit is contained in:
sokol
2026-02-20 21:01:09 +03:00
parent fc3ad9f6db
commit f320aa50ed
14 changed files with 518 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
namespace MyBiz.Core;
/// <summary>
/// Тип здания
/// </summary>
public enum BuildingType
{
// Добыча сырья
Farm, // Ферма
CottonField, // Хлопковое поле
Mine, // Шахта
// Производство
FoodFactory, // Пищекомбинат
TextileFactory, // Текстильная фабрика
SteelMill, // Сталелитейный завод
PlasticPlant, // Завод пластика
ElectronicsFactory, // Завод электроники
AutoFactory, // Автозавод
// Торговля
GroceryStore, // Продуктовый магазин
ClothingStore, // Магазин одежды
ElectronicsStore, // Магазин электроники
AutoDealer, // Автосалон
Mall, // Торговый центр
// Исследования
Laboratory, // Лаборатория
// Склад
Warehouse // Склад
}
/// <summary>
/// Здание
/// </summary>
public class Building
{
public Guid Id { get; set; } = Guid.NewGuid();
public BuildingType Type { get; set; }
public string Name { get; set; } = string.Empty;
public string CityId { get; set; } = string.Empty;
/// <summary>
/// Уровень здания (влияет на эффективность)
/// </summary>
public int Level { get; set; } = 1;
/// <summary>
/// Стоимость постройки
/// </summary>
public decimal BuildCost { get; set; }
/// <summary>
/// Стоимость содержания в тик
/// </summary>
public decimal UpkeepCost { get; set; }
/// <summary>
/// Вместимость склада
/// </summary>
public int StorageCapacity { get; set; }
/// <summary>
/// Количество рабочих мест
/// </summary>
public int WorkerSlots { get; set; }
/// <summary>
/// Заполненность рабочими
/// </summary>
public int Workers { get; set; }
}

View File

@@ -0,0 +1,47 @@
namespace MyBiz.Core;
/// <summary>
/// Размер города
/// </summary>
public enum CitySize
{
Small, // Малый
Medium, // Средний
Large // Крупный
}
/// <summary>
/// Город
/// </summary>
public class City
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public string Name { get; set; } = string.Empty;
public string Country { get; set; } = string.Empty;
public CitySize Size { get; set; }
/// <summary>
/// Население
/// </summary>
public int Population { get; set; }
/// <summary>
/// Доступные здания
/// </summary>
public List<Building> Buildings { get; set; } = new();
/// <summary>
/// Рынок города (спрос на продукты)
/// </summary>
public Dictionary<ProductType, int> MarketDemand { get; set; } = new();
/// <summary>
/// Предложение на рынке
/// </summary>
public Dictionary<ProductType, int> MarketSupply { get; set; } = new();
/// <summary>
/// Текущие цены
/// </summary>
public Dictionary<ProductType, decimal> Prices { get; set; } = new();
}

View File

@@ -0,0 +1,50 @@
namespace MyBiz.Core;
/// <summary>
/// Компания игрока
/// </summary>
public class Company
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
/// <summary>
/// Доступные деньги
/// </summary>
public decimal Cash { get; set; }
/// <summary>
/// Активы компании
/// </summary>
public decimal Assets { get; set; }
/// <summary>
/// Пассивы (долги)
/// </summary>
public decimal Liabilities { get; set; }
/// <summary>
/// Прибыль за последний период
/// </summary>
public decimal LastPeriodProfit { get; set; }
/// <summary>
/// Список зданий компании
/// </summary>
public List<Building> Buildings { get; set; } = new();
/// <summary>
/// Складские запасы
/// </summary>
public Dictionary<ProductType, int> Inventory { get; set; } = new();
/// <summary>
/// Открытые технологии
/// </summary>
public HashSet<string> UnlockedTechnologies { get; set; } = new();
/// <summary>
/// Рассчитать чистую стоимость
/// </summary>
public decimal NetWorth => Assets - Liabilities + Cash;
}

View File

@@ -0,0 +1,65 @@
namespace MyBiz.Core;
/// <summary>
/// Категория продукта
/// </summary>
public enum ProductCategory
{
RawMaterial, // Сырьё
Component, // Компоненты
ConsumerGoods // Товары народного потребления
}
/// <summary>
/// Тип продукта
/// </summary>
public enum ProductType
{
// Сырьё
Cotton, // Хлопок
Steel, // Сталь
Plastic, // Пластик
FoodRaw, // Сырьё для еды
// Компоненты
Fabric, // Ткань
MetalParts, // Металлические детали
PlasticParts, // Пластиковые детали
ElectronicsComponents, // Электронные компоненты
// Товары
Food, // Еда
Clothing, // Одежда
Electronics, // Электроника
Automobile // Автомобили
}
/// <summary>
/// Продукт
/// </summary>
public class Product
{
public ProductType Type { get; set; }
public string Name { get; set; } = string.Empty;
public ProductCategory Category { get; set; }
/// <summary>
/// Базовая цена продукта
/// </summary>
public decimal BasePrice { get; set; }
/// <summary>
/// Текущая цена (с учётом спроса/предложения)
/// </summary>
public decimal CurrentPrice { get; set; }
/// <summary>
/// Доступное количество на рынке
/// </summary>
public int AvailableQuantity { get; set; }
/// <summary>
/// Спрос на продукт
/// </summary>
public int Demand { get; set; }
}

View File

@@ -0,0 +1,37 @@
namespace MyBiz.Core;
/// <summary>
/// Шаг производственной цепочки
/// </summary>
public class ProductionStep
{
/// <summary>
/// Требуемый продукт
/// </summary>
public ProductType InputProduct { get; set; }
/// <summary>
/// Количество требуемого продукта
/// </summary>
public int InputQuantity { get; set; }
/// <summary>
/// Время производства (в тиках)
/// </summary>
public int ProductionTime { get; set; }
}
/// <summary>
/// Производственная цепочка
/// </summary>
public class ProductionChain
{
public ProductType OutputProduct { get; set; }
public BuildingType RequiredBuilding { get; set; }
public List<ProductionStep> Steps { get; set; } = new();
/// <summary>
/// Количество выходного продукта за цикл
/// </summary>
public int OutputQuantity { get; set; }
}