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(); }
/// <summary> /// ゲーム中のセーブ・ロード画面 /// </summary> /// <param name="saveMode">セーブモードであるか</param> private void P_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.Title, // 仮 WallCurtain = -0.5, }; int selectIndex = 0; for (; ;) { selectIndex = simpleMenu.Perform( saveMode ? "セーブメニュー" : "ロードメニュー", Ground.I.SaveDataSlots.Select(saveDataSlot => saveDataSlot.SavedTime.Year == 1 ? "----" : "[" + saveDataSlot.SavedTime.ToString() + "]").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(200, 100, 50) } .Perform( Ground.I.SaveDataSlots[selectIndex].SerializedGameStatus != null ? "スロット " + (selectIndex + 1) + " のデータを上書きします。" : "スロット " + (selectIndex + 1) + " にセーブします。", "はい", "いいえ") == 0) { Ground.I.SaveDataSlots[selectIndex].SerializedGameStatus = this.Status.Serialize(); Ground.I.SaveDataSlots[selectIndex].SavedTime = new SCommon.SimpleDateTime(SCommon.TimeStampToSec.ToSec(DateTime.Now)); } } 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); }
public static void SaveGame(GameStatus gameStatus) { SaveGame_幕間(); DDEngine.FreezeInput(); DDCurtain.SetCurtain(); DDEngine.FreezeInput(); DDSimpleMenu simpleMenu = new DDSimpleMenu() { BorderColor = new I3Color(0, 128, 0), WallDrawer = () => { DDDraw.SetBright(new I3Color(128, 64, 0)); DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H); DDDraw.Reset(); }, }; int selectIndex = 0; for (; ;) { // セーブしたら戻ってくるので、毎回更新する。 string[] items = Ground.I.SaveDataSlots.Select(v => v.GameStatus == null ? "----" : "[" + v.TimeStamp + "] " + v.Description).Concat(new string[] { "戻る" }).ToArray(); selectIndex = simpleMenu.Perform(18, 18, 32, 24, "セーブ", items, selectIndex); if (selectIndex < Consts.SAVE_DATA_SLOT_NUM) { if (new Confirm() { BorderColor = Ground.I.SaveDataSlots[selectIndex].GameStatus != null ? new I3Color(200, 0, 0) : new I3Color(100, 100, 0) } .Perform( Ground.I.SaveDataSlots[selectIndex].GameStatus != null ? "スロット " + (selectIndex + 1) + " のデータを上書きします。" : "スロット " + (selectIndex + 1) + " にセーブします。", "はい", "いいえ") == 0) { Ground.P_SaveDataSlot saveDataSlot = Ground.I.SaveDataSlots[selectIndex]; saveDataSlot.TimeStamp = DateTime.Now.ToString("yyyy/MM/dd (ddd) HH:mm:ss"); saveDataSlot.Description = "@~@~@"; saveDataSlot.MapName = GameCommon.GetMapName(Game.I.Map.MapFile, "Tests\\t0001"); saveDataSlot.GameStatus = gameStatus; } } else // [戻る] { break; } //DDEngine.EachFrame(); // 不要 } SaveGame_幕間(); DDEngine.FreezeInput(); }
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: if (DDConfig.LOG_ENABLED && 1 <= DDInput.DIR_6.GetInput()) { this.CheatMainMenu(); } else { 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.WallDrawer(); DDEngine.EachFrame(); } DDEngine.FreezeInput(); }