OSDN Git Service

結果画面のパラメータ表示を実装。
authorくまかみ工房 <kumakamikoubou@gmail.com>
Tue, 11 Oct 2016 07:26:42 +0000 (16:26 +0900)
committerくまかみ工房 <kumakamikoubou@gmail.com>
Tue, 11 Oct 2016 07:27:35 +0000 (16:27 +0900)
StrokeStyleT/StrokeStyleT.cs
StrokeStyleT/ステージ/結果/結果ステージ.cs

index 5752f2f..e611c57 100644 (file)
@@ -79,6 +79,11 @@ namespace SST
                        //-----------------
                        #endregion
 
+                       #region " ステージのActionを接続する。"
+                       //----------------
+                       this.結果ステージ.演奏ステージインスタンスを取得する = () => this.演奏ステージ;
+                       //----------------
+                       #endregion
                        #region " ユーザを初期化する。"
                        //-----------------
                        FDK.Log.Info( "ユーザ情報を初期化します。" );
@@ -399,7 +404,7 @@ namespace SST
                        FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
                }
 
-               // 各ステージの、唯一のインスタンス。
+               // 各ステージの、唯一のインスタンス。最終的に null を代入するので、readonlyにはしない。
                protected SST.ステージ.ステージ 最初のダミーステージ = new ステージ.ステージ();
                protected SST.ステージ.起動.起動ステージ 起動ステージ = new ステージ.起動.起動ステージ();
                protected SST.ステージ.タイトル.タイトルステージ タイトルステージ = new ステージ.タイトル.タイトルステージ();
index 0ed88e2..3eb1d13 100644 (file)
@@ -18,23 +18,26 @@ namespace SST.ステージ.結果
 
                // 外部依存 Action。
                public Action BGMを終了する = null;
+               public Func<SST.ステージ.演奏.演奏ステージ> 演奏ステージインスタンスを取得する = null;
 
                public 結果ステージ()
                {
                        this.子リスト.Add( this.背景動画 = new 動画( @"$(Static)\images\結果画面BGV.mp4" ) );
                        this.子リスト.Add( this.背景画像 = new 画像( @"$(Static)\images\結果画面 背景.png" ) );
                        this.子リスト.Add( this.結果表示パラメータパネル = new 画像( @"$(Static)\images\結果画面 パラメータパネル.png" ) );
-                       this.子リスト.Add( this.結果表示パラメータ = new テクスチャフォント( @"$(Static)\images\結果画面 パラメータフォント.png", @"$(Static)\images\結果画面 パラメータフォント矩形リスト.xml" ) );
+                       this.子リスト.Add( this.結果表示パラメータ = new 画像フォント( @"$(Static)\images\結果画面 パラメータフォント.png", @"$(Static)\images\結果画面 パラメータフォント矩形リスト.xml" ) );
                }
                protected override void On活性化( デバイスリソース dr )
                {
                        FDK.Log.Info( "結果ステージを開始します。" );
+
                        this.背景動画.ループ再生する = true;
                        this.現在のフェーズ = フェーズ.表示中;
                }
                protected override void On非活性化( デバイスリソース dr )
                {
                        FDK.Log.Info( "結果ステージを終了します。" );
+
                        this.BGMを終了する?.Invoke();    // ここでBGMを終了する。
                }
                public override void 進行描画する( デバイスリソース dr )
@@ -43,8 +46,30 @@ namespace SST.ステージ.結果
 
                        this.背景動画.進行描画する( dr, new SharpDX.RectangleF( 0f, 0f, dr.設計画面サイズdpx.Width, dr.設計画面サイズdpx.Height ) );
                        this.背景画像.描画する( dr, 0f, 0f );
+
+                       #region " 結果表示パラメータ "
+                       //----------------
                        this.結果表示パラメータパネル.描画する( dr, 60f, 196f );
 
+                       var 演奏ステージ = this.演奏ステージインスタンスを取得する();
+                       var hitTypes = new[] { 演奏.ヒット判定種別.PERFECT, 演奏.ヒット判定種別.GREAT, 演奏.ヒット判定種別.GOOD, 演奏.ヒット判定種別.POOR, 演奏.ヒット判定種別.MISS, 演奏.ヒット判定種別.AUTO };
+
+                       int 総数 = 0;
+                       foreach( var hitType in hitTypes )
+                               総数 += 演奏ステージ.ヒットした回数[ hitType ];
+
+                       float Xdpx = 360f;
+                       float Ydpx = 230f;
+                       foreach( var hitType in hitTypes )
+                       {
+                               int 回数 = 演奏ステージ.ヒットした回数[ hitType ];
+                               double 割合 = ( 0 < 総数 ) ? ( 回数 * 100.0 / 総数 ) : 0.0;
+                               this.結果表示パラメータ.描画する( dr, Xdpx, Ydpx, $"{回数:00000}({割合:000.0}%)" );
+                               Ydpx += 71f;
+                       }
+                       //----------------
+                       #endregion
+
                        // 入力。
 
                        StrokeStyleT.すべての入力デバイスをポーリングする();
@@ -60,6 +85,6 @@ namespace SST.ステージ.結果
                protected readonly FDK.メディア.動画 背景動画;
                protected readonly FDK.メディア.画像 背景画像;
                protected readonly FDK.メディア.画像 結果表示パラメータパネル;
-               protected readonly FDK.メディア.テクスチャフォント 結果表示パラメータ;
+               protected readonly FDK.メディア.画像フォント 結果表示パラメータ;
        }
 }