示例#1
0
        public int Perform(int x, int y, int yStep, int fontSize, string title, string[] items, int selectIndex, bool ポーズボタンでメニュー終了 = false, bool noPound = false)
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            for (; ;)
            {
                // ★★★ キー押下は 1 マウス押下は -1 で判定する。

                if (this.MouseUsable)
                {
                    int musSelIdxY = DDMouse.Y - (y + yStep);
                    int musSelIdx  = musSelIdxY / yStep;

                    DDUtils.ToRange(ref musSelIdx, 0, items.Length - 1);

                    selectIndex = musSelIdx;

                    if (DDMouse.L.GetInput() == -1)
                    {
                        break;
                    }
                    if (DDMouse.R.GetInput() == -1)
                    {
                        selectIndex = items.Length - 1;
                        break;
                    }
                }

                if (ポーズボタンでメニュー終了 && DDInput.PAUSE.GetInput() == 1)
                {
                    selectIndex = items.Length - 1;
                    break;
                }

                bool chgsel = false;

                if (DDInput.A.GetInput() == 1)
                {
                    break;
                }
                if (DDInput.B.GetInput() == 1)
                {
                    if (selectIndex == items.Length - 1)
                    {
                        break;
                    }

                    selectIndex = items.Length - 1;
                    chgsel      = true;
                }
                if (noPound ? DDInput.DIR_8.GetInput() == 1 : DDInput.DIR_8.IsPound())
                {
                    selectIndex--;
                    chgsel = true;
                }
                if (noPound ? DDInput.DIR_2.GetInput() == 1 : DDInput.DIR_2.IsPound())
                {
                    selectIndex++;
                    chgsel = true;
                }

                selectIndex += items.Length;
                selectIndex %= items.Length;

                if (this.MouseUsable && chgsel)
                {
                    DDMouse.X = 0;
                    DDMouse.Y = y + (selectIndex + 1) * yStep + yStep / 2;

                    DDMouse.PosChanged();
                }

                this.WallDrawer();
                this.ResetPrint();

                // old
                //DDPrint.SetPrint(DDConsts.Screen_W - 45, 2);
                //DDPrint.Print("[M:" + (this.MouseUsable ? "E" : "D") + "]");

                DDPrint.SetPrint(x, y, yStep, fontSize);
                //DDPrint.SetPrint(16, 16, 32); // old
                DDPrint.PrintLine(title);

                for (int c = 0; c < items.Length; c++)
                {
                    DDPrint.PrintLine(string.Format("[{0}] {1}", selectIndex == c ? ">" : " ", items[c]));
                }
                DDPrint.Reset();

                DDEngine.EachFrame();
            }
            DDEngine.FreezeInput();

            return(selectIndex);
        }
示例#2
0
        public int Perform(string title, string[] items, int selectIndex)
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            for (; ;)
            {
                // ★★★ キー押下は 1 マウス押下は -1 で判定する。

                if (this.MouseUsable)
                {
                    int musSelIdxY = DDMouse.Y - (this.Y + this.YStep);
                    int musSelIdx  = musSelIdxY / this.YStep;

                    DDUtils.ToRange(ref musSelIdx, 0, items.Length - 1);

                    selectIndex = musSelIdx;

                    if (DDMouse.L.GetInput() == -1)
                    {
                        break;
                    }
                    if (DDMouse.R.GetInput() == -1)
                    {
                        selectIndex = items.Length - 1;
                        break;
                    }
                }

                bool chgsel = false;

                if (DDInput.A.GetInput() == 1)
                {
                    break;
                }
                if (DDInput.B.GetInput() == 1)
                {
                    if (selectIndex == items.Length - 1)
                    {
                        break;
                    }

                    selectIndex = items.Length - 1;
                    chgsel      = true;
                }
                if (DDInput.DIR_8.IsPound())
                {
                    selectIndex--;
                    chgsel = true;
                }
                if (DDInput.DIR_2.IsPound())
                {
                    selectIndex++;
                    chgsel = true;
                }

                selectIndex += items.Length;
                selectIndex %= items.Length;

                if (this.MouseUsable && chgsel)
                {
                    DDMouse.X = 0;
                    DDMouse.Y = this.Y + (selectIndex + 1) * this.YStep + this.YStep / 2;

                    DDMouse.PosChanged();
                }

                this.DrawWall();

                if (this.Color != null)
                {
                    DDPrint.SetColor(this.Color.Value);
                }

                if (this.BorderColor != null)
                {
                    DDPrint.SetBorder(this.BorderColor.Value);
                }

                DDPrint.SetPrint(DDConsts.Screen_W - 80, 4);
                DDPrint.Print("[M:" + (this.MouseUsable ? "E" : "D") + "]");

                DDPrint.SetPrint(this.X, this.Y, this.YStep);
                //DDPrint.SetPrint(16, 16, 32); // old
                DDPrint.PrintLine(title);

                for (int c = 0; c < items.Length; c++)
                {
                    DDPrint.PrintLine(string.Format("[{0}] {1}", selectIndex == c ? ">" : " ", items[c]));
                }
                DDPrint.Reset();

                DDEngine.EachFrame();
            }
            DDEngine.FreezeInput();

            return(selectIndex);
        }