Ejemplo n.º 1
0
                public void マウスカーソルをここへ移動()
                {
                    const double MOUSE_XY_MGN = 3.0;

                    DDMouse.X = (int)(ITEM_X + ITEM_W / 2 - MOUSE_XY_MGN);
                    DDMouse.Y = (int)(ITEM_Y + ITEM_H / 2 - MOUSE_XY_MGN + this.SelfIndex * ITEM_Y_STEP);

                    DDMouse.PosChanged();
                }
Ejemplo n.º 2
0
        public override IEnumerable <bool> E_Draw()
        {
            Game.I.SkipMode = false;

            for (; ;)
            {
                //Game.I.CancelSkipAutoMode();

                if (
                    this.Options.Count < GameConsts.SELECT_OPTION_MIN ||
                    this.Options.Count > GameConsts.SELECT_OPTION_MAX
                    )
                {
                    throw new DDError("選択肢の個数に問題があります。");
                }

                // ---- 入力ここから

                if (!Game.I.BacklogMode)
                {
                    int moving = 0;

                    if (DDInput.DIR_8.IsPound())
                    {
                        moving = -1;
                    }

                    if (DDInput.DIR_2.IsPound())
                    {
                        moving = 1;
                    }

                    if (moving != 0)
                    {
                        int optIndex = this.GetMouseFocusedIndex();

                        if (optIndex == -1)
                        {
                            optIndex = 0;
                        }
                        else
                        {
                            optIndex += this.Options.Count + moving;
                            optIndex %= this.Options.Count;
                        }

                        DDMouse.X =
                            GameConsts.SELECT_FRAME_L +
                            Ground.I.Picture.MessageFrame_Button2.Get_W() * 2 -
                            10;
                        DDMouse.Y =
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * optIndex +
                            Ground.I.Picture.MessageFrame_Button2.Get_H() * 2 -
                            10;

                        DDMouse.PosChanged();
                    }
                }

                // ---- ここから描画

                if (!Hide)
                {
                    for (int index = 0; index < GameConsts.SELECT_FRAME_NUM; index++)
                    {
                        DDPicture picture = Ground.I.Picture.MessageFrame_Button;

                        if (index < this.Options.Count)
                        {
                            picture = Ground.I.Picture.MessageFrame_Button2;

                            if (this.Options[index].MouseFocused)
                            {
                                picture = Ground.I.Picture.MessageFrame_Button3;
                            }
                        }

                        DDDraw.DrawBeginRect(
                            picture,
                            GameConsts.SELECT_FRAME_L,
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * index,
                            picture.Get_W() * 2.0,
                            picture.Get_H() * 2.0
                            );
                        DDCrash drawedCrash = DDDraw.DrawGetCrash();
                        DDDraw.DrawEnd();

                        // フォーカスしている選択項目を再設定
                        {
                            if (index < this.Options.Count)
                            {
                                bool mouseIn = drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y)));

                                this.Options[index].MouseFocused = mouseIn;
                            }
                        }
                    }
                    for (int index = 0; index < this.Options.Count; index++)
                    {
                        const int title_x = 160;
                        const int title_y = 56;

                        DDFontUtils.DrawString(
                            GameConsts.SELECT_FRAME_L + title_x,
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * index + title_y,
                            this.Options[index].Title,
                            DDFontUtils.GetFont("Kゴシック", 32),
                            false,
                            new I3Color(110, 100, 90)
                            );
                    }
                }

                // 隠しているなら選択出来ない。
                if (Hide)
                {
                    foreach (OptionInfo option in this.Options)
                    {
                        option.MouseFocused = false;
                    }
                }

                yield return(true);
            }
        }