public ClickDeKaishiState(EPuzzleWindow window, WindowState previousState, WindowState nextState, string text)
            : base(window)
        {
            if (null == nextState) throw new ArgumentNullException();
            if (null == previousState) throw new ArgumentNullException();

            PreviousStates.Add(previousState);
            NextStates.Add(nextState);
            var label = new EigoTestLabelItem()
            {
                Color = Color.Gray,
            //				Text = "クリックまたは打鍵で開始します",
                Text = text,
                Location = new Point(0, 0),
                Size = new SizeF(DrawingObjectRoot.Width, DrawingObjectRoot.Height),
                Font = EPuzzleFonts.クリックで開始します,
            };
            Items.Add(label);

            Action0 += (sender, e) =>
            {
                Window.State = NextState;
                Window.ChumonResult = new ChumonResult(window.EPuzzleData.CurrentUserInfo);
            };
            Action3 += (sender, e) =>
            {
                Window.State = PreviousState;
            };
        }
 public FadeoutState(EPuzzleWindow window, int milliseconds, WindowState previousState, WindowState nextState, Color color)
     : base(window)
 {
     if (null == previousState) throw new ArgumentNullException("previousState");
     if (null == nextState) throw new ArgumentNullException("nextState");
     PreviousState = previousState;
     NextState = nextState;
     _milliseconds = milliseconds;
     _color0 = color;
 }
        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 void QuitGame(WindowState sender)
 {
     if (!object.ReferenceEquals(State, sender))
     {
         throw new InvalidOperationException();
     }
     if (null != Quit)
     {
         Quit(this, EventArgs.Empty);
     }
 }
        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) =>
            {
                ゲームに戻る();
            };
        }
 public virtual void MouseUp(WindowState eigoTestState, IMouseEventInfo mouseEventInfo)
 {
 }
 public virtual void Action1(WindowState state)
 {
 }
 public void SetState(WindowState state)
 {
     _state = state;
 }
            public override void Action0(WindowState state)
            {
                if (null == state.CurrentItem) return;
                var wordCard = state.CurrentItem as WordCard;
                if (null == wordCard) return;
                var ankimonState = (AnkimonState)state;
                var item = ankimonState.GetSelectedItem();
                if (item.Text == wordCard.Text) return;

                item.IsSelected = false;

                ankimonState.場所の入れ換え(wordCard, item, TimeSpan.FromMilliseconds(200d));
                ankimonState._subState = new SentakuNashiState();
                state.Invalidate();
            }
 public static WindowState FoFi(WindowState state1, WindowState state2, int milliseconds = EPuzzleConstants.画面切替時間)
 {
     return FoFi(state1, state2, Color.Black, milliseconds);
 }
 public static WindowState Fi(WindowState state, int milliseconds = EPuzzleConstants.画面切替時間)
 {
     if (null == state) throw new ArgumentNullException("state1");
     var fadeinState = new FadeinState(state.Window, milliseconds, state, Color.Black);
     return fadeinState;
 }
        public static void Chumonを開始する(Chumon chumon, WindowState parent)
        {
            var window = parent.Window;
            window.WindowStateWhichHasStartedChumon = parent;
            if (chumon.IsShuffled)
            {
                chumon.Shuffle();
            }
            //			var chumonState = WindowState.Create(window, chumon.Items[0]);
            var chumonState = window.CreateMondaiState(chumon.Items[0]);

            Fish.Test.TestUtility.Set("nextShomonState", chumonState);

            var clickDeKaishi = new ClickDeKaishiState(window, parent, chumonState, chumon.Name);
            var helpItems = window.EPuzzleData.HelpDocumentSet.GetItems(chumon.HelpIds).
                Concat(new [] { window.EPuzzleData.HelpDocumentSet.GetItemAndNotThrowTheException(chumon.Id) }).Where(x => null != x).ToArray();

            if (helpItems.Any() && !window.EPuzzleData.CurrentUserInfo.MondaiResults.HasItem(chumon.Id))
            {
                window.State = WindowState.FoFi(parent, new HelpItemState(window, helpItems, 0, clickDeKaishi));
            }
            else
            {
                window.State = clickDeKaishi;
            }
        }
 public override void Action1(WindowState state)
 {
     // 無視
 }
 public override void Action0(WindowState state)
 {
     if (null == state.CurrentItem) return;
     var wordCard = state.CurrentItem as WordCard;
     if (null == wordCard) return;
     wordCard.IsSelected = true;
     ((AnkimonState)state)._subState = new SentakuAriState();
     state.Invalidate();
 }
 public override void Action1(WindowState state)
 {
     var ankimonState = (AnkimonState)state;
     ankimonState.GetSelectedItem().IsSelected = false;
     ankimonState._subState = new SentakuNashiState();
     state.Invalidate();
 }
 public void Func(WindowState parent)
 {
     IsVisible = null != parent.CurrentItem && !string.IsNullOrWhiteSpace(parent.CurrentItem.HelpText);
 }
        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 static WindowState FoFi(WindowState state1, WindowState state2, Color color, int milliseconds)
 {
     if (null == state1) throw new ArgumentNullException("state1");
     if (null == state2) throw new ArgumentNullException("state2");
     var fadeinState = new FadeinState(state1.Window, milliseconds / 2, state2, color);
     var fadeoutState = new FadeoutState(state1.Window, milliseconds / 2, state1, fadeinState, color);
     return fadeoutState;
 }