Example #1
0
        protected override IEnumerable <int> Script()
        {
            // TODO: 背景
            // TODO: BGM

            // _#Include_Resource // for t20201023_GitHubRepositoriesSolve

            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(50, 200, "\u751f\u9084\u3057\u305f\u30a2\u30bf\u30b7\u306e\u4e16\u754c\u306b\u306f\u8272\u304c\u306a\u304b\u3063\u305f\u3002", 1200)));
            yield return(440);

            DDGround.EL.Add(SCommon.Supplier(DrawString(50, 250, "\u3067\u3082\u3001\u6291\u3048\u3088\u3046\u306e\u306a\u3044\u9ed2\u3044\u708e\u304c\u5fc3\u306e\u4e2d\u3067\u71c3\u3048\u76db\u308a\u3001", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(50, 300, "\u6050\u308d\u3057\u3044\u307b\u3069\u306e\u539f\u52d5\u529b\u3092\u751f\u3093\u3067\u3044\u305f\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(20, 250, "\u305d\u306e\u529b\u306b\u3001\u5fc3\u306b\u5f93\u3046\u3053\u3068\u3067\u30a2\u30bf\u30b7\u306e\u4e16\u754c\u306b\u4e00\u8272\u3060\u3051\u8272\u304c\u623b\u3063\u305f\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(320, 250, "\u300c \u30a2\u30ab\u8272 \u300d \u3060\u3051\u304c\u3002")));

            yield return(800);

            DDCurtain.SetCurtain(30, -1.0);
            DDMusicUtils.Fade();
            yield return(40);
        }
Example #2
0
        private IEnumerable <bool> E_開放()
        {
            // ---- game_制御 ----

            DDMusicUtils.Fade();

            // ----

            Game.I.UserInputDisabled = true;

            for (int x = 0; x < Game.I.Map.W; x++)
            {
                this.開放(x, 0);
                this.開放(x, Game.I.Map.H - 1);

                yield return(true);
            }
            for (int y = 0; y < Game.I.Map.H; y++)
            {
                this.開放(0, y);
                this.開放(Game.I.Map.W - 1, 0);

                yield return(true);
            }
            Game.I.UserInputDisabled = false;
        }
Example #3
0
        protected override IEnumerable <int> Script()
        {
            // reset
            {
                Wall_GB        = 1.0;
                Wall_GB_Target = 1.0;
            }

            DDGround.EL.Add(() =>
            {
                DDUtils.Approach(ref Wall_GB, Wall_GB_Target, 0.998);
                return(true);
            });

            ClearAllSubScreen();

            Ground.I.Music.Ending_復讐.Play();

            DrawWall drawWall = new DrawWall();

            drawWall.DrawPictures.Add(new DrawWall.DrawPicture()
            {
                Picture = Ground.I.Picture.Ending_復讐_背景_01, YAdd = -0.02
            });
            DDGround.EL.Add(drawWall.Task);

            // _#Include_Resource // for t20201023_GitHubRepositoriesSolve

            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 200, "\u751f\u9084\u3057\u305f\u30a2\u30bf\u30b7\u306e\u4e16\u754c\u306b\u306f\u8272\u304c\u306a\u304b\u3063\u305f\u3002", 1200)));
            yield return(440);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 250, "\u3067\u3082\u3001\u6291\u3048\u3088\u3046\u306e\u306a\u3044\u9ed2\u3044\u708e\u304c\u5fc3\u306e\u4e2d\u3067\u71c3\u3048\u76db\u308a\u3001", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 300, "\u6050\u308d\u3057\u3044\u307b\u3069\u306e\u539f\u52d5\u529b\u3092\u751f\u3093\u3067\u3044\u305f\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 250, "\u305d\u306e\u529b\u306b\u3001\u5fc3\u306b\u5f93\u3046\u3053\u3068\u3067\u30a2\u30bf\u30b7\u306e\u4e16\u754c\u306b\u4e00\u8272\u3060\u3051\u8272\u304c\u623b\u3063\u305f\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 250, "\u300c \u30a2\u30ab\u8272 \u300d \u3060\u3051\u304c\u3002", 600, new I3Color(255, 0, 0))));

            Wall_GB_Target = 0.0;

            yield return(1200);

            DDCurtain.SetCurtain(600, -1.0);
            yield return(300);

            DDMusicUtils.Fade(300);
            yield return(330);

            ClearAllSubScreen();
        }
Example #4
0
 private void MusicFileChanged()
 {
     if (this.MusicFile == null)
     {
         DDMusicUtils.Fade();
     }
     else
     {
         DDCCResource.GetMusic(this.MusicFile).Play();
     }
 }
Example #5
0
        protected override IEnumerable <int> Script()
        {
            // TODO: 背景
            // TODO: BGM

            // _#Include_Resource // for t20201023_GitHubRepositoriesSolve

            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 200, "\u7729\u3057\u3044\u5149\u304c\u76ee\u306b\u98db\u3073\u8fbc\u3093\u3067\u304f\u308b\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 250, "\u3069\u3046\u3084\u3089\u79c1\u306f\u751f\u6b7b\u306e\u5883\u304b\u3089\u751f\u9084\u3057\u305f\u3089\u3057\u3044\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 250, "\u5468\u308a\u306b\u306f\u5b89\u5835\u306e\u8868\u60c5\u3092\u6d6e\u304b\u3079\u305f\u533b\u5e2b\u3068\u770b\u8b77\u5e2b\u304c\u5c45\u308b\u3002", 1000)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 300, "\u2026\u2026\u305d\u308c\u4ee5\u5916\u306b\u306f\u8ab0\u3082\u5c45\u306a\u3044\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 350, "\u305d\u308c\u3067\u826f\u3044\u3057\u3001\u3068\u3063\u304f\u306b\u899a\u609f\u306f\u3057\u3066\u3044\u305f\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 150, "\u751f\u304d\u308b\u3053\u3068\u306f\u7d20\u6674\u3089\u3057\u304f\u3001\u305d\u308c\u3060\u3051\u3067\u5e78\u305b\u306a\u3053\u3068\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 200, "\u305d\u3093\u306a\u6b3a\u779e\u306b\u6e80\u3061\u305f\u8a00\u8449\u306b\u306f\u53cd\u5410\u304c\u51fa\u308b\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 250, "\u3067\u3082\u3001\u79c1\u306f\u30a2\u30a4\u30c4\u3068\u4e00\u7dd2\u306b\u751f\u304d\u3066\u3044\u304f\u3068\u6c7a\u3081\u305f\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 300, "\u305d\u308c\u304c\u6b63\u3057\u3044\u9078\u629e\u304b\u3069\u3046\u304b\u306f\u3001\u751f\u304d\u629c\u3044\u3066\u307f\u3066\u521d\u3081\u3066\u5206\u304b\u308b\u3053\u3068\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 200, "\u7b11\u3063\u3066\u6b7b\u306c\u3002", 1200)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 250, "\u660e\u78ba\u306a\u76ee\u6a19\u304c\u51fa\u6765\u305f\u3053\u3068\u3067\u3001\u5fc3\u306f\u30b9\u30c3\u30ad\u30ea\u3057\u3066\u3044\u308b\u3002", 1000)));
            yield return(440);

            DDGround.EL.Add(SCommon.Supplier(DrawString(480, 330, "\u2026\u2026\u3068\u308a\u3042\u3048\u305a\u3001\u5893\u53c2\u308a\u3068\u9762\u4f1a\u304b\u3089\u59cb\u3081\u3066\u307f\u3088\u3046\u304b\u306a\u3002")));

            yield return(800);

            DDCurtain.SetCurtain(30, -1.0);
            DDMusicUtils.Fade();
            yield return(40);
        }
Example #6
0
        private void LeaveTitleMenu()
        {
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.SimpleMenu.WallDrawer();
                DDEngine.EachFrame();
            }

            GC.Collect();
        }
Example #7
0
        public void Perform()
        {
            DDEngine.FreezeInput();

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain();

            Func <bool> a_script = DDUtils.Scripter(this.Script());

            for (int scrfrm = 0; a_script(); scrfrm++)
            {
                if (DDInput.L.GetInput() == 1)                 // エンディング_スキップ
                {
                    if (Ground.I.会話スキップ抑止)
                    {
                        Ground.I.SE.拒否.Play();
                    }
                    else if (180 < scrfrm)                     // 数秒経過するまでスキップさせない。
                    {
                        DDEngine.EachFrame();

                        DDCurtain.SetCurtain(30, -1.0);
                        DDMusicUtils.Fade();

                        for (int c = 0; c < 40; c++)
                        {
                            a_script();

                            DDEngine.EachFrame();
                        }
                        break;
                    }
                }
                DDEngine.EachFrame();
            }

            // a_script において以下は実行されているものとする。
            // -- DDCurtain.SetCurtain(30, -1.0);
            // -- DDMusicUtils.Fade();

            foreach (DDScene scene in DDSceneUtils.Create(60))             // 暗転_時間調整
            {
                DDEngine.EachFrame();
            }

            DDGround.EL.Clear();

            DDEngine.FreezeInput();
        }
Example #8
0
        private void LeaveTitleMenu()
        {
#if false
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.DrawWall();
                DDEngine.EachFrame();
            }
#endif

            GC.Collect();
        }
Example #9
0
        private void LeaveTitleMenu()
        {
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                DDDraw.SetBright(WALL_COLOR);
                DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
            GC.Collect();
        }
Example #10
0
        private void イベント実行()
        {
            DDMain.KeepMainScreen();

            // swap
            {
                DDSubScreen tmp = _lastGameScreen;
                _lastGameScreen         = DDGround.KeptMainScreen;
                DDGround.KeptMainScreen = tmp;
            }

            DDMusicUtils.Fade();

            DDCurtain.SetCurtain(10, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(20))
            {
                DDDraw.DrawSimple(_lastGameScreen.ToPicture(), 0, 0);
                DDEngine.EachFrame();
            }

            DDCurtain.SetCurtain(10);

            using (new Novel())
            {
                Novel.I.Status.Scenario = new Scenario("テスト0001");
                //Novel.I.Status.Scenario = new Scenario("イベント0001"); // old
                Novel.I.Perform();

                if (Novel.I.ReturnToTitleMenu)
                {
                    Game.I.RequestReturnToTitleMenu = true;
                }
            }

            MusicCollection.Get(Game.I.Map.MusicName).Play();

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain(10);

#if false // いらん
            foreach (DDScene scene in DDSceneUtils.Create(20))
            {
                DDDraw.DrawSimple(_lastGameScreen.ToPicture(), 0, 0);
                DDEngine.EachFrame();
            }
#endif
        }
Example #11
0
        public override void DrawWall(double cam_x, double cam_y, double cam_xRate, double cam_yRate)
        {
            DDDraw.SetBright(new I3Color(0, 0, 20));
            DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
            DDDraw.Reset();

            if (DDEngine.ProcFrame % 90 == 0)
            {
                波紋効果.Addマップ下部から炎();
            }

            DDGround.EL.Add(() =>
            {
                double map_b = Game.I.Map.H * GameConsts.TILE_H;
                double cam_b = DDGround.Camera.Y + DDConsts.Screen_H;

                double y = map_b - cam_b;
                y       *= 0.5;
                y        = DDConsts.Screen_H - Ground.I.Picture.WallFire.Get_H() + y;

                DDDraw.SetBright(new I3Color(255, 0, 0));
                DDDraw.DrawSimple(Ground.I.Picture.WallFire, 0, y);
                DDDraw.Reset();

                if (DDEngine.ProcFrame % 20 == 0)
                {
                    double yy = map_b - cam_b;
                    yy       /= 2000.0;
                    yy        = 1.0 - yy;
                    DDUtils.ToRange(ref yy, 0.0, 1.0);
                    yy = 0.3 + yy * 0.7;

                    // yy == 0.3 ~ 1.0 == 高い位置 ~ 低い位置

                    if (DDConfig.LOG_ENABLED)
                    {
                        DDGround.EL.Keep(10, () =>
                        {
                            DDPrint.SetPrint(0, 16);
                            DDPrint.DebugPrint("yy: " + yy);
                        });
                    }
                    DDMusicUtils.Fade(10, yy);
                }
                return(false);
            });
        }
Example #12
0
        public override void Draw()
        {
            if (DDUtils.GetDistance(new D2Point(this.X, this.Y), new D2Point(Game.I.Player.X, Game.I.Player.Y)) < 50.0)
            {
                if (Game.I.FinalZone == null)                 // ? 最終ゾーン未侵入
                {
                    DDMusicUtils.Fade();

                    this.最終ノベルパート();
                    Game.I.FinalZone = new Game.FinalZoneInfo();
                    Game.I.Enemies.Add(new Enemy_MeteorLoader(new D2Point(0, 0)));                     // メテオローダー設置
                    Game.I.TakeSnapshot();

                    Ground.I.Music.FinalZone.Play();
                }
            }
        }
Example #13
0
        protected override IEnumerable <int> Script()
        {
            // TODO: 背景
            // TODO: BGM

            // _#Include_Resource // for t20201023_GitHubRepositoriesSolve

            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(50, 200, "\u5451\u307e\u308c\u3066\u3044\u308b\u611f\u899a\u304c\u5206\u304b\u308b\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(50, 250, "\u6297\u3044\u3088\u3046\u306e\u7121\u3044\u3001\u5727\u5012\u7684\u306b\u6697\u3044\u95c7\u306e\u4e2d\u3078\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(300, 300, "\u305f\u3060\u3001\u601d\u3063\u3066\u3044\u305f\u69d8\u306a\u82e6\u75db\u3084\u6050\u6016\u306f\u306a\u3044\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(300, 350, "\u30a2\u30a4\u30c4\u304c\u5916\u5074\u3067\u7de9\u548c\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u3093\u3060\u308d\u3046\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(150, 150, "\u3082\u3046\u4e00\u5ea6\u751f\u304d\u3066\u307f\u3088\u3046\u3002", 1200)));
            yield return(480);

            DDGround.EL.Add(SCommon.Supplier(DrawString(150, 300, "\u305d\u3093\u306a\u6c17\u6301\u3061\u3082\u306a\u304b\u3063\u305f\u308f\u3051\u3058\u3083\u306a\u3044\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(150, 350, "\u3051\u3069\u3001\u3053\u308c\u3082\u30a2\u30bf\u30b7\u304c\u671b\u3093\u3067\u3044\u305f\u7d50\u679c\u306e\uff11\u3064\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(400, 250, "\u2026\u2026\u60aa\u304f\u306a\u3044\u7d42\u308f\u308a\u304b\u305f\u3002")));

            yield return(800);

            DDCurtain.SetCurtain(30, -1.0);
            DDMusicUtils.Fade();
            yield return(40);
        }
Example #14
0
        private void デフォルトに戻す()
        {
            {
                const int def_screen_w = DDConsts.Screen_W / 2;
                const int def_screen_h = DDConsts.Screen_H / 2;

                DDMain.SetScreenSize(def_screen_w, def_screen_h);
            }

            DDGround.MusicVolume         = 0.45;
            DDGround.SEVolume            = 0.45;
            Ground.I.MessageSpeed        = GameConsts.MESSAGE_SPEED_DEF;
            Ground.I.MessageWindow_A_Pct = GameConsts.MESSAGE_WINDOW_A_PCT_DEF;

            // 設定値変更を反映
            DDMusicUtils.UpdateVolume();
            DDSEUtils.UpdateVolume();

            // ボタン設定
            {
                DDInput.DIR_2.BtnIds = new int[] { 0 };
                DDInput.DIR_4.BtnIds = new int[] { 1 };
                DDInput.DIR_6.BtnIds = new int[] { 2 };
                DDInput.DIR_8.BtnIds = new int[] { 3 };
                DDInput.A.BtnIds     = new int[] { 4 };
                DDInput.B.BtnIds     = new int[] { 7 };
                DDInput.L.BtnIds     = new int[] { 10 };
            }

            // キー設定
            {
                DDInput.DIR_2.KeyIds = new int[] { DX.KEY_INPUT_DOWN };
                DDInput.DIR_4.KeyIds = new int[] { DX.KEY_INPUT_LEFT };
                DDInput.DIR_6.KeyIds = new int[] { DX.KEY_INPUT_RIGHT };
                DDInput.DIR_8.KeyIds = new int[] { DX.KEY_INPUT_UP };
                DDInput.A.KeyIds     = new int[] { DX.KEY_INPUT_RETURN };
                DDInput.B.KeyIds     = new int[] { DX.KEY_INPUT_DELETE };
                DDInput.L.KeyIds     = new int[] { DX.KEY_INPUT_LCONTROL, DX.KEY_INPUT_RCONTROL };
            }
        }
Example #15
0
        public override void Draw()
        {
            if (DDUtils.GetDistance(new D2Point(this.X, this.Y), new D2Point(Game.I.Player.X, Game.I.Player.Y)) < 50.0)
            {
                if (Game.I.FinalZone.OH_Event9003.Once())
                {
                    for (int x = 0; x < Game.I.Map.W; x++)
                    {
                        for (int y = 0; y < Game.I.Map.H; y++)
                        {
                            MapCell cell = Game.I.Map.GetCell(x, y);

                            if (
                                cell.Kind == MapCell.Kind_e.DEATH ||
                                cell.Kind == MapCell.Kind_e.GOAL
                                )
                            {
                                cell.Kind = MapCell.Kind_e.WALL;
                            }
                        }
                    }

                    // 必要なイベント以外を除去
                    //
                    Game.I.Enemies.RemoveAll(enemy => !(
                                                 enemy is Enemy_Event9003B ||
                                                 enemy is Enemy_Event9004 ||
                                                 enemy is Enemy_Event9005
                                                 ));

                    Game.I.Map.Design = new Design_0002();

                    //DDGround.EL.Add(SCommon.Supplier(Effects.Liteフラッシュ()));
                    DDGround.EL.Add(SCommon.Supplier(Effects.Heavyフラッシュ()));

                    DDMusicUtils.Stop();
                }
            }
        }
Example #16
0
        public void Perform()
        {
            DDUtils.SetMouseDispMode(true);

            // reset
            {
                //this.SkipMode = false;
                //this.AutoMode = false;

                Surface_吹き出し.Hide = false;
                //Surface_SystemButtons.Hide = false;
            }

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain();

restartCurrPage:
            this.CurrPage = this.Status.Scenario.Pages[this.Status.CurrPageIndex];

            foreach (ScenarioCommand command in this.CurrPage.Commands)
            {
                command.Invoke();
            }

            this.DispSubtitleCharCount = 0;
            this.DispCharCount         = 0;
            this.DispPageEndedCount    = 0;
            this.DispFastMode          = false;

            DDEngine.FreezeInput();

            for (; ;)
            {
                bool nextPageFlag = false;

                // ★★★ キー押下は 1 マウス押下は -1 で判定する。

                // 入力:シナリオを進める。(マウスホイール)
                if (DDMouse.Rot < 0)
                {
                    //this.CancelSkipAutoMode(); // 廃止

                    if (this.DispPageEndedCount < NovelConsts.NEXT_PAGE_INPUT_INTERVAL)                     // ? ページ表示_未完了 -> ページ表示_高速化
                    {
                        this.DispFastMode = true;
                    }
                    else                     // ? ページ表示_完了 -> 次ページ
                    {
                        nextPageFlag = true;
                    }
                    DDEngine.FreezeInput(NovelConsts.SHORT_INPUT_SLEEP);
                }

                // 入力:シナリオを進める。(マウスホイール_以外)
                if (
                    DDMouse.L.GetInput() == -1 ||
                    DDInput.A.GetInput() == 1
                    )
                {
                    if (this.DispPageEndedCount < NovelConsts.NEXT_PAGE_INPUT_INTERVAL)                     // ? ページ表示_未完了 -> ページ表示_高速化
                    {
                        this.DispFastMode = true;
                    }
                    else                     // ? ページ表示_完了 -> 次ページ
                    {
                        nextPageFlag = true;
                    }
                }

                // 入力:会話スキップ
                if (DDInput.L.GetInput() == 1 || this.会話スキップ_Request)
                {
                    this.会話スキップ_Request = false;                     // reset

                    if (Ground.I.会話スキップ抑止)
                    {
                        Ground.I.SE.拒否.Play();
                    }
                    else
                    {
                        this.会話スキップした = true;
                        break;
                    }
                }
                if (this.会話終了_Request)
                {
                    break;
                }

                //if (this.SkipMode)
                //    if (1 <= this.DispPageEndedCount)
                //        nextPageFlag = true;

                //if (this.AutoMode)
                //    if (NovelConsts.AUTO_NEXT_PAGE_INTERVAL <= this.DispPageEndedCount)
                //        nextPageFlag = true;

                if (nextPageFlag)                 // 次ページ
                {
                    // スキップモード時はページを進める毎にエフェクトを強制終了する。
                    //if (this.SkipMode)
                    //    foreach (Surface surface in this.Status.Surfaces)
                    //        surface.Act.Clear();

                    this.Status.CurrPageIndex++;

                    if (this.Status.Scenario.Pages.Count <= this.Status.CurrPageIndex)
                    {
                        break;
                    }

                    goto restartCurrPage;
                }

                // 入力:過去ログ
                if (
                    DDInput.DIR_4.GetInput() == 1 ||
                    0 < DDMouse.Rot
                    )
                {
                    this.BackLog();
                }

                // 入力:鑑賞モード
                if (
                    DDMouse.R.GetInput() == -1 ||
                    DDInput.B.GetInput() == 1
                    )
                {
                    this.Appreciate();
                }

                if (
                    this.CurrPage.Subtitle.Length < this.DispSubtitleCharCount &&
                    this.CurrPage.Text.Length < this.DispCharCount
                    )
                {
                    this.DispPageEndedCount++;
                }

                //if (this.SkipMode)
                //{
                //    this.DispSubtitleCharCount += 8;
                //    this.DispCharCount += 8;
                //}
                //else
                if (this.DispFastMode)
                {
                    this.DispSubtitleCharCount += 2;
                    this.DispCharCount         += 2;
                }
                else
                {
                    if (DDEngine.ProcFrame % 2 == 0)
                    {
                        this.DispSubtitleCharCount++;
                    }

                    if (DDEngine.ProcFrame % 3 == 0)
                    {
                        this.DispCharCount++;
                    }
                }
                DDUtils.ToRange(ref this.DispSubtitleCharCount, 0, SCommon.IMAX);
                DDUtils.ToRange(ref this.DispCharCount, 0, SCommon.IMAX);

                // ====
                // 描画ここから
                // ====

                this.DrawSurfaces();

                // ====
                // 描画ここまで
                // ====

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }

            DDCurtain.SetCurtain(10, -1.0);
            DDMusicUtils.Fade();

            foreach (DDScene scene in DDSceneUtils.Create(20))
            {
                this.DrawSurfaces();

                DDEngine.EachFrame();
            }

            DDEngine.FreezeInput();

            DDUtils.SetMouseDispMode(false);

            // ★★★ end of Perform() ★★★
        }
Example #17
0
        public void Perform()
        {
            Func <bool> f_ゴミ回収 = SCommon.Supplier(this.E_ゴミ回収());

            this.Map = new Map(GameCommon.GetMapFile(this.World.GetCurrMapName()));
            this.ReloadEnemies();

            // デフォルトの「プレイヤーのスタート地点」
            // -- マップの中央
            this.Player.X = this.Map.W * GameConsts.TILE_W / 2.0;
            this.Player.Y = this.Map.H * GameConsts.TILE_H / 2.0;

            {
                Enemy enemy = this.Enemies.Iterate().FirstOrDefault(v => v is Enemy_スタート地点 && ((Enemy_スタート地点)v).Direction == this.Status.StartPointDirection);

                if (enemy != null)
                {
                    this.Player.X = enemy.X;
                    this.Player.Y = enemy.Y;
                }
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ入場時)
            // その他の反映箇所:
            // -- マップ退場時
            // -- セーブ時
            {
                this.Player.HP            = this.Status.StartHP;
                this.Player.FaceDirection = this.Status.StartFaceDirection;
                this.Player.選択武器          = this.Status.Start選択武器;
            }

            this.Wall = WallCreator.Create(this.Map.WallName);

            MusicCollection.Get(this.Map.MusicName).Play();

            DDGround.Camera.X = this.Player.X - DDConsts.Screen_W / 2.0;
            DDGround.Camera.Y = this.Player.Y - DDConsts.Screen_H / 2.0;

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain(10);

            DDEngine.FreezeInput();

            // TODO: 音楽

            for (this.Frame = 0; ; this.Frame++)
            {
                if (!this.UserInputDisabled && DDInput.PAUSE.GetInput() == 1)
                {
                    this.Pause();

                    if (this.Pause_ReturnToTitleMenu)
                    {
                        this.Status.ExitDirection = 5;
                        break;
                    }
                }
                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1)
                {
                    this.DebugPause();
                }

                // 死亡時にカメラ移動を止める。
                //if (this.Player.DeadFrame == 0)
                //    this.カメラ位置調整(false);

                this.カメラ位置調整(false);

                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_E) == 1)                 // エディットモード(デバッグ用)
                {
                    this.Edit();
                    this.ReloadEnemies();
                    this.Frame = 0;
                }

                // プレイヤー入力・移動
                {
                    bool deadOrUID = 1 <= this.Player.DeadFrame || this.UserInputDisabled;
                    bool dir2      = !deadOrUID && 1 <= DDInput.DIR_2.GetInput() || this.PlayerHacker.DIR_2;
                    bool dir4      = !deadOrUID && 1 <= DDInput.DIR_4.GetInput() || this.PlayerHacker.DIR_4;
                    bool dir6      = !deadOrUID && 1 <= DDInput.DIR_6.GetInput() || this.PlayerHacker.DIR_6;
                    bool dir8      = !deadOrUID && 1 <= DDInput.DIR_8.GetInput() || this.PlayerHacker.DIR_8;
                    int  dir;                    // 1~9 == { 左下, 下, 右下, 左, 動かない, 右, 左上, 上, 右上 }

                    if (dir2 && dir4)
                    {
                        dir = 1;
                    }
                    else if (dir2 && dir6)
                    {
                        dir = 3;
                    }
                    else if (dir4 && dir8)
                    {
                        dir = 7;
                    }
                    else if (dir6 && dir8)
                    {
                        dir = 9;
                    }
                    else if (dir2)
                    {
                        dir = 2;
                    }
                    else if (dir4)
                    {
                        dir = 4;
                    }
                    else if (dir6)
                    {
                        dir = 6;
                    }
                    else if (dir8)
                    {
                        dir = 8;
                    }
                    else
                    {
                        dir = 5;
                    }

                    if (1 <= this.Player.DamageFrame)                     // ? プレイヤー・ダメージ中
                    {
                        dir = 5;
                    }

                    bool camSlide = !deadOrUID && 1 <= DDInput.L.GetInput();

                    if (camSlide)
                    {
                        dir = 5;
                    }

                    bool slow = !deadOrUID && 1 <= DDInput.A.GetInput() || this.PlayerHacker.Slow;
                    bool fast = !deadOrUID && 1 <= DDInput.R.GetInput() || this.PlayerHacker.Fast;

                    if (Ground.I.FastReverseMode)
                    {
                        fast = !fast;
                    }

                    double speed = 3.0;

                    if (slow)
                    {
                        speed -= 1.0;
                    }

                    if (fast)
                    {
                        speed += 2.0;
                    }

                    double nanameSpeed = speed / Consts.ROOT_OF_2;

                    switch (dir)
                    {
                    case 2:
                        this.Player.Y += speed;
                        break;

                    case 4:
                        this.Player.X -= speed;
                        break;

                    case 6:
                        this.Player.X += speed;
                        break;

                    case 8:
                        this.Player.Y -= speed;
                        break;

                    case 1:
                        this.Player.X -= nanameSpeed;
                        this.Player.Y += nanameSpeed;
                        break;

                    case 3:
                        this.Player.X += nanameSpeed;
                        this.Player.Y += nanameSpeed;
                        break;

                    case 7:
                        this.Player.X -= nanameSpeed;
                        this.Player.Y -= nanameSpeed;
                        break;

                    case 9:
                        this.Player.X += nanameSpeed;
                        this.Player.Y -= nanameSpeed;
                        break;

                    case 5:
                        break;

                    default:
                        throw null;                                 // never
                    }
                    if (dir != 5 && !slow)
                    {
                        this.Player.FaceDirection = dir;
                    }

                    if (dir != 5)
                    {
                        this.Player.MoveFrame++;
                    }
                    else
                    {
                        this.Player.MoveFrame = 0;
                    }

                    if (this.Player.MoveFrame == 0)                     // 立ち止まったら座標を整数に矯正
                    {
                        this.Player.X = SCommon.ToInt(this.Player.X);
                        this.Player.Y = SCommon.ToInt(this.Player.Y);
                    }
                    if (camSlide)
                    {
                        if (dir4)
                        {
                            this.CamSlideCount++;
                            this.CamSlideX--;
                        }
                        if (dir6)
                        {
                            this.CamSlideCount++;
                            this.CamSlideX++;
                        }
                        if (dir8)
                        {
                            this.CamSlideCount++;
                            this.CamSlideY--;
                        }
                        if (dir2)
                        {
                            this.CamSlideCount++;
                            this.CamSlideY++;
                        }
                        DDUtils.ToRange(ref this.CamSlideX, -1, 1);
                        DDUtils.ToRange(ref this.CamSlideY, -1, 1);
                    }
                    else
                    {
                        if (this.CamSlideMode && this.CamSlideCount == 0)
                        {
                            this.CamSlideX = 0;
                            this.CamSlideY = 0;
                        }
                        this.CamSlideCount = 0;
                    }
                    this.CamSlideMode = camSlide;

                    bool attack = !deadOrUID && 1 <= DDInput.B.GetInput() || this.PlayerHacker.Attack;

                    if (attack)
                    {
                        this.Player.AttackFrame++;
                    }
                    else
                    {
                        this.Player.AttackFrame = 0;
                    }

                    bool 武器切り替え = !deadOrUID && DDInput.C.GetInput() == 1;

                    if (武器切り替え)
                    {
                        this.Player.選択武器 = (Player.武器_e)(((int)this.Player.選択武器 + 1) % Player.武器_e_Length);
                    }
                }

                //startDead:
                if (1 <= this.Player.DeadFrame)                 // プレイヤー死亡中の処理
                {
                    int frame = this.Player.DeadFrame - 1;

                    if (GameConsts.PLAYER_DEAD_FRAME_MAX < frame)
                    {
                        this.Player.DeadFrame     = 0;
                        this.Status.ExitDirection = 5;
                        break;
                    }
                    this.Player.DeadFrame++;

                    // ----

                    const int HITBACK_FRAME_MAX = 30;

                    if (frame < HITBACK_FRAME_MAX)
                    {
                        double rate    = (double)frame / HITBACK_FRAME_MAX;
                        double invRate = 1.0 - rate;

                        D2Point speed = GameCommon.GetXYSpeed(this.Player.FaceDirection, 10.0 * invRate);

                        this.Player.X -= speed.X;
                        this.Player.Y -= speed.Y;
                    }
                }
                //endDead:

                //startDamage:
                if (1 <= this.Player.DamageFrame)                 // プレイヤー・ダメージ中の処理
                {
                    int frame = this.Player.DamageFrame - 1;

                    if (GameConsts.PLAYER_DAMAGE_FRAME_MAX < frame)
                    {
                        this.Player.DamageFrame     = 0;
                        this.Player.InvincibleFrame = 1;
                        goto endDamage;
                    }
                    this.Player.DamageFrame++;

                    // ----

                    {
                        D2Point speed = GameCommon.GetXYSpeed(this.Player.FaceDirection, 5.0);

                        for (int c = 0; c < 5; c++)
                        {
                            {
                                int x = SCommon.ToInt(this.Player.X) / GameConsts.TILE_W;
                                int y = SCommon.ToInt(this.Player.Y) / GameConsts.TILE_H;

                                if (this.Map.GetCell(x, y).Tile.GetKind() != Tile.Kind_e.SPACE)                                 // ? 歩行可能な場所ではない -> これ以上ヒットバックさせない。
                                {
                                    break;
                                }
                            }

                            this.Player.X -= speed.X;
                            this.Player.Y -= speed.Y;
                        }
                    }
                }
endDamage:

                //startInvincible:
                if (1 <= this.Player.InvincibleFrame)                 // プレイヤー無敵時間中の処理
                {
                    int frame = this.Player.InvincibleFrame - 1;

                    if (GameConsts.PLAYER_INVINCIBLE_FRAME_MAX < frame)
                    {
                        this.Player.InvincibleFrame = 0;
                        goto endInvincible;
                    }
                    this.Player.InvincibleFrame++;

                    // ----

                    // noop
                }
endInvincible:

                // プレイヤー位置矯正
                {
                    壁キャラ処理.Perform(ref this.Player.X, ref this.Player.Y, v => v.GetKind() != Tile.Kind_e.SPACE);
                }

                if (this.Player.X < 0.0)                 // ? マップの左側に出た。
                {
                    this.Status.ExitDirection = 4;
                    break;
                }
                if (this.Map.W * GameConsts.TILE_W < this.Player.X)                 // ? マップの右側に出た。
                {
                    this.Status.ExitDirection = 6;
                    break;
                }
                if (this.Player.Y < 0.0)                 // ? マップの上側に出た。
                {
                    this.Status.ExitDirection = 8;
                    break;
                }
                if (this.Map.H * GameConsts.TILE_H < this.Player.Y)                 // ? マップの下側に出た。
                {
                    this.Status.ExitDirection = 2;
                    break;
                }

                // 画面遷移時の微妙なカメラ位置ズレ解消
                // -- 必要無いかもしれないが、念の為実行しておく。
                if (this.Frame == 0)
                {
                    this.カメラ位置調整(true);
                }

                if (1 <= this.Player.AttackFrame)
                {
                    this.Player.Attack();
                }

                DDCrash plCrash = DDCrashUtils.Point(new D2Point(this.Player.X, this.Player.Y));

                // ====
                // 描画ここから
                // ====

                this.DrawWall();
                this.DrawMap();
                this.Player.Draw();

                // memo: DeadFlag をチェックするのは「当たり判定」から

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    enemy.Crash = DDCrashUtils.None();                     // reset
                    enemy.Draw();
                }
                foreach (Shot shot in this.Shots.Iterate())
                {
                    shot.Crash = DDCrashUtils.None();                     // reset
                    shot.Draw();
                }

                if (this.当たり判定表示)
                {
                    // 最後に描画されるように DDGround.EL.Add() する。

                    DDGround.EL.Add(() =>
                    {
                        DDCurtain.DrawCurtain(-0.8);

                        const double A = 0.3;

                        DDCrashView.Draw(new DDCrash[] { plCrash }, new I3Color(255, 0, 0), 1.0);
                        DDCrashView.Draw(this.Enemies.Iterate().Select(v => v.Crash), new I3Color(255, 255, 255), A);
                        DDCrashView.Draw(this.Shots.Iterate().Select(v => v.Crash), new I3Color(0, 255, 255), A);

                        return(false);
                    });
                }

                // ====
                // 描画ここまで
                // ====

                // ====
                // 当たり判定ここから
                // ====

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    if (1 <= enemy.HP)                     // ? 敵:生存 && 無敵ではない
                    {
                        foreach (Shot shot in this.Shots.Iterate())
                        {
                            // 衝突判定:敵 x 自弾
                            if (
                                !shot.DeadFlag &&                                 // ? 自弾:生存
                                enemy.Crash.IsCrashed(shot.Crash)                 // ? 衝突
                                )
                            {
                                // ★ 敵_被弾ここから

                                if (!shot.敵を貫通する)
                                {
                                    shot.Kill();
                                }

                                enemy.HP -= shot.AttackPoint;

                                if (1 <= enemy.HP)                                 // ? まだ生存している。
                                {
                                    enemy.Damaged(shot);
                                }
                                else                                 // ? 撃破した。
                                {
                                    enemy.Kill(true);
                                    break;                                     // この敵は死亡したので、この敵について以降の当たり判定は不要
                                }

                                // ★ 敵_被弾ここまで
                            }
                        }
                    }

                    // 衝突判定:敵 x 自機
                    if (
                        this.Player.DeadFrame == 0 &&                // ? プレイヤー死亡中ではない。
                        this.Player.DamageFrame == 0 &&              // ? プレイヤー・ダメージ中ではない。
                        this.Player.InvincibleFrame == 0 &&          // ? プレイヤー無敵時間中ではない。
                        !enemy.DeadFlag &&                           // ? 敵:生存
                        DDCrashUtils.IsCrashed(enemy.Crash, plCrash) // ? 衝突
                        )
                    {
                        // ★ 自機_被弾ここから

                        if (enemy.自機に当たると消滅する)
                        {
                            enemy.Kill();
                        }

                        this.Player.HP -= enemy.AttackPoint;

                        if (1 <= this.Player.HP)                         // ? まだ生存している。
                        {
                            this.Player.DamageFrame = 1;
                        }
                        else                         // ? 死亡した。
                        {
                            this.Player.HP        = -1;
                            this.Player.DeadFrame = 1;
                        }

                        // ★ 自機_被弾ここまで
                    }
                }

                foreach (Shot shot in this.Shots.Iterate())
                {
                    // 壁への当たり判定は自弾の「中心座標のみ」であることに注意して下さい。

                    if (
                        !shot.DeadFlag &&                                                                            // ? 自弾:生存
                        !shot.壁をすり抜ける &&                                                                             // ? この自弾は壁に当たる。
                        this.Map.GetCell(GameCommon.ToTablePoint(shot.X, shot.Y)).Tile.GetKind() == Tile.Kind_e.WALL // ? 壁に当たった。
                        )
                    {
                        shot.Kill();
                    }
                }

                // ====
                // 当たり判定ここまで
                // ====

                f_ゴミ回収();

                this.Enemies.RemoveAll(v => v.DeadFlag);
                this.Shots.RemoveAll(v => v.DeadFlag);

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }
            DDEngine.FreezeInput();

            if (this.Status.ExitDirection == 5)
            {
                DDMusicUtils.Fade();
                DDCurtain.SetCurtain(30, -1.0);

                foreach (DDScene scene in DDSceneUtils.Create(40))
                {
                    this.DrawWall();
                    this.DrawMap();

                    DDEngine.EachFrame();
                }
            }
            else
            {
                double destSlide_X = 0.0;
                double destSlide_Y = 0.0;

                switch (this.Status.ExitDirection)
                {
                case 4:
                    destSlide_X = DDConsts.Screen_W;
                    break;

                case 6:
                    destSlide_X = -DDConsts.Screen_W;
                    break;

                case 8:
                    destSlide_Y = DDConsts.Screen_H;
                    break;

                case 2:
                    destSlide_Y = -DDConsts.Screen_H;
                    break;

                default:
                    throw null;                             // never
                }
                using (DDSubScreen wallMapScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H))
                {
                    using (wallMapScreen.Section())
                    {
                        this.DrawWall();
                        this.DrawMap();
                    }
                    foreach (DDScene scene in DDSceneUtils.Create(30))
                    {
                        double slide_X = destSlide_X * scene.Rate;
                        double slide_Y = destSlide_Y * scene.Rate;

                        DDCurtain.DrawCurtain();
                        DDDraw.DrawSimple(wallMapScreen.ToPicture(), slide_X, slide_Y);

                        DDEngine.EachFrame();
                    }
                }
                DDCurtain.SetCurtain(0, -1.0);
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ退場時)
            // その他の反映箇所:
            // -- マップ入場時
            // -- セーブ時
            {
                this.Status.StartHP            = this.Player.HP;
                this.Status.StartFaceDirection = this.Player.FaceDirection;
                this.Status.Start選択武器          = this.Player.選択武器;
            }

            // ★★★ end of Perform() ★★★
        }
Example #18
0
        private void Setting()
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            string[] items = new string[]
            {
                "パッドのボタン設定",
                "ウィンドウサイズ変更",
                "BGM音量",
                "SE音量",
                "戻る",
            };

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = this.SimpleMenu.Perform("設定", items, selectIndex);

                switch (selectIndex)
                {
                case 0:
                    this.SimpleMenu.PadConfig();
                    break;

                case 1:
                    this.SimpleMenu.WindowSizeConfig();
                    break;

                case 2:
                    this.SimpleMenu.VolumeConfig("BGM音量", DDGround.MusicVolume, 0, 100, 1, 10, volume =>
                    {
                        DDGround.MusicVolume = volume;
                        DDMusicUtils.UpdateVolume();
                    },
                                                 () => { }
                                                 );
                    break;

                case 3:
                    this.SimpleMenu.VolumeConfig("SE音量", DDGround.SEVolume, 0, 100, 1, 10, volume =>
                    {
                        DDGround.SEVolume = volume;
                        DDSEUtils.UpdateVolume();
                    },
                                                 () =>
                    {
                        //Ground.I.SE.PauseIn.Play();
                    }
                                                 );
                    break;

                case 4:
                    goto endMenu;

                default:
                    throw new DDError();
                }
            }
endMenu:
            DDEngine.FreezeInput();
        }
Example #19
0
        public void Perform()
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            //Ground.I.Music.Title.Play();

            string[] items = new string[]
            {
                "ゲームスタート",
                "コンテニュー?",
                "設定",
                "終了",
            };

            int selectIndex = 0;

            this.SimpleMenu = new DDSimpleMenu();

            this.SimpleMenu.WallColor = WALL_COLOR;
            //this.SimpleMenu.WallPicture = Ground.I.Picture.TitleWall;

            for (; ;)
            {
                selectIndex = this.SimpleMenu.Perform("Donut2", items, selectIndex);

                switch (selectIndex)
                {
                case 0:
                {
                    this.LeaveTitleMenu();

                    using (World world = new World())
                    {
                        world.Scenarios = new IScenario[]
                        {
                            new Scenario0001(),
                        };

                        world.Perform();
                    }

                    this.ReturnTitleMenu();
                }
                break;

                case 1:
                    // TODO
                    break;

                case 2:
                    this.Setting();
                    break;

                case 3:
                    goto endMenu;

                default:
                    throw new DDError();
                }
            }
endMenu:
            DDEngine.FreezeInput();
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.DrawWall();
                DDEngine.EachFrame();
            }
        }
Example #20
0
        public void Perform()
        {
            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain();

            DDEngine.FreezeInput();

            Ground.I.Music.Title.Play();

            this.SimpleMenu = new DDSimpleMenu()
            {
                BorderColor = new I3Color(0, 96, 0),
                WallDrawer  = this.DrawWall.Execute,
            };

            this.TopMenu.SelectIndex = 0;

            for (; ;)
            {
                if (DDInput.DIR_8.IsPound())
                {
                    this.TopMenu.SelectIndex--;
                }

                if (DDInput.DIR_2.IsPound())
                {
                    this.TopMenu.SelectIndex++;
                }

                this.TopMenu.SelectIndex += TopMenuTask.ITEM_NUM;
                this.TopMenu.SelectIndex %= TopMenuTask.ITEM_NUM;

                if (DDInput.A.GetInput() == 1)                 // ? 決定ボタン押下
                {
                    switch (this.TopMenu.SelectIndex)
                    {
                    case 0:
                    {
                        this.LeaveTitleMenu();

                        using (new WorldGameMaster())
                        {
                            WorldGameMaster.I.World  = new World("Start");
                            WorldGameMaster.I.Status = new GameStatus();
                            WorldGameMaster.I.Perform();
                        }
                        this.ReturnTitleMenu();
                    }
                    break;

                    case 1:
                    {
                        this.DrawWall.DeepConfigEntered = true;
                        Ground.P_SaveDataSlot saveDataSlot = LoadGame();
                        this.DrawWall.DeepConfigEntered = false;

                        if (saveDataSlot != null)
                        {
                            this.LeaveTitleMenu();

                            using (new WorldGameMaster())
                            {
                                WorldGameMaster.I.World  = new World(saveDataSlot.MapName);
                                WorldGameMaster.I.Status = saveDataSlot.GameStatus.GetClone();
                                WorldGameMaster.I.Status.StartPointDirection = 101;                                                 // スタート地点を「ロード地点」にする。
                                WorldGameMaster.I.Perform();
                            }
                            this.ReturnTitleMenu();
                        }
                    }
                    break;

                    case 2:
                        this.DrawWall.TopMenuLeaved = true;

                        using (new SettingMenu()
                        {
                            SimpleMenu = this.SimpleMenu,
                            SetDeepConfigEntered = flag => this.DrawWall.DeepConfigEntered = flag,
                        })
                        {
                            SettingMenu.I.Perform();
                        }
                        this.DrawWall.TopMenuLeaved = false;
                        break;

                    case 3:
                        goto endMenu;

                    default:
                        throw new DDError();
                    }
                }
                if (DDInput.B.GetInput() == 1)                 // ? キャンセルボタン押下
                {
                    if (this.TopMenu.SelectIndex == TopMenuTask.ITEM_NUM - 1)
                    {
                        break;
                    }

                    this.TopMenu.SelectIndex = TopMenuTask.ITEM_NUM - 1;
                }

                this.DrawWall.Execute();
                this.TopMenu.Execute();

                DDEngine.EachFrame();
            }
endMenu:
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.SimpleMenu.WallDrawer();
                DDEngine.EachFrame();
            }

            DDEngine.FreezeInput();
        }
Example #21
0
        private void Setting()
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            string[] items = new string[]
            {
                "ゲームパッドのボタン設定",
                "キーボードのキー設定",
                "ウィンドウサイズ変更",
                "BGM音量",
                "SE音量",
                "ノベルパートのメッセージ表示速度",
                "戻る",
            };

            DDSE[] seSamples = Ground.I.SE.テスト用s;

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = this.SimpleMenu.Perform("設定", items, selectIndex);

                switch (selectIndex)
                {
                case 0:
                    this.SimpleMenu.PadConfig();
                    break;

                case 1:
                    this.SimpleMenu.PadConfig(true);
                    break;

                case 2:
                    this.SimpleMenu.WindowSizeConfig();
                    break;

                case 3:
                    this.SimpleMenu.VolumeConfig("BGM音量", DDGround.MusicVolume, 0, 100, 1, 10, volume =>
                    {
                        DDGround.MusicVolume = volume;
                        DDMusicUtils.UpdateVolume();
                    },
                                                 () => { }
                                                 );
                    break;

                case 4:
                    this.SimpleMenu.VolumeConfig("SE音量", DDGround.SEVolume, 0, 100, 1, 10, volume =>
                    {
                        DDGround.SEVolume = volume;
                        //DDSEUtils.UpdateVolume(); // old

                        foreach (DDSE se in seSamples)                                 // サンプルのみ音量更新
                        {
                            se.UpdateVolume();
                        }
                    },
                                                 () =>
                    {
                        DDUtils.Random.ChooseOne(seSamples).Play();
                    }
                                                 );
                    DDSEUtils.UpdateVolume();                             // 全音量更新
                    break;

                case 5:
                    this.SimpleMenu.IntVolumeConfig(
                        "ノベルパートのメッセージ表示速度",
                        Ground.I.NovelMessageSpeed,
                        NovelConsts.MESSAGE_SPEED_MIN,
                        NovelConsts.MESSAGE_SPEED_MAX,
                        1,
                        2,
                        speed => Ground.I.NovelMessageSpeed = speed,
                        () => { }
                        );
                    break;

                case 6:
                    goto endMenu;

                default:
                    throw new DDError();
                }
            }
endMenu:
            DDEngine.FreezeInput();
        }
Example #22
0
        public void Perform()
        {
            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain();

            DDEngine.FreezeInput();

            Ground.I.Music.Title.Play();

            string[] items = new string[]
            {
                "ゲームスタート",
                "コンテニュー(未実装)",
                "設定",
                "終了",
            };

            int selectIndex = 0;

            this.SimpleMenu = new DDSimpleMenu();

            this.SimpleMenu.BorderColor = new I3Color(0, 64, 128);
            //this.SimpleMenu.WallColor = new I3Color(60, 120, 130);
            //this.SimpleMenu.WallPicture = Ground.I.Picture.P_TITLE_WALL;
            //this.SimpleMenu.WallCurtain = -0.8;
            this.SimpleMenu.WallDrawer = this.背景.Execute;

            for (; ;)
            {
                selectIndex = this.SimpleMenu.Perform("横シュー・テストコード / タイトルメニュー", items, selectIndex);

                switch (selectIndex)
                {
                case 0:
                {
                    this.LeaveTitleMenu();

                    using (new Game())
                    {
                        Game.I.Script = new Script_Bステージ0001();                                         // 仮?
                        Game.I.Perform();
                    }
                    this.ReturnTitleMenu();
                }
                break;

                case 1:
                    // TODO
                    break;

                case 2:
                    this.Setting();
                    break;

                case 3:
                    goto endMenu;

                default:
                    throw new DDError();
                }
            }
endMenu:
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.SimpleMenu.DrawWall();
                DDEngine.EachFrame();
            }

            DDEngine.FreezeInput();
        }
Example #23
0
        public void Perform(bool continueByTitleMenuFlag = false)
        {
            // reset
            {
                this.SkipMode    = false;
                this.AutoMode    = false;
                this.BacklogMode = false;

                Surface_MessageWindow.Hide = false;
                Surface_SystemButtons.Hide = false;
            }

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain();

restartCurrPage:
            this.CurrPage = this.Status.Scenario.Pages[this.Status.CurrPageIndex];

            if (!continueByTitleMenuFlag)
            {
                foreach (ScenarioCommand command in this.CurrPage.Commands)
                {
                    command.Invoke();
                }
            }

            continueByTitleMenuFlag = false;

            this.DispSubtitleCharCount = 0;
            this.DispCharCount         = 0;
            this.DispPageEndedCount    = 0;
            this.DispFastMode          = false;

            DDEngine.FreezeInput();

            for (; ;)
            {
                bool nextPageFlag = false;

                // ★★★ キー押下は 1 マウス押下は -1 で判定する。

                // 入力:シナリオを進める。(マウスホイール)
                if (DDMouse.Rot < 0)
                {
                    this.CancelSkipAutoMode();

                    if (this.DispPageEndedCount < GameConsts.NEXT_PAGE_INPUT_INTERVAL)                     // ? ページ表示_未完了 -> ページ表示_高速化
                    {
                        this.DispFastMode = true;
                    }
                    else                     // ? ページ表示_完了 -> 次ページ
                    {
                        if (!this.Status.HasSelect())
                        {
                            nextPageFlag = true;
                        }
                    }
                    DDEngine.FreezeInput(GameConsts.SHORT_INPUT_SLEEP);
                }

                // 入力:シナリオを進める。(マウスホイール_以外)
                if (
                    DDMouse.L.GetInput() == -1 && this.SelectedSystemButtonIndex == -1 ||                     // システムボタン以外を左クリック
                    DDInput.A.GetInput() == 1
                    )
                {
                    if (this.DispPageEndedCount < GameConsts.NEXT_PAGE_INPUT_INTERVAL)                     // ? ページ表示_未完了 -> ページ表示_高速化
                    {
                        this.DispFastMode = true;
                    }
                    else                              // ? ページ表示_完了 -> 次ページ
                    {
                        if (!this.Status.HasSelect()) // ? 選択肢表示中ではない。
                        {
                            nextPageFlag = true;
                        }
                        else                         // ? 選択肢表示中
                        {
                            int index = this.Status.GetSelect().GetMouseFocusedIndex();

                            if (index != -1)                             // 選択中の選択肢へ進む
                            {
                                string scenarioName = this.Status.GetSelect().Options[index].ScenarioName;

                                this.Status.Scenario      = new Scenario(scenarioName);
                                this.Status.CurrPageIndex = 0;
                                this.Status.RemoveSelect();                                 // 選択肢_終了
                                //this.SkipMode = false; // moved

                                goto restartCurrPage;
                            }
                        }
                    }
                }

                if (this.SkipMode)
                {
                    if (!this.Status.HasSelect())
                    {
                        if (1 <= this.DispPageEndedCount)
                        {
                            nextPageFlag = true;
                        }
                    }
                }

                if (this.AutoMode)
                {
                    if (!this.Status.HasSelect())
                    {
                        if (GameConsts.AUTO_NEXT_PAGE_INTERVAL <= this.DispPageEndedCount)
                        {
                            nextPageFlag = true;
                        }
                    }
                }

                if (nextPageFlag)                 // 次ページ
                {
                    // スキップモード時はページを進める毎にエフェクトを強制終了する。
                    if (this.SkipMode)
                    {
                        foreach (Surface surface in this.Status.Surfaces)
                        {
                            surface.Act.Flush();
                        }
                    }

                    this.Status.CurrPageIndex++;

                    if (this.Status.Scenario.Pages.Count <= this.Status.CurrPageIndex)
                    {
                        break;
                    }

                    goto restartCurrPage;
                }

                // 入力:過去ログ
                if (
                    //DDInput.DIR_8.GetInput() == 1 || // 選択肢の選択に反応してしまう。
                    DDInput.DIR_4.GetInput() == 1 ||
                    0 < DDMouse.Rot
                    )
                {
                    this.Backlog();
                }

                // 入力:鑑賞モード
                if (
                    DDMouse.R.GetInput() == -1 ||
                    DDInput.B.GetInput() == 1
                    )
                {
                    this.Appreciate();
                }

                // 入力:システムボタン
                if (DDMouse.L.GetInput() == -1 && this.SelectedSystemButtonIndex != -1)                 // システムボタンを左クリック
                {
                    switch (this.SelectedSystemButtonIndex)
                    {
                    case 0:
                        foreach (Surface surface in this.Status.Surfaces)
                        {
                            surface.Act.Flush();
                        }

                        this.SaveMenu();
                        break;

                    case 1: this.LoadMenu(); break;

                    case 2: this.SkipMode = !this.SkipMode; break;

                    case 3: this.AutoMode = !this.AutoMode; break;

                    case 4: this.Backlog(); break;

                    case 5: this.SystemMenu(); break;

                    default:
                        throw null;                                 // never
                    }
                    if (this.SystemMenu_ReturnToTitleMenu)
                    {
                        break;
                    }
                }

                if (
                    this.CurrPage.Subtitle.Length < this.DispSubtitleCharCount &&
                    this.CurrPage.Text.Length < this.DispCharCount
                    )
                {
                    this.DispPageEndedCount++;
                }

                if (this.SkipMode)
                {
                    this.DispSubtitleCharCount += 8;
                    this.DispCharCount         += 8;
                }
                else if (this.DispFastMode)
                {
                    this.DispSubtitleCharCount += Ground.I.MessageSpeed;
                    this.DispCharCount         += Ground.I.MessageSpeed;
                }
                else
                {
                    int speed = (GameConsts.MESSAGE_SPEED_MAX + GameConsts.MESSAGE_SPEED_MIN) - Ground.I.MessageSpeed;

                    if (DDEngine.ProcFrame % speed == 0)
                    {
                        this.DispSubtitleCharCount++;
                    }

                    if (DDEngine.ProcFrame % (speed + 1) == 0)
                    {
                        this.DispCharCount++;
                    }
                }
                DDUtils.ToRange(ref this.DispSubtitleCharCount, 0, SCommon.IMAX);
                DDUtils.ToRange(ref this.DispCharCount, 0, SCommon.IMAX);

                // ====
                // 描画ここから
                // ====

                this.DrawSurfaces();

                // ====
                // 描画ここまで
                // ====

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }

            DDCurtain.SetCurtain(30, -1.0);
            DDMusicUtils.Fade();

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.DrawSurfaces();

                DDEngine.EachFrame();
            }

            DDEngine.FreezeInput();

            // ★★★ end of Perform() ★★★
        }
Example #24
0
        public void Perform()
        {
            Func <bool> f_ゴミ回収 = SCommon.Supplier(this.E_ゴミ回収());

            DDUtils.Random = new DDRandom(1u);             // 電源パターン確保のため

            this.Player.X = DDConsts.Screen_W / 4;
            this.Player.Y = DDConsts.Screen_H / 2;

            // ★★★★★
            // プレイヤー・ステータス反映(ステージ開始時)
            {
                // none
            }

            this.Player.RebornFrame = 1;

            Game.I.Walls.Add(new Wall_Dark());

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain(20);

            DDEngine.FreezeInput();

            for (this.Frame = 0; ; this.Frame++)
            {
                if (!this.Script.EachFrame())
                {
                    break;
                }

                if (!this.UserInputDisabled && DDInput.PAUSE.GetInput() == 1)                 // ポーズ
                {
                    DDMusicUtils.Pause();
                    this.Pause();

                    if (this.Pause_ReturnToTitleMenu)
                    {
                        break;
                    }
                    DDMusicUtils.Resume();
                }
                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1)
                {
                    this.DebugPause();
                }

                // プレイヤー行動
                {
                    bool   deadOrRebornOrUID = 1 <= this.Player.DeadFrame || 1 <= this.Player.RebornFrame || this.UserInputDisabled;
                    bool   deadOrUID         = 1 <= this.Player.DeadFrame || this.UserInputDisabled;
                    double xa = 0.0;
                    double ya = 0.0;

                    if (!deadOrUID && 1 <= DDInput.DIR_4.GetInput())                     // 左移動
                    {
                        xa = -1.0;
                    }
                    if (!deadOrUID && 1 <= DDInput.DIR_6.GetInput())                     // 右移動
                    {
                        xa = 1.0;
                    }
                    if (!deadOrUID && 1 <= DDInput.DIR_8.GetInput())                     // 上移動
                    {
                        ya = -1.0;
                    }
                    if (!deadOrUID && 1 <= DDInput.DIR_2.GetInput())                     // 下移動
                    {
                        ya = 1.0;
                    }

                    double speed;

                    if (1 <= DDInput.A.GetInput())                     // 低速ボタン押下中
                    {
                        speed = (double)this.Player.SpeedLevel;
                    }
                    else
                    {
                        speed = (double)(this.Player.SpeedLevel * 2);
                    }

                    this.Player.X += xa * speed;
                    this.Player.Y += ya * speed;

                    DDUtils.ToRange(ref this.Player.X, 0.0, DDConsts.Screen_W);
                    DDUtils.ToRange(ref this.Player.Y, 0.0, DDConsts.Screen_H);

                    if (!deadOrRebornOrUID && 1 <= DDInput.B.GetInput())                     // 攻撃ボタン押下中
                    {
                        this.Player.Shoot();
                    }

                    if (DDInput.C.GetInput() == 1)
                    {
                        this.Player.SpeedLevel--;
                    }
                    if (DDInput.D.GetInput() == 1)
                    {
                        this.Player.SpeedLevel++;
                    }
                    DDUtils.ToRange(ref this.Player.SpeedLevel, Player.SPEED_LEVEL_MIN, Player.SPEED_LEVEL_MAX);
                }

                //startDead:
                if (1 <= this.Player.DeadFrame)                 // プレイヤー死亡中の処理
                {
                    int frame = this.Player.DeadFrame - 1;

                    if (GameConsts.PLAYER_DEAD_FRAME_MAX < frame)
                    {
                        this.Player.DeadFrame = 0;

                        if (this.Status.Zanki <= 0)                         // ? 残機不足
                        {
                            break;
                        }

                        this.システム的な敵クリア();

                        this.Status.Zanki--;
                        this.Player.AttackLevel = Math.Max(0, this.Player.AttackLevel - 1);
                        this.Player.RebornFrame = 1;
                        goto endDead;
                    }
                    this.Player.DeadFrame++;

                    // ----

                    if (frame == 0)                     // init
                    {
                        DDMain.KeepMainScreen();

                        foreach (DDScene scene in DDSceneUtils.Create(20))
                        {
                            DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);

                            DDDraw.SetAlpha(0.3 + scene.Rate * 0.3);
                            DDDraw.SetBright(1.0, 0.0, 0.0);
                            DDDraw.DrawRect(Ground.I.Picture.WhiteBox, new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H));
                            DDDraw.Reset();

                            DDEngine.EachFrame();
                        }
                        DDGround.EL.Add(SCommon.Supplier(Effects.PlayerDead(this.Player.X, this.Player.Y)));
                    }
                }
endDead:

                //startReborn:
                if (1 <= this.Player.RebornFrame)                 // プレイヤー登場中の処理
                {
                    int frame = this.Player.RebornFrame - 1;

                    if (GameConsts.PLAYER_REBORN_FRAME_MAX < frame)
                    {
                        this.Player.RebornFrame     = 0;
                        this.Player.InvincibleFrame = 1;
                        goto endReborn;
                    }
                    this.Player.RebornFrame++;

                    // ----

                    double rate = (double)frame / GameConsts.PLAYER_REBORN_FRAME_MAX;

                    if (frame == 0)                     // init
                    {
                        this.Player.Reborn_X = -50.0;
                        this.Player.Reborn_Y = DDConsts.Screen_H / 2.0;
                    }
                    DDUtils.Approach(ref this.Player.Reborn_X, this.Player.X, 0.9 - 0.3 * rate);
                    DDUtils.Approach(ref this.Player.Reborn_Y, this.Player.Y, 0.9 - 0.3 * rate);
                }
endReborn:

                //startInvincible:
                if (1 <= this.Player.InvincibleFrame)                 // プレイヤー無敵時間中の処理
                {
                    int frame = this.Player.InvincibleFrame - 1;

                    if (GameConsts.PLAYER_INVINCIBLE_FRAME_MAX < frame)
                    {
                        this.Player.InvincibleFrame = 0;
                        goto endInvincible;
                    }
                    this.Player.InvincibleFrame++;

                    // ----

                    // noop
                }
endInvincible:

                DDCrash plCrash = DDCrashUtils.Point(new D2Point(this.Player.X, this.Player.Y));

                // ====
                // 描画ここから
                // ====

                foreach (Wall wall in this.Walls.Iterate())
                {
                    wall.Draw();
                }

                this.Player.Draw();

                // memo: DeadFlag をチェックするのは「当たり判定」から

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    enemy.Crash = DDCrashUtils.None();                     // reset
                    enemy.Draw();
                }
                foreach (Shot shot in this.Shots.Iterate())
                {
                    shot.Crash = DDCrashUtils.None();                     // reset
                    shot.Draw();
                }

                if (DDConfig.LOG_ENABLED && 1 <= DDInput.R.GetInput())                 // 当たり判定表示(チート)
                {
                    DDCurtain.DrawCurtain(-0.7);

                    const double A = 0.7;

                    DDCrashView.Draw(new DDCrash[] { plCrash }, new I3Color(255, 0, 0), 1.0);
                    DDCrashView.Draw(this.Enemies.Iterate().Select(v => v.Crash), new I3Color(255, 255, 255), A);
                    DDCrashView.Draw(this.Shots.Iterate().Select(v => v.Crash), new I3Color(0, 255, 255), A);
                }

                // ====
                // 描画ここまで
                // ====

                // ====
                // 当たり判定ここから
                // ====

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    if (
                        1 <= enemy.HP &&                                      // ? 敵:生存 && 無敵ではない
                        !DDUtils.IsOutOfScreen(new D2Point(enemy.X, enemy.Y)) // ? 画面内の敵である。
                        )
                    {
                        foreach (Shot shot in this.Shots.Iterate())
                        {
                            // 衝突判定:敵 x 自弾
                            if (
                                !shot.DeadFlag &&                                 // ? 自弾:生存
                                DDCrashUtils.IsCrashed(enemy.Crash, shot.Crash)   // ? 衝突
                                )
                            {
                                // ★ 敵_被弾ここから

                                shot.Kill();

                                enemy.HP -= shot.AttackPoint;

                                if (1 <= enemy.HP)                                 // ? まだ生存している。
                                {
                                    enemy.Damaged();
                                }
                                else                                 // ? 撃破した。
                                {
                                    enemy.Kill(true);
                                    break;                                     // この敵は死亡したので、この敵について以降の当たり判定は不要
                                }

                                // ★ 敵_被弾ここまで
                            }
                        }
                    }

                    // 衝突判定:敵 x 自機
                    if (
                        this.Player.RebornFrame == 0 &&                          // ? プレイヤー登場中ではない。
                        this.Player.DeadFrame == 0 &&                            // ? プレイヤー死亡中ではない。
                        this.Player.InvincibleFrame == 0 &&                      // ? プレイヤー無敵時間中ではない。
                        !enemy.DeadFlag &&                                       // ? 敵:生存
                        !DDUtils.IsOutOfScreen(new D2Point(enemy.X, enemy.Y)) && // ? 画面内の敵である。
                        DDCrashUtils.IsCrashed(enemy.Crash, plCrash)             // ? 衝突
                        )
                    {
                        // ★ 自機_被弾ここから

                        this.Player.DeadFrame = 1;

                        // ★ 自機_被弾ここまで
                    }
                }

                // ====
                // 当たり判定ここまで
                // ====

                // 不要な壁の死亡フラグを立てる。
                // -- FilledFlag == true な Wall より下の Wall は見えないので破棄して良い。
                {
                    bool flag = false;

                    for (int index = this.Walls.Count - 1; 0 <= index; index--)
                    {
                        this.Walls[index].DeadFlag |= flag;
                        flag |= this.Walls[index].FilledFlag;
                    }
                }

                f_ゴミ回収();

                this.Walls.RemoveAll(v => v.DeadFlag);
                this.Enemies.RemoveAll(v => v.DeadFlag);
                this.Shots.RemoveAll(v => v.DeadFlag);

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }

            DDMain.KeepMainScreen();

            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                DDEngine.EachFrame();
            }

            // ★★★★★
            // プレイヤー・ステータス反映(ステージ終了時)
            {
                // none
            }

            // ★★★ end of Perform() ★★★
        }
Example #25
0
        private void Setting()
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            string[] items = new string[]
            {
                "ゲームパッドのボタン設定",
                "キーボードのキー設定",
                "ウィンドウサイズ変更",
                "BGM音量",
                "SE音量",
                "スナップショット・ストック数",
                "戻る",
            };

            DDSE[] seSamples = new DDSE[]
            {
                Ground.I.SE.Dummy,                 // TODO
            };

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = this.SimpleMenu.Perform("設定", items, selectIndex, false, 282, 48, 60);

                switch (selectIndex)
                {
                case 0:
                    this.SimpleMenu.PadConfig();
                    break;

                case 1:
                    this.SimpleMenu.PadConfig(true);
                    break;

                case 2:
                    this.SimpleMenu.WindowSizeConfig();
                    break;

                case 3:
                    this.SimpleMenu.VolumeConfig("BGM音量", DDGround.MusicVolume, 0, 100, 1, 10, volume =>
                    {
                        DDGround.MusicVolume = volume;
                        DDMusicUtils.UpdateVolume();
                    },
                                                 () => { }
                                                 );
                    break;

                case 4:
                    this.SimpleMenu.VolumeConfig("SE音量", DDGround.SEVolume, 0, 100, 1, 10, volume =>
                    {
                        DDGround.SEVolume = volume;
                        //DDSEUtils.UpdateVolume(); // old

                        foreach (DDSE se in seSamples)                                 // サンプルのみ音量更新
                        {
                            se.UpdateVolume();
                        }
                    },
                                                 () =>
                    {
                        DDUtils.Random.ChooseOne(seSamples).Play();
                    }
                                                 );
                    DDSEUtils.UpdateVolume();                             // 全音量更新
                    break;

                case 5:
                    this.Setting_SnapshotCountMax();
                    break;

                case 6:
                    goto endMenu;

                default:
                    throw new DDError();
                }
            }
endMenu:
            DDEngine.FreezeInput();
        }
Example #26
0
        public void Perform()
        {
            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain();

            DDEngine.FreezeInput();

            Ground.I.Music.Title.Play();

            this.SimpleMenu = new DDSimpleMenu()
            {
                BorderColor = new I3Color(64, 0, 0),
                WallDrawer  = this.DrawWall.Execute,
            };

            this.TopMenu.SelectIndex = 0;

            for (; ;)
            {
                bool cheatFlag;

                {
                    int bk_freezeInputFrame = DDEngine.FreezeInputFrame;
                    DDEngine.FreezeInputFrame = 0;
                    cheatFlag = 1 <= DDInput.DIR_6.GetInput();
                    DDEngine.FreezeInputFrame = bk_freezeInputFrame;
                }

                if (DDInput.DIR_8.IsPound())
                {
                    this.TopMenu.SelectIndex--;
                }

                if (DDInput.DIR_2.IsPound())
                {
                    this.TopMenu.SelectIndex++;
                }

                this.TopMenu.SelectIndex += TopMenuTask.ITEM_NUM;
                this.TopMenu.SelectIndex %= TopMenuTask.ITEM_NUM;

                if (DDInput.A.GetInput() == 1)                 // ? 決定ボタン押下
                {
                    switch (this.TopMenu.SelectIndex)
                    {
                    case 0:
                        if (DDConfig.LOG_ENABLED && cheatFlag)
                        {
                            this.DrawWall.TopMenuLeaved = true;
                            this.CheatMainMenu();
                            this.DrawWall.TopMenuLeaved = false;                                     // restore
                        }
                        else
                        {
                            this.LeaveTitleMenu();

                            using (new GameProgressMaster())
                            {
                                GameProgressMaster.I.Perform();
                            }
                            this.ReturnTitleMenu();
                        }
                        break;

                    case 1:
                    {
                        this.LeaveTitleMenu();

                        using (new GameProgressMaster())
                        {
                            GameProgressMaster.I.Perform_コンテニュー();
                        }
                        this.ReturnTitleMenu();
                    }
                    break;

                    case 2:
                    {
                        this.DrawWall.TopMenuLeaved = true;

                        using (new SettingMenu())
                        {
                            SettingMenu.I.SimpleMenu = this.SimpleMenu;
                            SettingMenu.I.Perform();
                        }
                        this.DrawWall.TopMenuLeaved = false;                                         // restore
                    }
                    break;

                    case 3:
                        goto endMenu;

                    default:
                        throw new DDError();
                    }
                }
                if (DDInput.B.GetInput() == 1)                 // ? キャンセルボタン押下
                {
                    if (this.TopMenu.SelectIndex == TopMenuTask.ITEM_NUM - 1)
                    {
                        break;
                    }

                    this.TopMenu.SelectIndex = TopMenuTask.ITEM_NUM - 1;
                }

                this.DrawWall.Execute();
                this.TopMenu.Execute();

                DDEngine.EachFrame();
            }
endMenu:
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.SimpleMenu.WallDrawer();
                DDEngine.EachFrame();
            }

            DDEngine.FreezeInput();
        }
Example #27
0
        private void 基本設定()
        {
            DDSE[] seSamples = new DDSE[]
            {
                Ground.I.SE.Poka01,
                Ground.I.SE.Poka02,
            };

            DDEngine.FreezeInput();

            for (; ;)
            {
                // ====
                // 入力判定ここから
                // ====

                if (
                    DDInput.A.GetInput() == 1 ||
                    DDInput.B.GetInput() == 1 ||
                    DDMouse.R.GetInput() == -1
                    )
                {
                    this.Mode = Mode_e.END;
                    break;
                }

                if (DDMouse.L.GetInput() == -1)
                {
                    if (this.GetTabTitleCrash_拡張設定().IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
                    {
                        this.Mode = Mode_e.拡張設定;
                        break;
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_フルスクリーン)
                    {
                        DDMain.SetFullScreen();
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_ウィンドウ)
                    {
                        const int def_screen_w = DDConsts.Screen_W / 2;
                        const int def_screen_h = DDConsts.Screen_H / 2;

                        DDMain.SetScreenSize(def_screen_w, def_screen_h);
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_デフォルトに戻す)
                    {
                        this.デフォルトに戻す();
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_戻る)
                    {
                        this.Mode = Mode_e.END;
                        break;
                    }
                }

                // ====
                // 入力判定ここまで
                // ====

                // ====
                // 描画ここから
                // ====

                this.BeforeDrawContents();

                DDDraw.DrawSimple(Ground.I.Picture.基本設定枠, 0, 0);

                this.DrawTabTitles(false);

                this.DrawPrompt(100, 250, "画面モード");
                this.DrawPrompt(100, 380, "BGM音量");
                this.DrawPrompt(100, 510, "SE音量");
                this.DrawPrompt(100, 640, "メッセージ表示速度");
                this.DrawPrompt(100, 770, "メッセージウィンドウ透明度");

                bool fullScreenFlag =
                    DDGround.RealScreen_W == DDGround.MonitorRect.W &&
                    DDGround.RealScreen_H == DDGround.MonitorRect.H;

                this.DrawButton(1100, 280, Ground.I.Picture.SettingButton_フルスクリーン, fullScreenFlag);
                this.DrawButton(1550, 280, Ground.I.Picture.SettingButton_ウィンドウ, !fullScreenFlag);
                this.DrawTrackBar(1325, 410, "小", "大", DDGround.MusicVolume, volume =>
                {
                    DDGround.MusicVolume = volume;
                    DDMusicUtils.UpdateVolume();
                });
                this.DrawTrackBar(1325, 540, "小", "大", DDGround.SEVolume, volume =>
                {
                    DDGround.SEVolume = volume;
                    //DDSEUtils.UpdateVolume(); // v_20210215 -- メソッド終了時に全て更新する。

                    foreach (DDSE se in seSamples)
                    {
                        se.UpdateVolume();
                    }
                },
                                  () =>
                {
                    DDUtils.Random.ChooseOne(seSamples).Play();
                });
                this.DrawTrackBar(1325, 670, "遅い", "速い",
                                  DDUtils.RateAToB(GameConsts.MESSAGE_SPEED_MIN, GameConsts.MESSAGE_SPEED_MAX, Ground.I.MessageSpeed),
                                  value => Ground.I.MessageSpeed = SCommon.ToInt(
                                      DDUtils.AToBRate(GameConsts.MESSAGE_SPEED_MIN, GameConsts.MESSAGE_SPEED_MAX, value)
                                      )
                                  );
                this.DrawTrackBar(1325, 800, "透明", "不透明",
                                  DDUtils.RateAToB(0, 100, Ground.I.MessageWindow_A_Pct),
                                  value => Ground.I.MessageWindow_A_Pct = SCommon.ToInt(
                                      DDUtils.AToBRate(0, 100, value)
                                      )
                                  );

                this.DrawUnderButtons();

                // ====
                // 描画ここまで
                // ====

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

            DDSEUtils.UpdateVolume();             // v_20210215
        }
Example #28
0
        public void Perform()
        {
            Func <bool> f_ゴミ回収 = SCommon.Supplier(this.E_ゴミ回収());

            this.Map = new Map(GameCommon.GetMapFile(this.World.GetCurrMapName()));
            this.ReloadEnemies();

            // デフォルトの「プレイヤーのスタート地点」
            // -- マップの中央
            this.Player.X = this.Map.W * GameConsts.TILE_W / 2.0;
            this.Player.Y = this.Map.H * GameConsts.TILE_H / 2.0;

            {
                Enemy enemy = this.Enemies.Iterate().FirstOrDefault(v => v is Enemy_スタート地点 && ((Enemy_スタート地点)v).Direction == this.Status.StartPointDirection);

                if (enemy != null)
                {
                    this.Player.X = enemy.X;
                    this.Player.Y = enemy.Y;
                }
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ入場時)
            // その他の反映箇所:
            // -- マップ退場時
            // -- セーブ時
            {
                this.Player.HP         = this.Status.StartHP;
                this.Player.FacingLeft = this.Status.StartFacingLeft;
                this.Player.武器         = this.Status.Start_武器;
            }

            this.Wall = WallCreator.Create(this.Map.WallName);

            MusicCollection.Get(this.Map.MusicName).Play();

            DDGround.Camera.X = this.Player.X - DDConsts.Screen_W / 2.0;
            DDGround.Camera.Y = this.Player.Y - DDConsts.Screen_H / 2.0;

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain(10);

            DDEngine.FreezeInput();

            bool jumpLock = false;             // ? ジャンプ・ロック // ジャンプしたらボタンを離すまでロックする。

            for (this.Frame = 0; ; this.Frame++)
            {
                if (!this.UserInputDisabled && DDInput.PAUSE.GetInput() == 1)
                {
                    this.Pause();

                    if (this.Pause_ReturnToTitleMenu)
                    {
                        this.Status.ExitDirection = 5;
                        break;
                    }
                }
                if (this.RequestReturnToTitleMenu)
                {
                    this.Status.ExitDirection = 5;
                    break;
                }
                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1)
                {
                    this.DebugPause();
                }

                // 死亡時にカメラ移動を止める。
                //if (this.Player.DeadFrame == 0)
                //    this.カメラ位置調整(false);

                this.カメラ位置調整(false);

                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_E) == 1)                 // エディットモード(デバッグ用)
                {
                    this.Edit();
                    this.ReloadEnemies();
                    this.Frame = 0;
                }

                // プレイヤー入力
                {
                    bool deadOrDamageOrUID = 1 <= this.Player.DeadFrame || 1 <= this.Player.DamageFrame || this.UserInputDisabled;
                    bool move     = false;
                    bool slow     = false;
                    bool camSlide = false;
                    int  jump     = 0;
                    bool shagami  = false;
                    bool attack   = false;

                    if (!deadOrDamageOrUID && 1 <= DDInput.DIR_2.GetInput() || this.PlayerHacker.DIR_2)
                    {
                        shagami = true;
                    }

                    // 入力抑止中であるか否かに関わらず左右の入力は受け付ける様にする。
                    int freezeInputFrameBackup = DDEngine.FreezeInputFrame;
                    DDEngine.FreezeInputFrame = 0;

                    if (!deadOrDamageOrUID && 1 <= DDInput.DIR_4.GetInput() || this.PlayerHacker.DIR_4)
                    {
                        this.Player.FacingLeft = true;
                        move = true;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.DIR_6.GetInput() || this.PlayerHacker.DIR_6)
                    {
                        this.Player.FacingLeft = false;
                        move = true;
                    }

                    DDEngine.FreezeInputFrame = freezeInputFrameBackup;                     // restore

                    if (1 <= DDInput.L.GetInput())
                    {
                        move     = false;
                        shagami  = false;
                        camSlide = true;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.R.GetInput() || this.PlayerHacker.Slow)
                    {
                        slow = true;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.A.GetInput())
                    {
                        jump = DDInput.A.GetInput();
                    }
                    if (this.PlayerHacker.Jump != 0)
                    {
                        jump = this.PlayerHacker.Jump;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.B.GetInput() || this.PlayerHacker.Attack)
                    {
                        attack = true;
                    }

                    if (move)
                    {
                        this.Player.MoveFrame++;
                        shagami = false;
                    }
                    else
                    {
                        this.Player.MoveFrame = 0;
                    }

                    this.Player.MoveSlow = move && slow;

                    if (jump == 0)
                    {
                        jumpLock = false;
                    }

                    if (1 <= this.Player.JumpFrame)
                    {
                        const int JUMP_FRAME_MAX = 22;

                        if (1 <= jump && this.Player.JumpFrame < JUMP_FRAME_MAX)
                        {
                            this.Player.JumpFrame++;
                        }
                        else
                        {
                            this.Player.JumpFrame = 0;
                        }
                    }
                    else
                    {
                        // 事前入力 == 着地前の数フレーム間にジャンプボタンを押し始めてもジャンプできるようにする。
                        // 入力猶予 == 落下(地面から離れた)直後の数フレーム間にジャンプボタンを押し始めてもジャンプできるようにする。

                        const int 事前入力時間 = 5;
                        const int 入力猶予時間 = 5;

                        if (1 <= jump && jump < 事前入力時間 && this.Player.AirborneFrame < 入力猶予時間 && this.Player.JumpCount == 0 && !jumpLock)
                        {
                            this.Player.JumpCount = 1;
                            this.Player.JumpFrame = 1;
                            jumpLock = true;
                        }
                    }

                    if (this.Player.JumpFrame == 1)                     // ? ジャンプ開始
                    {
                        Ground.I.SE.PlayerJump.Play();
                    }

                    if (camSlide)
                    {
                        if (DDInput.DIR_4.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideX--;
                        }
                        if (DDInput.DIR_6.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideX++;
                        }
                        if (DDInput.DIR_8.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideY--;
                        }
                        if (DDInput.DIR_2.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideY++;
                        }
                        DDUtils.ToRange(ref this.CamSlideX, -1, 1);
                        DDUtils.ToRange(ref this.CamSlideY, -1, 1);
                    }
                    else
                    {
                        if (this.CamSlideMode && this.CamSlideCount == 0)
                        {
                            this.CamSlideX = 0;
                            this.CamSlideY = 0;
                        }
                        this.CamSlideCount = 0;
                    }
                    this.CamSlideMode = camSlide;

                    if (1 <= this.Player.AirborneFrame)
                    {
                        shagami = false;
                    }

                    if (shagami)
                    {
                        this.Player.ShagamiFrame++;
                    }
                    else
                    {
                        this.Player.ShagamiFrame = 0;
                    }

                    if (attack)
                    {
                        this.Player.AttackFrame++;
                    }
                    else
                    {
                        this.Player.AttackFrame = 0;
                    }
                }

                //startDead:
                if (1 <= this.Player.DeadFrame)                 // プレイヤー死亡中の処理
                {
                    if (GameConsts.PLAYER_DEAD_FRAME_MAX < ++this.Player.DeadFrame)
                    {
                        this.Player.DeadFrame     = 0;
                        this.Status.ExitDirection = 5;
                        break;
                    }
                    int    frame = this.Player.DeadFrame;                  // 値域 == 2 ~ GameConsts.PLAYER_DEAD_FRAME_MAX
                    double rate  = DDUtils.RateAToB(2, GameConsts.PLAYER_DEAD_FRAME_MAX, frame);

                    // ---- Dead

                    const int HIT_BACK_FRAME_MAX = 30;

                    if (frame < HIT_BACK_FRAME_MAX)
                    {
                        double hitBackRate = (double)frame / HIT_BACK_FRAME_MAX;

                        this.Player.X -= 10.0 * (1.0 - hitBackRate) * (this.Player.FacingLeft ? -1 : 1);
                    }
                }
                //endDead:

                //startDamage:
                if (1 <= this.Player.DamageFrame)                 // プレイヤー・ダメージ中の処理
                {
                    if (GameConsts.PLAYER_DAMAGE_FRAME_MAX < ++this.Player.DamageFrame)
                    {
                        this.Player.DamageFrame     = 0;
                        this.Player.InvincibleFrame = 1;
                        goto endDamage;
                    }
                    int    frame = this.Player.DamageFrame;                  // 値域 == 2 ~ GameConsts.PLAYER_DAMAGE_FRAME_MAX
                    double rate  = DDUtils.RateAToB(2, GameConsts.PLAYER_DAMAGE_FRAME_MAX, frame);

                    // ---- Damage

                    this.Player.X -= (9.0 - 6.0 * rate) * (this.Player.FacingLeft ? -1 : 1);
                }
endDamage:

                //startInvincible:
                if (1 <= this.Player.InvincibleFrame)                 // プレイヤー無敵時間中の処理
                {
                    if (GameConsts.PLAYER_INVINCIBLE_FRAME_MAX < ++this.Player.InvincibleFrame)
                    {
                        this.Player.InvincibleFrame = 0;
                        goto endInvincible;
                    }
                    int    frame = this.Player.InvincibleFrame;                  // 値域 == 2 ~ GameConsts.PLAYER_INVINCIBLE_FRAME_MAX
                    double rate  = DDUtils.RateAToB(2, GameConsts.PLAYER_INVINCIBLE_FRAME_MAX, frame);

                    // ---- Invincible

                    // noop
                }
endInvincible:

                // プレイヤー移動
                {
                    if (1 <= this.Player.MoveFrame)
                    {
                        double speed = 0.0;

                        if (this.Player.MoveSlow)
                        {
                            speed = this.Player.MoveFrame * 0.2;
                            DDUtils.Minim(ref speed, GameConsts.PLAYER_SLOW_SPEED);
                        }
                        else
                        {
                            speed = GameConsts.PLAYER_SPEED;
                        }

                        speed *= this.Player.FacingLeft ? -1 : 1;

                        this.Player.X += speed;
                    }
                    else
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X);
                    }

                    if (1 <= this.Player.JumpFrame)
                    {
                        this.Player.YSpeed = GameConsts.PLAYER_ジャンプによる上昇速度;
                    }
                    else
                    {
                        this.Player.YSpeed += GameConsts.PLAYER_GRAVITY;
                    }

                    DDUtils.Minim(ref this.Player.YSpeed, GameConsts.PLAYER_FALL_SPEED_MAX);

                    this.Player.Y += this.Player.YSpeed;                     // 自由落下
                }

                // プレイヤー位置矯正
                {
                    bool touchSide_L =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y - GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y + GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall();

                    bool touchSide_R =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y - GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y + GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall();

                    if (touchSide_L && touchSide_R)                     // -> 壁抜け防止のため再チェック
                    {
                        touchSide_L = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall();
                        touchSide_R = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall();
                    }

                    if (touchSide_L && touchSide_R)
                    {
                        // noop
                    }
                    else if (touchSide_L)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W + GameConsts.PLAYER_側面判定Pt_X;
                    }
                    else if (touchSide_R)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W - GameConsts.PLAYER_側面判定Pt_X;
                    }

                    bool touchCeiling_L =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_脳天判定Pt_X, this.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y)).Tile.IsWall();

                    bool touchCeiling_R =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_脳天判定Pt_X, this.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y)).Tile.IsWall();

                    if (touchCeiling_L && touchCeiling_R)
                    {
                        if (this.Player.YSpeed < 0.0)
                        {
                            double plY = ((int)((this.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y) / GameConsts.TILE_H) + 1) * GameConsts.TILE_H + GameConsts.PLAYER_脳天判定Pt_Y;

                            this.Player.Y         = plY;
                            this.Player.YSpeed    = 0.0;
                            this.Player.JumpFrame = 0;
                        }
                    }
                    else if (touchCeiling_L)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W + GameConsts.PLAYER_脳天判定Pt_X;
                    }
                    else if (touchCeiling_R)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W - GameConsts.PLAYER_脳天判定Pt_X;
                    }

                    bool touchGround =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_接地判定Pt_X, this.Player.Y + GameConsts.PLAYER_接地判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_接地判定Pt_X, this.Player.Y + GameConsts.PLAYER_接地判定Pt_Y)).Tile.IsWall();

                    if (touchGround)
                    {
                        if (0.0 < this.Player.YSpeed)
                        {
                            double plY = (int)((this.Player.Y + GameConsts.PLAYER_接地判定Pt_Y) / GameConsts.TILE_H) * GameConsts.TILE_H - GameConsts.PLAYER_接地判定Pt_Y;

                            this.Player.Y      = plY;
                            this.Player.YSpeed = 0.0;
                        }
                    }

                    if (touchGround)
                    {
                        this.Player.JumpCount     = 0;
                        this.Player.AirborneFrame = 0;
                    }
                    else
                    {
                        this.Player.AirborneFrame++;
                    }
                }
                //endPlayer:

                if (this.Player.X < 0.0)                 // ? マップの左側に出た。
                {
                    this.Status.ExitDirection = 4;
                    break;
                }
                if (this.Map.W * GameConsts.TILE_W < this.Player.X)                 // ? マップの右側に出た。
                {
                    this.Status.ExitDirection = 6;
                    break;
                }
                if (this.Player.Y < 0.0)                 // ? マップの上側に出た。
                {
                    this.Status.ExitDirection = 8;
                    break;
                }
                if (this.Map.H * GameConsts.TILE_H < this.Player.Y)                 // ? マップの下側に出た。
                {
                    this.Status.ExitDirection = 2;
                    break;
                }

                // 画面遷移時の微妙なカメラ位置ズレ解消
                // -- スタート地点(入場地点)が地面と接していると、最初のフレームでプレイヤーは上に押し出されてカメラの初期位置とズレてしまう。
                if (this.Frame == 0 || this.次のカメラ位置調整を一瞬で)
                {
                    this.次のカメラ位置調整を一瞬で = false;
                    this.カメラ位置調整(true);
                }

                if (1 <= this.Player.AttackFrame)
                {
                    this.Player.Attack();
                }

                DDCrash plCrash = DDCrashUtils.Point(new D2Point(this.Player.X, this.Player.Y + (1 <= this.Player.ShagamiFrame ? 16 : 0)));

                // ====
                // 描画ここから
                // ====

                this.DrawWall();
                this.DrawMap();
                this.Player.Draw();

                // memo: DeadFlag をチェックするのは「当たり判定」から

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    enemy.Crash = DDCrashUtils.None();                     // reset
                    enemy.Draw();
                }
                foreach (Shot shot in this.Shots.Iterate())
                {
                    shot.Crash = DDCrashUtils.None();                     // reset
                    shot.Draw();
                }

                if (this.当たり判定表示)
                {
                    // 最後に描画されるように DDGround.EL.Add() する。

                    DDGround.EL.Add(() =>
                    {
                        DDCurtain.DrawCurtain(-0.7);

                        const double A = 0.7;

                        DDCrashView.Draw(new DDCrash[] { plCrash }, new I3Color(255, 0, 0), 1.0);
                        DDCrashView.Draw(this.Enemies.Iterate().Select(v => v.Crash), new I3Color(255, 255, 255), A);
                        DDCrashView.Draw(this.Shots.Iterate().Select(v => v.Crash), new I3Color(0, 255, 255), A);

                        return(false);
                    });
                }

                // ====
                // 描画ここまで
                // ====

                // ====
                // 当たり判定ここから
                // ====

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    if (1 <= enemy.HP)                     // ? 敵:生存 && 無敵ではない
                    {
                        foreach (Shot shot in this.Shots.Iterate())
                        {
                            // 衝突判定:敵 x 自弾
                            if (
                                !shot.DeadFlag &&                                 // ? 自弾:生存
                                enemy.Crash.IsCrashed(shot.Crash)                 // ? 衝突
                                )
                            {
                                // ★ 敵_被弾ここから

                                enemy.HP -= shot.AttackPoint;

                                if (!shot.敵を貫通する)                                 // 自弾の攻撃力と敵のHPを相殺
                                {
                                    if (0 <= enemy.HP)                            // ? 丁度削りきった || 削りきれなかった -> 攻撃力を使い果たしたので、ショットは消滅
                                    {
                                        shot.Kill();
                                    }
                                    else
                                    {
                                        shot.AttackPoint = -enemy.HP;                                         // 過剰に削った分を残りの攻撃力として反映
                                    }
                                }

                                if (1 <= enemy.HP)                                 // ? まだ生存している。
                                {
                                    enemy.Damaged(shot);
                                }
                                else                                 // ? 撃破した。
                                {
                                    enemy.Kill(true);
                                    break;                                     // この敵は死亡したので、この敵について以降の当たり判定は不要
                                }

                                // ★ 敵_被弾ここまで
                            }
                        }
                    }

                    // 衝突判定:敵 x 自機
                    if (
                        this.Player.DeadFrame == 0 &&                // ? プレイヤー死亡中ではない。
                        this.Player.DamageFrame == 0 &&              // ? プレイヤー・ダメージ中ではない。
                        this.Player.InvincibleFrame == 0 &&          // ? プレイヤー無敵時間中ではない。
                        !enemy.DeadFlag &&                           // ? 敵:生存
                        DDCrashUtils.IsCrashed(enemy.Crash, plCrash) // ? 衝突
                        )
                    {
                        // ★ 自機_被弾ここから

                        if (enemy.自機に当たると消滅する)
                        {
                            enemy.Kill();
                        }

                        this.Player.HP -= enemy.AttackPoint;

                        if (1 <= this.Player.HP)                         // ? まだ生存している。
                        {
                            this.Player.DamageFrame = 1;
                        }
                        else                         // ? 死亡した。
                        {
                            this.Player.HP        = -1;
                            this.Player.DeadFrame = 1;
                        }

                        // ★ 自機_被弾ここまで
                    }
                }

                foreach (Shot shot in this.Shots.Iterate())
                {
                    // 壁への当たり判定は自弾の「中心座標のみ」であることに注意して下さい。

                    if (
                        !shot.DeadFlag &&                                                       // ? 自弾:生存
                        !shot.壁をすり抜ける &&                                                        // ? この自弾は壁に当たる。
                        this.Map.GetCell(GameCommon.ToTablePoint(shot.X, shot.Y)).Tile.IsWall() // ? 壁に当たった。
                        )
                    {
                        shot.Kill();
                    }
                }

                // ====
                // 当たり判定ここまで
                // ====

                f_ゴミ回収();

                this.Enemies.RemoveAll(v => v.DeadFlag);
                this.Shots.RemoveAll(v => v.DeadFlag);

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }
            DDEngine.FreezeInput();

            if (this.Status.ExitDirection == 5)
            {
                DDMusicUtils.Fade();
                DDCurtain.SetCurtain(30, -1.0);

                foreach (DDScene scene in DDSceneUtils.Create(40))
                {
                    this.DrawWall();
                    this.DrawMap();

                    DDEngine.EachFrame();
                }
            }
            else
            {
                double destSlide_X = 0.0;
                double destSlide_Y = 0.0;

                switch (this.Status.ExitDirection)
                {
                case 4:
                    destSlide_X = DDConsts.Screen_W;
                    break;

                case 6:
                    destSlide_X = -DDConsts.Screen_W;
                    break;

                case 8:
                    destSlide_Y = DDConsts.Screen_H;
                    break;

                case 2:
                    destSlide_Y = -DDConsts.Screen_H;
                    break;

                default:
                    throw null;                             // never
                }
                using (DDSubScreen wallMapScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H))
                {
                    using (wallMapScreen.Section())
                    {
                        this.DrawWall();
                        this.DrawMap();
                    }
                    foreach (DDScene scene in DDSceneUtils.Create(30))
                    {
                        double slide_X = destSlide_X * scene.Rate;
                        double slide_Y = destSlide_Y * scene.Rate;

                        DDCurtain.DrawCurtain();
                        DDDraw.DrawSimple(wallMapScreen.ToPicture(), slide_X, slide_Y);

                        DDEngine.EachFrame();
                    }
                }
                DDCurtain.SetCurtain(0, -1.0);
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ退場時)
            // その他の反映箇所:
            // -- マップ入場時
            // -- セーブ時
            {
                this.Status.StartHP         = this.Player.HP;
                this.Status.StartFacingLeft = this.Player.FacingLeft;
                this.Status.Start_武器        = this.Player.武器;
            }

            // ★★★ end of Perform() ★★★
        }
Example #29
0
        public void Perform()
        {
            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain();

            DDEngine.FreezeInput();

            Ground.I.Music.Title.Play();

            this.SimpleMenu = new DDSimpleMenu();

            this.SimpleMenu.BorderColor = new I3Color(0, 96, 192);
            this.SimpleMenu.WallDrawer  = this.DrawWall.Execute;

            for (; ;)
            {
                if (DDInput.DIR_8.IsPound())
                {
                    this.TopMenu.SelectIndex--;
                }

                if (DDInput.DIR_2.IsPound())
                {
                    this.TopMenu.SelectIndex++;
                }

                this.TopMenu.SelectIndex += TopMenuTask.ITEM_NUM;
                this.TopMenu.SelectIndex %= TopMenuTask.ITEM_NUM;

                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_Q) == 1)                 // (開発デバッグ用)ロック解除
                {
                    Ground.I.ReachedStageIndex = 10;
                }
                if (DDInput.A.GetInput() == 1)                 // ? 決定ボタン押下
                {
                    switch (this.TopMenu.SelectIndex)
                    {
                    case 0:
                        if (DDConfig.LOG_ENABLED && 1 <= DDInput.DIR_6.GetInput())
                        {
                            this.DrawWall.TopMenuLeaved = true;
                            this.CheatMainMenu();
                            this.DrawWall.TopMenuLeaved = false;
                        }
                        else
                        {
                            this.LeaveTitleMenu();

                            using (new GameProgressMaster())
                            {
                                GameProgressMaster.I.StartStageIndex = 1;
                                GameProgressMaster.I.Perform();
                            }
                            this.ReturnTitleMenu();
                        }
                        break;

                    case 1:
                        this.DrawWall.TopMenuLeaved = true;
                        this.SelectStage();
                        this.DrawWall.TopMenuLeaved = false;
                        break;

                    case 2:
                        this.DrawWall.TopMenuLeaved = true;
                        this.Setting();
                        this.DrawWall.TopMenuLeaved = false;
                        break;

                    case 3:
                        goto endMenu;

                    default:
                        throw new DDError();
                    }
                }
                if (DDInput.B.GetInput() == 1)                 // ? キャンセルボタン押下
                {
                    if (this.TopMenu.SelectIndex == TopMenuTask.ITEM_NUM - 1)
                    {
                        break;
                    }

                    this.TopMenu.SelectIndex = TopMenuTask.ITEM_NUM - 1;
                }

                this.DrawWall.Execute();
                this.TopMenu.Execute();

                DDEngine.EachFrame();
            }
endMenu:
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                //this.SimpleMenu.DrawWall();
                this.DrawWall.Execute();

                DDEngine.EachFrame();
            }

            DDEngine.FreezeInput();
        }
Example #30
0
        public void Perform()
        {
            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain();

            DDEngine.FreezeInput();

            Ground.I.Music.Title.Play();

            string[] items = new string[]
            {
                "ゲームスタート(ほむら)",
                "ゲームスタート(さやか)",
                "コンテニュー",
                "設定",
                "終了",
            };

            int selectIndex = 0;

            this.SimpleMenu = new DDSimpleMenu();

            this.SimpleMenu.BorderColor = new I3Color(64, 0, 0);
            //this.SimpleMenu.WallColor = new I3Color(96, 0, 0);
            this.SimpleMenu.WallPicture = Ground.I.Picture.Title;
            this.SimpleMenu.WallCurtain = -0.8;

            for (; ;)
            {
                selectIndex = this.SimpleMenu.Perform("横スクロール アクションゲーム タイプ-K テストコード / タイトルメニュー", items, selectIndex);

                switch (selectIndex)
                {
                case 0:
                {
                    this.LeaveTitleMenu();

                    using (new WorldGameMaster())
                    {
                        WorldGameMaster.I.World  = new World("t0001");                                        // 仮?
                        WorldGameMaster.I.Status = new GameStatus();
                        WorldGameMaster.I.Perform();
                    }
                    this.ReturnTitleMenu();
                }
                break;

                case 1:
                {
                    this.LeaveTitleMenu();

                    using (new WorldGameMaster())
                    {
                        WorldGameMaster.I.World  = new World("t0001");                                        // 仮?
                        WorldGameMaster.I.Status = new GameStatus()
                        {
                            StartChara = Player.Chara_e.SAYAKA,
                        };
                        WorldGameMaster.I.Perform();
                    }
                    this.ReturnTitleMenu();
                }
                break;

                case 2:
                {
                    Ground.P_SaveDataSlot saveDataSlot = LoadGame();

                    if (saveDataSlot != null)
                    {
                        this.LeaveTitleMenu();

                        using (new WorldGameMaster())
                        {
                            WorldGameMaster.I.World  = new World(saveDataSlot.MapName);
                            WorldGameMaster.I.Status = saveDataSlot.GameStatus.GetClone();
                            WorldGameMaster.I.Status.StartPointDirection = 101;                                             // スタート地点を「ロード地点」にする。
                            WorldGameMaster.I.Perform();
                        }
                        this.ReturnTitleMenu();
                    }
                }
                break;

                case 3:
                    this.Setting();
                    break;

                case 4:
                    goto endMenu;

                default:
                    throw new DDError();
                }
            }
endMenu:
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.SimpleMenu.DrawWall();
                DDEngine.EachFrame();
            }

            DDEngine.FreezeInput();
        }