public override void UpdateItemsToBeDrawn() { Items.Clear(); var rect = Window.ClientRectangle; var button_color = Color.FromArgb(0xff, 0x00, 0x00, 0x80); var helpTextBox = CreateHelpTextBox(); helpTextBox.Left = 840; helpTextBox.Top = 100; helpTextBox.Width = 150; helpTextBox.Height = 400; // helpTextBox.Left = 0; // helpTextBox.Top = 0; Items.Add(helpTextBox); var title_label = new EigoTestLabelItem() { MarginTop = 30f, MarginBottom = 30f, Color = button_color, BackColor = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde), BorderLine = true, Text = Daimon.Name, Height = 56f, }; title_label.Font = EPuzzleFonts.GetFont("Arial", (int)(title_label.Height / 2f)); title_label.MarginLeft = title_label.MarginRight = 300f; Items.Add(title_label); // 前の問題ドキュメントへ遷移するボタン var previousMondaiDocumentButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 800, Top = 10, Width = 40, Height = 40, Text = "↑", Name = "PreviousMondaiDocumentButton", IsVisible = Daimon.Parent.PreviousItem != null, IsClickable = Daimon.Parent.PreviousItem != null, HelpText = "前の問題ファイルに移動します。", }; previousMondaiDocumentButton.Click += (sender, e) => { if (e.Info.Button != MouseButtons.Left) return; OnActionUp(); }; Items.Add(previousMondaiDocumentButton); // 次の問題ドキュメントへ遷移するボタン var nextMondaiDocumentButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 850, Top = 10, Width = 40, Height = 40, Text = "↓", Name = "NextMondaiDocumentButton", IsVisible = Daimon.Parent.NextItem != null, IsClickable = Daimon.Parent.NextItem != null, HelpText = "次の問題ファイルに移動します。", }; nextMondaiDocumentButton.Click += (sender, e) => { if (e.Info.Button != MouseButtons.Left) return; OnActionDown(); }; Items.Add(nextMondaiDocumentButton); // 問題ドキュメントメニューへ遷移するボタン var mondaiDocumentMenuButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 900, Top = 10, Width = 40, Height = 40, Text = "=", Name = "MondaiMenuButton", HelpText = "問題ファイルの選択メニューに戻ります。", }; mondaiDocumentMenuButton.Click += (sender, e) => { MoveToMondaiDocumentMenuState(); }; Items.Add(mondaiDocumentMenuButton); // タイトルに戻るボタン _back_button = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 950, Top = 10, Width = 40, Height = 40, Text = "T", Name = "タイトル画面に戻る", HelpText = "タイトル画面に戻ります。", }; _back_button.Font = EPuzzleFonts.GetMsGothic((int)(_back_button.Height / 2f)); _back_button.Click += (sender, e) => { MoveToStartGameState(); }; Items.Add(_back_button); // 成績グラフ _kirokuBox = new KirokuBox2() { Position = DrawingObjectPosition.Absolute, Left = 10, Top = 100, Width = 180, Height = 180, UserInfo = Window.EPuzzleData.CurrentUserInfo, Chumon = (Chumon)Daimon.Items.First(), }; Items.Add(_kirokuBox); _kirokuInfoBox = new KirokuInfoBox() { Position = DrawingObjectPosition.Absolute, Left = 50, Top = 300, Width = 160, Height = 200, UserInfo = Window.EPuzzleData.CurrentUserInfo, Chumon = (Chumon)Daimon.Items.First(), }; Items.Add(_kirokuInfoBox); var chumonButtonHeight = 36; var chumonButtonWidth = 600; _helpWithScroll.Items = Daimon.Items.OfType<Chumon>().ToArray(); _chumonButtons = _helpWithScroll.GetItemsToBeShown().Select(x => { var mondaiResult = Window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(x.Id); var shoyou = null == mondaiResult ? TimeSpan.Zero : mondaiResult.所要時間; // var button = new ChumonButton(new MondaiJirushi(Window.EPuzzleData.CurrentUserInfo, x), Window.EPuzzleData.CurrentUserInfo) var button = new ChumonButton(Window.EPuzzleData.CurrentUserInfo, x) { Color = button_color, BackColor = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde), Height = chumonButtonHeight, Size = new SizeF(chumonButtonWidth, chumonButtonHeight), }; button.MarginLeft = button.MarginRight = (DrawingObjectRoot.Width - chumonButtonWidth) / 2f; button.Font = EPuzzleFonts.GetFont("Arial", (int)(button.Height / 2f)); return button; }).ToArray(); foreach (var chumonButton in _chumonButtons) { Items.Add(chumonButton); } // 発音問題ボタンを追加する /* if (Window.EPuzzleData.発音問題を有効にする) { var chumonCreator = new ChumonCreator(Window.EPuzzleData.PronunciationInfoContainer); foreach (var chumonButton in _chumonButtons) { var proChumon = chumonCreator.GetPronunciationChumon(chumonButton.Chumon); if (null == proChumon) continue; var button = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = chumonButton.BorderRight + 10, Top = chumonButton.BorderTop, Width = chumonButton.Height, Height = chumonButton.Height, Text = "P", Name = "pron-mondai", Tag = proChumon, BorderLine = true, }; Items.Add(button); } }*/ // 次のDaimonへ遷移するボタン var nextButtonSize = new SizeF(30, 45); if (null != Daimon.NextItem) { var nextDaimonButton = new NextButton() { Position = DrawingObjectPosition.Absolute, Color = button_color, BackColor = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde), Location = new PointF(Window.ClientRectangle.Width - nextButtonSize.Width - 10, Window.ClientRectangle.Height / 2 - nextButtonSize.Height / 2), Size = nextButtonSize, Name = "NextDaimon", }; nextDaimonButton.Click += (sender, e) => { if (e.Info.Button != MouseButtons.Left) return; MoveToNextDaimon(); // OnActionRight(); }; Items.Add(nextDaimonButton); } // 前のDaimonへ遷移するボタン if (null != Daimon.PreviousItem) { var previousButton = new PreviousButton() { Position = DrawingObjectPosition.Absolute, Color = button_color, BackColor = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde), Location = new PointF(10, Window.ClientRectangle.Height / 2 - nextButtonSize.Height / 2), Size = nextButtonSize, Name = "PreviousDaimon", }; previousButton.Click += (sender, e) => { if (e.Info.Button != MouseButtons.Left) return; MoveToPreviousDaimon(); // OnActionLeft(); }; Items.Add(previousButton); } if (_helpWithScroll.NeedToShowButtonToScrollUp) { var upButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 800, Top = 10, Width = 80, Height = 40, Text = "↑ " + _helpWithScroll.NumberOfUpperItems, Name = "upButton", IsVisible = true, IsClickable = true, }; Items.Add(upButton); upButton.水平方向に中央揃え(); } if (_helpWithScroll.NeedToShowButtonToScrollDown) { var downButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 800, Top = 718, Width = 80, Height = 40, Text = "↓ " + _helpWithScroll.NumberOfLowerItems, Name = "downButton", IsVisible = true, IsClickable = true, }; Items.Add(downButton); downButton.水平方向に中央揃え(); } { var label = CreateLabelToShowNumberOfQuestionsThatHaveBeenFinished(); label.Top -= 100f; Items.Add(label); } var daimons = Daimon.Parent.Items.OfType<Daimon>().ToArray(); var daimonIndex = daimons.GetIndexOf(x => object.ReferenceEquals(x, Daimon)); var daimonButtonBox = new DaimonButtonBox(daimons, daimonIndex, Window.EPuzzleData.CurrentUserInfo) { Position = DrawingObjectPosition.Absolute, MarginBottom = 30f, }; Items.Add(daimonButtonBox); daimonButtonBox.水平方向に中央揃え(); daimonButtonBox.下揃え(); LockButtons(); CurrentItemにロックされていない最後の問題を設定する(); }
public ChumonResultState(EPuzzleWindow window, EigoTestMondai mondai, ChumonResult chumonResult, MondaiResult mondaiResult) : base(window) { _mondai = mondai; _chumonResult = chumonResult; DrawingObjectRoot.BackColor = EPuzzleColors.Color109; // var imageFile = ResultImageManager.Instance.GetFile(_mondai.Parent.GetGradeString(mondaiResult.所要時間)); // var imageFile = ResultImageManager.Instance.GetImage(_mondai.Parent.GetGradeString(mondaiResult.所要時間)); var image = window.EPuzzleData.CurrentUserInfo.ResultImageManager.GetImage(_mondai.Parent.GetGradeString(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo)); if (null != image) { // var imageItem = new ImageItem(imageFile, true); var imageItem = new ImageItem(image.Shrink((int)DrawingObjectRoot.Width, (int)DrawingObjectRoot.Height)); imageItem.Left = 0f; imageItem.Top = 0f; imageItem.Position = DrawingObjectPosition.Absolute; Items.Add(imageItem); #if DEBUG { // 使用したファイルの記録 var imagePath = (string)image.Tag; Clipboard.SetText(imagePath); var path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "usedImages.txt"); File.AppendAllText(path, imagePath + Environment.NewLine); } #endif // DEBUG // ResultImageManager.Instance.UpdateAccessTime(fileName); // ResultImageManager.Instance.SaveFileIfItPassed(TimeSpan.FromMinutes(10d)); } var w1 = 180f; var h1 = EPuzzleFonts.ChumonResultState_Default.Height; var backColor = EPuzzleColors.Color107; var kirokuBox = new KirokuBox2() { BorderLine = false, Position = DrawingObjectPosition.Absolute, Width = 200, UserInfo = Window.EPuzzleData.CurrentUserInfo, Chumon = (Chumon)_mondai.Parent, Color = EPuzzleColors.ChumonResultState_KirokuBox2_Color, BackColor = EPuzzleColors.ChumonResultState_KirokuBox2_BackColor, BackColorA = EPuzzleColors.ChumonResultState_KirokuBox2_BackColorA, BackColorB = EPuzzleColors.ChumonResultState_KirokuBox2_BackColorB, LineColor = EPuzzleColors.ChumonResultState_KirokuBox2_LineColor, NodeColor = EPuzzleColors.ChumonResultState_KirokuBox2_NodeColor, }; Items.Add(kirokuBox); var box = new DrawingObjectContainer() { Position = DrawingObjectPosition.Absolute, Color = EPuzzleColors.Color108, BackColor = backColor, Width = w1, PaddingLeft = 10f, PaddingRight = 10f, PaddingTop = 10f, PaddingBottom = 10f, BorderLine = false, }; Items.Add(box); { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = mondai.Parent.LongName, Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("グレード: {0}({1:0.00})", mondai.Parent.GetGradeString(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo), mondai.Parent.GetGrade(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo)), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } { var duration = mondai.Parent.復習までの猶予期間を取得(window.EPuzzleData.CurrentUserInfo); if (null != duration) { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("復習猶予期間: {0:0.0}日", ((TimeSpan)duration).TotalDays), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } } { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("基準時間: {0}", EigoTestMondai.符号無時間文字列(_mondai.Parent.GetTimeLimit(window.EPuzzleData.CurrentUserInfo))), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("所要時間: {0}", EigoTestMondai.符号無時間文字列(mondaiResult.所要時間)), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("基準との差: {0}", EigoTestMondai.符号付時間文字列(mondaiResult.所要時間 - _mondai.Parent.GetTimeLimit(window.EPuzzleData.CurrentUserInfo))), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } /* { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("Perfect: {0}", string.Join("", chumonResult.ShomonResults.Select(x => x.IsPerfect ? "■" : "□").ToArray())), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); }*/ { var height = 25f; var stars = chumonResult.ShomonResults.Select(x => { var star = new Pentagram(2) { Color = EPuzzleColors.PerfectStarOnChumonResultState, Width = height, Height = height, Tag = x.IsPerfect, PaddingLeft = 3f, PaddingBottom = 3f, }; return star; }).ToArray(); /* for (int i = 0; i < stars.Length; i++) { stars[i].Left = stars[0].OuterWidth * i; stars[i].Top = DrawingObjectRoot.Height - stars[0].OuterHeight; } */ for (int i = 0; i < stars.Length; i++) { stars[i].Left = stars[0].OuterWidth * i; stars[i].Top = 0f; } if (stars.Any()) { var starbox = new DrawingObjectContainer() { Position = DrawingObjectPosition.Absolute, Left = 0f, Top = DrawingObjectRoot.Height - stars.First().OuterHeight, Width = stars.Last().OuterRight - stars.First().OuterLeft, Height = stars.First().OuterHeight, // BackColor = EPuzzleColors.Color107, }; starbox.Items.AddRange(stars); Items.Add(starbox); } // Items.AddRange(stars); } /* { var bestMondaiResult = window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(mondai.Parent.Id); if (null != bestMondaiResult) { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("最速記録: {0}", EigoTestMondai.符号無時間文字列(bestMondaiResult.所要時間)), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } } { var bestMondaiResult = window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(mondai.Parent.Id); if (null != bestMondaiResult) { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("最速との差: {0}", EigoTestMondai.符号付時間文字列(mondaiResult.所要時間 - bestMondaiResult.所要時間)), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } }*/ /* var retryButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Color = EPuzzleColors.Color108, Text = "再挑戦", Name = "retryButton", Font = EPuzzleFonts.ChumonResultState_Default, Width = 80, Height = h1, }; Items.Add(retryButton);*/ /* // 右がbox box.Left = DrawingObjectRoot.Width - ( box.OuterWidth + kirokuBox.OuterWidth ); box.Top = DrawingObjectRoot.Height - box.OuterHeight; kirokuBox.Height = box.OuterHeight; kirokuBox.Left = DrawingObjectRoot.Width - kirokuBox.OuterWidth; kirokuBox.Top = box.Top; */ box.Left = DrawingObjectRoot.Width - box.OuterWidth; box.Top = DrawingObjectRoot.Height - box.OuterHeight; kirokuBox.Height = box.OuterHeight; kirokuBox.Left = box.OuterLeft - kirokuBox.OuterWidth; kirokuBox.Top = box.Top; Action0 += (sender, e) => { MouseUpInternal(new MouseEventInfo(new PointF(0f, 0f), MouseButtons.Left)); }; }
public TutorState(EPuzzleWindow window, EPuzzleTutor tutor) : base(window) { Trace.WriteLine(_sortType); _tutor = tutor; _kirokuBox = new KirokuBox2() { Position = DrawingObjectPosition.Absolute, Left = 10, Top = 60, Width = 280, Height = 200, UserInfo = Window.EPuzzleData.CurrentUserInfo, }; Action0 += (sender, e) => { var chumonButton = CurrentItem as ChumonButton; if (null != chumonButton) { Chumonを開始する(chumonButton.Chumon, this); return; } var button = CurrentItem as EigoTestButtonItem; if (null != button) { switch (button.Name) { case "upButton" : _helpWithScroll.ScrollUp(); return; case "downButton" : _helpWithScroll.ScrollDown(); return; /* case "orderByGradeStringsButton" : OrderByGradeStrings = !OrderByGradeStrings; Refresh(); return;*/ case "mottoyaruButton" : もっとやる係数++; Refresh(); return; case "backToStartGameStateButton" : MoveToStartGameState(); return; case "byGracePriodButton" : { _sortType = TutorStateSortType.GracePriod; Refresh(); return; } case "byDateYouDidThemButton" : { _sortType = TutorStateSortType.DateYouDidThem; Refresh(); return; } case "byGradeButton" : { _sortType = TutorStateSortType.Grade; Refresh(); return; } default: return; } } }; ActionUp += (sender, e) => { _helpWithScroll.ScrollUp(); }; ActionDown += (sender, e) => { _helpWithScroll.ScrollDown(); }; PropertyChanged += (sender, e) => { if ("CurrentItem" != e.PropertyName) return; var chumonButton = CurrentItem as ChumonButton; _kirokuBox.Chumon = null == chumonButton ? null : chumonButton.Chumon; }; EventHandler updateScreen = (sender, e) => { Refresh(); }; _dateYouDidThemScrollHelper.UpdateScreen += updateScreen; _gracePriodScrollHelper.UpdateScreen += updateScreen; _gradeScrollHelper.UpdateScreen += updateScreen; Refresh(); }