public DaimonButtonBox(Daimon[] daimons, int daimonIndex, EPuzzleUserInfo userInfo) { if (null == userInfo) throw new ArgumentNullException("userInfo"); BorderLine = true; Daimons = daimons; DaimonIndex = daimonIndex; _userInfo = userInfo; var daimonButtons = Daimons.Select(x => { return new DaimonButton(x) { FukushuFlag = x.復習判定_2(userInfo), Floating = DrawingObjectFloating.Left, }; }); foreach (var daimonButton in daimonButtons) { Items.Add(daimonButton); } SetDaimonButtonValue(new SizeF(30, 30), 10f, 10f, 10f); }
public MondaiDocument GetMondaiDocument() { var mondaiDocument = new MondaiDocument(); var documentElement = GetElement("document"); mondaiDocument.Id = documentElement.GetElement("id").Value; mondaiDocument.Name = documentElement.GetElement("title").Value; var daimonItems = documentElement.GetElements("daimon").Select(daimonElement => { var daimon = new Daimon() { Id = daimonElement.GetElement("id").Value, Name = daimonElement.GetElement("title").Value, }; var chumonItems = daimonElement.Items.Where(xx => "chumon" == xx.Name).Select(chumonElement => { var chumon = new Chumon() { Id = chumonElement.GetElement("id").Value, Name = chumonElement.GetElement("title").Value, IsOptional = "true" == chumonElement.GetValue("optional"), IsShuffled = "true" == chumonElement.GetValue("shuffle"), }; // 入力ミスの検査 var optional = chumonElement.GetValue("optional"); var shuffle = chumonElement.GetValue("shuffle"); var flag = (null == optional || "true" == optional || "false" == optional) && (null == shuffle || "true" == shuffle || "false" == shuffle); if (!flag) throw new EmpException("optional, shuffleにはtrue, falseのみ指定できます"); chumon.HelpIds = chumonElement.GetValues("helpId").Where(x => !string.IsNullOrWhiteSpace(x)).ToArray(); var shomonItems = chumonElement.Items.Where(x => "shomon" == x.Name || "ankimon" == x.Name).Select ( shomonElement => { switch (shomonElement.Name) { case "shomon" : { return (EigoTestMondai)CreateShomon(shomonElement); } case "ankimon" : { return (EigoTestMondai)CreateAnkimon(shomonElement); } default : { throw new InvalidOperationException(); } } } ); chumon.Items = shomonItems.ToList(); // chumon.GetTimeLimit() = chumon.制限時間の計算(); return chumon; }).Cast<EigoTestMondai>(); daimon.Items = chumonItems.ToList(); return daimon; }).Cast<EigoTestMondai>(); mondaiDocument.Items = daimonItems.ToList(); return mondaiDocument; }
public virtual bool 復習判定_2(Daimon daimon, EPuzzleUserInfo userInfo) { return daimon.Items.OfType<Chumon>().Any(chumon => 復習判定_2(chumon, userInfo)); }
public DaimonButton(Daimon daimon) { Daimon = daimon; // BorderLine = true; }
public DaimonState(EPuzzleWindow window, Daimon daimon, int numberOfItemsToBeShown = 16) : base(window) { _helpWithScroll = new HelpWithScroll<Chumon>(numberOfItemsToBeShown); Daimon = daimon; DrawingObjectRoot.BackColor = EPuzzleColors.DaimonStateBackColor; PropertyChanged += (sender, e) => { if ("CurrentItem" != e.PropertyName) return; var chumonButton = CurrentItem as ChumonButton; if (null != chumonButton) { _kirokuBox.Chumon = chumonButton.Chumon; _kirokuInfoBox.Chumon = chumonButton.Chumon; } }; Action0 += (sender, e) => { var chumonButton = CurrentItem as ChumonButton; if (null != chumonButton) { Chumonを開始する(chumonButton.Chumon, this); return; } var daimonButton = CurrentItem as DaimonButton; if (null != daimonButton) { Window.State = FoFi(this, new DaimonState(Window, daimonButton.Daimon)); return; } var button = CurrentItem as EigoTestButtonItem; if (null != button) { switch (button.Name) { case "upButton" : { _helpWithScroll.ScrollUp(); return; } case "downButton" : { _helpWithScroll.ScrollDown(); return; } } var chumon = button.Tag as Chumon; if (null != chumon) { Chumonを開始する(chumon, this); return; } } }; ActionLeft += (sender, e) => { MoveToPreviousDaimon(); /* if (null == Daimon.PreviousItem) return; Window.State = FoFi(this, new DaimonState(Window, (Daimon)Daimon.PreviousItem)); */ }; ActionRight += (sender, e) => { MoveToNextDaimon(); /* if (null == Daimon.NextItem) return; Window.State = FoFi(this, new DaimonState(Window, (Daimon)Daimon.NextItem)); */ }; ActionUp += (sender, e) => { if (null == Daimon.Parent.PreviousItem) return; MoveTo((MondaiDocument)Daimon.Parent.PreviousItem); }; ActionDown += (sender, e) => { if (null == Daimon.Parent.NextItem) return; MoveTo((MondaiDocument)Daimon.Parent.NextItem); }; _helpWithScroll.UpdateScreen += (sender, e) => { UpdateItemsToBeDrawn(); }; UpdateItemsToBeDrawn(); }