using System; using System.Collections.Generic; [Serializable] public class SaveItemCounts { public int hammer = 1; public int moves = 1; public int shuffle = 1; public int key = 0; public int Get(string itemKey) { switch (itemKey) { case GameDefinitions.HammerItem: return hammer; case GameDefinitions.MovesItem: return moves; case GameDefinitions.ShuffleItem: return shuffle; case GameDefinitions.KeyItem: return key; default: return 0; } } public void Add(string itemKey, int amount) { switch (itemKey) { case GameDefinitions.HammerItem: hammer += amount; break; case GameDefinitions.MovesItem: moves += amount; break; case GameDefinitions.ShuffleItem: shuffle += amount; break; case GameDefinitions.KeyItem: key += amount; break; } } } [Serializable] public class SaveModeClears { public int classic; public int rush; public int sealedLevels; public int Get(string modeKey) { switch (modeKey) { case GameDefinitions.ClassicMode: return classic; case GameDefinitions.RushMode: return rush; case GameDefinitions.SealedMode: return sealedLevels; default: return 0; } } public void Set(string modeKey, int value) { value = Math.Max(0, Math.Min(GameDefinitions.MaxLevel, value)); switch (modeKey) { case GameDefinitions.ClassicMode: classic = value; break; case GameDefinitions.RushMode: rush = value; break; case GameDefinitions.SealedMode: sealedLevels = value; break; } } public int Total() { return classic + rush + sealedLevels; } } [Serializable] public class SaveCheckInState { public int day = 1; public string last = ""; } [Serializable] public class SaveLotteryState { public string last = ""; } [Serializable] public class SavePlayerState { public string name = "LuckyPlayer"; public string id = ""; public int avatar = 1; } [Serializable] public class SavePlayerStats { public int clears; public int served; public int best; public int earned; } [Serializable] public class SaveSettings { public bool bgm = true; public bool sfx = true; public bool reduceMotion; public string localeId = "en"; } [Serializable] public class SaveAdState { public string reviveDate = ""; public int reviveCount; } [Serializable] public class LedgerEntry { public string type; public string note; public int amount; public string time; } [Serializable] public class GameSaveData { public int version = 1; public int coins = GameDefinitions.DefaultCoins; public SaveItemCounts items = new SaveItemCounts(); public SaveModeClears cleared = new SaveModeClears(); public SaveCheckInState checkin = new SaveCheckInState(); public SaveLotteryState lottery = new SaveLotteryState(); public int tickets; public string selectedMode = GameDefinitions.ClassicMode; public SavePlayerState player = new SavePlayerState(); public SavePlayerStats stats = new SavePlayerStats(); public SaveSettings settings = new SaveSettings(); public SaveAdState ads = new SaveAdState(); public int tut; public int story; public List ledger = new List(); }