コード例 #1
0
        private IEnumerator LoadSequence(List <SaveData> saveData)
        {
            Processing = true;
            yield return(new WaitForSecondsRealtime(0.5f));

            yield return(new WaitForSecondsRealtime(loadDelay));

            for (int i = 0; i < saveData.Count; i++)
            {
                SaveData  data     = saveData[i];
                ISaveable saveable = saveables.SingleOrDefault(x => x.Id == data.id);
                if (saveable != null && saveable.ToString() != "null")
                {
                    saveable.Load(data);
                }
            }

            Processing = false;

            ClearTrash();
            List <ISaveable> redundant = saveables.Where(x => !saveData.Any(y => y.id == x.Id)).ToList();

            for (int i = redundant.Count - 1; i >= 0; i--)
            {
                Destroy(redundant[i].GO);
            }

            DevTools.Instance().DisableAll();
            yield return(new WaitForEndOfFrame());

            onLoad?.Invoke();
        }