예제 #1
0
        /// <summary>
        /// ゲーム中のロード画面
        /// </summary>
        private void LoadMenu()
        {
            using (new SaveOrLoadMenu())
            {
                SaveDataSlot sdSlot = SaveOrLoadMenu.I.Load(() =>
                {
                    DDPicture picture = Ground.I.Picture.Title;

                    DDDraw.DrawRect(
                        picture,
                        DDUtils.AdjustRectExterior(picture.GetSize().ToD2Size(), new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H))
                        );

                    DDCurtain.DrawCurtain(-0.5);
                });

                if (sdSlot != null)
                {
                    this.Status   = GameStatus.Deserialize(sdSlot.SerializedGameStatus);
                    this.CurrPage = this.Status.Scenario.Pages[this.Status.CurrPageIndex];
                    this.DispSubtitleCharCount = 0;
                    this.DispCharCount         = 0;
                    this.DispPageEndedCount    = 0;
                    this.DispFastMode          = false;
                }
            }
            DDEngine.FreezeInput(GameConsts.LONG_INPUT_SLEEP);
        }
예제 #2
0
        /// <summary>
        /// ゲーム中のセーブ・ロード画面
        /// </summary>
        /// <param name="saveMode">セーブモードであるか</param>
        private void SaveOrLoadMenu(bool saveMode)
        {
            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                Color       = new I3Color(255, 255, 255),
                BorderColor = saveMode ? new I3Color(192, 0, 0) : new I3Color(0, 0, 192),
                WallPicture = Ground.I.Picture.星屑物語02,
                WallCurtain = -0.5,
            };

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = simpleMenu.Perform(
                    saveMode ? "セーブメニュー" : "ロードメニュー",
                    Ground.I.SaveDataSlots.Select(saveDataSlot =>
                                                  saveDataSlot.SavedTime.Year == 1 ?
                                                  "----" :
                                                  "[" + saveDataSlot.SavedTime.ToString() + "] " + saveDataSlot.Description).Concat(new string[] { "戻る" }).ToArray(),
                    selectIndex
                    );

                if (selectIndex < Consts.SAVE_DATA_SLOT_NUM)
                {
                    if (saveMode)                     // ? セーブモード
                    {
                        if (new Confirm()
                        {
                            BorderColor =
                                Ground.I.SaveDataSlots[selectIndex].SerializedGameStatus != null ?
                                new I3Color(255, 0, 0) :
                                new I3Color(150, 150, 0)
                        }
                            .Perform(
                                Ground.I.SaveDataSlots[selectIndex].SerializedGameStatus != null ?
                                "スロット " + (selectIndex + 1) + " のデータを上書きします。" :
                                "スロット " + (selectIndex + 1) + " にセーブします。", "はい", "いいえ") == 0)
                        {
                            string description = "シナリオ:" + this.Status.Scenario.Name + " の " + (this.Status.CurrPageIndex + 1) + " 頁";

                            Ground.I.SaveDataSlots[selectIndex].SerializedGameStatus = this.Status.Serialize();
                            Ground.I.SaveDataSlots[selectIndex].SavedTime            = new SCommon.SimpleDateTime(SCommon.TimeStampToSec.ToSec(DateTime.Now));
                            Ground.I.SaveDataSlots[selectIndex].Description          = description;
                        }
                    }
                    else                                                                      // ? ロードモード
                    {
                        if (Ground.I.SaveDataSlots[selectIndex].SerializedGameStatus != null) // ロードする。
                        {
                            if (new Confirm()
                            {
                                BorderColor = new I3Color(50, 100, 200)
                            }
                                .Perform("スロット " + (selectIndex + 1) + " のデータをロードします。", "はい", "いいえ") == 0)
                            {
                                this.Status   = GameStatus.Deserialize(Ground.I.SaveDataSlots[selectIndex].SerializedGameStatus);
                                this.CurrPage = this.Status.Scenario.Pages[this.Status.CurrPageIndex];
                                this.DispSubtitleCharCount = 0;
                                this.DispCharCount         = 0;
                                this.DispPageEndedCount    = 0;
                                this.DispFastMode          = false;
                                break;
                            }
                        }
                    }
                }
                else                 // [戻る]
                {
                    break;
                }
                //DDEngine.EachFrame(); // 不要
            }
            DDEngine.FreezeInput(GameConsts.LONG_INPUT_SLEEP);
        }
예제 #3
0
        public void Perform()
        {
            DDUtils.SetMouseDispMode(true);             // 2bs -- 既にマウス有効であるはず

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

            DDEngine.FreezeInput();

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

            this.SimpleMenu             = new DDSimpleMenu();
            this.SimpleMenu.Color       = new I3Color(255, 255, 128);
            this.SimpleMenu.BorderColor = new I3Color(0, 0, 100);
            this.SimpleMenu.WallDrawer  = this.DrawWall.Execute;

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

                int moving = 0;

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

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

                if (moving != 0)
                {
                    if (this.TopMenu.SelectIndex == -1)
                    {
                        this.TopMenu.SelectIndex = moving == 1 ? 0 : TopMenuTask.ITEM_NUM - 1;
                    }
                    else
                    {
                        this.TopMenu.SelectIndex += moving;
                        this.TopMenu.SelectIndex += TopMenuTask.ITEM_NUM;
                        this.TopMenu.SelectIndex %= TopMenuTask.ITEM_NUM;
                    }
                    this.TopMenu.Items[this.TopMenu.SelectIndex].マウスカーソルをここへ移動();
                }

                if (
                    this.TopMenu.SelectIndex != -1 &&
                    (
                        DDMouse.L.GetInput() == -1 ||
                        DDInput.A.GetInput() == 1
                    )
                    )
                {
                    switch (this.TopMenu.SelectIndex)
                    {
                    case 0:
                    {
                        this.LeaveTitleMenu();

                        using (new Game())
                        {
                            Game.I.Status.Scenario = new Scenario(GameConsts.FIRST_SCENARIO_NAME);
                            Game.I.Perform();
                        }
                        this.ReturnTitleMenu();
                    }
                    break;

                    case 1:
                    {
#if true
                        this.DrawWall.TopMenuLeaved = true;
                        SaveDataSlot saveDataSlot;

                        using (new SaveOrLoadMenu())
                        {
                            saveDataSlot = SaveOrLoadMenu.I.Load(this.DrawWall.Execute);
                        }
                        this.DrawWall.TopMenuLeaved = false;
#else // old
                        this.DrawWall.TopMenuLeaved = true;
                        SaveDataSlot saveDataSlot = this.LoadGame();
                        this.DrawWall.TopMenuLeaved = false;
#endif

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

                            using (new Game())
                            {
                                Game.I.Status = GameStatus.Deserialize(saveDataSlot.SerializedGameStatus);
                                Game.I.Perform(true);
                            }
                            this.ReturnTitleMenu();
                        }
                    }
                    break;

                    case 2:
#if true
                        this.DrawWall.TopMenuLeaved = true;

                        using (new SettingMenu())
                        {
                            SettingMenu.I.Perform(this.DrawWall.Execute);
                        }
                        this.DrawWall.TopMenuLeaved = false;
#else // old
                        this.DrawWall.TopMenuLeaved = true;
                        this.Setting();
                        this.DrawWall.TopMenuLeaved = false;
#endif
                        break;

                    case 3:
                        goto endMenu;

                    default:
                        throw null;                                 // never
                    }
                }
                if (DDMouse.R.GetInput() == -1)
                {
                    goto endMenu;
                }

                if (DDInput.B.GetInput() == 1)
                {
                    if (this.TopMenu.SelectIndex == TopMenuTask.ITEM_NUM - 1)
                    {
                        goto endMenu;
                    }

                    this.TopMenu.Items[TopMenuTask.ITEM_NUM - 1].マウスカーソルをここへ移動();
                }
                DDEngine.EachFrame();
            }
endMenu:
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.SimpleMenu.DrawWall();
                DDEngine.EachFrame();
            }
            DDEngine.FreezeInput();
        }
예제 #4
0
        public void Perform()
        {
            DDUtils.SetMouseDispMode(true);             // 2bs -- 既にマウス有効であるはず

            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.Color       = new I3Color(255, 255, 128);
            this.SimpleMenu.BorderColor = new I3Color(0, 0, 100);
            this.SimpleMenu.WallPicture = Ground.I.Picture.星屑物語11;
            this.SimpleMenu.WallCurtain = -0.5;

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

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

                    using (new Game())
                    {
                        Game.I.Status.Scenario = new Scenario(GameConsts.FIRST_SCENARIO_NAME);
                        Game.I.Perform();
                    }
                    this.ReturnTitleMenu();
                }
                break;

                case 1:
                {
                    SaveDataSlot saveDataSlot = this.LoadGame();

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

                        using (new Game())
                        {
                            Game.I.Status = GameStatus.Deserialize(saveDataSlot.SerializedGameStatus);
                            Game.I.Perform(true);
                        }
                        this.ReturnTitleMenu();
                    }
                }
                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();
        }