Beispiel #1
0
        public static void EachFrame()
        {
            //Ground.EL.ExecuteAllTask();

            DDGround.EL.ExecuteAllTask();
            DispDebug();
            DDMouse.PosChanged_Delay();
            DDCurtain.EachFrame();

            if (!DDSEUtils.EachFrame())
            {
                DDMusicUtils.EachFrame();
            }

            DDSubScreenUtils.ChangeDrawScreen(DX.DX_SCREEN_BACK);

            if (DDGround.RealScreenDraw_W == -1)
            {
                bool mosaicFlag =
                    DDConfig.DrawScreen_MosaicFlag &&
                    DDGround.RealScreen_W % DDConsts.Screen_W == 0 &&
                    DDGround.RealScreen_H % DDConsts.Screen_H == 0;

                if (mosaicFlag)
                {
                    DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST);
                }

                if (DX.DrawExtendGraph(0, 0, DDGround.RealScreen_W, DDGround.RealScreen_H, DDGround.MainScreen.GetHandle(), 0) != 0)                 // ? 失敗
                {
                    throw new DDError();
                }

                if (mosaicFlag)
                {
                    DX.SetDrawMode(DDConsts.DEFAULT_DX_DRAWMODE);                     // restore
                }
            }
            else
            {
                if (DX.DrawBox(0, 0, DDGround.RealScreen_W, DDGround.RealScreen_H, DX.GetColor(0, 0, 0), 1) != 0)                 // ? 失敗
                {
                    throw new DDError();
                }

                bool mosaicFlag =
                    DDConfig.DrawScreen_MosaicFlag &&
                    DDGround.RealScreenDraw_W % DDConsts.Screen_W == 0 &&
                    DDGround.RealScreenDraw_H % DDConsts.Screen_H == 0;

                if (mosaicFlag)
                {
                    DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST);
                }

                if (DX.DrawExtendGraph(
                        DDGround.RealScreenDraw_L,
                        DDGround.RealScreenDraw_T,
                        DDGround.RealScreenDraw_L + DDGround.RealScreenDraw_W,
                        DDGround.RealScreenDraw_T + DDGround.RealScreenDraw_H, DDGround.MainScreen.GetHandle(), 0) != 0)                 // ? 失敗
                {
                    throw new DDError();
                }

                if (mosaicFlag)
                {
                    DX.SetDrawMode(DDConsts.DEFAULT_DX_DRAWMODE);                     // restore
                }
            }

            GC.Collect(0);

            FrameProcessingMillis = (int)(DDUtils.GetCurrTime() - FrameStartTime);

            if (FrameProcessingMillis_Worst < FrameProcessingMillis || !DDUtils.CountDown(ref FrameProcessingMillis_WorstFrame))
            {
                FrameProcessingMillis_Worst      = FrameProcessingMillis;
                FrameProcessingMillis_WorstFrame = 120;
            }

            // DxLib >

            DX.ScreenFlip();

            if (DX.CheckHitKey(DX.KEY_INPUT_ESCAPE) == 1 || DX.ProcessMessage() == -1)
            {
                throw new DDCoffeeBreak();
            }

            // < DxLib

            CheckHz();

            ProcFrame++;
            DDUtils.CountDown(ref FreezeInputFrame);
            WindowIsActive = DDUtils.IsWindowActive();

            if (SCommon.IMAX < ProcFrame)             // 192.9日程度でカンスト
            {
                ProcFrame = SCommon.IMAX;             // 2bs
                throw new DDError();
            }

            DDPad.EachFrame();
            DDKey.EachFrame();
            DDInput.EachFrame();
            DDMouse.EachFrame();

            // Swap MainScreen
            {
                DDSubScreen tmp = DDGround.MainScreen;
                DDGround.MainScreen     = DDGround.LastMainScreen;
                DDGround.LastMainScreen = tmp;
            }

            DDGround.MainScreen.ChangeDrawScreen();

            // ? ALT + ENTER -> フルスクリーン切り替え
            if ((1 <= DDKey.GetInput(DX.KEY_INPUT_LALT) || 1 <= DDKey.GetInput(DX.KEY_INPUT_RALT)) && DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1)
            {
                // ? 現在フルスクリーン -> フルスクリーン解除
                if (
                    DDGround.RealScreen_W == DDGround.MonitorRect.W &&
                    DDGround.RealScreen_H == DDGround.MonitorRect.H
                    )
                {
                    DDMain.SetScreenSize(DDGround.UnfullScreen_W, DDGround.UnfullScreen_H);
                }
                else                 // ? 現在フルスクリーンではない -> フルスクリーンにする
                {
                    DDGround.UnfullScreen_W = DDGround.RealScreen_W;
                    DDGround.UnfullScreen_H = DDGround.RealScreen_H;

                    DDMain.SetFullScreen();
                }
                DDEngine.FreezeInput(30);                 // エンターキー押下がゲームに影響しないように
            }

            DX.ClearDrawScreen();
        }
Beispiel #2
0
        public static void GameStart()
        {
            foreach (string dllFile in "DxLib.dll:DxLib_x64.dll:DxLibDotNet.dll".Split(':'))             // DxLibDotNet.dll 等の存在確認 (1)
            {
                if (!File.Exists(dllFile))
                {
                    throw new DDError();
                }
            }

            DX.GetColor(0, 0, 0);        // DxLibDotNet.dll 等の存在確認 (2)

            DDConfig.Load();             // LogFile, LOG_ENABLED 等を含むので真っ先に

            // Log >

            File.WriteAllBytes(DDConfig.LogFile, SCommon.EMPTY_BYTES);

            ProcMain.WriteLog = message =>
            {
                if (LogCount < DDConfig.LogCountMax)
                {
                    using (StreamWriter writer = new StreamWriter(DDConfig.LogFile, true, Encoding.UTF8))
                    {
                        writer.WriteLine("[" + DateTime.Now + "] " + message);
                    }
                    LogCount++;
                }
            };

            // < Log

            // *.INIT
            {
                DDGround.INIT();
                DDResource.INIT();
                DDDatStrings.INIT();
                DDUserDatStrings.INIT();
                DDFontRegister.INIT();
                DDKey.INIT();
            }

            DDSaveData.Load();

            // DxLib >

            if (DDConfig.LOG_ENABLED)
            {
                DX.SetApplicationLogSaveDirectory(SCommon.MakeFullPath(DDConfig.ApplicationLogSaveDirectory));
            }

            DX.SetOutApplicationLogValidFlag(DDConfig.LOG_ENABLED ? 1 : 0); // DxLib のログを出力 1: する 0: しない

            DX.SetAlwaysRunFlag(1);                                         // ? 非アクティブ時に 1: 動く 0: 止まる

            SetMainWindowTitle();

            //DX.SetGraphMode(DDConsts.Screen_W, DDConsts.Screen_H, 32);
            DX.SetGraphMode(DDGround.RealScreen_W, DDGround.RealScreen_H, 32);
            DX.ChangeWindowMode(1);             // 1: ウィンドウ 0: フルスクリーン

            //DX.SetFullSceneAntiAliasingMode(4, 2); // フルスクリーンを廃止したので不要

            DX.SetWindowIconHandle(GetAppIcon());             // ウィンドウ左上のアイコン

            if (0 <= DDConfig.DisplayIndex)
            {
                DX.SetUseDirectDrawDeviceIndex(DDConfig.DisplayIndex);
            }

            if (DX.DxLib_Init() != 0)             // ? 失敗
            {
                throw new DDError();
            }

            Finalizers.Add(() =>
            {
                if (DX.DxLib_End() != 0)                 // ? 失敗
                {
                    throw new DDError();
                }
            });

            DDUtils.SetMouseDispMode(DDGround.RO_MouseDispMode); // ? マウスを表示する。
            DX.SetWindowSizeChangeEnableFlag(0);                 // ウィンドウの右下をドラッグで伸縮 1: する 0: しない

            //DX.SetDrawScreen(DX.DX_SCREEN_BACK);
            DX.SetDrawMode(DDConsts.DEFAULT_DX_DRAWMODE);             // これをデフォルトとする。

            // < DxLib

            DDGround.MainScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);
            DDGround.MainScreen.ChangeDrawScreen();
            DDGround.LastMainScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);
            DDGround.KeptMainScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);

            if (DDConfig.DisplayIndex == -2)
            {
                I2Point  mousePt       = DDWin32.GetMousePosition();
                I4Rect[] monitors      = DDWin32.GetAllMonitor();
                I4Rect   activeMonitor = monitors[0];               // マウス位置のモニタを特定出来ない場合のモニタ

                foreach (I4Rect monitor in monitors)
                {
                    if (
                        monitor.L <= mousePt.X && mousePt.X < monitor.R &&
                        monitor.T <= mousePt.Y && mousePt.Y < monitor.B
                        )
                    {
                        activeMonitor = monitor;
                        break;
                    }
                }
                DDGround.MonitorRect = activeMonitor;
            }
            else
            {
                int l;
                int t;
                int w;
                int h;
                int p1;
                int p2;
                int p3;
                int p4;

                DX.GetDefaultState(out w, out h, out p1, out p2, out l, out t, out p3, out p4);

                if (
                    w < 1 || SCommon.IMAX < w ||
                    h < 1 || SCommon.IMAX < h ||
                    l < -SCommon.IMAX || SCommon.IMAX < l ||
                    t < -SCommon.IMAX || SCommon.IMAX < t
                    )
                {
                    throw new DDError();
                }

                DDGround.MonitorRect = new I4Rect(l, t, w, h);
            }

            PostSetScreenSize(DDGround.RealScreen_W, DDGround.RealScreen_H);

            // Font
            {
                //DDFontRegister.Add(@"e20200928_NovelAdv\Font\Genkai-Mincho-font\genkai-mincho.ttf");
                //DDFontRegister.Add(@"e20200928_NovelAdv\Font\riitf\RiiT_F.otf");
                DDFontRegister.Add(@"dat\Font\K Gothic\K Gothic.ttf");
                DDFontRegister.Add(@"dat\Font\焚火フォント\03Takibi-Regular.otf");
            }

            Ground.I          = new Ground();
            Ground.I.Picture2 = new ResourcePicture2();             // Ground.I を参照しているので Ground のコンストラクタには書けない。

            MainWin.I.PostGameStart_G3();

            DDSaveData.Load_Delay();

            Finalizers.Add(() =>
            {
                DDSaveData.Save();
            });
        }
Beispiel #3
0
        public static void Save()
        {
            List <byte[]> blocks = new List <byte[]>();

            // Donut3 用のセーブデータ
            {
                List <string> lines = new List <string>();

                lines.Add(ProcMain.APP_IDENT);
                lines.Add(ProcMain.APP_TITLE);

                lines.Add("" + DDGround.RealScreen_W);
                lines.Add("" + DDGround.RealScreen_H);

                lines.Add("" + DDGround.RealScreenDraw_L);
                lines.Add("" + DDGround.RealScreenDraw_T);
                lines.Add("" + DDGround.RealScreenDraw_W);
                lines.Add("" + DDGround.RealScreenDraw_H);

                lines.Add("" + DDGround.UnfullScreen_W);
                lines.Add("" + DDGround.UnfullScreen_H);

                lines.Add("" + SCommon.ToLong(DDGround.MusicVolume * SCommon.IMAX));
                lines.Add("" + SCommon.ToLong(DDGround.SEVolume * SCommon.IMAX));

                lines.Add("" + P_Join(DDInput.DIR_2.BtnIds));
                lines.Add("" + P_Join(DDInput.DIR_4.BtnIds));
                lines.Add("" + P_Join(DDInput.DIR_6.BtnIds));
                lines.Add("" + P_Join(DDInput.DIR_8.BtnIds));
                lines.Add("" + P_Join(DDInput.A.BtnIds));
                lines.Add("" + P_Join(DDInput.B.BtnIds));
                lines.Add("" + P_Join(DDInput.C.BtnIds));
                lines.Add("" + P_Join(DDInput.D.BtnIds));
                lines.Add("" + P_Join(DDInput.E.BtnIds));
                lines.Add("" + P_Join(DDInput.F.BtnIds));
                lines.Add("" + P_Join(DDInput.L.BtnIds));
                lines.Add("" + P_Join(DDInput.R.BtnIds));
                lines.Add("" + P_Join(DDInput.PAUSE.BtnIds));
                lines.Add("" + P_Join(DDInput.START.BtnIds));

                lines.Add("" + P_Join(DDInput.DIR_2.KeyIds));
                lines.Add("" + P_Join(DDInput.DIR_4.KeyIds));
                lines.Add("" + P_Join(DDInput.DIR_6.KeyIds));
                lines.Add("" + P_Join(DDInput.DIR_8.KeyIds));
                lines.Add("" + P_Join(DDInput.A.KeyIds));
                lines.Add("" + P_Join(DDInput.B.KeyIds));
                lines.Add("" + P_Join(DDInput.C.KeyIds));
                lines.Add("" + P_Join(DDInput.D.KeyIds));
                lines.Add("" + P_Join(DDInput.E.KeyIds));
                lines.Add("" + P_Join(DDInput.F.KeyIds));
                lines.Add("" + P_Join(DDInput.L.KeyIds));
                lines.Add("" + P_Join(DDInput.R.KeyIds));
                lines.Add("" + P_Join(DDInput.PAUSE.KeyIds));
                lines.Add("" + P_Join(DDInput.START.KeyIds));

                lines.Add("" + (DDGround.RO_MouseDispMode ? 1 : 0));

                // 新しい項目をここへ追加...

                blocks.Add(DDUtils.SplitableJoin(lines.ToArray()));
            }

            // アプリ固有のセーブデータ
            {
                List <string> lines = new List <string>();

                //lines.Add("Donut3-SaveData"); // Dummy
                //lines.Add("Donut3-SaveData"); // Dummy
                //lines.Add("Donut3-SaveData"); // Dummy

                lines.Add("" + Ground.I.MessageSpeed);
                lines.Add("" + Ground.I.MessageWindow_A_Pct);

                foreach (SaveDataSlot saveDataSlot in Ground.I.SaveDataSlots)
                {
                    lines.Add(saveDataSlot.Serialize());
                }

                // 新しい項目をここへ追加...

                blocks.Add(DDUtils.SplitableJoin(lines.ToArray()));
            }

            File.WriteAllBytes(DDConsts.SaveDataFile, DDJammer.Encode(SCommon.SplittableJoin(blocks.ToArray())));
        }
Beispiel #4
0
        public static void Load()
        {
            if (!File.Exists(DDConsts.SaveDataFile))
            {
                return;
            }

            byte[][] blocks = SCommon.Split(DDJammer.Decode(File.ReadAllBytes(DDConsts.SaveDataFile)));
            int      bc     = 0;

            string[] lines = DDUtils.Split(blocks[bc++]);
            int      c     = 0;

            if (lines[c++] != ProcMain.APP_IDENT)
            {
                throw new DDError();
            }

            if (lines[c++] != ProcMain.APP_TITLE)
            {
                throw new DDError();
            }

            // アプリのアップデートによって項目の更新・増減があっても処理を続行するように try ~ catch しておく。

            try             // Donut3 のセーブデータ
            {
                // TODO int.Parse -> IntTools.ToInt

                DDGround.RealScreen_W = int.Parse(lines[c++]);
                DDGround.RealScreen_H = int.Parse(lines[c++]);

                DDGround.RealScreenDraw_L = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_T = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_W = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_H = int.Parse(lines[c++]);

                DDGround.UnfullScreen_W = int.Parse(lines[c++]);
                DDGround.UnfullScreen_H = int.Parse(lines[c++]);

                DDGround.MusicVolume = long.Parse(lines[c++]) / (double)SCommon.IMAX;
                DDGround.SEVolume    = long.Parse(lines[c++]) / (double)SCommon.IMAX;

                DDInput.DIR_2.BtnIds = P_Split(lines[c++]);
                DDInput.DIR_4.BtnIds = P_Split(lines[c++]);
                DDInput.DIR_6.BtnIds = P_Split(lines[c++]);
                DDInput.DIR_8.BtnIds = P_Split(lines[c++]);
                DDInput.A.BtnIds     = P_Split(lines[c++]);
                DDInput.B.BtnIds     = P_Split(lines[c++]);
                DDInput.C.BtnIds     = P_Split(lines[c++]);
                DDInput.D.BtnIds     = P_Split(lines[c++]);
                DDInput.E.BtnIds     = P_Split(lines[c++]);
                DDInput.F.BtnIds     = P_Split(lines[c++]);
                DDInput.L.BtnIds     = P_Split(lines[c++]);
                DDInput.R.BtnIds     = P_Split(lines[c++]);
                DDInput.PAUSE.BtnIds = P_Split(lines[c++]);
                DDInput.START.BtnIds = P_Split(lines[c++]);

                DDInput.DIR_2.KeyIds = P_Split(lines[c++]);
                DDInput.DIR_4.KeyIds = P_Split(lines[c++]);
                DDInput.DIR_6.KeyIds = P_Split(lines[c++]);
                DDInput.DIR_8.KeyIds = P_Split(lines[c++]);
                DDInput.A.KeyIds     = P_Split(lines[c++]);
                DDInput.B.KeyIds     = P_Split(lines[c++]);
                DDInput.C.KeyIds     = P_Split(lines[c++]);
                DDInput.D.KeyIds     = P_Split(lines[c++]);
                DDInput.E.KeyIds     = P_Split(lines[c++]);
                DDInput.F.KeyIds     = P_Split(lines[c++]);
                DDInput.L.KeyIds     = P_Split(lines[c++]);
                DDInput.R.KeyIds     = P_Split(lines[c++]);
                DDInput.PAUSE.KeyIds = P_Split(lines[c++]);
                DDInput.START.KeyIds = P_Split(lines[c++]);

                DDGround.RO_MouseDispMode = int.Parse(lines[c++]) != 0;

                // 新しい項目をここへ追加...
            }
            catch (Exception e)
            {
                ProcMain.WriteLog(e);
            }

            Load_Delay = () =>
            {
                lines = DDUtils.Split(blocks[bc++]);
                c     = 0;

                try                 // アプリ固有のセーブデータ
                {
                    //DDUtils.Noop(lines[c++]); // Dummy
                    //DDUtils.Noop(lines[c++]); // Dummy
                    //DDUtils.Noop(lines[c++]); // Dummy

                    Ground.I.MessageSpeed        = int.Parse(lines[c++]);
                    Ground.I.MessageWindow_A_Pct = int.Parse(lines[c++]);

                    for (int index = 0; index < Consts.SAVE_DATA_SLOT_NUM; index++)
                    {
                        Ground.I.SaveDataSlots[index].Deserialize(lines[c++]);
                    }

                    // 新しい項目をここへ追加...
                }
                catch (Exception e)
                {
                    ProcMain.WriteLog(e);
                }

                Load_Delay = () => { };                 // reset
            };
        }
Beispiel #5
0
        public void PadConfig(bool keyMode = false)
        {
            ButtonInfo[] btnInfos = new ButtonInfo[]
            {
#if false // 例
                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.A, "Aボタン"),
                new ButtonInfo(DDInput.B, "Bボタン"),
                new ButtonInfo(DDInput.C, "Cボタン"),
                //new ButtonInfo(DDInput.D, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.E, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.F, ""), // 使用しないボタン
                new ButtonInfo(DDInput.L, "Lボタン"),
                new ButtonInfo(DDInput.R, "Rボタン"),
                //new ButtonInfo(DDInput.PAUSE, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.START, ""), // 使用しないボタン
#else
                // アプリ固有の設定 >

                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.A, "低速/決定"),
                new ButtonInfo(DDInput.B, "ショット/キャンセル"),
                new ButtonInfo(DDInput.C, "速度を下げる"),
                new ButtonInfo(DDInput.D, "速度を上げる"),
                new ButtonInfo(DDInput.E, "ボム"),
                //new ButtonInfo(DDInput.F, ""),
                new ButtonInfo(DDInput.L, "会話スキップ"),
                new ButtonInfo(DDInput.R, "当たり判定表示(チート)"),
                new ButtonInfo(DDInput.PAUSE, "ポーズボタン"),
                //new ButtonInfo(DDInput.START, ""),

                // < アプリ固有の設定
#endif
            };

            foreach (ButtonInfo btnInfo in btnInfos)
            {
                btnInfo.Button.Backup();
            }

            bool?mouseDispModeBk = null;

            try
            {
                if (keyMode)
                {
                    mouseDispModeBk = DDUtils.GetMouseDispMode();
                    DDUtils.SetMouseDispMode(true);

                    foreach (ButtonInfo btnInfo in btnInfos)
                    {
                        btnInfo.Button.KeyId = -1;
                    }

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

                    int currBtnIndex = 0;

                    while (currBtnIndex < btnInfos.Length)
                    {
                        if (DDMouse.R.GetInput() == -1)
                        {
                            return;
                        }
                        if (DDMouse.L.GetInput() == -1)
                        {
                            currBtnIndex++;
                            goto endInput;
                        }

                        {
                            int pressKeyId = -1;

                            foreach (KeyInfo keyInfo in KeyInfos)
                            {
                                if (DDKey.GetInput(keyInfo.KeyId) == 1)
                                {
                                    pressKeyId = keyInfo.KeyId;
                                }
                            }

                            for (int c = 0; c < currBtnIndex; c++)
                            {
                                if (btnInfos[c].Button.KeyId == pressKeyId)
                                {
                                    pressKeyId = -1;
                                }
                            }

                            if (pressKeyId != -1)
                            {
                                btnInfos[currBtnIndex].Button.KeyId = pressKeyId;
                                currBtnIndex++;
                            }
                        }
endInput:

                        this.DrawWall();

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

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

                        DDPrint.SetPrint(this.X, this.Y, this.YStep);
                        //DDPrint.SetPrint(16, 16, 32); // old
                        DDPrint.PrintLine("キーボードのキー設定");

                        for (int c = 0; c < btnInfos.Length; c++)
                        {
                            DDPrint.Print(string.Format("[{0}] {1}", currBtnIndex == c ? ">" : " ", btnInfos[c].Name));

                            if (c < currBtnIndex)
                            {
                                int keyId = btnInfos[c].Button.KeyId;

                                DDPrint.Print(" -> ");

                                if (keyId == -1)
                                {
                                    DDPrint.Print("割り当てナシ");
                                }
                                else
                                {
                                    DDPrint.Print(KeyInfos.First(keyInfo => keyInfo.KeyId == keyId).Name);
                                }
                            }
                            DDPrint.PrintRet();
                        }
                        DDPrint.PrintLine("★ カーソルの指す機能に割り当てるキーを押して下さい。");
                        DDPrint.PrintLine("★ 画面を左クリックするとキーの割り当てをスキップします。(非推奨)");
                        DDPrint.PrintLine("★ 画面を右クリックするとキャンセルします。");

                        DDEngine.EachFrame();
                    }
                }
                else
                {
                    foreach (ButtonInfo btnInfo in btnInfos)
                    {
                        btnInfo.Button.BtnId = -1;
                    }

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

                    int currBtnIndex = 0;

                    while (currBtnIndex < btnInfos.Length)
                    {
                        if (DDKey.GetInput(DX.KEY_INPUT_SPACE) == 1)
                        {
                            return;
                        }
                        if (DDKey.GetInput(DX.KEY_INPUT_Z) == 1)
                        {
                            currBtnIndex++;
                            goto endInput;
                        }

                        {
                            int pressBtnId = -1;

                            for (int padId = 0; padId < DDPad.GetPadCount(); padId++)
                            {
                                for (int btnId = 0; btnId < DDPad.PAD_BUTTON_MAX; btnId++)
                                {
                                    if (DDPad.GetInput(padId, btnId) == 1)
                                    {
                                        pressBtnId = btnId;
                                    }
                                }
                            }

                            for (int c = 0; c < currBtnIndex; c++)
                            {
                                if (btnInfos[c].Button.BtnId == pressBtnId)
                                {
                                    pressBtnId = -1;
                                }
                            }

                            if (pressBtnId != -1)
                            {
                                btnInfos[currBtnIndex].Button.BtnId = pressBtnId;
                                currBtnIndex++;
                            }
                        }
endInput:

                        this.DrawWall();

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

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

                        DDPrint.SetPrint(this.X, this.Y, this.YStep);
                        //DDPrint.SetPrint(16, 16, 32); // old
                        DDPrint.PrintLine("ゲームパッドのボタン設定");

                        for (int c = 0; c < btnInfos.Length; c++)
                        {
                            DDPrint.Print(string.Format("[{0}] {1}", currBtnIndex == c ? ">" : " ", btnInfos[c].Name));

                            if (c < currBtnIndex)
                            {
                                int btnId = btnInfos[c].Button.BtnId;

                                DDPrint.Print(" -> ");

                                if (btnId == -1)
                                {
                                    DDPrint.Print("割り当てナシ");
                                }
                                else
                                {
                                    DDPrint.Print("" + btnId);
                                }
                            }
                            DDPrint.PrintRet();
                        }
                        DDPrint.PrintLine("★ カーソルの指す機能に割り当てるボタンを押して下さい。");
                        DDPrint.PrintLine("★ [Z]キーを押すとボタンの割り当てをスキップします。");
                        DDPrint.PrintLine("★ スペースキーを押すとキャンセルします。");

                        if (this.MouseUsable)
                        {
                            DDPrint.PrintLine("★ 右クリックするとキャンセルします。");

                            if (DDMouse.R.GetInput() == -1)
                            {
                                return;
                            }
                        }

                        DDEngine.EachFrame();
                    }
                }
                btnInfos = null;

                // 最後の画面を維持
                {
                    DDMain.KeepMainScreen();

                    for (int c = 0; c < 30; c++)
                    {
                        DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                        DDEngine.EachFrame();
                    }
                }
            }
            finally
            {
                if (btnInfos != null)
                {
                    foreach (ButtonInfo info in btnInfos)
                    {
                        info.Button.Restore();
                    }
                }

                if (mouseDispModeBk != null)
                {
                    DDUtils.SetMouseDispMode(mouseDispModeBk.Value);
                }

                DDEngine.FreezeInput();
            }
        }
Beispiel #6
0
        public int Perform(string title, string[] items, int selectIndex, bool ポーズボタンでメニュー終了 = false, bool noPound = false)
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

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

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

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

                    selectIndex = musSelIdx;

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

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

                bool chgsel = false;

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

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

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

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

                    DDMouse.PosChanged();
                }

                this.DrawWall();

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

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

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

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

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

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

            return(selectIndex);
        }
Beispiel #7
0
 public bool IsPound()
 {
     return(DDUtils.IsPound(this.GetInput()));
 }
Beispiel #8
0
 public DDSimpleMenu()
     : this(DDUtils.GetMouseDispMode())
 {
 }
Beispiel #9
0
 public static bool IsPound(int keyId)
 {
     return(DDUtils.IsPound(GetInput(keyId)));
 }
Beispiel #10
0
        public static void Load()
        {
            if (!File.Exists(DDConsts.SaveDataFile))
            {
                return;
            }

            byte[][] blocks = SCommon.Split(DDJammer.Decode(File.ReadAllBytes(DDConsts.SaveDataFile)));
            int      bc     = 0;

            string[] lines = DDUtils.Split(blocks[bc++]);
            int      c     = 0;

            if (lines[c++] != ProcMain.APP_IDENT)
            {
                throw new DDError();
            }

            if (lines[c++] != ProcMain.APP_TITLE)
            {
                throw new DDError();
            }

            // アプリのアップデートによって項目の更新・増減があっても処理を続行するように try ~ catch しておく。

            try             // Donut3 のセーブデータ
            {
                DDGround.RealScreen_W = int.Parse(lines[c++]);
                DDGround.RealScreen_H = int.Parse(lines[c++]);

                DDGround.RealScreenDraw_L = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_T = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_W = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_H = int.Parse(lines[c++]);

                DDGround.UnfullScreen_W = int.Parse(lines[c++]);
                DDGround.UnfullScreen_H = int.Parse(lines[c++]);

                DDGround.MusicVolume = long.Parse(lines[c++]) / (double)SCommon.IMAX;
                DDGround.SEVolume    = long.Parse(lines[c++]) / (double)SCommon.IMAX;

                DDInput.DIR_2.BtnId = int.Parse(lines[c++]);
                DDInput.DIR_4.BtnId = int.Parse(lines[c++]);
                DDInput.DIR_6.BtnId = int.Parse(lines[c++]);
                DDInput.DIR_8.BtnId = int.Parse(lines[c++]);
                DDInput.A.BtnId     = int.Parse(lines[c++]);
                DDInput.B.BtnId     = int.Parse(lines[c++]);
                DDInput.C.BtnId     = int.Parse(lines[c++]);
                DDInput.D.BtnId     = int.Parse(lines[c++]);
                DDInput.E.BtnId     = int.Parse(lines[c++]);
                DDInput.F.BtnId     = int.Parse(lines[c++]);
                DDInput.L.BtnId     = int.Parse(lines[c++]);
                DDInput.R.BtnId     = int.Parse(lines[c++]);
                DDInput.PAUSE.BtnId = int.Parse(lines[c++]);
                DDInput.START.BtnId = int.Parse(lines[c++]);

                DDInput.DIR_2.KeyId = int.Parse(lines[c++]);
                DDInput.DIR_4.KeyId = int.Parse(lines[c++]);
                DDInput.DIR_6.KeyId = int.Parse(lines[c++]);
                DDInput.DIR_8.KeyId = int.Parse(lines[c++]);
                DDInput.A.KeyId     = int.Parse(lines[c++]);
                DDInput.B.KeyId     = int.Parse(lines[c++]);
                DDInput.C.KeyId     = int.Parse(lines[c++]);
                DDInput.D.KeyId     = int.Parse(lines[c++]);
                DDInput.E.KeyId     = int.Parse(lines[c++]);
                DDInput.F.KeyId     = int.Parse(lines[c++]);
                DDInput.L.KeyId     = int.Parse(lines[c++]);
                DDInput.R.KeyId     = int.Parse(lines[c++]);
                DDInput.PAUSE.KeyId = int.Parse(lines[c++]);
                DDInput.START.KeyId = int.Parse(lines[c++]);

                DDGround.RO_MouseDispMode = int.Parse(lines[c++]) != 0;

                // 新しい項目をここへ追加...
            }
            catch (Exception e)
            {
                ProcMain.WriteLog(e);
            }

            Load_Delay = () =>
            {
                lines = DDUtils.Split(blocks[bc++]);
                c     = 0;

                try                 // アプリ固有のセーブデータ
                {
                    //DDUtils.Noop(lines[c++]); // Dummy
                    //DDUtils.Noop(lines[c++]); // Dummy
                    //DDUtils.Noop(lines[c++]); // Dummy

                    Ground.I.ReachedStageIndex  = int.Parse(lines[c++]);
                    Ground.I.SawFinalNovel      = int.Parse(lines[c++]) != 0;
                    Ground.I.SawEnding_死亡       = int.Parse(lines[c++]) != 0;
                    Ground.I.SawEnding_生還       = int.Parse(lines[c++]) != 0;
                    Ground.I.SawEnding_復讐       = int.Parse(lines[c++]) != 0;
                    Ground.I.StartSnapshotCount = int.Parse(lines[c++]);

                    // 新しい項目をここへ追加...
                }
                catch (Exception e)
                {
                    ProcMain.WriteLog(e);
                }

                Load_Delay = () => { };                 // reset
            };
        }
Beispiel #11
0
        public static void Save()
        {
            List <byte[]> blocks = new List <byte[]>();

            // Donut3 用のセーブデータ
            {
                List <string> lines = new List <string>();

                lines.Add(ProcMain.APP_IDENT);
                lines.Add(ProcMain.APP_TITLE);

                lines.Add("" + DDGround.RealScreen_W);
                lines.Add("" + DDGround.RealScreen_H);

                lines.Add("" + DDGround.RealScreenDraw_L);
                lines.Add("" + DDGround.RealScreenDraw_T);
                lines.Add("" + DDGround.RealScreenDraw_W);
                lines.Add("" + DDGround.RealScreenDraw_H);

                lines.Add("" + DDGround.UnfullScreen_W);
                lines.Add("" + DDGround.UnfullScreen_H);

                lines.Add("" + SCommon.ToLong(DDGround.MusicVolume * SCommon.IMAX));
                lines.Add("" + SCommon.ToLong(DDGround.SEVolume * SCommon.IMAX));

                lines.Add("" + DDInput.DIR_2.BtnId);
                lines.Add("" + DDInput.DIR_4.BtnId);
                lines.Add("" + DDInput.DIR_6.BtnId);
                lines.Add("" + DDInput.DIR_8.BtnId);
                lines.Add("" + DDInput.A.BtnId);
                lines.Add("" + DDInput.B.BtnId);
                lines.Add("" + DDInput.C.BtnId);
                lines.Add("" + DDInput.D.BtnId);
                lines.Add("" + DDInput.E.BtnId);
                lines.Add("" + DDInput.F.BtnId);
                lines.Add("" + DDInput.L.BtnId);
                lines.Add("" + DDInput.R.BtnId);
                lines.Add("" + DDInput.PAUSE.BtnId);
                lines.Add("" + DDInput.START.BtnId);

                lines.Add("" + DDInput.DIR_2.KeyId);
                lines.Add("" + DDInput.DIR_4.KeyId);
                lines.Add("" + DDInput.DIR_6.KeyId);
                lines.Add("" + DDInput.DIR_8.KeyId);
                lines.Add("" + DDInput.A.KeyId);
                lines.Add("" + DDInput.B.KeyId);
                lines.Add("" + DDInput.C.KeyId);
                lines.Add("" + DDInput.D.KeyId);
                lines.Add("" + DDInput.E.KeyId);
                lines.Add("" + DDInput.F.KeyId);
                lines.Add("" + DDInput.L.KeyId);
                lines.Add("" + DDInput.R.KeyId);
                lines.Add("" + DDInput.PAUSE.KeyId);
                lines.Add("" + DDInput.START.KeyId);

                lines.Add("" + (DDGround.RO_MouseDispMode ? 1 : 0));

                // 新しい項目をここへ追加...

                blocks.Add(DDUtils.SplitableJoin(lines.ToArray()));
            }

            // アプリ固有のセーブデータ
            {
                List <string> lines = new List <string>();

                //lines.Add("Donut3-SaveData"); // Dummy
                //lines.Add("Donut3-SaveData"); // Dummy
                //lines.Add("Donut3-SaveData"); // Dummy

                lines.Add("" + Ground.I.ReachedStageIndex);
                lines.Add("" + (Ground.I.SawFinalNovel ? 1 : 0));
                lines.Add("" + (Ground.I.SawEnding_死亡 ? 1 : 0));
                lines.Add("" + (Ground.I.SawEnding_生還 ? 1 : 0));
                lines.Add("" + (Ground.I.SawEnding_復讐 ? 1 : 0));
                lines.Add("" + Ground.I.StartSnapshotCount);

                // 新しい項目をここへ追加...

                blocks.Add(DDUtils.SplitableJoin(lines.ToArray()));
            }

            File.WriteAllBytes(DDConsts.SaveDataFile, DDJammer.Encode(SCommon.SplittableJoin(blocks.ToArray())));
        }
Beispiel #12
0
        public void PadConfig(bool keyMode = false)
        {
            ButtonInfo[] btnInfos = new ButtonInfo[]
            {
#if false // 例
                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.A, "Aボタン"),
                new ButtonInfo(DDInput.B, "Bボタン"),
                new ButtonInfo(DDInput.C, "Cボタン"),
                //new ButtonInfo(DDInput.D, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.E, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.F, ""), // 使用しないボタン
                new ButtonInfo(DDInput.L, "Lボタン"),
                new ButtonInfo(DDInput.R, "Rボタン"),
                //new ButtonInfo(DDInput.PAUSE, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.START, ""), // 使用しないボタン
#else
                // アプリ固有の設定 >

                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.A, "ジャンプボタン/決定"),
                new ButtonInfo(DDInput.B, "攻撃ボタン/キャンセル"),
                //new ButtonInfo(DDInput.C, ""),
                //new ButtonInfo(DDInput.D, ""),
                //new ButtonInfo(DDInput.E, ""),
                //new ButtonInfo(DDInput.F, ""),
                new ButtonInfo(DDInput.L, "画面スライド/会話スキップ"),
                new ButtonInfo(DDInput.R, "低速ボタン"),
                new ButtonInfo(DDInput.PAUSE, "ポーズボタン"),
                //new ButtonInfo(DDInput.START, ""),

                // < アプリ固有の設定
#endif
            };

            foreach (ButtonInfo btnInfo in btnInfos)
            {
                btnInfo.Button.Backup();
            }

            bool?mouseDispModeBk = null;

            try
            {
                if (keyMode)
                {
                    mouseDispModeBk = DDUtils.GetMouseDispMode();
                    DDUtils.SetMouseDispMode(true);

                    foreach (ButtonInfo btnInfo in btnInfos)
                    {
                        btnInfo.Button.KeyId = -1;
                    }

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

                    int currBtnIndex = 0;

                    while (currBtnIndex < btnInfos.Length)
                    {
                        if (DDMouse.R.GetInput() == -1)
                        {
                            return;
                        }
                        // スキップ禁止
                        //if (DDMouse.L.GetInput() == -1)
                        //{
                        //    currBtnIndex++;
                        //    goto endInput;
                        //}

                        {
                            int pressKeyId = -1;

                            foreach (KeyInfo keyInfo in KeyInfos)
                            {
                                if (DDKey.GetInput(keyInfo.KeyId) == 1)
                                {
                                    pressKeyId = keyInfo.KeyId;
                                }
                            }

                            for (int c = 0; c < currBtnIndex; c++)
                            {
                                if (btnInfos[c].Button.KeyId == pressKeyId)
                                {
                                    pressKeyId = -1;
                                }
                            }

                            if (pressKeyId != -1)
                            {
                                btnInfos[currBtnIndex].Button.KeyId = pressKeyId;
                                currBtnIndex++;
                            }
                        }
                        //endInput:

                        this.WallDrawer();
                        this.ResetPrint();
                        DDPrint.SetPrint(20, 20, 40, 20);
                        DDPrint.PrintLine("キーボードのキー設定");

                        for (int c = 0; c < btnInfos.Length; c++)
                        {
                            DDPrint.Print(string.Format("[{0}] {1}", currBtnIndex == c ? ">" : " ", btnInfos[c].Name));

                            if (c < currBtnIndex)
                            {
                                int keyId = btnInfos[c].Button.KeyId;

                                DDPrint.Print(" >>> ");

                                if (keyId == -1)
                                {
                                    DDPrint.Print("割り当てナシ");
                                }
                                else
                                {
                                    DDPrint.Print(KeyInfos.First(keyInfo => keyInfo.KeyId == keyId).Name);
                                }
                            }
                            DDPrint.PrintRet();
                        }
                        DDPrint.SetPrint(450, 420, 40, 20);
                        //DDPrint.SetPrint(410, 380, 40, 20); // スキップ禁止
                        DDPrint.PrintLine("/// TIPS ///");
                        DDPrint.PrintLine("カーソルの指す機能に割り当てるキーを押して下さい。");
                        //DDPrint.PrintLine("画面を左クリックするとキーの割り当てをスキップします。"); // スキップ禁止
                        DDPrint.SetColor(new I3Color(255, 255, 0));
                        DDPrint.SetBorder(new I3Color(100, 50, 0));
                        DDPrint.PrintLine("画面を右クリックするとキャンセルします。");
                        this.ResetPrint();

                        DDEngine.EachFrame();
                    }
                }
                else
                {
                    foreach (ButtonInfo btnInfo in btnInfos)
                    {
                        btnInfo.Button.BtnId = -1;
                    }

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

                    int currBtnIndex = 0;

                    while (currBtnIndex < btnInfos.Length)
                    {
                        if (DDKey.GetInput(DX.KEY_INPUT_SPACE) == 1)
                        {
                            return;
                        }
                        if (DDKey.GetInput(DX.KEY_INPUT_Z) == 1)
                        {
                            currBtnIndex++;
                            goto endInput;
                        }

                        {
                            int pressBtnId = -1;

                            for (int padId = 0; padId < DDPad.GetPadCount(); padId++)
                            {
                                for (int btnId = 0; btnId < DDPad.PAD_BUTTON_MAX; btnId++)
                                {
                                    if (DDPad.GetInput(padId, btnId) == 1)
                                    {
                                        pressBtnId = btnId;
                                    }
                                }
                            }

                            for (int c = 0; c < currBtnIndex; c++)
                            {
                                if (btnInfos[c].Button.BtnId == pressBtnId)
                                {
                                    pressBtnId = -1;
                                }
                            }

                            if (pressBtnId != -1)
                            {
                                btnInfos[currBtnIndex].Button.BtnId = pressBtnId;
                                currBtnIndex++;
                            }
                        }
endInput:

                        this.WallDrawer();
                        this.ResetPrint();
                        DDPrint.SetPrint(20, 20, 40, 20);
                        DDPrint.PrintLine("ゲームパッドのボタン設定");

                        for (int c = 0; c < btnInfos.Length; c++)
                        {
                            DDPrint.Print(string.Format("[{0}] {1}", currBtnIndex == c ? ">" : " ", btnInfos[c].Name));

                            if (c < currBtnIndex)
                            {
                                int btnId = btnInfos[c].Button.BtnId;

                                DDPrint.Print(" >>> ");

                                if (btnId == -1)
                                {
                                    DDPrint.Print("割り当てナシ");
                                }
                                else
                                {
                                    DDPrint.Print(btnId.ToString("D2"));
                                }
                            }
                            DDPrint.PrintRet();
                        }
                        DDPrint.SetPrint(430, 380, 40, 20);
                        DDPrint.PrintLine("/// TIPS ///");
                        DDPrint.PrintLine("カーソルの指す機能に割り当てるボタンを押して下さい。");
                        DDPrint.PrintLine("Zキーを押すとボタンの割り当てをスキップします。");
                        DDPrint.SetColor(new I3Color(255, 255, 0));
                        DDPrint.SetBorder(new I3Color(100, 50, 0));

                        if (this.MouseUsable)
                        {
                            DDPrint.PrintLine("スペースキーまたは右クリックするとキャンセルします。");

                            if (DDMouse.R.GetInput() == -1)
                            {
                                return;
                            }
                        }
                        else
                        {
                            DDPrint.PrintLine("スペースキーを押すとキャンセルします。");
                        }

                        this.ResetPrint();

                        DDEngine.EachFrame();
                    }
                }
                btnInfos = null;

                // 最後の画面を維持
                {
                    DDMain.KeepMainScreen();

                    for (int c = 0; c < 30; c++)
                    {
                        DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                        DDEngine.EachFrame();
                    }
                }
            }
            finally
            {
                if (btnInfos != null)
                {
                    foreach (ButtonInfo info in btnInfos)
                    {
                        info.Button.Restore();
                    }
                }

                if (mouseDispModeBk != null)
                {
                    DDUtils.SetMouseDispMode(mouseDispModeBk.Value);
                }

                DDEngine.FreezeInput();
            }
        }
Beispiel #13
0
        public static bool IsCrashed(DDCrash a, DDCrash b)
        {
            if ((int)b.Kind < (int)a.Kind)
            {
                DDCrash tmp = a;
                a = b;
                b = tmp;
            }
            if (a.Kind == Kind_e.NONE)
            {
                return(false);
            }

            if (b.Kind == Kind_e.MULTI)
            {
                return(IsCrashed_Any_Multi(a, b));
            }

            if (a.Kind == Kind_e.POINT)
            {
                if (b.Kind == Kind_e.POINT)
                {
                    return(false);
                }

                if (b.Kind == Kind_e.CIRCLE)
                {
                    return(DDUtils.IsCrashed_Circle_Point(b.Pt, b.R, a.Pt));
                }

                if (b.Kind == Kind_e.RECT)
                {
                    return(DDUtils.IsCrashed_Rect_Point(b.Rect, a.Pt));
                }

                if (b.Kind == Kind_e.MULTI)
                {
                    throw new DDError();
                }
            }
            if (a.Kind == Kind_e.CIRCLE)
            {
                if (b.Kind == Kind_e.CIRCLE)
                {
                    return(DDUtils.IsCrashed_Circle_Circle(a.Pt, a.R, b.Pt, b.R));
                }

                if (b.Kind == Kind_e.RECT)
                {
                    return(DDUtils.IsCrashed_Circle_Rect(a.Pt, a.R, b.Rect));
                }

                throw new DDError();
            }
            if (a.Kind == Kind_e.RECT)
            {
                if (b.Kind == Kind_e.RECT)
                {
                    return(DDUtils.IsCrashed_Rect_Rect(a.Rect, b.Rect));
                }

                throw new DDError();
            }
            throw new DDError();
        }