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); }
public void Perform() { // 開発中_暫定 { int endFrame = DDEngine.ProcFrame + 300; DDGround.EL.Add(() => { int sec = endFrame - DDEngine.ProcFrame; DDPrint.SetDebug(70, DDConsts.Screen_H - 32); DDPrint.Print("これはクローズドテスト版です。仮リソース・実装されていない機能を含みます。(あと " + (sec / 60.0).ToString("F1") + " 秒で消えます)"); return(0 < sec); }); } foreach (DDScene scene in DDSceneUtils.Create(60)) // LiteStatusDlg を閉じるまでの遅延の分(30フレーム)延長 //foreach (DDScene scene in DDSceneUtils.Create(30)) { DDCurtain.DrawCurtain(); DDEngine.EachFrame(); } double z1 = 0.3; double z2 = 2.0; double z3 = 3.7; foreach (DDScene scene in DDSceneUtils.Create(60)) { DDCurtain.DrawCurtain(); DDDraw.SetAlpha(scene.Rate); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(z1); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.7); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(0.8 + 0.5 * scene.Rate); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(z2); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(z3); DDDraw.DrawEnd(); DDDraw.Reset(); DDUtils.Approach(ref z1, 1.0, 0.9); DDUtils.Approach(ref z2, 1.0, 0.98); DDUtils.Approach(ref z3, 1.0, 0.95); DDEngine.EachFrame(); } foreach (DDScene scene in DDSceneUtils.Create(90)) { DDCurtain.DrawCurtain(); DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDEngine.EachFrame(); } foreach (DDScene scene in DDSceneUtils.Create(60)) { DDCurtain.DrawCurtain(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(1.0 - 0.3 * scene.Rate); DDDraw.DrawRotate(scene.Rate * -0.1); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(1.0 + 0.8 * scene.Rate); DDDraw.DrawRotate(scene.Rate * 0.1); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3); DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2 + scene.Rate * 100.0, DDConsts.Screen_H / 2); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3); DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2 + scene.Rate * 50.0); DDDraw.Reset(); DDEngine.EachFrame(); } }
private void Edit() { this.Map.Load(); // ゲーム中にマップを書き換える場合があるので、再ロードする。 DDEngine.FreezeInput(); DDUtils.SetMouseDispMode(true); LevelEditor.ShowDialog(); int lastMouseX = DDMouse.X; int lastMouseY = DDMouse.Y; for (; ;) { if (LevelEditor.Dlg.XPressed) { break; } // 廃止 //if (DDKey.GetInput(DX.KEY_INPUT_E) == 1) // break; I2Point cellPos = GameCommon.ToTablePoint( DDGround.Camera.X + DDMouse.X, DDGround.Camera.Y + DDMouse.Y ); MapCell cell = Game.I.Map.GetCell(cellPos); if (cell.IsDefault) { // noop } else if (1 <= DDKey.GetInput(DX.KEY_INPUT_LSHIFT) && 1 <= DDKey.GetInput(DX.KEY_INPUT_LCONTROL)) // 左シフト・コントロール押下 -> 塗り潰し / none { if (DDMouse.L.GetInput() == -1) // クリックを検出 { this.Map.Save(); // 失敗を想定して、セーブしておく switch (LevelEditor.Dlg.GetMode()) { case LevelEditor.Mode_e.TILE: { string tileName = LevelEditor.Dlg.GetTile(); if (tileName != cell.TileName) { string targetTileName = cell.TileName; // cell.TileName は this.EditFill で変更される。 this.EditFill( cellPos, v => v.TileName == targetTileName, v => { v.TileName = tileName; v.Tile = TileCatalog.Create(tileName); } ); } } break; case LevelEditor.Mode_e.ENEMY: { string enemyName = LevelEditor.Dlg.GetEnemy(); if (enemyName != cell.EnemyName) { string targetEnemyName = cell.EnemyName; // cell.EnemyName は this.EditFill で変更される。 this.EditFill( cellPos, v => v.EnemyName == targetEnemyName, v => v.EnemyName = enemyName ); } } break; default: throw null; // never } } else if (1 <= DDMouse.R.GetInput()) { // none } } else if (1 <= DDKey.GetInput(DX.KEY_INPUT_LSHIFT)) // 左シフト押下 -> 移動 / none { if (1 <= DDMouse.L.GetInput()) { DDGround.Camera.X -= DDMouse.X - lastMouseX; DDGround.Camera.Y -= DDMouse.Y - lastMouseY; DDUtils.ToRange(ref DDGround.Camera.X, 0.0, this.Map.W * GameConsts.TILE_W - DDConsts.Screen_W); DDUtils.ToRange(ref DDGround.Camera.Y, 0.0, this.Map.H * GameConsts.TILE_H - DDConsts.Screen_H); DDGround.ICamera.X = SCommon.ToInt(DDGround.Camera.X); DDGround.ICamera.Y = SCommon.ToInt(DDGround.Camera.Y); } else if (1 <= DDMouse.R.GetInput()) { // none } } else if (1 <= DDKey.GetInput(DX.KEY_INPUT_LCONTROL)) // 左コントロール押下 -> スポイト / none { if (1 <= DDMouse.L.GetInput()) { switch (LevelEditor.Dlg.GetMode()) { case LevelEditor.Mode_e.TILE: LevelEditor.Dlg.SetTile(cell.TileName); break; case LevelEditor.Mode_e.ENEMY: LevelEditor.Dlg.SetEnemy(cell.EnemyName); break; default: throw null; // never } } else if (1 <= DDMouse.R.GetInput()) { // none } } else if (1 <= DDKey.GetInput(DX.KEY_INPUT_LALT)) // 左 ALT 押下 -> 自機ワープ / none { if (DDMouse.L.GetInput() == -1) // クリックを検出 { this.Player.X = cellPos.X * GameConsts.TILE_W + GameConsts.TILE_W / 2; this.Player.Y = cellPos.Y * GameConsts.TILE_H + GameConsts.TILE_H / 2; DDGround.EL.Add(SCommon.Supplier(Effects.中爆発(this.Player.X, this.Player.Y))); // アクションが分かるように } else if (1 <= DDMouse.R.GetInput()) { // none } } else // シフト系押下無し -> セット / クリア { if (1 <= DDMouse.L.GetInput()) { switch (LevelEditor.Dlg.GetMode()) { case LevelEditor.Mode_e.TILE: { string tileName = LevelEditor.Dlg.GetTile(); cell.TileName = tileName; cell.Tile = TileCatalog.Create(tileName); } break; case LevelEditor.Mode_e.ENEMY: { string enemyName = LevelEditor.Dlg.GetEnemy(); cell.EnemyName = enemyName; } break; default: throw null; // never } } else if (1 <= DDMouse.R.GetInput()) { switch (LevelEditor.Dlg.GetMode()) { case LevelEditor.Mode_e.TILE: cell.TileName = GameConsts.TILE_NONE; cell.Tile = new Tile_None(); break; case LevelEditor.Mode_e.ENEMY: cell.EnemyName = GameConsts.ENEMY_NONE; break; default: throw null; // never } } } if (DDKey.GetInput(DX.KEY_INPUT_S) == 1) // S キー --> Save { this.Map.Save(); // 表示 { int endFrame = DDEngine.ProcFrame + 60; DDGround.EL.Add(() => { DDPrint.SetPrint(0, 16); DDPrint.SetBorder(new I3Color(0, 0, 0)); DDPrint.Print("セーブしました..."); DDPrint.Reset(); return(DDEngine.ProcFrame < endFrame); }); } } if (DDKey.GetInput(DX.KEY_INPUT_L) == 1) // L キー --> Load { this.Map.Load(); // 表示 { int endFrame = DDEngine.ProcFrame + 60; DDGround.EL.Add(() => { DDPrint.SetPrint(0, 16); DDPrint.SetBorder(new I3Color(0, 0, 0)); DDPrint.Print("ロードしました..."); DDPrint.Reset(); return(DDEngine.ProcFrame < endFrame); }); } } DDCurtain.DrawCurtain(); if (LevelEditor.Dlg.IsShowTile()) { this.DrawMap(); } if (LevelEditor.Dlg.IsShowEnemy()) { LevelEditor.DrawEnemy(); } lastMouseX = DDMouse.X; lastMouseY = DDMouse.Y; DDEngine.EachFrame(); } DDEngine.FreezeInput(); DDUtils.SetMouseDispMode(false); LevelEditor.CloseDialog(); this.Map.Save(); // ★★★ マップをセーブする ★★★ }
private int HitBackFrame = 0; // 0 == 無効, 1~ ヒットバック中 protected override IEnumerable <bool> E_Draw() { for (int frame = 0; ; frame++) { double SPEED = 2.0; double xBuru = 0.0; double yBuru = 0.0; if (1 <= this.HitBackFrame) { int frm = this.HitBackFrame - 1; if (HIT_BACK_FRAME_MAX < frm) { this.HitBackFrame = 0; goto endHitBack; } this.HitBackFrame++; // ---- double rate = (double)frm / HIT_BACK_FRAME_MAX; SPEED = 0.0; xBuru = (1.0 - rate) * 30.0 * DDUtils.Random.Real(); yBuru = (1.0 - rate) * 30.0 * DDUtils.Random.Real(); } endHitBack: switch (frame / 60 % 4) { case 0: this.X += SPEED; break; case 1: this.Y += SPEED; break; case 2: this.X -= SPEED; break; case 3: this.Y -= SPEED; break; default: throw null; // never } if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), 100.0)) { if (1 <= this.HitBackFrame) { DDDraw.SetBright(1.0, 0.8, 1.0); } else { DDDraw.SetBright(1.0, 0.5, 0.0); } DDDraw.DrawBegin( Ground.I.Picture.WhiteBox, this.X - DDGround.ICamera.X + xBuru, this.Y - DDGround.ICamera.Y + yBuru ); DDDraw.DrawSetSize(100.0, 100.0); DDDraw.DrawEnd(); DDDraw.Reset(); DDPrint.SetBorder(new I3Color(128, 64, 0)); DDPrint.SetPrint( (int)this.X - DDGround.ICamera.X - 46, (int)this.Y - DDGround.ICamera.Y - 46, 20 ); DDPrint.PrintLine("敵(仮)"); DDPrint.PrintLine("HP:" + this.HP); DDPrint.Reset(); this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(this.X, this.Y), new D2Size(100.0, 100.0)); } yield return(true); } }
public override IEnumerable <bool> E_Task() { DDTaskList el = new DDTaskList(); double dx = 0.0; double dy = 0.0; double ldx; double ldy; double shadow_a = 0.0; double shadow_x = 0.0; double title_a = 0.0; double shadow_targ_a; double shadow_targ_x; double title_targ_a; for (int frame = 0; ; frame++) { ldx = dx; ldy = dy; dx = Math.Cos(frame / 199.0) * 40.0; dy = Math.Cos(frame / 211.0) * 30.0; double dxa = dx - ldx; double dya = dy - ldy; DDDraw.DrawBegin(Ground.I.Picture.TitleWall, DDConsts.Screen_W / 2 + dx, DDConsts.Screen_H / 2 + dy); DDDraw.DrawZoom(1.3); DDDraw.DrawEnd(); if (1 <= frame && DDUtils.Random.Real() < 0.03 + Math.Sin(frame / 307.0) * 0.02) { el.Add(SCommon.Supplier(this.Effect_0001(dx, dy, dxa, dya))); } el.ExecuteAllTask_Reverse(); double titleX = 720.0 + dx * 0.4; double titleY = 270.0 + dy * 0.4; double tba = 0.5 + Math.Sin(frame / 103.0) * 0.185 + Math.Sin(frame / 3.0) * 0.015 * Math.Sin(frame / 107.0); double tfa = 0.3; tba *= title_a; tfa *= title_a; { const int FRAME_MAX = 300; if (frame < FRAME_MAX) { DDDraw.SetBlendAdd(frame * tba / FRAME_MAX); DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY); DDDraw.Reset(); } else { DDDraw.SetBlendAdd(tba); DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY); DDDraw.Reset(); } } { const int FRAME_MAX = 300; if (frame < FRAME_MAX) { DDDraw.SetBlendAdd(frame * tfa / FRAME_MAX); DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY); DDDraw.Reset(); } else { DDDraw.SetBlendAdd(tfa); DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY); DDDraw.Reset(); } } if (this.DeepConfigEntered) { shadow_targ_a = 0.3; shadow_targ_x = DDConsts.Screen_W; title_targ_a = 0.0; } else if (this.TopMenuLeaved) { shadow_targ_a = 0.3; shadow_targ_x = 480.0; title_targ_a = 1.0; } else { shadow_targ_a = 0.0; shadow_targ_x = 30.0; title_targ_a = 1.0; } DDUtils.Approach(ref shadow_a, shadow_targ_a, 0.8); DDUtils.Approach(ref shadow_x, shadow_targ_x, 0.8); DDUtils.Approach(ref title_a, title_targ_a, 0.97); DDDraw.SetAlpha(shadow_a); DDDraw.SetBright(0, 0, 0); DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, 0, shadow_x, DDConsts.Screen_H); DDDraw.Reset(); yield return(true); } }
/// <summary> /// 過去ログ /// </summary> private void Backlog() { List <string> logLines = new List <string>(); for (int index = 0; index < this.Status.CurrPageIndex; index++) { foreach (string line in this.Status.Scenario.Pages[index].Lines) { logLines.Add(line); } } DDEngine.FreezeInput(GameConsts.SHORT_INPUT_SLEEP); this.BacklogMode = true; int backIndex = 0; for (; ;) { if ( DDMouse.L.GetInput() == -1 || DDInput.A.GetInput() == 1 ) { break; } if ( DDInput.DIR_8.IsPound() || 0 < DDMouse.Rot ) { backIndex++; } if ( DDInput.DIR_2.IsPound() || DDMouse.Rot < 0 ) { backIndex--; } if ( DDInput.DIR_6.GetInput() == 1 ) { backIndex = -1; } DDUtils.ToRange(ref backIndex, -1, logLines.Count - 1); if (backIndex < 0) { break; } this.DrawSurfaces(); DDCurtain.DrawCurtain(-0.8); for (int c = 1; c <= 17; c++) { int i = logLines.Count - backIndex - c; if (0 <= i) { DDFontUtils.DrawString(16, DDConsts.Screen_H - c * 60 - 16, logLines[i], DDFontUtils.GetFont("Kゴシック", 32)); } } DDEngine.EachFrame(); } DDEngine.FreezeInput(GameConsts.SHORT_INPUT_SLEEP); this.BacklogMode = false; }
/// <summary> /// システムメニュー画面 /// </summary> private void SystemMenu() { this.SystemMenu_ReturnToTitleMenu = false; // reset DDSimpleMenu simpleMenu = new DDSimpleMenu() { Color = new I3Color(255, 255, 255), BorderColor = new I3Color(0, 64, 0), //WallPicture = Ground.I.Picture.Title, //WallCurtain = -0.5, WallDrawer = () => { DDPicture picture = Ground.I.Picture.Title; DDDraw.DrawRect( picture, DDUtils.AdjustRectExterior(picture.GetSize().ToD2Size(), new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H)) ); DDDraw.SetAlpha(0.5); DDDraw.SetBright(0, 0, 0); DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, DDConsts.Screen_H / 4, DDConsts.Screen_W, DDConsts.Screen_H / 2); DDDraw.Reset(); }, X = 150, Y = DDConsts.Screen_H / 4 + 150, }; int selectIndex = 0; for (; ;) { selectIndex = simpleMenu.Perform( "システムメニュー", new string[] { "設定", "タイトルに戻る", "ゲームに戻る", }, selectIndex ); switch (selectIndex) { case 0: using (new SettingMenu()) { SettingMenu.I.Perform(() => { 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); }); } break; case 1: if (new Confirm().Perform("タイトル画面に戻ります。", "はい", "いいえ") == 0) { this.SystemMenu_ReturnToTitleMenu = true; goto endLoop; } break; case 2: goto endLoop; default: throw null; // never } //DDEngine.EachFrame(); // 不要 } endLoop: DDEngine.FreezeInput(GameConsts.LONG_INPUT_SLEEP); }
public void Perform() { for (int index = this.StartStageIndex; ; index++) { if (!DDConfig.LOG_ENABLED) // zantei zantei zantei test test test 開発デバッグ中は抑止 { レイヤ表示.Perform(index, this.ThemeColors[index]); } Game.EndStatus_e endStatus; using (new Game()) { Game.I.Map = this.MapLoaders[index](); Game.I.Perform(); endStatus = Game.I.EndStatus; if (endStatus == Game.EndStatus_e.ReturnToTitleMenu) { break; } } #if true int reachedStageIndexNew = index + 1; bool 初見 = false; if (Ground.I.ReachedStageIndex < reachedStageIndexNew) { Ground.I.ReachedStageIndex = reachedStageIndexNew; 初見 = true; } Ground.I.会話スキップ抑止 = 初見; #else // old DDUtils.Maxim(ref Ground.I.ReachedStageIndex, index + 1); #endif try { if (endStatus == Game.EndStatus_e.NextStage) { 箱から出る.Perform(); using (new Novel()) { Novel.I.Status.Scenario = ScenarioLoaders[index](); Novel.I.Perform(); } } else if (endStatus == Game.EndStatus_e.死亡エンド) { Ground.I.会話スキップ抑止 = !Ground.I.SawEnding_死亡; new Ending_死亡().Perform(); Ground.I.SawEnding_死亡 = true; break; } else if (endStatus == Game.EndStatus_e.生還エンド) { Ground.I.会話スキップ抑止 = !Ground.I.SawEnding_生還; new Ending_生還().Perform(); Ground.I.SawEnding_生還 = true; break; } else if (endStatus == Game.EndStatus_e.復讐エンド) { Ground.I.会話スキップ抑止 = !Ground.I.SawEnding_復讐; using (new Novel()) { Novel.I.Status.Scenario = new Scenario("エンディング_復讐"); Novel.I.Perform(); if (Novel.I.会話スキップした) { throw new 箱から出る.Cancelled(); } } new Ending_復讐().Perform(); Ground.I.SawEnding_復讐 = true; break; } else { throw null; // never } } catch (箱から出る.Cancelled) { } finally { DDUtils.SetMouseDispMode(false); Ground.I.会話スキップ抑止 = false; // restore } } }
public Enemy_ルーミア_Tama_03(double x, double y, double rad, EnemyCommon.TAMA_COLOR_e color, int absorbableWeapon = -1) : base(x, y, Kind_e.TAMA, 0, 0, absorbableWeapon) { this.Speed = DDUtils.AngleToPoint(rad, 6.0); this.Color = color; }
protected override IEnumerable <bool> E_Draw() { double SCALE = LevelToScale(this.Level); double R = SCommon.ToInt(24.0 * SCALE); double xAdd = this.FacingLeft ? -1.0 : 1.0; double yAdd = Game.I.Player.YSpeed * 0.2; DDUtils.MakeXYSpeed(0.0, 0.0, xAdd, yAdd, 20.0 * SCALE, out xAdd, out yAdd); for (int frame = 0; ; frame++) { if (Game.I.Status.Equipment != GameStatus.Equipment_e.ハンマー陰陽玉) // 武器を切り替えたら消滅 { this.Kill(); break; } double xaa; double yaa; // バネの加速度 { xaa = (Game.I.Player.X - this.X) * 0.01; yaa = (Game.I.Player.Y - this.Y) * 0.01; } yaa += 1.0; // 重力加速度 xAdd += xaa; yAdd += yaa; // 空気抵抗 { double 空気抵抗 = LevelTo空気抵抗(this.Level); xAdd *= 空気抵抗; yAdd *= 空気抵抗; } this.X += xAdd; this.Y += yAdd; DDDraw.DrawBegin(Ground.I.Picture2.陰陽玉, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y); DDDraw.DrawSetSize(R * 2, R * 2); DDDraw.DrawRotate(frame / 10.0); DDDraw.DrawEnd(); // プレイヤーとハンマーを繋ぐバネのような何かを描画する。 { double d = DDUtils.GetDistance(this.X - Game.I.Player.X, this.Y - Game.I.Player.Y); if (10.0 < d) { double x = (this.X + Game.I.Player.X) / 2.0; double y = (this.Y + Game.I.Player.Y) / 2.0; double rot = DDUtils.GetAngle(this.X - Game.I.Player.X, this.Y - Game.I.Player.Y) + Math.PI / 2; DDDraw.SetAlpha(0.5); DDDraw.DrawBegin(Ground.I.Picture2.Laser[4], x - DDGround.ICamera.X, y - DDGround.ICamera.Y); DDDraw.DrawSetSize_H(d); DDDraw.DrawRotate(rot); DDDraw.DrawEnd(); DDDraw.Reset(); } } this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), R); yield return(true); } }
protected override IEnumerable <bool> E_Draw() { double R = LevelToR(this.Level); // 自弾半径 const double X_ADD = 8.0; // 横移動速度 const double GRAVITY = 0.8; // 重力加速度 const double Y_ADD_MAX = 19.0; // 落下最高速度 double Y_ADD_FIRST = Game.I.Player.YSpeed - 6.0; // 初期_縦移動速度 const double K = 0.98; // 跳ね返り係数 double yAdd = Y_ADD_FIRST; int bouncedCount = 0; // 初期位置調整 { this.X += R * (this.FacingLeft ? -1 : 1); this.Y -= R; } for (int frame = 0; ; frame++) { this.X += X_ADD * (this.FacingLeft ? -1 : 1); this.Y += yAdd; yAdd += GRAVITY; DDUtils.Minim(ref yAdd, Y_ADD_MAX); // 跳ね返り { int xBounce = 0; int yBounce = 0; if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R, this.Y)).Tile.IsWall()) { xBounce += 3; } if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R, this.Y)).Tile.IsWall()) { xBounce -= 3; } if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y - R)).Tile.IsWall()) { yBounce += 3; } if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y + R)).Tile.IsWall()) { yBounce -= 3; } if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R / Consts.ROOT_OF_2, this.Y - R / Consts.ROOT_OF_2)).Tile.IsWall()) { xBounce += 2; yBounce += 2; } if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R / Consts.ROOT_OF_2, this.Y - R / Consts.ROOT_OF_2)).Tile.IsWall()) { xBounce -= 2; yBounce += 2; } if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R / Consts.ROOT_OF_2, this.Y + R / Consts.ROOT_OF_2)).Tile.IsWall()) { xBounce += 2; yBounce -= 2; } if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R / Consts.ROOT_OF_2, this.Y + R / Consts.ROOT_OF_2)).Tile.IsWall()) { xBounce -= 2; yBounce -= 2; } DDUtils.ToRange(ref xBounce, -1, 1); DDUtils.ToRange(ref yBounce, -1, 1); bool bounced = xBounce != 0 || yBounce != 0; if (bounced) { bouncedCount++; if (20 <= bouncedCount) // ? 跳ね返り回数オーバー { //DDGround.EL.Add(SCommon.Supplier(Effects.FireBall爆発(this.X, this.Y))); break; } } if (xBounce == -1) { this.FacingLeft = true; } else if (xBounce == 1) { this.FacingLeft = false; } if (yBounce == -1) { if (0.0 < yAdd) { yAdd *= -K; } } else if (yBounce == 1) { if (yAdd < 0.0) { yAdd *= -K; } } } DDDraw.DrawBegin(Ground.I.Picture2.陰陽玉, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y); DDDraw.DrawSetSize(R * 2, R * 2); DDDraw.DrawRotate(frame / 10.0); DDDraw.DrawEnd(); this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), R); yield return(!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), R)); // カメラから出たら消滅する。 } }
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.Chara = this.Status.StartChara; this.Player.HP = this.Status.StartHP; this.Player.FacingLeft = this.Status.StartFacingLeft; } 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(); for (this.Frame = 0; ; this.Frame++) { // Attack_ほむらシールド 終了から Shot_ほむらシールド の PlayerTracer.Start 実行の間に // ポーズできるタイミングは無いはずだけど、曲芸的で気持ち悪い。 if ( !this.UserInputDisabled && //Game.I.Player.Attack == null && // ? プレイヤーの攻撃モーション中ではない。// モーション中でも良いはず! 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; } if (this.Player.Attack != null) // プレイヤー攻撃中 { if (this.Player.Attack.EachFrame()) // ? このプレイヤー攻撃を継続する。 goto endPlayer; this.Player.Attack = null; // プレイヤー攻撃_終了 } // プレイヤー入力 { 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; int attack = 0; int extendedAttack = 0; if (!deadOrDamageOrUID && 1 <= DDInput.DIR_2.GetInput()) { shagami = true; } // 入力抑止中であるか否かに関わらず左右の入力は受け付ける様にする。 int freezeInputFrameBackup = DDEngine.FreezeInputFrame; DDEngine.FreezeInputFrame = 0; if (!deadOrDamageOrUID && 1 <= DDInput.DIR_4.GetInput()) { this.Player.FacingLeft = true; move = true; } if (!deadOrDamageOrUID && 1 <= DDInput.DIR_6.GetInput()) { this.Player.FacingLeft = false; move = true; } DDEngine.FreezeInputFrame = freezeInputFrameBackup; // restore if (1 <= DDInput.L.GetInput()) { move = false; camSlide = true; } if (!deadOrDamageOrUID && 1 <= DDInput.R.GetInput()) { slow = true; } if (!deadOrDamageOrUID && 1 <= DDInput.A.GetInput()) { jump = DDInput.A.GetInput(); } if (!deadOrDamageOrUID && 1 <= DDInput.B.GetInput()) { attack = DDInput.B.GetInput(); } if (!deadOrDamageOrUID && 1 <= DDInput.C.GetInput()) { extendedAttack = DDInput.C.GetInput(); } if (move) { this.Player.MoveFrame++; shagami = false; } else this.Player.MoveFrame = 0; this.Player.MoveSlow = move && slow; if (1 <= this.Player.JumpFrame) { if (1 <= jump) { this.Player.JumpFrame++; } else { // ★ ジャンプを中断・終了した。 this.Player.JumpFrame = 0; if (this.Player.YSpeed < 0.0) this.Player.YSpeed /= 2.0; } } else { // 事前入力 == 着地前の数フレーム間にジャンプボタンを押し始めてもジャンプできるようにする。 // 入力猶予 == 落下(地面から離れた)直後の数フレーム間にジャンプボタンを押し始めてもジャンプできるようにする。 const int 事前入力時間 = 5; const int 入力猶予時間 = 10; if (this.Player.AirborneFrame < 入力猶予時間) // ? 接地状態からのジャンプが可能な状態 { if (1 <= jump && jump < 事前入力時間) { // ★ ジャンプを開始した。 this.Player.JumpFrame = 1; this.Player.JumpCount = 1; this.Player.YSpeed = GameConsts.PLAYER_ジャンプ初速度; } else { this.Player.JumpCount = 0; } } else // ? 接地状態からのジャンプが「可能ではない」状態 { // 滞空状態に入ったら「通常ジャンプの状態」にする。 if (this.Player.JumpCount < 1) this.Player.JumpCount = 1; if (1 <= jump && jump < 事前入力時間 && this.Player.JumpCount < GameConsts.JUMP_MAX) { // ★ 空中(n-段)ジャンプを開始した。 this.Player.JumpFrame = 1; this.Player.JumpCount++; this.Player.YSpeed = GameConsts.PLAYER_ジャンプ初速度; DDGround.EL.Add(SCommon.Supplier(Effects.空中ジャンプの足場(this.Player.X, this.Player.Y + 48))); } else { // noop } } } if (camSlide) { if (DDInput.DIR_4.IsPound()) { this.CamSlided = true; this.CamSlideX--; } if (DDInput.DIR_6.IsPound()) { this.CamSlided = true; this.CamSlideX++; } if (DDInput.DIR_8.IsPound()) { this.CamSlided = true; this.CamSlideY--; } if (DDInput.DIR_2.IsPound()) { this.CamSlided = true; this.CamSlideY++; } DDUtils.ToRange(ref this.CamSlideX, -1, 1); DDUtils.ToRange(ref this.CamSlideY, -1, 1); } else { if (this.CamSlideMode && !this.CamSlided) { this.CamSlideX = 0; this.CamSlideY = 0; } this.CamSlided = false; } this.CamSlideMode = camSlide; if (this.Player.AirborneFrame != 0) // ? 滞空状態 shagami = false; if (shagami) this.Player.ShagamiFrame++; else this.Player.ShagamiFrame = 0; { const int 事前入力時間 = 2; // 無効 //const int 事前入力時間 = 5; //const int 事前入力時間 = 10; // HACK: ちょっと長すぎるかもしれない。無効でも良いかもしれない。// 暴発があるので事前入力は無効にする。 if (1 <= attack && attack < 事前入力時間) { switch (this.Player.Chara) { case Player.Chara_e.HOMURA: { if (this.Player.AirborneFrame == 0) this.Player.Attack = new Attack_ほむら接地攻撃(); else this.Player.Attack = new Attack_ほむら滞空攻撃(); } break; case Player.Chara_e.SAYAKA: { if (this.Player.AirborneFrame == 0) this.Player.Attack = new Attack_さやか接地攻撃(); else this.Player.Attack = new Attack_さやか滞空攻撃(); } break; default: throw null; // never } } if (1 <= extendedAttack && extendedAttack < 事前入力時間) { switch (this.Player.Chara) { case Player.Chara_e.HOMURA: { if (this.Player.AirborneFrame == 0) this.Player.Attack = new Attack_ほむらシールド(); } break; case Player.Chara_e.SAYAKA: { this.Player.Attack = new Attack_さやか突き(); } break; default: throw null; // never } } } } 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 // noop } //endDead: //startDamage: if (1 <= this.Player.DamageFrame) // プレイヤー・ダメージ中の処理 { if (GameConsts.PLAYER_DAMAGE_FRAME_MAX < ++this.Player.DamageFrame) { this.Player.DamageFrame = 0; if (1 <= this.Player.HP) { this.Player.InvincibleFrame = 1; goto endDamage; } else { this.Player.DeadFrame = 1; goto startDead; } } 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 / 10.0; 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); // 重力による加速 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 = 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 (touchCeiling) { 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; } } 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.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.カメラ位置調整(true); } 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.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; }); } // ==== // 描画ここまで // ==== // ==== // 当たり判定ここから // ==== // ? 無敵な攻撃中 -> 敵 x 自機 の衝突判定を行わない。 bool attackInvincibleMode = Game.I.Player.Attack != null && Game.I.Player.Attack.IsInvincibleMode(); 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 && // ? プレイヤー無敵時間中ではない。 !attackInvincibleMode && // 無敵になる攻撃中ではない。 !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; // ヒットバックした後で死亡フレームを上げる。 this.Player.DamageFrame = 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.StartChara = this.Player.Chara; this.Status.StartHP = this.Player.HP; this.Status.StartFacingLeft = this.Player.FacingLeft; } // ★★★ end of Perform() ★★★ }
private void P_Draw() { DDPicture picture = Ground.I.Picture.Enemy_B0002_01; double SPEED = 2.0; double xBuru = 0.0; double yBuru = 0.0; if (1 <= this.HitBackFrame) { int frame = this.HitBackFrame - 1; if (HIT_BACK_FRAME_MAX < frame) { this.HitBackFrame = 0; goto endHitBack; } this.HitBackFrame++; // ---- double rate = (double)frame / HIT_BACK_FRAME_MAX; picture = Ground.I.Picture.Enemy_B0002_02; SPEED = 0.0; xBuru = (1.0 - rate) * 50.0 * (DDUtils.Random.Real() - 0.5); yBuru = (1.0 - rate) * 50.0 * (DDUtils.Random.Real() - 0.5); } endHitBack: switch (this.Frame / 60 % 4) { case 0: this.X += SPEED; break; case 1: this.Y += SPEED; break; case 2: this.X -= SPEED; break; case 3: this.Y -= SPEED; break; default: throw null; // never } if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), 100.0)) { double xZoom = this.X < Game.I.Player.X ? -1.0 : 1.0; DDDraw.DrawBegin( picture, this.X - DDGround.ICamera.X + xBuru, this.Y - DDGround.ICamera.Y + yBuru ); DDDraw.DrawSetSize(100.0, 100.0); DDDraw.DrawZoom_X(xZoom); DDDraw.DrawEnd(); DDDraw.Reset(); this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(this.X, this.Y), new D2Size(100.0, 100.0)); } this.Frame++; }
public void Main01(string spectrumFile, DDPicture jacket, string wDir, int spBarNum, int spBarWidth, int spBarHeight, I3Color spBarColor, double spBarAlpha, double z2) { FileTools.Delete(wDir); FileTools.CreateDir(wDir); this.SpData = new SpectrumData(spectrumFile); double a = -1.0; double foa = 0.0; double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W(); double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H(); double bz1 = Math.Max(xz, yz); double bz2 = Math.Min(xz, yz); double z1 = 1.0; //double z2 = 2.0; const int JACKET_MARGIN = 10; using (DDSubScreen pseudoMainScreen = new DDSubScreen( DDConsts.Screen_W, DDConsts.Screen_H )) using (DDSubScreen workScreen = new DDSubScreen( DDConsts.Screen_W, DDConsts.Screen_H )) using (DDSubScreen jacketScreen = new DDSubScreen( jacket.Get_W() + JACKET_MARGIN * 2, jacket.Get_H() + JACKET_MARGIN * 2, true )) { // ---- jacketScreen DDSubScreenUtils.ChangeDrawScreen(jacketScreen); DX.ClearDrawScreen(); DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2); DDSubScreenUtils.RestoreDrawScreen(); // ---- SpectrumScreen0001 spScr = new SpectrumScreen0001(spBarNum, spBarWidth, spBarHeight, spBarColor); while (this.Frame < this.SpData.Rows.Length) { double[] row = this.SpData.Rows[this.Frame]; spScr.Draw(row); // ---- workScreen DDSubScreenUtils.ChangeDrawScreen(workScreen); DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(bz1 * z1); DDDraw.DrawEnd(); DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000); //DDSubScreenUtils.RestoreDrawScreen(); // ---- pseudoMainScreen DDSubScreenUtils.ChangeDrawScreen(pseudoMainScreen); DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0); DDCurtain.DrawCurtain(-0.5); DDDraw.DrawBegin( jacketScreen.ToPicture(), //jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(bz2 * z2); DDDraw.DrawEnd(); DDCurtain.DrawCurtain(Math.Min(a, foa)); DDDraw.SetAlpha(spBarAlpha); DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - spBarHeight / 2 - 10); DDDraw.Reset(); // ここでフレームを保存 DX.SaveDrawScreen(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.bmp", this.Frame))); DDSubScreenUtils.RestoreDrawScreen(); // ---- 実際に表示される画面の描画 DDCurtain.DrawCurtain(); { double rate = this.Frame * 1.0 / this.SpData.Rows.Length; const int PROGRESS_BAR_H = 10; DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, (DDConsts.Screen_H - PROGRESS_BAR_H) / 2, Math.Max(5, DDConsts.Screen_W * rate), PROGRESS_BAR_H); } // ---- if (40 < this.Frame) { DDUtils.Approach(ref a, 0.0, 0.985); } if (this.SpData.Rows.Length - 40 < this.Frame) { DDUtils.Approach(ref foa, -1.0, 0.9); } //DDUtils.Approach(ref z1, 1.2, 0.999); //z1 += 0.0001; DDUtils.Approach(ref z2, 1.0, 0.9985); this.MG_EachFrame(); } } }
protected override IEnumerable <bool> E_Draw() { const double CHARA_R = 20.0; double ySpeed = 0.0; for (; ;) { if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X - CHARA_R, this.Y))).Tile.IsWall()) // ? 左側面接触 { this.FacingLeft = false; } if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X + CHARA_R, this.Y))).Tile.IsWall()) // ? 右側面接触 { this.FacingLeft = true; } if (this.端から落ちない) { const double 判定_X = 10.0; const double 判定_Y = CHARA_R + 1.0; if (!Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X - 判定_X, this.Y + 判定_Y))).Tile.IsWall()) // ? 左下足場無し -> 引き返す。 { this.FacingLeft = false; } if (!Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X + 判定_X, this.Y + 判定_Y))).Tile.IsWall()) // ? 右下足場なし -> 引き返す。 { this.FacingLeft = true; } } const double X_SPEED = 1.0; const double GRAVITY = 0.5; const double Y_SPEED_MAX = 10.0; this.X += X_SPEED * (this.FacingLeft ? -1 : 1); this.Y += ySpeed; ySpeed += GRAVITY; ySpeed = Math.Min(ySpeed, Y_SPEED_MAX); if (GameCommon.壁処理(ref this.X, ref this.Y, new D2Point[] { new D2Point(0.0, CHARA_R) })) { ySpeed = 0.0; } if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), CHARA_R * 1.2)) { // 暫定_描画 { DDDraw.SetBright(new I3Color(64, 64, 255)); DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y); DDDraw.DrawSetSize(CHARA_R * 2, CHARA_R * 2); DDDraw.DrawEnd(); DDDraw.Reset(); DDPrint.SetDebug((int)this.X - DDGround.ICamera.X, (int)this.Y - DDGround.ICamera.Y); DDPrint.SetBorder(new I3Color(0, 0, 0)); DDPrint.Print("[ノコ◆コ_" + this.HP + "_" + (this.端から落ちない ? 1 : 0) + "]"); DDPrint.Reset(); } this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), CHARA_R); } yield return(true); } }
// // copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c // public static bool IsCrashed(Crash a, Crash b) { if ((int)b.Kind < (int)a.Kind) { Crash 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(); }
public override void DrawTile(MapCell cell, int cell_x, int cell_y, double draw_x, double draw_y) { if (cell.Kind == MapCell.Kind_e.WALL || cell.IsCookie()) { // cell.敵接近_Rate 更新 { double rate = GetEnemyNearlyRate( DDGround.Camera.X + draw_x, DDGround.Camera.Y + draw_y ); DDUtils.Maxim(ref cell.敵接近_Rate, rate); cell.敵接近_Rate *= 0.97; } double p = cell.ColorPhase; if (this.市松tic) { if ((cell_x + cell_y) % 2 == 0) { p = p * 0.7; } else { p = p * 0.3 + 0.7; } } if (cell.ColorPhaseShift < -SCommon.MICRO) { p *= cell.ColorPhaseShift + 1.0; } else if (SCommon.MICRO < cell.ColorPhaseShift) { p = DDUtils.AToBRate(p, 1.0, cell.ColorPhaseShift); } DDDraw.SetAlpha(this.WallAlpha * (1.0 - cell.敵接近_Rate * 0.5)); DDDraw.SetBright(new I3Color( SCommon.ToInt(DDUtils.AToBRate(this.Color_A.R, this.Color_B.R, p)), SCommon.ToInt(DDUtils.AToBRate(this.Color_A.G, this.Color_B.G, p)), SCommon.ToInt(DDUtils.AToBRate(this.Color_A.B, this.Color_B.B, p)) )); DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, draw_x, draw_y); DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H); DDDraw.DrawEnd(); DDDraw.Reset(); if (cell.IsCookie()) { DDDraw.SetBright(this.CookieAxisColor); DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, draw_x, draw_y); DDDraw.DrawSetSize(GameConsts.TILE_W / 2, GameConsts.TILE_H / 2); DDDraw.DrawEnd(); DDDraw.Reset(); } } else if (cell.Kind == MapCell.Kind_e.GOAL) { //double bright = // Math.Sin(DDEngine.ProcFrame / 37.0) * 0.3 + // Math.Sin(DDEngine.ProcFrame / 0.7) * 0.1 + // 0.6; double bright = Math.Sin(DDEngine.ProcFrame / 13.0) * 0.4 + 0.6; DDDraw.SetBright( bright * 0.5, bright * 0.9, bright * 1.0 ); DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, draw_x, draw_y); DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H); DDDraw.DrawEnd(); DDDraw.Reset(); } }
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(); }
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() ★★★ }
public void Perform() { if (DDConfig.LOG_ENABLED) // 開発・デバッグ_モードであることを表示 { DDGround.EL.Keep(300, () => { DDPrint.SetDebug(30, DDConsts.Screen_H - 32); DDPrint.Print("これはクローズドテスト版です。仮リソース・未実装・不完全な機能を含みます。(このメッセージは数秒で消えます)"); }); } foreach (DDScene scene in DDSceneUtils.Create(60)) // LiteStatusDlg を閉じるまでの遅延の分(30フレーム)延長 //foreach (DDScene scene in DDSceneUtils.Create(30)) { DDCurtain.DrawCurtain(); DDEngine.EachFrame(); } double z1 = 0.3; double z2 = 2.0; double z3 = 3.7; foreach (DDScene scene in DDSceneUtils.Create(60)) { DDCurtain.DrawCurtain(); DDDraw.SetAlpha(scene.Rate); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(z1); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.7); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(0.8 + 0.5 * scene.Rate); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(z2); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(z3); DDDraw.DrawEnd(); DDDraw.Reset(); DDUtils.Approach(ref z1, 1.0, 0.9); DDUtils.Approach(ref z2, 1.0, 0.98); DDUtils.Approach(ref z3, 1.0, 0.95); DDEngine.EachFrame(); } { long endLoopTime = long.MaxValue; for (int frame = 0; ; frame++) { if (endLoopTime < DDEngine.FrameStartTime) { break; } if (frame == 1) { endLoopTime = DDEngine.FrameStartTime + 1500; DDTouch.Touch(); } DDCurtain.DrawCurtain(); DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDEngine.EachFrame(); } } foreach (DDScene scene in DDSceneUtils.Create(60)) { DDCurtain.DrawCurtain(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(1.0 - 0.3 * scene.Rate); DDDraw.DrawRotate(scene.Rate * -0.1); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5); DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(1.0 + 0.8 * scene.Rate); DDDraw.DrawRotate(scene.Rate * 0.1); DDDraw.DrawEnd(); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3); DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2 + scene.Rate * 100.0, DDConsts.Screen_H / 2); DDDraw.Reset(); DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3); DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2 + scene.Rate * 50.0); DDDraw.Reset(); DDEngine.EachFrame(); } }
protected void btn_Sumbit_Click(object sender, EventArgs e) { string path = up(); if (path != "") { DataTable dt = ReadExcel(path); if (dt != null) { List <User> UserList = db.User.Where(t => t.IsDel != true).ToList(); List <UserDetails> UserDetailsList = db.UserDetails.Where(t => t.IsDel != true).ToList(); string colname = ""; foreach (DataColumn dc in dt.Columns) { colname += dc.ColumnName + ","; } string[] needcol = { "用户名", "员工编号", "姓名", "性别", "身份证", "手机号码", "职务", "部门", "岗位", "政治面貌", "民族", "出生日期", "入职日期", "转正日期", "员工分类", "岗位类型", "状态", "家庭住址" }; int count = 0; for (int i = 0; i < needcol.Length; i++) { count += colname.IndexOf(needcol[i]) == -1 ? -1 : 1; } if (count >= needcol.Length) { try { using (TransactionScope ts = new TransactionScope()) { int result = 0; string message = ""; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["用户名"].ToString().Trim() == "" || dt.Rows[i]["员工编号"].ToString().Trim() == "" || dt.Rows[i]["姓名"].ToString().Trim() == "" || dt.Rows[i]["性别"].ToString().Trim() == "" || dt.Rows[i]["部门"].ToString().Trim() == "" || dt.Rows[i]["岗位"].ToString().Trim() == "" || dt.Rows[i]["政治面貌"].ToString().Trim() == "" || dt.Rows[i]["民族"].ToString().Trim() == "" || dt.Rows[i]["员工分类"].ToString().Trim() == "" || dt.Rows[i]["岗位类型"].ToString().Trim() == "" || dt.Rows[i]["状态"].ToString().Trim() == "") { result = -1; message = "第【" + (i + 2) + "】行有不可为空项为空,请检查后重新导入"; break; } //用身份证判断是不是有了该用户 string Identity = dt.Rows[i]["身份证"].ToString().Trim(); UserDetails userdetails = db.UserDetails.FirstOrDefault(t => t.Identity == Identity); if (userdetails == null) { User user = new User(); userdetails = new UserDetails(); user.UserNumber = dt.Rows[i]["员工编号"].ToString().Trim(); user.UserName = dt.Rows[i]["用户名"].ToString().Replace(" ", "").Trim(); user.Cellphone = dt.Rows[i]["手机号码"].ToString().Trim(); if (!string.IsNullOrEmpty(user.Cellphone) && new BaseUtils().GetRegex(user.Cellphone, RegexType.手机号) == false) { result = -1; message = "第【" + (i + 2) + "】行手机号码不正确,请检查后重新导入"; break; } user.RealName = dt.Rows[i]["姓名"].ToString().Trim(); user.Password = new BaseUtils().BuildPW(user.UserName, "888888"); user.CreateDate = DateTime.Now; user.CreateUserID = UserID; user.IsDel = false; try { user.UserState = (UserState)Enum.Parse(typeof(UserState), dt.Rows[i]["状态"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行状态信息有误,请检查后重新提交"; break; } try { user.UserLeaveType = (UserLeaveType)Enum.Parse(typeof(UserLeaveType), dt.Rows[i]["岗位类型"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行岗位类型信息有误,请检查后重新提交"; break; } if (db.User.FirstOrDefault(t => t.UserName == user.UserName && t.IsDel != true) != null) { result = -1; message = "第【" + (i + 2) + "】行用户名已存在,请检查后重新提交"; break; } if (db.User.FirstOrDefault(t => t.UserNumber == user.UserNumber && t.IsDel != true) != null) { result = -1; message = "第【" + (i + 2) + "】行员工编号已存在,请检查后重新提交"; break; } db.User.Add(user); db.SaveChanges(); //用户添加到部门 string depname = dt.Rows[i]["部门"].ToString().Trim(); Department dep = db.Department.FirstOrDefault(t => t.Name.Contains(depname) && t.IsDel != true); if (dep != null) { DepartmentUser DepartmentUser = new DepartmentUser(); DepartmentUser.DepartmentID = dep.ID; DepartmentUser.UserID = user.ID; db.DepartmentUser.Add(DepartmentUser); //db.SaveChanges(); } else { result = -1; message = "第【" + (i + 2) + "】行部门名称不存在,请检查后重新提交"; break; } //用户添加到岗位 string postname = dt.Rows[i]["岗位"].ToString().Trim(); Post post = db.Post.FirstOrDefault(t => t.Name.Contains(postname) && t.IsDel != true); if (post != null) { PostUser postuser = new PostUser(); postuser.PostID = post.ID; postuser.UserID = user.ID; db.PostUser.Add(postuser); //db.SaveChanges(); } else { result = -1; message = "第【" + (i + 2) + "】行岗位名称不存在,请检查后重新提交"; break; } db.SaveChanges(); userdetails.UserID = user.ID; try { userdetails.Sex = (Sex)Enum.Parse(typeof(Sex), dt.Rows[i]["性别"].ToString()); } catch { result = -1; message = "第【" + (i + 2) + "】行性别信息有误,请检查后重新提交"; break; } try { userdetails.Nationality = (Nationality)Enum.Parse(typeof(Nationality), dt.Rows[i]["民族"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行民族信息有误,请检查后重新提交"; break; } try { userdetails.Polity = (Polity)Enum.Parse(typeof(Polity), dt.Rows[i]["政治面貌"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行政治面貌信息有误,请检查后重新提交"; break; } if (!string.IsNullOrEmpty(dt.Rows[i]["出生日期"].ToString().Trim())) { userdetails.BirthDate = Convert.ToDateTime(dt.Rows[i]["出生日期"].ToString().Trim()); } userdetails.Address = dt.Rows[i]["家庭住址"].ToString().Trim(); userdetails.Job = dt.Rows[i]["职务"].ToString().Trim(); try { userdetails.HireDate = Convert.ToDateTime(dt.Rows[i]["入职日期"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行入职日期信息有误,请检查后重新提交"; break; } userdetails.ProbationDays = 0; if (!string.IsNullOrEmpty(dt.Rows[i]["转正日期"].ToString().Trim())) { userdetails.QualifiedDate = Convert.ToDateTime(dt.Rows[i]["转正日期"].ToString().Trim()); } try { userdetails.UserType = (UserType)Enum.Parse(typeof(UserType), dt.Rows[i]["员工分类"].ToString()); } catch { result = -1; message = "第【" + (i + 2) + "】行员工分类信息有误,请检查后重新提交"; break; } userdetails.Identity = dt.Rows[i]["身份证"].ToString().Trim(); if (!string.IsNullOrEmpty(userdetails.Identity) && new BaseUtils().GetRegex(userdetails.Identity, RegexType.身份证号码) == false) { result = -1; message = "第【" + (i + 2) + "】行身份证号码不正确,请检查后重新导入"; break; } userdetails.HeaderUrl = ""; userdetails.CreateDate = DateTime.Now; userdetails.CreateUserID = UserID; userdetails.IsDel = false; db.UserDetails.Add(userdetails); string accesstoken = new DDUtils().GetAccessToken(); user.DDID = new DDUtils().AddUser(user, accesstoken); db.SaveChanges(); } else { User user = db.User.FirstOrDefault(t => t.ID == userdetails.UserID); user.UserNumber = dt.Rows[i]["员工编号"].ToString().Trim(); user.UserName = dt.Rows[i]["用户名"].ToString().Replace(" ", "").Trim(); user.Cellphone = dt.Rows[i]["手机号码"].ToString().Trim(); if (!string.IsNullOrEmpty(user.Cellphone) && new BaseUtils().GetRegex(user.Cellphone, RegexType.手机号) == false) { result = -1; message = "第【" + (i + 2) + "】行手机号码不正确,请检查后重新导入"; break; } user.RealName = dt.Rows[i]["姓名"].ToString().Trim(); user.Password = new BaseUtils().BuildPW(user.UserName, "888888"); user.CreateDate = DateTime.Now; user.CreateUserID = UserID; user.IsDel = false; try { user.UserState = (UserState)Enum.Parse(typeof(UserState), dt.Rows[i]["状态"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行状态信息有误,请检查后重新提交"; break; } try { user.UserLeaveType = (UserLeaveType)Enum.Parse(typeof(UserLeaveType), dt.Rows[i]["岗位类型"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行岗位类型信息有误,请检查后重新提交"; break; } if (db.User.FirstOrDefault(t => t.UserName == user.UserName && t.IsDel != true) != null) { result = -1; message = "第【" + (i + 2) + "】行用户名已存在,请检查后重新提交"; break; } if (db.User.FirstOrDefault(t => t.UserNumber == user.UserNumber && t.IsDel != true) != null) { result = -1; message = "第【" + (i + 2) + "】行员工编号已存在,请检查后重新提交"; break; } //db.User.Add(user); db.SaveChanges(); //用户添加到部门 db.DepartmentUser.RemoveRange(db.DepartmentUser.Where(t => t.UserID == user.ID).ToList()); string depname = dt.Rows[i]["部门"].ToString().Trim(); Department dep = db.Department.FirstOrDefault(t => t.Name.Contains(depname) && t.IsDel != true); if (dep != null) { DepartmentUser DepartmentUser = new DepartmentUser(); DepartmentUser.DepartmentID = dep.ID; DepartmentUser.UserID = user.ID; db.DepartmentUser.Add(DepartmentUser); //db.SaveChanges(); } else { result = -1; message = "第【" + (i + 2) + "】行部门名称不存在,请检查后重新提交"; break; } //用户添加到岗位 db.PostUser.RemoveRange(db.PostUser.Where(t => t.UserID == user.ID).ToList()); string postname = dt.Rows[i]["岗位"].ToString().Trim(); Post post = db.Post.FirstOrDefault(t => t.Name.Contains(postname) && t.IsDel != true); if (post != null) { PostUser postuser = new PostUser(); postuser.PostID = post.ID; postuser.UserID = user.ID; db.PostUser.Add(postuser); //db.SaveChanges(); } else { result = -1; message = "第【" + (i + 2) + "】行岗位名称不存在,请检查后重新提交"; break; } db.SaveChanges(); userdetails.UserID = user.ID; try { userdetails.Sex = (Sex)Enum.Parse(typeof(Sex), dt.Rows[i]["性别"].ToString()); } catch { result = -1; message = "第【" + (i + 2) + "】行性别信息有误,请检查后重新提交"; break; } try { userdetails.Nationality = (Nationality)Enum.Parse(typeof(Nationality), dt.Rows[i]["民族"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行民族信息有误,请检查后重新提交"; break; } try { userdetails.Polity = (Polity)Enum.Parse(typeof(Polity), dt.Rows[i]["政治面貌"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行政治面貌信息有误,请检查后重新提交"; break; } if (!string.IsNullOrEmpty(dt.Rows[i]["出生日期"].ToString().Trim())) { userdetails.BirthDate = Convert.ToDateTime(dt.Rows[i]["出生日期"].ToString().Trim()); } userdetails.Address = dt.Rows[i]["家庭住址"].ToString().Trim(); userdetails.Job = dt.Rows[i]["职务"].ToString().Trim(); try { userdetails.HireDate = Convert.ToDateTime(dt.Rows[i]["入职日期"].ToString().Trim()); } catch { result = -1; message = "第【" + (i + 2) + "】行入职日期信息有误,请检查后重新提交"; break; } userdetails.ProbationDays = 0; if (!string.IsNullOrEmpty(dt.Rows[i]["转正日期"].ToString().Trim())) { userdetails.QualifiedDate = Convert.ToDateTime(dt.Rows[i]["转正日期"].ToString().Trim()); } try { userdetails.UserType = (UserType)Enum.Parse(typeof(UserType), dt.Rows[i]["员工分类"].ToString()); } catch { result = -1; message = "第【" + (i + 2) + "】行员工分类信息有误,请检查后重新提交"; break; } userdetails.Identity = dt.Rows[i]["身份证"].ToString().Trim(); if (!string.IsNullOrEmpty(userdetails.Identity) && new BaseUtils().GetRegex(userdetails.Identity, RegexType.身份证号码) == false) { result = -1; message = "第【" + (i + 2) + "】行身份证号码不正确,请检查后重新导入"; break; } userdetails.HeaderUrl = ""; userdetails.CreateDate = DateTime.Now; userdetails.CreateUserID = UserID; userdetails.IsDel = false; //db.UserDetails.Add(userdetails); //string accesstoken = new DDUtils().GetAccessToken(); //user.DDID = new DDUtils().AddUser(user, accesstoken); db.SaveChanges(); } } if (result != 0) { ShowMessage(message); new SysLogDAO().AddLog(LogType.系统日志, message, UserID); ts.Dispose(); } else { ShowMessage(); new SysLogDAO().AddLog(LogType.操作日志_导入, "成功导入用户及档案信息", UserID); ts.Complete(); } } } catch (Exception ex) { ShowMessage(ex.Message); new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID); } } else { ShowMessage("文件中缺少必要的信息,请检查后重新导入"); return; } } else { ShowMessage("文件读取失败,请检查文件是否已损坏"); return; } } else { ShowMessage("文件导入失败"); return; } }
public Enemy_B神奈子_Tama(double x, double y) : base(x, y, 0, 1, true) { DDUtils.MakeXYSpeed(this.X, this.Y, Game.I.Player.X, Game.I.Player.Y, SPEED, out this.XAdd, out this.YAdd); }
protected override IEnumerable <bool> E_Draw() { const int SHOOTING_FRAME_MAX = 10; int shootingFrame = 0; // 0 == 無効, 1~ == 射撃モーション (カウントダウン方式) // 梯子の中央に寄せる。 // -- 複数箇所から new Attack_Ladder() されるので、ここでやるのが妥当 Game.I.Player.X = GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, 0.0)).X *GameConsts.TILE_W + GameConsts.TILE_W / 2; for (int frame = 0; ; frame++) { if (AttackCommon.CamSlide()) { goto endPlayer; } if (DDInput.DIR_8.GetInput() == 0 && 1 <= DDInput.A.GetInput()) // ? 上ボタンを離して、ジャンプボタン押下 { if (1 <= DDInput.DIR_2.GetInput()) // ? 下ボタン押下 -> ジャンプしない。 { Game.I.Player.JumpFrame = 0; Game.I.Player.JumpCount = 0; Game.I.Player.YSpeed = 0.0; } else // ? 下ボタンを離している -> ジャンプする。 { Game.I.Player.JumpFrame = 1; Game.I.Player.JumpCount = 1; Game.I.Player.YSpeed = GameConsts.PLAYER_ジャンプ初速度; } // スライディングさせないために滞空状態にする。 // -- 入力猶予を考慮して、大きい値を設定する。 Game.I.Player.AirborneFrame = SCommon.IMAX / 2; break; } if (1 <= DDInput.DIR_4.GetInput()) { Game.I.Player.FacingLeft = true; } if (1 <= DDInput.DIR_6.GetInput()) { Game.I.Player.FacingLeft = false; } // 移動 if (shootingFrame == 0) // 射撃モーション時は移動出来ない。 { const double SPEED = 2.5; const double 加速_RATE = 0.5; bool moved = false; if (1 <= DDInput.DIR_8.GetInput()) { Game.I.Player.Y -= Math.Min(SPEED, DDInput.DIR_8.GetInput() * 加速_RATE); moved = true; } if (1 <= DDInput.DIR_2.GetInput()) { Game.I.Player.Y += Math.Min(SPEED, DDInput.DIR_2.GetInput() * 加速_RATE); moved = true; } if (moved) { // none } } bool 攻撃ボタンを押した瞬間撃つ = Ground.I.ショットのタイミング == Ground.ショットのタイミング_e.ショットボタンを押し下げた時; bool shot = false; if (1 <= DDInput.B.GetInput()) { if (攻撃ボタンを押した瞬間撃つ && DDInput.B.GetInput() == 1) { Game.I.Player.Shoot(1); shot = true; } Game.I.Player.ShotChargePCT++; DDUtils.Minim(ref Game.I.Player.ShotChargePCT, 100); } else { int level = GameCommon.ShotChargePCTToLevel(Game.I.Player.ShotChargePCT); int chargePct = Game.I.Player.ShotChargePCT; Game.I.Player.ShotChargePCT = 0; if (攻撃ボタンを押した瞬間撃つ ? 2 <= level : 1 <= chargePct) { Game.I.Player.Shoot(level); shot = true; } } if (shot) { shootingFrame = SHOOTING_FRAME_MAX; } else { DDUtils.CountDown(ref shootingFrame); } //AttackCommon.ProcPlayer_移動(); //AttackCommon.ProcPlayer_Fall(); //AttackCommon.ProcPlayer_側面(); AttackCommon.ProcPlayer_脳天(); if (AttackCommon.ProcPlayer_接地()) { Game.I.Player.JumpFrame = 0; Game.I.Player.JumpCount = 0; Game.I.Player.YSpeed = 0.0; break; } // ? 梯子の下に出た。 if ( Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, Game.I.Player.Y + GameConsts.TILE_H * 0))).Tile.GetKind() != Tile.Kind_e.LADDER && Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, Game.I.Player.Y + GameConsts.TILE_H * 1))).Tile.GetKind() != Tile.Kind_e.LADDER ) { Game.I.Player.JumpFrame = 0; Game.I.Player.JumpCount = 0; Game.I.Player.YSpeed = 0.0; break; } endPlayer: DDPicture picture; double xZoom; if (1 <= shootingFrame) { picture = Ground.I.Picture.Chara_A01_Climb_Attack; xZoom = Game.I.Player.FacingLeft ? -1.0 : 1.0; } else { if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, Game.I.Player.Y))).Tile.GetKind() == Tile.Kind_e.LADDER) { picture = Ground.I.Picture.Chara_A01_Climb[(int)Game.I.Player.Y / 20 % 2]; } else { picture = Ground.I.Picture.Chara_A01_Climb_Top; } xZoom = 1.0; } double x = Game.I.Player.X; double y = Game.I.Player.Y; // 整数化 x = (int)x; y = (int)y; DDDraw.SetTaskList(Game.I.Player.Draw_EL); DDDraw.DrawBegin( picture, x - DDGround.ICamera.X, y - DDGround.ICamera.Y ); DDDraw.DrawZoom_X(xZoom); DDDraw.DrawEnd(); DDDraw.Reset(); yield return(true); } }
/// <summary> /// throws Cancelled /// </summary> public static void Perform() { DDUtils.SetMouseDispMode(true); DDCurtain.SetCurtain(0, -1.0); DDCurtain.SetCurtain(10); foreach (DDScene scene in DDSceneUtils.Create(30)) { DDDraw.DrawSimple(Ground.I.Picture.箱から出る_背景, 0, 0); DDDraw.DrawCenter(Ground.I.Picture.箱から出る_箱0001, DDConsts.Screen_W / 2, DDConsts.Screen_H - Ground.I.Picture.箱から出る_箱0001.Get_H() / 2); P_EachFrame(); } for (int c = 0; c < 2; c++) { foreach (DDScene scene in DDSceneUtils.Create(30)) { double x = DDConsts.Screen_W / 2; double y = DDConsts.Screen_H / 2; //double buruSpan = 20.0 * (1.0 - scene.Rate) + 10.0; double buruSpan = 30.0 * (1.0 - scene.Rate); double xBuru = DDUtils.Random.Real() * buruSpan - buruSpan / 2; double yBuru = DDUtils.Random.Real() * buruSpan - buruSpan / 2; double z = 1.0 + 0.1 * (1.0 - scene.Rate); DDDraw.DrawSimple(Ground.I.Picture.箱から出る_背景, 0, 0); DDDraw.DrawBegin(Ground.I.Picture.箱から出る_箱0001, x + xBuru, y + yBuru); DDDraw.DrawZoom(z); DDDraw.DrawEnd(); P_EachFrame(); } } foreach (DDScene scene in DDSceneUtils.Create(80)) { if (scene.Numer == 60) { DDCurtain.SetCurtain(20, -1.0); } double x = DDConsts.Screen_W / 2; double y = DDConsts.Screen_H / 2 - 10.0; double zure; if (scene.Numer < 2) { zure = (1.0 - scene.Numer / 2.0) * 20.0; } else { zure = scene.Rate * 20.0; } double xZure = 0.0; double yZure = zure; double z = 1.0; DDDraw.DrawSimple(Ground.I.Picture.箱から出る_背景, 0, 0); DDDraw.DrawBegin(Ground.I.Picture.箱から出る_箱0002, x + xZure, y + yZure); DDDraw.DrawZoom(z); DDDraw.DrawEnd(); P_EachFrame(); } }
public void Main01(string spectrumFile, DDPicture jacket, string wDir, int spBarNum, int spBarWidth, int spBarHeight, I3Color spBarColor, double spBarAlpha, double z2) { FileTools.Delete(wDir); FileTools.CreateDir(wDir); this.SpData = new SpectrumData(spectrumFile); double a = -1.0; double foa = 0.0; double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W(); double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H(); double bz1 = Math.Max(xz, yz); double bz2 = Math.Min(xz, yz); double z1 = 1.0; //double z2 = 2.0; const int JACKET_MARGIN = 10; using (DDSubScreen pseudoMainScreen = new DDSubScreen( DDConsts.Screen_W, DDConsts.Screen_H )) using (DDSubScreen workScreen = new DDSubScreen( DDConsts.Screen_W, DDConsts.Screen_H )) using (DDSubScreen jacketScreen = new DDSubScreen( jacket.Get_W() + JACKET_MARGIN * 2, jacket.Get_H() + JACKET_MARGIN * 2, true )) { // ---- jacketScreen DDSubScreenUtils.ChangeDrawScreen(jacketScreen); DX.ClearDrawScreen(); DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2); DDSubScreenUtils.RestoreDrawScreen(); // ---- SpectrumScreen0001 spScr = new SpectrumScreen0001(spBarNum, spBarWidth, spBarHeight, spBarColor); while (this.Frame < this.SpData.Rows.Length) { double[] row = this.SpData.Rows[this.Frame]; spScr.Draw(row); // ---- workScreen DDSubScreenUtils.ChangeDrawScreen(workScreen); DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(bz1 * z1); DDDraw.DrawEnd(); DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000); //DDSubScreenUtils.RestoreDrawScreen(); // ---- pseudoMainScreen DDSubScreenUtils.ChangeDrawScreen(pseudoMainScreen); DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0); DDCurtain.DrawCurtain(-0.5); DDDraw.DrawBegin( jacketScreen.ToPicture(), //jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(bz2 * z2); DDDraw.DrawEnd(); DDCurtain.DrawCurtain(Math.Min(a, foa)); DDDraw.SetAlpha(spBarAlpha); DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - spBarHeight / 2 - 10); DDDraw.Reset(); // ここでフレームを保存 DX.SaveDrawScreenToJPEG(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.jpg", this.Frame)), Consts.JPEG_QUALITY); //DX.SaveDrawScreen(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.bmp", this.Frame))); DDSubScreenUtils.RestoreDrawScreen(); // ---- 以降、フレーム毎の処理 if (40 < this.Frame) { DDUtils.Approach(ref a, 0.0, 0.985); } if (this.SpData.Rows.Length - 40 < this.Frame) { DDUtils.Approach(ref foa, -1.0, 0.9); } //DDUtils.Approach(ref z1, 1.2, 0.999); //z1 += 0.0001; DDUtils.Approach(ref z2, 1.0, 0.9985); if (this.Frame % 30 == 0) // 毎回やる必要は無い。 { DDCurtain.DrawCurtain(); DDPrint.SetPrint(16, 16, 32); DDPrint.SetBorder(new I3Color(0, 64, 128)); DDPrint.PrintLine("ConvGenVideo"); //DDPrint.PrintLine("ConvGenVideo [Version " + DDUserDatStrings.Version + "]"); DDPrint.PrintLine("映像を生成しています..."); DDPrint.PrintLine("右上の[X]ボタンを押すと全ての処理を中止(キャンセル)します。"); { double rate = this.Frame * 1.0 / this.SpData.Rows.Length; const int PROGRESS_BAR_H = 10; DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, (DDConsts.Screen_H - PROGRESS_BAR_H) / 2, Math.Max(5, DDConsts.Screen_W * rate), PROGRESS_BAR_H); } DDEngine.EachFrame(); } this.Frame++; } } }
private void Main4_Release() { DDUtils.SetMouseDispMode(true); new TitleMenu().Perform(); }
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(); 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 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 (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.JumpFrame = 1; } } 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) // プレイヤー死亡中の処理 { 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++; // この時点でとりうる this.Player.DeadFrame の最大値は Consts.PLAYER_DEAD_FRAME_MAX + 2 // ---- const int HIT_BACK_FRAME_MAX = 30; if (frame < HIT_BACK_FRAME_MAX) { double rate = (double)frame / HIT_BACK_FRAME_MAX; this.Player.X -= 10.0 * (1.0 - rate) * (this.Player.FacingLeft ? -1 : 1); } } //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++; // この時点でとりうる this.Player.DamageFrame の最大値は Consts.PLAYER_DAMAGE_FRAME_MAX + 2 // ---- { double rate = (double)frame / GameConsts.PLAYER_DAMAGE_FRAME_MAX; this.Player.X -= (9.0 - 6.0 * rate) * (this.Player.FacingLeft ? -1 : 1); } } 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++; // この時点でとりうる this.Player.InvincibleFrame の最大値は Consts.PLAYER_INVINCIBLE_FRAME_MAX + 2 // ---- // 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, 2.0); } else { speed = 6.0; } speed *= this.Player.FacingLeft ? -1 : 1; this.Player.X += speed; } else { this.Player.X = (double)SCommon.ToInt(this.Player.X); } const double 重力加速度 = 1.0; const double 落下最高速度 = 8.0; const double ジャンプによる上昇_YSpeed = -8.0; if (1 <= this.Player.JumpFrame) { this.Player.YSpeed = ジャンプによる上昇_YSpeed; } else { this.Player.YSpeed += 重力加速度; } DDUtils.Minim(ref this.Player.YSpeed, 落下最高速度); this.Player.Y += this.Player.YSpeed; // 自由落下 } // 上昇が速すぎると、脳天判定より先に側面判定に引っ掛かってしまう可能性がある。 // -- ( -(ジャンプによる上昇_YSpeed) < 脳天判定Pt_Y - 側面判定Pt_Y ) を維持すること。 // 下降が速すぎると、接地判定より先に側面判定に引っ掛かってしまう可能性がある。 // -- ( 落下最高速度 < 接地判定Pt_Y - 側面判定Pt_Y ) を維持すること。 // プレイヤー位置矯正 { const double 側面判定Pt_X = 10.0; const double 側面判定Pt_Y = GameConsts.TILE_H / 2.0; bool touchSide_L = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - 側面判定Pt_X, this.Player.Y - 側面判定Pt_Y)).Tile.IsWall() || this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - 側面判定Pt_X, this.Player.Y)).Tile.IsWall() || this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - 側面判定Pt_X, this.Player.Y + 側面判定Pt_Y)).Tile.IsWall(); bool touchSide_R = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + 側面判定Pt_X, this.Player.Y - 側面判定Pt_Y)).Tile.IsWall() || this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + 側面判定Pt_X, this.Player.Y)).Tile.IsWall() || this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + 側面判定Pt_X, this.Player.Y + 側面判定Pt_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 + 側面判定Pt_X; } else if (touchSide_R) { this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W - 側面判定Pt_X; } const double 脳天判定Pt_X = 9.0; const double 脳天判定Pt_Y = GameConsts.TILE_H; bool touchCeiling_L = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - 脳天判定Pt_X, this.Player.Y - 脳天判定Pt_Y)).Tile.IsWall(); bool touchCeiling_R = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + 脳天判定Pt_X, this.Player.Y - 脳天判定Pt_Y)).Tile.IsWall(); if (touchCeiling_L && touchCeiling_R) { if (this.Player.YSpeed < 0.0) { double plY = ((int)((this.Player.Y - 脳天判定Pt_Y) / GameConsts.TILE_H) + 1) * GameConsts.TILE_H + 脳天判定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 + 脳天判定Pt_X; } else if (touchCeiling_R) { this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W - 脳天判定Pt_X; } const double 接地判定Pt_X = 9.0; const double 接地判定Pt_Y = GameConsts.TILE_H; bool touchGround = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - 接地判定Pt_X, this.Player.Y + 接地判定Pt_Y)).Tile.IsWall() || this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + 接地判定Pt_X, this.Player.Y + 接地判定Pt_Y)).Tile.IsWall(); if (touchGround) { if (0.0 < this.Player.YSpeed) { double plY = (int)((this.Player.Y + 接地判定Pt_Y) / GameConsts.TILE_H) * GameConsts.TILE_H - 接地判定Pt_Y; this.Player.Y = plY; this.Player.YSpeed = 0.0; } } if (touchGround) { 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) // ? 衝突 ) { // ★ 敵_被弾ここから 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.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() ★★★ }
private IEnumerable <bool> DrawString(int x, int y, string text, int frameMax, I3Color color) { DDSubScreen subScreenTmp = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H, true); DDSubScreen subScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H, true); SubScreens.Add(subScreenTmp); SubScreens.Add(subScreen); using (subScreenTmp.Section()) { DX.ClearDrawScreen(); DDFontUtils.DrawString_XCenter(x, y, text, DDFontUtils.GetFont("03\u711a\u706b-Regular", 30)); ぼかし効果.Perform(0.01); } for (int c = 0; c < 4; c++) { using (subScreen.Section()) { DX.ClearDrawScreen(); for (int d = 0; d < 20; d++) { DDDraw.SetBlendAdd(1.0); DDDraw.DrawSimple(subScreenTmp.ToPicture(), 0, 0); DDDraw.Reset(); } ぼかし効果.Perform(0.01); } SCommon.Swap(ref subScreen, ref subScreenTmp); } using (subScreen.Section()) { DX.ClearDrawScreen(); DDDraw.SetBright(0.0, 0.0, 0.0); DDDraw.DrawSimple(subScreenTmp.ToPicture(), 0, 0); DDDraw.Reset(); DDFontUtils.DrawString_XCenter(x, y, text, DDFontUtils.GetFont("03\u711a\u706b-Regular", 30), false, color); } double a = 0.0; double aTarg = 1.0; foreach (DDScene scene in DDSceneUtils.Create(frameMax)) { if (scene.Numer == scene.Denom - 300) { aTarg = 0.0; } DDUtils.Approach(ref a, aTarg, 0.985); DDDraw.SetAlpha(a); DDDraw.DrawSimple(subScreen.ToPicture(), 0, 0); DDDraw.Reset(); yield return(true); } }
public void Draw() { if (PlayerLookLeftFrame == 0 && DDUtils.Random.Real() < 0.002) // キョロキョロするレート { PlayerLookLeftFrame = 150 + (int)(DDUtils.Random.Real() * 90.0); } DDUtils.CountDown(ref PlayerLookLeftFrame); double xZoom = this.FacingLeft ? -1 : 1; // 立ち > DDPicture picture = Ground.I.Picture.PlayerStands[120 < PlayerLookLeftFrame ? 1 : 0][(DDEngine.ProcFrame / 20) % 2]; if (1 <= this.MoveFrame) { if (this.MoveSlow) { picture = Ground.I.Picture.PlayerWalk[(DDEngine.ProcFrame / 10) % 2]; } else { picture = Ground.I.Picture.PlayerDash[(DDEngine.ProcFrame / 5) % 2]; } } if (1 <= this.AirborneFrame) { picture = Ground.I.Picture.PlayerJump[0]; } if (1 <= this.ShagamiFrame) { picture = Ground.I.Picture.PlayerShagami; } // < 立ち // 攻撃中 > if (1 <= this.AttackFrame) { picture = Ground.I.Picture.PlayerAttack; if (1 <= this.MoveFrame) { if (this.MoveSlow) { picture = Ground.I.Picture.PlayerAttackWalk[(DDEngine.ProcFrame / 10) % 2]; } else { picture = Ground.I.Picture.PlayerAttackDash[(DDEngine.ProcFrame / 5) % 2]; } } if (1 <= this.AirborneFrame) { picture = Ground.I.Picture.PlayerAttackJump; } if (1 <= this.ShagamiFrame) { picture = Ground.I.Picture.PlayerAttackShagami; } } // < 攻撃中 if (1 <= this.DeadFrame) { int koma = SCommon.ToRange(this.DeadFrame / 20, 0, 1); if (this.AirborneFrame == 0) { koma *= 2; } koma *= 2; koma++; picture = Ground.I.Picture.PlayerDamage[koma]; DDDraw.SetTaskList(DDGround.EL); } if (1 <= this.DamageFrame) { picture = Ground.I.Picture.PlayerDamage[0]; xZoom *= -1; } if (1 <= this.DamageFrame || 1 <= this.InvincibleFrame) { DDDraw.SetTaskList(DDGround.EL); DDDraw.SetAlpha(0.5); } DDDraw.DrawBegin( picture, SCommon.ToInt(this.X - DDGround.ICamera.X), SCommon.ToInt(this.Y - DDGround.ICamera.Y) - 16 ); DDDraw.DrawZoom_X(xZoom); DDDraw.DrawEnd(); DDDraw.Reset(); }
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 && !Ground.I.会話スキップ抑止) { this.会話スキップした = true; break; } if (this.会話スキップ_Request && !Ground.I.会話スキップ抑止) { 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() ★★★ }