예제 #1
0
        /// <summary>
        /// システムメニュー画面
        /// </summary>
        private void SystemMenu()
        {
            DDMain.KeepMainScreen();
            SCommon.Swap(ref DDGround.KeptMainScreen, ref SystemMenu_KeptMainScreen);

            this.SystemMenu_ReturnToTitleMenu = false;             // reset

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                BorderColor = new I3Color(0, 64, 0),
                WallDrawer  = () =>
                {
                    DDDraw.DrawSimple(SystemMenu_KeptMainScreen.ToPicture(), 0, 0);

                    DDDraw.SetAlpha(0.5);
                    DDDraw.SetBright(0, 0, 0);
                    DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, DDConsts.Screen_H / 4, DDConsts.Screen_W, DDConsts.Screen_H / 2);
                    DDDraw.Reset();
                },
            };

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = simpleMenu.Perform(
                    100,
                    180,
                    50,
                    24,
                    "システムメニュー",
                    new string[]
                {
                    "設定",
                    "タイトルに戻る",
                    "ゲームに戻る",
                },
                    selectIndex
                    );

                switch (selectIndex)
                {
                case 0:
                    using (new SettingMenu()
                    {
                        SimpleMenu = new DDSimpleMenu()
                        {
                            BorderColor = new I3Color(0, 64, 0),
                            WallDrawer = () =>
                            {
                                DDDraw.DrawSimple(SystemMenu_KeptMainScreen.ToPicture(), 0, 0);
                                DDCurtain.DrawCurtain(-0.5);
                            },
                        },
                    })
                    {
                        SettingMenu.I.Perform();
                    }
                    break;

                case 1:
                    if (new Confirm().Perform("タイトル画面に戻ります。", "はい", "いいえ") == 0)
                    {
                        this.SystemMenu_ReturnToTitleMenu = true;
                        goto endLoop;
                    }
                    break;

                case 2:
                    goto endLoop;

                default:
                    throw null;                             // never
                }
                //DDEngine.EachFrame(); // 不要
            }
endLoop:
            DDEngine.FreezeInput(NovelConsts.LONG_INPUT_SLEEP);
        }
예제 #2
0
        public static void SaveGame(GameStatus gameStatus)
        {
            SaveGame_幕間();

            DDEngine.FreezeInput();

            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                BorderColor = new I3Color(0, 128, 0),
                WallDrawer  = () =>
                {
                    DDDraw.SetBright(new I3Color(128, 64, 0));
                    DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
                    DDDraw.Reset();
                },
            };

            int selectIndex = 0;

            for (; ;)
            {
                // セーブしたら戻ってくるので、毎回更新する。
                string[] items = Ground.I.SaveDataSlots.Select(v => v.GameStatus == null ?
                                                               "----" :
                                                               "[" + v.TimeStamp + "] " + v.Description).Concat(new string[] { "戻る" }).ToArray();

                selectIndex = simpleMenu.Perform(18, 18, 32, 24, "セーブ", items, selectIndex);

                if (selectIndex < Consts.SAVE_DATA_SLOT_NUM)
                {
                    if (new Confirm()
                    {
                        BorderColor =
                            Ground.I.SaveDataSlots[selectIndex].GameStatus != null ?
                            new I3Color(200, 0, 0) :
                            new I3Color(100, 100, 0)
                    }
                        .Perform(
                            Ground.I.SaveDataSlots[selectIndex].GameStatus != null ?
                            "スロット " + (selectIndex + 1) + " のデータを上書きします。" :
                            "スロット " + (selectIndex + 1) + " にセーブします。", "はい", "いいえ") == 0)
                    {
                        Ground.P_SaveDataSlot saveDataSlot = Ground.I.SaveDataSlots[selectIndex];

                        saveDataSlot.TimeStamp   = DateTime.Now.ToString("yyyy/MM/dd (ddd) HH:mm:ss");
                        saveDataSlot.Description = "@~@~@";
                        saveDataSlot.MapName     = GameCommon.GetMapName(Game.I.Map.MapFile, "Tests\\t0001");
                        saveDataSlot.GameStatus  = gameStatus;
                    }
                }
                else                 // [戻る]
                {
                    break;
                }
                //DDEngine.EachFrame(); // 不要
            }

            SaveGame_幕間();

            DDEngine.FreezeInput();
        }
예제 #3
0
        public static void EachFrame(DDSubScreen targetScreen)
        {
            if (!Enabled)
            {
                return;
            }

            for (int x = 0; x < PIECES_W; x++)
            {
                for (int y = 0; y < PIECES_H; y++)
                {
                    PieceTable[x, y].ChangeDrawScreen();

                    DX.DrawRectGraph(
                        0,
                        0,
                        x * PIECE_XY_STEP,
                        y * PIECE_XY_STEP,
                        x * PIECE_XY_STEP + PIECE_WH,
                        y * PIECE_XY_STEP + PIECE_WH,
                        targetScreen.GetHandle(),
                        0
                        );
                }
            }

            Screen.ChangeDrawScreen();

            // Fill_Red
            DDDraw.SetBright(1.0, 0.0, 0.0);
            DDDraw.DrawRect(Ground.I.Picture.WhiteBox, new D4Rect(0, 0, GameConsts.FIELD_W, GameConsts.FIELD_H));
            DDDraw.Reset();

            for (int x = 0; x < PIECES_W; x++)
            {
                for (int y = 0; y < PIECES_H; y++)
                {
                    D2Point centerPt = new D2Point(
                        x * PIECE_XY_STEP + PIECE_WH / 2,
                        y * PIECE_XY_STEP + PIECE_WH / 2
                        );
                    double    rot     = 0.0;
                    DDPicture picture = PieceTable[x, y].ToPicture();

                    if (
                        x == 0 && y == 0 ||
                        x == 1 && y == 0
                        )
                    {
                        centerPt.X += PIECE_XY_STEP;
                    }

                    if (
                        x == 2 && y == 0 ||
                        x == 2 && y == 1
                        )
                    {
                        centerPt.Y += PIECE_XY_STEP;
                    }

                    if (
                        x == 1 && y == 2 ||
                        x == 2 && y == 2
                        )
                    {
                        centerPt.X -= PIECE_XY_STEP;
                    }

                    if (
                        x == 0 && y == 1 ||
                        x == 0 && y == 2
                        )
                    {
                        centerPt.Y -= PIECE_XY_STEP;
                    }

                    // 右上 (元:中央上) のみ 90° 回転
                    if (
                        x == 1 && y == 0
                        )
                    {
                        rot = Math.PI / 2;
                    }

                    DDDraw.DrawBegin(picture, centerPt.X, centerPt.Y);
                    DDDraw.DrawRotate(rot);
                    DDDraw.DrawEnd();
                }
            }

            targetScreen.ChangeDrawScreen();

            DDDraw.DrawSimple(Screen.ToPicture(), 0, 0);
        }
예제 #4
0
        public void Draw(double[] spectra)
        {
            if (spectra.Length != SP_LEN)
            {
                throw null;                 // souteigai !!!
            }
            if (this.ShadowSpectra == null)
            {
                this.ShadowSpectra = new ShadowSpectraData();
            }

            this.ShadowSpectra.Projection(spectra);

            DDSubScreenUtils.ChangeDrawScreen(this.GraphScreen);
            DX.ClearDrawScreen();

            for (int layer = 0; layer < 2; layer++)
            {
                for (int bi = 0; bi < this.BarNum; bi++)
                {
                    int c1 = (SP_LEN * (bi + 0)) / this.BarNum;
                    int c2 = (SP_LEN * (bi + 1)) / this.BarNum;

                    double v = 0.0;

                    for (int c = c1; c < c2; c++)
                    {
                        v += (layer == 0 ? this.ShadowSpectra.ShadowSpectra : spectra)[c];
                    }
                    v /= c2 - c1;

                    int x1 = ((this.GraphScreen.GetSize().W - this.Bar_W) * bi) / (this.BarNum - 1);
                    int x2 = x1 + this.Bar_W;
                    int y1 = (int)((1.0 - v) * this.GraphScreen.GetSize().H);
                    int y2 = this.GraphScreen.GetSize().H;

                    if (y1 + 1 < y2)
                    {
                        double bright = layer == 0 ? 0.5 : 1.0;

                        DDDraw.SetBright(
                            bright * (this.BarColor.R / 255.0),
                            bright * (this.BarColor.G / 255.0),
                            bright * (this.BarColor.B / 255.0)
                            );
                        DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, x1, y1, x2 - x1, y2 - y1);
                        DDDraw.Reset();
                    }
                }
            }

            DDSubScreenUtils.ChangeDrawScreen(this.Screen);
            DX.ClearDrawScreen();

            for (int c = 0; c < 2; c++)
            {
                DDDraw.DrawBegin(this.GraphScreen.ToPicture(), this.Screen.GetSize().W / 2, this.Screen.GetSize().H / 2);
                DDDraw.SetBright(0, 0, 0);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DX.GraphFilter(this.Screen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);
            }

            DDDraw.DrawCenter(this.GraphScreen.ToPicture(), this.Screen.GetSize().W / 2, this.Screen.GetSize().H / 2);

            DDSubScreenUtils.RestoreDrawScreen();
        }
예제 #5
0
        public void Draw(double[] spectra)
        {
            if (spectra.Length != 90)
            {
                throw null;                 // souteigai !!!
            }
            if (this.ShadowSpectra == null)
            {
                this.ShadowSpectra = new ShadowSpectraData();
            }

            this.ShadowSpectra.Projection(spectra);

            DDSubScreenUtils.ChangeDrawScreen(this.GraphScreen);
            DX.ClearDrawScreen();

            for (int c = 0; c < 10; c++)
            {
                double v =
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 0] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 1] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 2] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 3] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 4] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 5] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 6] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 7] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 8];

                v /= 9.0;

                int x1 = c * 100;
                int x2 = x1 + 10;
                int y1 = (int)((1.0 - v) * this.GraphScreen.GetSize().H);
                int y2 = this.GraphScreen.GetSize().H;

                if (y1 + 1 < y2)
                {
                    DDDraw.SetBright(0.4, 0.5, 0.6);
                    DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, x1, y1, x2 - x1, y2 - y1);
                    DDDraw.Reset();
                }
            }
            for (int c = 0; c < 10; c++)
            {
                double v =
                    spectra[c * 9 + 0] +
                    spectra[c * 9 + 1] +
                    spectra[c * 9 + 2] +
                    spectra[c * 9 + 3] +
                    spectra[c * 9 + 4] +
                    spectra[c * 9 + 5] +
                    spectra[c * 9 + 6] +
                    spectra[c * 9 + 7] +
                    spectra[c * 9 + 8];

                v /= 9.0;

                int x1 = c * 100;
                int x2 = x1 + 10;
                int y1 = (int)((1.0 - v) * this.GraphScreen.GetSize().H);
                int y2 = this.GraphScreen.GetSize().H;

                if (y1 + 1 < y2)
                {
                    DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, x1, y1, x2 - x1, y2 - y1);
                }
            }

            DDSubScreenUtils.ChangeDrawScreen(this.Screen);
            DX.ClearDrawScreen();

            for (int c = 0; c < 2; c++)
            {
                DDDraw.DrawBegin(this.GraphScreen.ToPicture(), this.Screen.GetSize().W / 2, this.Screen.GetSize().H / 2);
                DDDraw.SetBright(0, 0, 0);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DX.GraphFilter(this.Screen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);
            }

            DDDraw.DrawCenter(this.GraphScreen.ToPicture(), this.Screen.GetSize().W / 2, this.Screen.GetSize().H / 2);

            DDSubScreenUtils.RestoreDrawScreen();
        }
예제 #6
0
            public override IEnumerable <bool> E_Task()
            {
                DDTaskList el = new DDTaskList();
                double     dx = 0.0;
                double     dy = 0.0;
                double     ldx;
                double     ldy;
                double     shadow_a = 0.0;
                double     shadow_x = 0.0;
                double     title_a  = 0.0;
                double     shadow_targ_a;
                double     shadow_targ_x;
                double     title_targ_a;

                for (int frame = 0; ; frame++)
                {
                    ldx = dx;
                    ldy = dy;
                    dx  = Math.Cos(frame / 199.0) * 40.0;
                    dy  = Math.Cos(frame / 211.0) * 30.0;
                    double dxa = dx - ldx;
                    double dya = dy - ldy;

                    DDDraw.DrawBegin(Ground.I.Picture.TitleWall, DDConsts.Screen_W / 2 + dx, DDConsts.Screen_H / 2 + dy);
                    DDDraw.DrawZoom(1.3);
                    DDDraw.DrawEnd();

                    if (1 <= frame && DDUtils.Random.Real() < 0.03 + Math.Sin(frame / 307.0) * 0.02)
                    {
                        el.Add(SCommon.Supplier(this.Effect_0001(dx, dy, dxa, dya)));
                    }
                    el.ExecuteAllTask_Reverse();

                    double titleX = 720.0 + dx * 0.4;
                    double titleY = 270.0 + dy * 0.4;

                    double tba = 0.5 + Math.Sin(frame / 103.0) * 0.185 + Math.Sin(frame / 3.0) * 0.015 * Math.Sin(frame / 107.0);
                    double tfa = 0.3;

                    tba *= title_a;
                    tfa *= title_a;

                    {
                        const int FRAME_MAX = 300;

                        if (frame < FRAME_MAX)
                        {
                            DDDraw.SetBlendAdd(frame * tba / FRAME_MAX);
                            DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY);
                            DDDraw.Reset();
                        }
                        else
                        {
                            DDDraw.SetBlendAdd(tba);
                            DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY);
                            DDDraw.Reset();
                        }
                    }

                    {
                        const int FRAME_MAX = 300;

                        if (frame < FRAME_MAX)
                        {
                            DDDraw.SetBlendAdd(frame * tfa / FRAME_MAX);
                            DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY);
                            DDDraw.Reset();
                        }
                        else
                        {
                            DDDraw.SetBlendAdd(tfa);
                            DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY);
                            DDDraw.Reset();
                        }
                    }

                    if (this.DeepConfigEntered)
                    {
                        shadow_targ_a = 0.3;
                        shadow_targ_x = DDConsts.Screen_W;
                        title_targ_a  = 0.0;
                    }
                    else if (this.TopMenuLeaved)
                    {
                        shadow_targ_a = 0.3;
                        shadow_targ_x = 480.0;
                        title_targ_a  = 1.0;
                    }
                    else
                    {
                        shadow_targ_a = 0.0;
                        shadow_targ_x = 30.0;
                        title_targ_a  = 1.0;
                    }
                    DDUtils.Approach(ref shadow_a, shadow_targ_a, 0.8);
                    DDUtils.Approach(ref shadow_x, shadow_targ_x, 0.8);
                    DDUtils.Approach(ref title_a, title_targ_a, 0.97);

                    DDDraw.SetAlpha(shadow_a);
                    DDDraw.SetBright(0, 0, 0);
                    DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, 0, shadow_x, DDConsts.Screen_H);
                    DDDraw.Reset();

                    yield return(true);
                }
            }
예제 #7
0
        public void Main01(string spectrumFile, DDPicture jacket, string wDir, int spBarNum, int spBarWidth, int spBarHeight, I3Color spBarColor, double spBarAlpha, double z2)
        {
            FileTools.Delete(wDir);
            FileTools.CreateDir(wDir);

            this.SpData = new SpectrumData(spectrumFile);

            double a   = -1.0;
            double foa = 0.0;

            double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W();
            double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H();

            double bz1 = Math.Max(xz, yz);
            double bz2 = Math.Min(xz, yz);

            double z1 = 1.0;
            //double z2 = 2.0;

            const int JACKET_MARGIN = 10;

            using (DDSubScreen pseudoMainScreen = new DDSubScreen(
                       DDConsts.Screen_W,
                       DDConsts.Screen_H
                       ))
                using (DDSubScreen workScreen = new DDSubScreen(
                           DDConsts.Screen_W,
                           DDConsts.Screen_H
                           ))
                    using (DDSubScreen jacketScreen = new DDSubScreen(
                               jacket.Get_W() + JACKET_MARGIN * 2,
                               jacket.Get_H() + JACKET_MARGIN * 2,
                               true
                               ))
                    {
                        // ---- jacketScreen

                        DDSubScreenUtils.ChangeDrawScreen(jacketScreen);
                        DX.ClearDrawScreen();

                        DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2);

                        DDSubScreenUtils.RestoreDrawScreen();

                        // ----

                        SpectrumScreen0001 spScr = new SpectrumScreen0001(spBarNum, spBarWidth, spBarHeight, spBarColor);

                        while (this.Frame < this.SpData.Rows.Length)
                        {
                            double[] row = this.SpData.Rows[this.Frame];

                            spScr.Draw(row);

                            // ---- workScreen

                            DDSubScreenUtils.ChangeDrawScreen(workScreen);

                            DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz1 * z1);
                            DDDraw.DrawEnd();

                            DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

                            //DDSubScreenUtils.RestoreDrawScreen();

                            // ---- pseudoMainScreen

                            DDSubScreenUtils.ChangeDrawScreen(pseudoMainScreen);

                            DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0);

                            DDCurtain.DrawCurtain(-0.5);

                            DDDraw.DrawBegin(
                                jacketScreen.ToPicture(),
                                //jacket,
                                DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz2 * z2);
                            DDDraw.DrawEnd();

                            DDCurtain.DrawCurtain(Math.Min(a, foa));

                            DDDraw.SetAlpha(spBarAlpha);
                            DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - spBarHeight / 2 - 10);
                            DDDraw.Reset();

                            // ここでフレームを保存
                            DX.SaveDrawScreen(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.bmp", this.Frame)));

                            DDSubScreenUtils.RestoreDrawScreen();

                            // ---- 実際に表示される画面の描画

                            DDCurtain.DrawCurtain();

                            {
                                double    rate           = this.Frame * 1.0 / this.SpData.Rows.Length;
                                const int PROGRESS_BAR_H = 10;

                                DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, (DDConsts.Screen_H - PROGRESS_BAR_H) / 2, Math.Max(5, DDConsts.Screen_W * rate), PROGRESS_BAR_H);
                            }

                            // ----

                            if (40 < this.Frame)
                            {
                                DDUtils.Approach(ref a, 0.0, 0.985);
                            }

                            if (this.SpData.Rows.Length - 40 < this.Frame)
                            {
                                DDUtils.Approach(ref foa, -1.0, 0.9);
                            }

                            //DDUtils.Approach(ref z1, 1.2, 0.999);
                            //z1 += 0.0001;
                            DDUtils.Approach(ref z2, 1.0, 0.9985);

                            this.MG_EachFrame();
                        }
                    }
        }