/// <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); }
private SaveDataSlot LoadGame() { SaveDataSlot saveDataSlot = null; DDCurtain.SetCurtain(); DDEngine.FreezeInput(); string[] items = Ground.I.SaveDataSlots.Select(v => v.SavedTime.Year == 1 ? "----" : "[" + v.SavedTime.ToString() + "]").Concat(new string[] { "戻る" }).ToArray(); int selectIndex = 0; for (; ;) { selectIndex = this.SimpleMenu.Perform("コンテニュー", items, selectIndex); if (selectIndex < Consts.SAVE_DATA_SLOT_NUM) { if (Ground.I.SaveDataSlots[selectIndex].SerializedGameStatus != null) // ロードする。 { if (new Confirm().Perform("スロット " + (selectIndex + 1) + " のデータをロードします。", "はい", "いいえ") == 0) { saveDataSlot = Ground.I.SaveDataSlots[selectIndex]; break; } } } else // [戻る] { break; } } DDEngine.FreezeInput(); return(saveDataSlot); }
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(); }
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(); }
private int SelectedSaveDataSlotIndex = -1; // -1 == 未選択 private SaveDataSlot Perform(Action a_drawWall, bool saveMode) // ret: null == セーブモード || (ロードモード && キャンセルした) { this.DrawWall = a_drawWall; DDHashedData thumbnail = saveMode ? this.MakeThumbnail() : null; SaveDataSlot ret = null; DDEngine.FreezeInput(); for (; ;) { // ==== // 入力判定ここから // ==== if ( DDInput.A.GetInput() == 1 || DDInput.B.GetInput() == 1 || DDMouse.R.GetInput() == -1 ) { break; } if (DDMouse.L.GetInput() == -1) { if (this.LastHoveringButton == Ground.I.Picture.SettingButton_前へ) { this.PageIndex--; } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_次へ) { this.PageIndex++; } DDUtils.ToRange(ref this.PageIndex, 0, PAGE_NUM - 1); if (this.LastHoveringButton == Ground.I.Picture.SettingButton_戻る) { break; } if (this.SelectedSaveDataSlotIndex != -1) { SaveDataSlot sdSlot = Ground.I.SaveDataSlots[this.SelectedSaveDataSlotIndex]; if (saveMode) // ? セーブモード { if (new Confirm() { BorderColor = sdSlot.SerializedGameStatus != null ? new I3Color(255, 0, 0) : new I3Color(150, 150, 50) } .Perform( sdSlot.SerializedGameStatus != null ? "スロット " + (this.SelectedSaveDataSlotIndex + 1) + " のデータを上書きします。" : "スロット " + (this.SelectedSaveDataSlotIndex + 1) + " にセーブします。", "はい", "いいえ") == 0) { sdSlot.SerializedGameStatus = Game.I.Status.Serialize(); sdSlot.SavedTime = new SCommon.SimpleDateTime(SCommon.TimeStampToSec.ToSec(DateTime.Now)); sdSlot.Thumbnail = thumbnail; } } else // ? ロードモード { if (sdSlot.SerializedGameStatus != null) // ロードする。 { if (new Confirm() { BorderColor = new I3Color(50, 100, 200) } .Perform("スロット " + (this.SelectedSaveDataSlotIndex + 1) + " のデータをロードします。", "はい", "いいえ") == 0) { ret = sdSlot; break; } } } } } // ==== // 入力判定ここまで // ==== // ==== // 描画ここから // ==== this.LastHoveringButton = null; // 不使用 this.DrawWall(); DDDraw.DrawSimple(Ground.I.Picture.詳細設定枠, 0, 0); DrawTabTitle(855, 70, saveMode ? "セーブ" : "ロード", true); int selSDSlotIndex = -1; int sdSlotIndex = this.PageIndex * 10; for (int y = 0; y < 2; y++) { for (int x = 0; x < 5; x++) { bool selected = this.SelectedSaveDataSlotIndex == sdSlotIndex; SaveDataSlot sdSlot = Ground.I.SaveDataSlots[sdSlotIndex]; int slotX = 260 + x * 350; int slotY = 360 + y * 350; DDDraw.SetAlpha(selected ? 1.0 : 0.3); DDDraw.DrawBegin(Ground.I.Picture.SaveDataSlot, slotX, slotY); DDCrash drawedCrash = DDDraw.DrawGetCrash(); DDDraw.DrawEnd(); DDDraw.Reset(); if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y)))) { selSDSlotIndex = sdSlotIndex; } DDDraw.DrawCenter(DDHashedResource.GetPicture(sdSlot.Thumbnail), slotX, slotY); DDPrint.SetBorder(new I3Color(0, 0, 150)); DDPrint.SetPrint(slotX - 140, slotY - 145); DDPrint.Print("" + (sdSlotIndex + 1)); DDPrint.SetBorder(new I3Color(0, 0, 150)); DDPrint.SetPrint(slotX - 150, slotY + 120); DDPrint.Print(sdSlot.SavedTime.Year == 1 ? "----/--/--(--)--:--" //"----/--/-- --:--:--" : sdSlot.SavedTime.ToString( "{0:D4}/{1:D2}/{2:D2}({3}){4:D2}:{5:D2}" //"{0:D4}/{1:D2}/{2:D2} {4:D2}:{5:D2}:{6:D2}" )); sdSlotIndex++; } } this.SelectedSaveDataSlotIndex = selSDSlotIndex; this.DrawButton(800, 950, Ground.I.Picture.SettingButton_前へ, 0 < this.PageIndex); this.DrawButton(1120, 950, Ground.I.Picture.SettingButton_次へ, this.PageIndex < PAGE_NUM - 1); this.DrawButton(1630, 950, Ground.I.Picture.SettingButton_戻る, true); // ==== // 描画ここまで // ==== DDEngine.EachFrame(); } DDEngine.FreezeInput(); DDHashedResource.ClearPicture(); return(ret); }