using AxibugProtobuf; using System.Collections.Generic; namespace AxibugEmuOnline.Client { /// /// 游戏存档管理器 /// public class SaveSlotManager { const int MAX_SLOT_COUNT = 4; SavCloudApi m_cloudApi = new SavCloudApi(); Dictionary m_saveFileDict = new Dictionary(); public List GetSlotSaves(int romID, RomPlatformType platform) { List result = new List(); for (int i = 0; i < MAX_SLOT_COUNT; i++) { result.Add(GetSaveFile(romID, platform, i)); } return result; } SaveFile GetSaveFile(int romID, RomPlatformType platform, int slotIndex) { if (!m_saveFileDict.TryGetValue(romID, out SaveFile[] files)) { if (files == null) files = new SaveFile[MAX_SLOT_COUNT]; for (int i = 0; i < files.Length; i++) { files[i] = new SaveFile(romID, platform, i); } m_saveFileDict[romID] = files; } return files[slotIndex]; } } }