コード例 #1
0
        private static ChapterData SaveChapter(Chapter chapter)
        {
            ChapterData data = new ChapterData();

            data.unlocked = chapter.unlocked;
            data.trophies = chapter.trophies;

            //Debug.Log ("Chapter " + (chapter.index+1) + " saved -- unlocked = " + chapter.unlocked);

            foreach (LevelOut level in chapter.levels)
            {
                data.level_data.Add(SaveLevel(level));
            }

            return(data);
        }
コード例 #2
0
        private static void LoadChapter(ChapterData chapter_data, Chapter chapter)
        {
            //Chapter chapter = new Chapter();
            chapter.unlocked = chapter_data.unlocked;
            chapter.trophies = chapter_data.trophies;

            //Debug.Log ("Chapter " + (chapter.index+1) + " loaded -- unlocked = " + chapter.unlocked);

            for (int i = 0; i < chapter.levels.Count; i++)
            {
                if (i >= chapter_data.level_data.Count || chapter.levels[i] == null || chapter_data.level_data[i] == null)
                {
                    return;
                }

                LoadLevel(chapter_data.level_data[i], chapter.levels[i]);
            }
        }