public InformationState(EPuzzleWindow window, WindowState parentState, string text) : base(window) { _parentState = parentState; var container = new DrawingObjectContainer() { Position = DrawingObjectPosition.Absolute, Width = DrawingObjectRoot.Width / 2f, Height = DrawingObjectRoot.Height / 2f, // BackColor = }; Items.Add(container); _textLabel = new EigoTestLabelItem() { Text = text, // Width = container.Width, Height = container.Height * 0.8f, BackColor = EPuzzleColors.ColorAlpha01, }; container.Items.Add(_textLabel); var okButton = new EigoTestButtonItem() { Text = "OK", Name = "ok", // Width = 100, Height = 60, }; container.Items.Add(okButton); container.水平方向に中央揃え(); container.垂直方向に中央揃え(); Action0 += (sender, e) => { if (null == CurrentItem) return; if ("ok" == CurrentItem.Name) { Window.State = parentState; } }; }
public HelpItemState(EPuzzleWindow window, HelpItemBase[] helpItems, int helpItemIndex, WindowState parentState) : base(window) { _helpItems = helpItems; _helpItemIndex = helpItemIndex; _parentState = parentState; var helpItemButtons = helpItems.Select(helpItem => { var helpItemButton = new EigoTestButtonItem("", 20f, 18f) { Position = DrawingObjectPosition.Absolute, MarginRight = 10f, MarginBottom = 10f, Tag = helpItem, }; return helpItemButton; }); var helpItemButtonContainer = new DrawingObjectContainer() { Position = DrawingObjectPosition.Absolute, MarginLeft = 50f, Height = 40f, }; helpItemButtonContainer.Items.AddRange(helpItemButtons); helpItemButtonContainer.Items[helpItemIndex].IsClickable = false; Items.Add(helpItemButtonContainer); for (int i = 1; i < helpItemButtonContainer.Items.Count(); i++) { var s = helpItemButtonContainer.Items[i - 1]; var t = helpItemButtonContainer.Items[i]; t.Left = s.Left + s.OuterWidth; } helpItemButtonContainer.下揃え(); var modoruButton = new EigoTestButtonItem("続ける", 80f, 50f) { Position = DrawingObjectPosition.Absolute, Name = "tsudukeru", MarginRight = 50f, MarginBottom = 10f, }; Items.Add(modoruButton); modoruButton.右揃え(); modoruButton.下揃え(); if (0 < helpItemIndex) { var previousButton = new PreviousButton() { Position = DrawingObjectPosition.Absolute, MarginLeft = 10f, Tag = helpItemIndex - 1, }; Items.Add(previousButton); previousButton.垂直方向に中央揃え(); } if (helpItemIndex < helpItemButtonContainer.Items.Count() - 1) { var nextButton = new NextButton() { Position = DrawingObjectPosition.Absolute, MarginRight = 10f, Tag = helpItemIndex + 1, }; Items.Add(nextButton); nextButton.垂直方向に中央揃え(); nextButton.右揃え(); } if (!string.IsNullOrWhiteSpace(_helpItems[helpItemIndex].ImageFile)) { var imageFile = Path.Combine(window.EPuzzleData.HelpDirectory, _helpItems[helpItemIndex].ImageFile); var imageItem = new ImageItem(imageFile) { Position = DrawingObjectPosition.Absolute, MarginTop = 20f, }; Items.Add(imageItem); imageItem.水平方向に中央揃え(); } Action0 += (sender, e) => { if (CurrentItem is NextButton) { MoveTo((int)CurrentItem.Tag); } else if (CurrentItem is PreviousButton) { MoveTo((int)CurrentItem.Tag); } else if (CurrentItem.Tag is HelpItem) { var index = Array.IndexOf(helpItems, CurrentItem.Tag); MoveTo(index); } else if ("tsudukeru" == CurrentItem.Name) { Window.State = parentState; } }; Action3 += (sender, e) => { Window.State = parentState; }; }
public PauseState(EPuzzleWindow window, WindowState previousState) : base(window) { if (null == previousState) throw new ArgumentNullException(); PreviousState = previousState; var gameButton = new EigoTestButtonItem() { Text = "ゲームに戻る", }; gameButton.Click += (sender, e) => { ゲームに戻る(); }; var menuButton = new EigoTestButtonItem() { Text = "メニューに戻る", }; menuButton.Click += (sender, e) => { BackToChumonMenu(); }; var titleButton = new EigoTestButtonItem() { Text = "タイトルに戻る", }; titleButton.Click += (sender, e) => { MoveToStartGameState(); }; var desktopButton = new EigoTestButtonItem() { Text = "ディスクトップに戻る", }; desktopButton.Click += (sender, e) => { Window.QuitGame(this); }; float y = 0f; foreach (var button in new [] { gameButton, menuButton, titleButton, desktopButton }) { button.Top = y; button.Height = 50f; button.MarginBottom = 20f; // button.PaddingTop = button.PaddingBottom = 10f; button.Color = Color.White; button.BackColor = Color.FromArgb(255, 80, 80, 80); button.BorderLine = true; button.Font = EPuzzleFonts.PauseStateButton; y += button.OuterHeight; } var container = new DrawingObjectContainer() { MarginLeft = 300, MarginRight = 300, }; container.MarginTop = (DrawingObjectRoot.Height - y) / 2; container.Items.Add(gameButton); container.Items.Add(menuButton); container.Items.Add(titleButton); container.Items.Add(desktopButton); Items.Add(container); Action1 += (sender, e) => { ゲームに戻る(); }; Action3 += (sender, e) => { ゲームに戻る(); }; }
// Static members public static EigoTestButtonItem CreateButton(string text, string name, Font font) { var button = new EigoTestButtonItem() { Floating = DrawingObjectFloating.Left, Text = text, Name = name, Font = font, Size = EigoTestDrawingObject.MeasureString(text, font), Color = EPuzzleColors.Color01, BackColor = EPuzzleColors.Color02, BorderLine = true, PaddingLeft = 10f, PaddingRight = 10f, }; return button; }
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 StartGameState(EPuzzleWindow window, string[] mondaiDocumentIdsWhichAreUsedInTutorState) : base(window) { if (null == mondaiDocumentIdsWhichAreUsedInTutorState) throw new ArgumentNullException(); var button_color = Color.FromArgb(0xff, 0x00, 0x00, 0x80); var button_background_color = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde); var button_size = new SizeF(260, 45); var button_left = (DrawingObjectRoot.Width - button_size.Width) / 2; var button_top = button_size.Height + 200; var title_label = new EigoTestLabelItem() { MarginTop = 100, MarginBottom = 80, Color = button_color, // Text = "英 文 復 習 ゲ ー ム", Text = Application.ProductName, Height = 72f, }; title_label.Font = EPuzzleFonts.GetMsGothic((int)(title_label.Height / 2f)); Items.Add(title_label); // 問題ファイルを選ぶ _start_game_button = new EigoTestButtonItem() { MarginTop = button_size.Height / 3f, MarginLeft = button_left, Name = "StartGameButton", Text = "問題を選択する", Color = button_color, BackColor = button_background_color, Size = button_size, HelpText = "プレイする問題ファイルを選択します。", }; _start_game_button.Click += (sender, e) => { if (e.Info.Button != MouseButtons.Left) return; MoveToMondaiDocumentMenuState(); }; /* _switch_profile_button = new EigoTestButtonItem() { MarginTop = button_size.Height / 3f, MarginLeft = button_left, Text = "Switch Profile", Color = button_color, BackColor = button_background_color, Size = button_size, };*/ _quit_button = new EigoTestButtonItem() { MarginTop = button_size.Height / 3f, MarginLeft = button_left, Text = "終了する", Color = button_color, BackColor = button_background_color, Size = button_size, HelpText = "ゲームを終了してWindowsに戻ります。", }; _quit_button.Click += (sender, e) => { if (e.Info.Button != MouseButtons.Left) return; Window.QuitGame(this); }; Items.Add(_start_game_button); var daimon = window.EPuzzleData.GetLastDaimon(); if (null != daimon) { var continueButton = new EigoTestButtonItem() { MarginTop = button_size.Height / 3f, MarginLeft = button_left, Text = "前回の続きから", Name = "tsudukiKara", Color = button_color, BackColor = button_background_color, Size = button_size, HelpText = "最後にプレイしていた問題から再開します。", }; Items.Add(continueButton); } if (mondaiDocumentIdsWhichAreUsedInTutorState.Any()) { var tutorButton = new EigoTestButtonItem() { MarginTop = button_size.Height / 3f, MarginLeft = button_left, Text = "復習する", Name = "tutorButton", Color = button_color, BackColor = button_background_color, Size = button_size, HelpText = "復習が必要な問題を提案します。", }; Items.Add(tutorButton); } // Items.Add(_switch_profile_button); Items.Add(_quit_button); DrawingObjectRoot.BackColor = EPuzzleColors.Color00; Items.Add(CreateHelpTextBox()); Action0 += (sender, e) => { switch (CurrentItem.Name) { case "tsudukiKara" : { if (null == daimon) throw new ApplicationException(); Window.State = WindowState.FoFi(this, new DaimonState(Window, daimon)); break; } case "tutorButton" : { Window.State = WindowState.FoFi(this, Window.GetTutorState(mondaiDocumentIdsWhichAreUsedInTutorState)); // Window.State = WindowState.FoFi(this, new TutorState(Window, mondaiDocumentIdsWhichAreUsedInTutorState)); break; } default : break; } }; }
public override void UpdateItemsToBeDrawn() { _tutor.もっとやる係数を適正値に修正(); var currentItemInfo = SaveCurrentItem(); Items.Clear(); CurrentItem = null; var userInfo = Window.EPuzzleData.CurrentUserInfo; var chumonButtonBox = new DrawingObjectContainer() { Position = DrawingObjectPosition.Absolute, Left = 300, Top = 60, }; Items.Add(chumonButtonBox); var buttonColor = Color.FromArgb(0xff, 0x00, 0x00, 0x80); var buttonBackColor = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde); var chumonButtonHeight = 36; var chumonButtonWidth = 714; _helpWithScroll = GetScrollHelper(_sortType); _helpWithScroll.Items = GetChumons(_tutor, _sortType); foreach (var chumon in _helpWithScroll.GetItemsToBeShown()) { var chumonButton = new ChumonButton(userInfo, chumon, true) { Color = buttonColor, BackColor = buttonBackColor, Width = chumonButtonWidth, Height = chumonButtonHeight, }; chumonButtonBox.Items.Add(chumonButton); } if (_helpWithScroll.NeedToShowButtonToScrollUp) { var upButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = DrawingObjectRoot.Width - (80 + 10), Top = 15, 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 = DrawingObjectRoot.Width - (80 + 10), Top = DrawingObjectRoot.Height - (40 + 10), Width = 80, Height = 40, Text = "↓ " + _helpWithScroll.NumberOfLowerItems, Name = "downButton", IsVisible = true, IsClickable = true, }; Items.Add(downButton); // downButton.水平方向に中央揃え(); } var xxx = !chumonButtonBox.Items.Any(); var mottoyaruButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 10, Top = 500, Width = 160, Height = 40, Text = string.Format("もっとやる ({0}回目)", もっとやる係数), Name = "mottoyaruButton", IsVisible = xxx, IsClickable = xxx, }; Items.Add(mottoyaruButton); /* var orderByGradeStringsButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 854, Top = 10, Width = 160, Height = 40, Name = "orderByGradeStringsButton", Text = OrderByGradeStrings ? "最新の成績順" : "復習猶予期間順", IsVisible = true, IsClickable = true, }; Items.Add(orderByGradeStringsButton);*/ var byGracePriodButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 300, Top = 15, Width = 160, Height = 40, Name = "byGracePriodButton", Text = "猶予順", IsVisible = true, IsClickable = TutorStateSortType.GracePriod != _sortType, ChangeColorWhenUnclickable = true, }; Items.Add(byGracePriodButton); var byDateYouDidThemButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 465, Top = 15, Width = 160, Height = 40, Name = "byDateYouDidThemButton", Text = "試験順", IsVisible = true, IsClickable = TutorStateSortType.DateYouDidThem != _sortType, ChangeColorWhenUnclickable = true, }; Items.Add(byDateYouDidThemButton); var byGradeButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 630, Top = 15, Width = 160, Height = 40, Name = "byGradeButton", Text = "成績順", IsVisible = true, IsClickable = TutorStateSortType.Grade != _sortType, ChangeColorWhenUnclickable = true, }; Items.Add(byGradeButton); var backToStartGameStateButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Left = 10, Top = 10, Width = 160, Height = 40, Name = "backToStartGameStateButton", Text = "タイトルに戻る", IsVisible = true, IsClickable = true, }; Items.Add(backToStartGameStateButton); Items.Add(CreateLabelToShowNumberOfQuestionsThatHaveBeenFinished()); Items.Add(_kirokuBox); RestoreCurrentItem(currentItemInfo); if (null == CurrentItem) { CurrentItem = GetAllItems().OfType<ChumonButton>().FirstOrDefault(); } }