コード例 #1
0
        public AnkimonState(EPuzzleWindow window, Ankimon ankimon)
            : base(window)
        {
            Ankimon = ankimon;
            _shomonStateHelper = new ShomonStateHelper(this);
            _ankimonBox = new AnkimonBox()
            {
                MarginLeft = 100f, MarginTop = 100f, MarginRight = 100f,
            };
            Items.Add(_ankimonBox);

            foreach (var container in ankimon.AnkimonItems.Select(ankimonItem =>
                {
                    var ankimonRowContainer = new AnkimonRowContainer()
                    {
                        MarginLeft = 10f, MarginTop = 0f,
                        AnkimonItem = ankimonItem,
                    };
                    ankimonRowContainer.Label.Text = ankimonItem.Name;
                    var collection = ankimonRowContainer.WordCardContainer.Items;
                    foreach (var word in ankimonItem.MondaiWords)
                    {
                        collection.Add(new WordCard(word));
                    }
                    ((DrawingObjectContainer.DrawingObjectCollection)collection).CollectionChanged += Handler0;
                    return ankimonRowContainer;
                }))
            {
                _ankimonBox.Items.Add(container);
            }
            int i = 0;
            do
            {
                Shuffle();
                if (i++ > 100)
                {
                    throw new ApplicationException("指定された回数を超えても問題がシャッフルできません: " + Ankimon.Id);
                }

            } while (正解判定());

            Action0 += (sender, e) =>
            {
                _subState.Action0((WindowState)sender);
            };
            Action1 += (sender, e) =>
            {
                _subState.Action1((WindowState)sender);
            };
            Action3 += (sender, e) =>
            {
                Window.State = new PauseState(Window, this);
            };
            CurrentItem = GetAllItems().First(x => x is WordCard);
        }
コード例 #2
0
 public static EmpElement Create(Ankimon ankimon)
 {
     var ankimonElement = new EmpElement("ankimon");
     ankimonElement.Items.Add(new EmpElement("id", ankimon.Id));
     ankimonElement.Items.AddRange(ankimon.AnkimonItems.Select(ankimonItem =>
     {
         var ankimonItemElement = new EmpElement("item");
         ankimonItemElement.Items.Add(new EmpElement("name", ankimonItem.Name));
         ankimonItemElement.Items.Add(new EmpElement("split", MondaiWord.相互変換可能なテキスト形式を取得する(ankimonItem.MondaiWords)));
     //				ankimonItemElement.Items.AddRange(ankimonItem.MondaiWords.Select(mondaiWord => new EmpElement("word", mondaiWord.Text)));
         return ankimonItemElement;
     }));
     return ankimonElement;
 }
コード例 #3
0
 protected abstract TimeSpan GetTimeLimit(Ankimon ankimon);
コード例 #4
0
 protected override TimeSpan GetTimeLimit(Ankimon ankimon)
 {
     int a = ankimon.AnkimonItems.Select(ankimonItem => ankimonItem.MondaiWords.Count()).Sum();
     return TimeSpan.FromSeconds((a - 1) * 2);
 }