OSDN Git Service

タイトルステージを実装。
authorくまかみ工房 <kumakamikoubou@gmail.com>
Sun, 18 Sep 2016 13:12:44 +0000 (22:12 +0900)
committerくまかみ工房 <kumakamikoubou@gmail.com>
Sun, 18 Sep 2016 13:12:44 +0000 (22:12 +0900)
StrokeStyleT/StrokeStyleT.cs
StrokeStyleT/StrokeStyleT.csproj
StrokeStyleT/ステージ/タイトル/タイトルステージ.cs [new file with mode: 0644]

index eaee52d..09cf4b7 100644 (file)
@@ -83,6 +83,14 @@ namespace SST
                {
                        Debug.Assert( null == this.デバイスリソース );  // 解放された後である。
 
+                       #region " ステージを終了し、解放する。"
+                       //----------------
+                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                       this.最初のダミーステージ  = null;
+                       this.起動ステージ = null;
+                       this.タイトルステージ = null;
+                       //----------------
+                       #endregion
                        #region " MIDI入力 を解放する。"
                        //-----------------
                        FDK.Log.Info( "MIDI入力デバイスを解放します。" );
@@ -106,6 +114,7 @@ namespace SST
                        //-----------------
                        #endregion
                }
+
                public override void シーンを描画する()
                {
                        #region " 描画を準備する。"
@@ -151,6 +160,19 @@ namespace SST
                                        break;
 
                                case nameof( ステージ.起動.起動ステージ ):
+                                       #region " 終了 → タイトルステージへ。"
+                                       //---------------
+                                       if( this.起動ステージ.現在のフェーズ == ステージ.起動.起動ステージ.フェーズ.終了 )
+                                       {
+                                               this.現在のステージ.非活性化する( this.デバイスリソース );
+                                               this.現在のステージ = this.タイトルステージ;
+                                               this.現在のステージ.活性化する( this.デバイスリソース );
+                                       }
+                                       //---------------
+                                       #endregion
+                                       break;
+
+                               case nameof( ステージ.タイトル.タイトルステージ ):
                                        #region " *** "
                                        //----------------
                                        //----------------
@@ -164,6 +186,7 @@ namespace SST
                // 各ステージの、唯一のインスタンス。
                protected SST.ステージ.ステージ 最初のダミーステージ = new ステージ.ステージ();
                protected SST.ステージ.起動.起動ステージ 起動ステージ = new ステージ.起動.起動ステージ();
+               protected SST.ステージ.タイトル.タイトルステージ タイトルステージ = new ステージ.タイトル.タイトルステージ();
 
                private SST.ステージ.ステージ 現在のステージ = null;
 
index 2abd0cf..9e1c417 100644 (file)
@@ -95,6 +95,7 @@
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="ステージ\ステージ.cs" />
+    <Compile Include="ステージ\タイトル\タイトルステージ.cs" />
     <Compile Include="ステージ\汎用\フェードアウト.cs" />
     <Compile Include="ステージ\汎用\フェードイン.cs" />
     <Compile Include="ステージ\起動\起動ステージ.cs" />
diff --git a/StrokeStyleT/ステージ/タイトル/タイトルステージ.cs b/StrokeStyleT/ステージ/タイトル/タイトルステージ.cs
new file mode 100644 (file)
index 0000000..3cbd6d7
--- /dev/null
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using FDK.メディア;
+
+namespace SST.ステージ.タイトル
+{
+       class タイトルステージ : SST.ステージ.ステージ
+       {
+               public enum フェーズ
+               {
+                       初期状態,
+                       表示中,
+                       確定,
+                       キャンセル,
+               }
+               public フェーズ 現在のフェーズ { get; protected set; } = フェーズ.初期状態;
+
+               public タイトルステージ()
+               {
+               }
+               protected override void On活性化( デバイスリソース dr )
+               {
+                       FDK.Log.Info( "タイトルステージを開始します。" );
+                       this.背景画像.活性化する( dr );
+                       this.現在のフェーズ = フェーズ.表示中;
+               }
+               protected override void On非活性化( デバイスリソース dr )
+               {
+                       FDK.Log.Info( "タイトルステージを終了します。" );
+                       this.背景画像.非活性化する( dr );
+               }
+               public override void 進行描画する( デバイスリソース dr )
+               {
+                       if( this.現在のフェーズ != フェーズ.表示中 )
+                               return;
+
+                       // 進行・描画。
+                       this.背景画像.進行描画する( dr, 0.0f, 0.0f );
+
+                       // 入力。
+
+                       StrokeStyleT.すべての入力デバイスをポーリングする();
+
+                       // Enter 押下 → 確定&ステージ終了
+                       if( StrokeStyleT.キーボード入力.キーが押された( SharpDX.DirectInput.Key.Return ) )
+                       {
+                               this.現在のフェーズ = フェーズ.確定;
+                       }
+                       // Esc 押下 → キャンセル&ステージ終了
+                       else if( StrokeStyleT.キーボード入力.キーが押された( SharpDX.DirectInput.Key.Escape ) )
+                       {
+                               this.現在のフェーズ = フェーズ.キャンセル;
+                       }
+               }
+
+               protected readonly FDK.メディア.画像 背景画像 = new 画像( @"$(Static)\images\タイトル画面.jpg" );
+       }
+}