コード例 #1
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                Dictionary <BookData, bool> lookup = new Dictionary <BookData, bool>();

                foreach (ReadBookData data in me.ReadBookDataList.Values)
                {
                    BookData bookData = BookData.GetBookData(BookData.BookType.General, data.BookID);
                    if (bookData == null)
                    {
                        bookData = BookData.GetBookData(BookData.BookType.Toddler, data.BookID);
                        if (bookData == null)
                        {
                            BookWrittenData writtenData;
                            if (BookData.BookWrittenDataList.TryGetValue(data.BookID, out writtenData))
                            {
                                bookData = writtenData;
                            }

                            if (bookData == null)
                            {
                                continue;
                            }
                        }
                    }

                    lookup.Add(bookData, true);
                }

                CommonSelection <Item> .Results selection = new CommonSelection <Item>(Name, GetOptions(me, lookup)).SelectMultiple();
                if ((selection == null) || (selection.Count == 0))
                {
                    return(false);
                }

                CommonSelection <Item> .HandleAllOrNothing(selection);

                mChoices = selection;
            }

            foreach (Item choice in mChoices)
            {
                Perform(me, choice.mBook, !choice.IsSet);
            }

            return(true);
        }