コード例 #1
0
        /// <summary>
        /// Adjustes map markers for a deleted chapters
        /// </summary>
        /// <param name="projectId">Project Id</param>
        /// <param name="deletedChapter">Deleted chapter number</param>
        /// <param name="minChapterNumber">Min Chapter number</param>
        /// <param name="maxChapterNumber">Max Chapter number</param>
        /// <param name="chapters">Chapters</param>
        /// <returns></returns>
        private async Task AdjustKartaMapMarkersForDeletedChapter(string projectId, int deletedChapter, int minChapterNumber, int maxChapterNumber, List <AikaChapter> chapters)
        {
            List <KartaMap> allMaps = await _kartaMapDbAccess.GetAllProjectMapsWithFullDetail(projectId);

            foreach (KartaMap curMap in allMaps)
            {
                bool anyChange = AdjustMapMarkerListForDeletedChapter(curMap.NpcMarker, deletedChapter, minChapterNumber, maxChapterNumber, chapters);
                anyChange = AdjustMapMarkerListForDeletedChapter(curMap.ItemMarker, deletedChapter, minChapterNumber, maxChapterNumber, chapters) || anyChange;
                anyChange = AdjustMapMarkerListForDeletedChapter(curMap.KirjaPageMarker, deletedChapter, minChapterNumber, maxChapterNumber, chapters) || anyChange;
                anyChange = AdjustMapMarkerListForDeletedChapter(curMap.QuestMarker, deletedChapter, minChapterNumber, maxChapterNumber, chapters) || anyChange;
                anyChange = AdjustMapMarkerListForDeletedChapter(curMap.MapChangeMarker, deletedChapter, minChapterNumber, maxChapterNumber, chapters) || anyChange;
                anyChange = AdjustMapMarkerListForDeletedChapter(curMap.NoteMarker, deletedChapter, minChapterNumber, maxChapterNumber, chapters) || anyChange;

                if (anyChange)
                {
                    await _kartaMapDbAccess.UpdateMap(curMap);
                }
            }
        }