Модуль Армии (Bogatyri.Army, без Unity): - ArmyService — единственное хранилище войск (4 типа), секция сохранения "army" - IArmy расширен: войска по типам, обучение (AddTroops), потери (LoseFraction), войска в походах - событие TroopsChangedEvent — по нему перерисовываются панели HUD - GameProgress и панели работают с войсками только через IArmy - перенос из progress.json (troops, sashaMarchUnits) при первой загрузке; старые данные удаляются только после записи save.json (флаг armyInModule) - ArmyBridge удалён: контракты и перенос сохранений проверены тестами - тесты: поход не создаёт и не теряет солдат, потери по типам, сохранение, перенос, сброс Окно «ВОЙСКО ВЕРНУЛОСЬ» в городе (UI/MarchReturnPopup): - куда ходили, победа/поражение, сколько вернулось из скольких, добыча - показывается и за походы, закончившиеся пока игра была закрыта; несколько — по очереди - в MarchReturnedEvent добавлены Sent, TargetName, LootText GameLoadedEvent публикуется и без файла сохранения. Документы Army, Core, Save, World, README обновлены. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
145 lines
5.3 KiB
C#
145 lines
5.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
// Всё, что сохраняется в progress.json (отдельно от save.json с ресурсами и зданиями).
|
|
// JsonUtility умеет: числа, строки, bool, массивы, List<> из [Serializable]-классов.
|
|
|
|
[Serializable]
|
|
public class MailItem
|
|
{
|
|
public int id;
|
|
public string title;
|
|
public string body;
|
|
public long sentTicks;
|
|
public bool read;
|
|
public bool claimed;
|
|
public List<RewardItem> rewards = new List<RewardItem>();
|
|
public bool HasRewards { get { return rewards != null && rewards.Count > 0; } }
|
|
}
|
|
|
|
[Serializable]
|
|
public class TrainingOrder
|
|
{
|
|
public int troopIndex;
|
|
public int count;
|
|
public long startTicks;
|
|
public long endTicks;
|
|
}
|
|
|
|
[Serializable]
|
|
public class ArenaOpponent
|
|
{
|
|
public string name;
|
|
public int power;
|
|
public int rating;
|
|
}
|
|
|
|
[Serializable]
|
|
public class ProgressData
|
|
{
|
|
// --- Профиль ---
|
|
public string playerName = "Командир";
|
|
public string playerId = "";
|
|
public int avatarIndex = 0;
|
|
public int level = 1;
|
|
public int xp = 0;
|
|
public long firstLaunchTicks = 0;
|
|
public int daysPlayed = 0;
|
|
public int lastLoginDay = -1;
|
|
|
|
// --- Настройки ---
|
|
public float musicVolume = 0.8f;
|
|
public float soundVolume = 0.8f;
|
|
public bool vibration = true;
|
|
public bool notifications = true;
|
|
public int quality = 1; // 0 низкое, 1 среднее, 2 высокое
|
|
public bool fps60 = true;
|
|
|
|
// --- Статистика (для профиля и заданий) ---
|
|
public float[] collected = new float[8]; // индекс = (int)ResourceType
|
|
public int battlesWon;
|
|
public int battlesLost;
|
|
public int troopsTrained;
|
|
public int arenaFights;
|
|
public int arenaWins;
|
|
public int questsDone;
|
|
|
|
// --- Задания ---
|
|
public List<string> claimedQuests = new List<string>();
|
|
public int dailyDay = -1;
|
|
public List<string> claimedDaily = new List<string>();
|
|
public float[] dailyCollected = new float[8];
|
|
public int dailyBattles;
|
|
public int dailyTroops;
|
|
public int dailyArena;
|
|
public int dailyMarches;
|
|
|
|
// --- Награда за вход ---
|
|
public int loginRewardIndex = 0; // какой день из 7 следующий
|
|
public int lastLoginRewardDay = -1;
|
|
|
|
// --- Почта ---
|
|
public List<MailItem> mail = new List<MailItem>();
|
|
public int nextMailId = 1;
|
|
public bool starterMailSent;
|
|
|
|
// --- Магазин ---
|
|
public int shopDay = -1;
|
|
public List<string> shopIds = new List<string>();
|
|
public List<int> shopCounts = new List<int>();
|
|
|
|
// --- Герой ---
|
|
public int heroLevel = 1;
|
|
|
|
// --- Войска ---
|
|
// Войска теперь хранит модуль Армии (save.json, секция "army"). Это поле -- только для переноса
|
|
// из старых сохранений: при первой загрузке его читает App/GameModules, потом оно обнуляется.
|
|
public int[] troops = new int[4];
|
|
public bool armyInModule; // войска уже перенесены в модуль Армии
|
|
public List<TrainingOrder> training = new List<TrainingOrder>();
|
|
|
|
// --- Бой (кампания) ---
|
|
public int battleStage = 1;
|
|
|
|
// --- Арена ---
|
|
public int arenaRating = 1000;
|
|
public int arenaTickets = 5;
|
|
public long arenaTicketTicks = 0;
|
|
public List<ArenaOpponent> arenaOpponents = new List<ArenaOpponent>();
|
|
|
|
// --- Карта мира (статистика для заданий; походы ведёт модуль Мира) ---
|
|
// Старая маленькая карта (панель "МИР", Meta/World) удалена 19.10.2026 -- осталась одна большая карта.
|
|
// marches оставлено только для переноса: солдаты из её походов возвращаются в город при загрузке.
|
|
public List<LegacyWorldMarch> marches = new List<LegacyWorldMarch>();
|
|
public int marchesSent;
|
|
public int worldWins;
|
|
public int worldLosses;
|
|
|
|
// --- Карта мира (сцена WorldMap) ---
|
|
public List<Bogatyri.World.MarchData> sashaMarches = new List<Bogatyri.World.MarchData>();
|
|
public List<LegacyMarchUnits> sashaMarchUnits = new List<LegacyMarchUnits>(); // только для переноса в модуль Армии
|
|
|
|
// --- Событие ---
|
|
public int eventWeek = -1;
|
|
public int eventPoints;
|
|
public int eventTroopRemainder;
|
|
public List<int> eventClaimed = new List<int>();
|
|
}
|
|
|
|
// Поход старой маленькой карты -- только чтобы при загрузке вернуть солдат в город (см. GameProgress.FixData)
|
|
[Serializable]
|
|
public class LegacyWorldMarch
|
|
{
|
|
public int[] units = new int[4]; // отправлено
|
|
public int[] survivors = new int[4]; // вернутся домой
|
|
public bool returning;
|
|
}
|
|
|
|
// Состав похода из старого progress.json (раньше хранил мост ArmyBridge) -- только для переноса в модуль Армии
|
|
[Serializable]
|
|
public class LegacyMarchUnits
|
|
{
|
|
public int marchId;
|
|
public int[] units = new int[4];
|
|
}
|