OSDN Git Service

作業部屋#50705 CActResultImage.csをXGとGITADORAで分離。
[dtxmaniaxg-verk/dtxmaniaxg-verk-git.git] / DTXManiaプロジェクト / コード / ステージ / 08.結果 / CStage結果.cs
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Text;
5 using System.Diagnostics;
6 using FDK;
7 using SlimDX.Direct3D9;
8
9 namespace DTXMania
10 {
11         internal class CStage結果 : CStage
12         {
13                 // プロパティ
14
15                 public STDGBVALUE<bool> b新記録スキル;
16                 public STDGBVALUE<bool> b新記録スコア;
17         public STDGBVALUE<bool> b新記録ランク;
18                 public STDGBVALUE<float> fPerfect率;
19                 public STDGBVALUE<float> fGreat率;
20                 public STDGBVALUE<float> fGood率;
21                 public STDGBVALUE<float> fPoor率;
22         public STDGBVALUE<float> fMiss率;
23         public STDGBVALUE<bool> bオート;        // #23596 10.11.16 add ikanick
24                                                 //        10.11.17 change (int to bool) ikanick
25                 public STDGBVALUE<int> nランク値;
26                 public STDGBVALUE<int> n演奏回数;
27                 public int n総合ランク値;
28                 public CDTX.CChip[] r空うちドラムチップ;
29                 public STDGBVALUE<CScoreIni.C演奏記録> st演奏記録;
30         public CScoreIni sc更新前Scoreini;
31
32
33                 // コンストラクタ
34
35                 public CStage結果()
36                 {
37                         this.st演奏記録.Drums = new CScoreIni.C演奏記録();
38                         this.st演奏記録.Guitar = new CScoreIni.C演奏記録();
39                         this.st演奏記録.Bass = new CScoreIni.C演奏記録();
40             this.sc更新前Scoreini = new CScoreIni();
41                         this.r空うちドラムチップ = new CDTX.CChip[ 11 ];
42                         this.n総合ランク値 = -1;
43                         this.nチャンネル0Atoレーン07 = new int[] { 1, 2, 3, 4, 5, 7, 6, 1, 8, 0, 9 };
44                         base.eステージID = CStage.Eステージ.結果;
45                         base.eフェーズID = CStage.Eフェーズ.共通_通常状態;
46                         base.b活性化してない = true;
47                         base.list子Activities.Add( this.actResultImage = new CActResultImage共通() );
48                         base.list子Activities.Add( this.actParameterPanel = new CActResultParameterPanel() );
49                         base.list子Activities.Add( this.actRank = new CActResultRank() );
50                         base.list子Activities.Add( this.actSongBar = new CActResultSongBar() );
51                         base.list子Activities.Add( this.actOption = new CActオプションパネル() );
52                         base.list子Activities.Add( this.actFI = new CActFIFOWhite() );
53                         base.list子Activities.Add( this.actFO = new CActFIFOBlack() );
54                         base.list子Activities.Add( this.actAVI = new CAct演奏AVI() );
55                 }
56
57                 
58                 // CStage 実装
59
60                 public override void On活性化()
61                 {
62                         Trace.TraceInformation( "結果ステージを活性化します。" );
63                         Trace.Indent();
64                         try
65                         {
66                                 #region [ 初期化 ]
67                                 //---------------------
68                                 this.eフェードアウト完了時の戻り値 = E戻り値.継続;
69                                 this.bアニメが完了 = false;
70                                 this.bIsCheckedWhetherResultScreenShouldSaveOrNot = false;                              // #24609 2011.3.14 yyagi
71                                 this.n最後に再生したHHのWAV番号 = -1;
72                                 this.n最後に再生したHHのチャンネル番号 = 0;
73                                 for( int i = 0; i < 3; i++ )
74                                 {
75                                         this.b新記録スキル[ i ] = false;
76                     this.b新記録スコア[ i ] = false;
77                     this.b新記録ランク[ i ] = false;
78                                 }
79                                 this.sc更新前Scoreini = new CScoreIni( CDTXMania.DTX.strファイル名の絶対パス + ".score.ini" ); //2016.03.07 kairera0467 記録更新前のScoreiniを格納する。
80                                 //---------------------
81                                 #endregion
82
83                                 #region [ 結果の計算 ]
84                                 //---------------------
85                                 for( int i = 0; i < 3; i++ )
86                                 {
87                                         this.nランク値[ i ] = -1;
88                                         this.fPerfect率[ i ] = this.fGreat率[ i ] = this.fGood率[ i ] = this.fPoor率[ i ] = this.fMiss率[ i ] = 0.0f;      // #28500 2011.5.24 yyagi
89                                         if ( ( ( ( i != 0 ) || ( CDTXMania.DTX.bチップがある.Drums && !CDTXMania.ConfigIni.bギタレボモード ) ) &&
90                                                 ( ( i != 1 ) || CDTXMania.DTX.bチップがある.Guitar ) ) &&
91                                                 ( ( i != 2 ) || CDTXMania.DTX.bチップがある.Bass ) )
92                                         {
93                                                 CScoreIni.C演奏記録 part = this.st演奏記録[ i ];
94                                                 bool bIsAutoPlay = true;
95                                                 switch( i )
96                                                 {
97                                                         case 0:
98                                 bIsAutoPlay = CDTXMania.ConfigIni.bドラムが全部オートプレイである || !CDTXMania.ConfigIni.bDrums有効; // #35411 chnmr0 add Drums が有効でない場合 AUTO 扱いとして LastPlay 更新しない
99                                                                 break;
100
101                                                         case 1:
102                                                                 bIsAutoPlay = CDTXMania.ConfigIni.bギターが全部オートプレイである || !CDTXMania.ConfigIni.bGuitar有効; // #35411 chnmr0 add
103                                                                 break;
104
105                                                         case 2:
106                                                                 bIsAutoPlay = CDTXMania.ConfigIni.bベースが全部オートプレイである || !CDTXMania.ConfigIni.bGuitar有効;
107                                                                 break;
108                                                 }
109                                                 this.fPerfect率[ i ] = bIsAutoPlay ? 0f : ( ( 100f * part.nPerfect数 ) / ( (float) part.n全チップ数 ) );
110                                                 this.fGreat率[ i ] = bIsAutoPlay ? 0f : ( ( 100f * part.nGreat数 ) / ( (float) part.n全チップ数 ) );
111                                                 this.fGood率[ i ] = bIsAutoPlay ? 0f : ( ( 100f * part.nGood数 ) / ( (float) part.n全チップ数 ) );
112                                                 this.fPoor率[ i ] = bIsAutoPlay ? 0f : ( ( 100f * part.nPoor数 ) / ( (float) part.n全チップ数 ) );
113                                                 this.fMiss率[ i ] = bIsAutoPlay ? 0f : ( ( 100f * part.nMiss数 ) / ( (float) part.n全チップ数 ) );
114                                                 this.bオート[ i ] = bIsAutoPlay;     // #23596 10.11.16 add ikanick そのパートがオートなら1
115                                                                                                                         //        10.11.17 change (int to bool) ikanick
116                         if( CDTXMania.ConfigIni.eSkillMode == ESkillType.DTXMania )
117                                                     this.nランク値[ i ] = CScoreIni.tランク値を計算して返す( part );
118                         else
119                             this.nランク値[ i ] = CScoreIni.tXGランク値を計算して返す( part, (E楽器パート)i );
120                                         }
121                                 }
122                                 this.n総合ランク値 = CScoreIni.t総合ランク値を計算して返す( this.st演奏記録.Drums, this.st演奏記録.Guitar, this.st演奏記録.Bass );
123                                 //---------------------
124                                 #endregion
125
126                 #region [ .score.ini の作成と出力 ]
127                                 //---------------------
128                                 string str = CDTXMania.DTX.strファイル名の絶対パス + ".score.ini";
129                                 CScoreIni ini = new CScoreIni( str );
130
131                                 bool[] b今までにフルコンボしたことがある = new bool[] { false, false, false };
132
133                                 for( int i = 0; i < 3; i++ )
134                                 {
135                                         // フルコンボチェックならびに新記録ランクチェックは、ini.Record[] が、スコアチェックや演奏型スキルチェックの IF 内で書き直されてしまうよりも前に行う。(2010.9.10)
136                                         
137                                         b今までにフルコンボしたことがある[ i ] = ini.stセクション[ i * 2 ].bフルコンボである | ini.stセクション[ i * 2 + 1 ].bフルコンボである;
138
139                                         #region [deleted by #24459]
140                         //              if( this.nランク値[ i ] <= CScoreIni.tランク値を計算して返す( ini.stセクション[ ( i * 2 ) + 1 ] ) )
141                         //              {
142                         //                      this.b新記録ランク[ i ] = true;
143                                         //              }
144                                         #endregion
145                                         // #24459 上記の条件だと[HiSkill.***]でのランクしかチェックしていないので、BestRankと比較するよう変更。
146                                         if ( this.nランク値[ i ] >= 0 && ini.stファイル.BestRank[ i ] > this.nランク値[ i ] )               // #24459 2011.3.1 yyagi update BestRank
147                                         {
148                                                 this.b新記録ランク[ i ] = true;
149                                                 ini.stファイル.BestRank[ i ] = this.nランク値[ i ];
150                                         }
151
152                                         // 新記録スコアチェック
153                                         if( ( this.st演奏記録[ i ].nスコア > ini.stセクション[ i * 2 ].nスコア ) && this.bオート[ i ] == false )
154                                         {
155                                                 this.b新記録スコア[ i ] = true;
156                                                 ini.stセクション[ i * 2 ] = this.st演奏記録[ i ];
157                         this.SaveGhost( i * 2 ); // #35411 chnmr0 add
158                                         }
159
160                     // 新記録スキルチェック
161                     if (this.st演奏記録[i].db演奏型スキル値 > ini.stセクション[(i * 2) + 1].db演奏型スキル値)
162                     {
163                         this.b新記録スキル[ i ] = true;
164                         ini.stセクション[(i * 2) + 1] = this.st演奏記録[ i ];
165                         this.SaveGhost((i * 2) + 1); // #35411 chnmr0 add
166                     }
167
168                                         // ラストプレイ #23595 2011.1.9 ikanick
169                     // オートじゃなければプレイ結果を書き込む
170                     if (this.bオート[ i ] == false) {
171                         ini.stセクション[i + 6] = this.st演奏記録[ i ];
172                         this.SaveGhost(i + 6); // #35411 chnmr0 add
173                     }
174
175                     // #23596 10.11.16 add ikanick オートじゃないならクリア回数を1増やす
176                     //        11.02.05 bオート to t更新条件を取得する use      ikanick
177                                         bool[] b更新が必要か否か = new bool[ 3 ];
178                                         CScoreIni.t更新条件を取得する( out b更新が必要か否か[ 0 ], out b更新が必要か否か[ 1 ], out b更新が必要か否か[ 2 ] );
179
180                     if (b更新が必要か否か[ i ])
181                     {
182                         switch ( i )
183                         {
184                             case 0:
185                                 ini.stファイル.ClearCountDrums++;
186                                 break;
187                             case 1:
188                                 ini.stファイル.ClearCountGuitar++;
189                                 break;
190                             case 2:
191                                 ini.stファイル.ClearCountBass++;
192                                 break;
193                             default:
194                                 throw new Exception("クリア回数増加のk(0-2)が範囲外です。");
195                         }
196                     }
197                     //---------------------------------------------------------------------/
198                                 }
199                 if( CDTXMania.ConfigIni.bScoreIniを出力する )
200                                     ini.t書き出し( str );
201                                 //---------------------
202                                 #endregion
203
204                                 #region [ リザルト画面への演奏回数の更新 #24281 2011.1.30 yyagi]
205                 if( CDTXMania.ConfigIni.bScoreIniを出力する )
206                 {
207                     this.n演奏回数.Drums = ini.stファイル.PlayCountDrums;
208                     this.n演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
209                     this.n演奏回数.Bass = ini.stファイル.PlayCountBass;
210                 }
211                                 #endregion
212                                 #region [ 選曲画面の譜面情報の更新 ]
213                                 //---------------------
214                                 if( !CDTXMania.bコンパクトモード )
215                                 {
216                                         Cスコア cスコア = CDTXMania.bXGRelease ? CDTXMania.stage選曲XG.r確定されたスコア : CDTXMania.stage選曲GITADORA.r確定されたスコア;
217                                         bool[] b更新が必要か否か = new bool[ 3 ];
218                                         CScoreIni.t更新条件を取得する( out b更新が必要か否か[ 0 ], out b更新が必要か否か[ 1 ], out b更新が必要か否か[ 2 ] );
219                                         for( int m = 0; m < 3; m++ )
220                                         {
221                                                 if( b更新が必要か否か[ m ] )
222                                                 {
223                                                         // FullCombo した記録を FullCombo なしで超えた場合、FullCombo マークが消えてしまう。
224                                                         // → FullCombo は、最新記録と関係なく、一度達成したらずっとつくようにする。(2010.9.11)
225                                                         cスコア.譜面情報.フルコンボ[ m ] = this.st演奏記録[ m ].bフルコンボである | b今までにフルコンボしたことがある[ m ];
226
227                                                         if( this.b新記録スキル[ m ] )
228                                                         {
229                                                                 cスコア.譜面情報.最大スキル[ m ] = this.st演奏記録[ m ].db演奏型スキル値;
230                                     }
231
232                             if (this.b新記録ランク[ m ])
233                             {
234                                 cスコア.譜面情報.最大ランク[ m ] = this.nランク値[ m ];
235                             }
236                                                 }
237                                         }
238                                 }
239                                 //---------------------
240                                 #endregion
241
242                                 #region [ #RESULTSOUND_xx の再生(あれば)]
243                                 //---------------------
244                                 int rank = CScoreIni.t総合ランク値を計算して返す( this.st演奏記録.Drums, this.st演奏記録.Guitar, this.st演奏記録.Bass );
245
246                                 if (rank == 99) // #23534 2010.10.28 yyagi: 演奏チップが0個のときは、rankEと見なす
247                                 {
248                                         rank = 6;
249                                 }
250         
251                                 if( string.IsNullOrEmpty( CDTXMania.DTX.RESULTSOUND[ rank ] ) )
252                                 {
253                                         CDTXMania.Skin.soundステージクリア音.t再生する();
254                                         this.rResultSound = null;
255                                 }
256                                 else
257                                 {
258                                         string str2 = CDTXMania.DTX.strフォルダ名 + CDTXMania.DTX.RESULTSOUND[ rank ];
259                                         try
260                                         {
261                                                 this.rResultSound = CDTXMania.Sound管理.tサウンドを生成する( str2 );
262                                         }
263                                         catch
264                                         {
265                                                 Trace.TraceError( "サウンドの生成に失敗しました。({0})", new object[] { str2 } );
266                                                 this.rResultSound = null;
267                                         }
268                                 }
269                                 //---------------------
270                                 #endregion
271
272                                 base.On活性化();
273                         }
274                         finally
275                         {
276                                 Trace.TraceInformation( "結果ステージの活性化を完了しました。" );
277                                 Trace.Unindent();
278                         }
279                 }
280
281         // #35411 chnmr0 add
282         private void SaveGhost(int sectionIndex)
283         {
284             STDGBVALUE<bool> saveCond = new STDGBVALUE<bool>();
285             saveCond.Drums = true;
286             saveCond.Guitar = true;
287             saveCond.Bass = true;
288             
289             foreach( CDTX.CChip chip in CDTXMania.DTX.listChip )
290             {
291                 if( chip.bIsAutoPlayed )
292                 {
293                                         if (chip.nチャンネル番号 != 0x28 && chip.nチャンネル番号 != 0xA8) // Guitar/Bass Wailing は OK
294                                         {
295                                                 saveCond[(int)(chip.e楽器パート)] = false;
296                                         }
297                 }
298             }
299             for(int instIndex = 0; instIndex < 3; ++instIndex)
300             {
301                 saveCond[instIndex] &= CDTXMania.listAutoGhostLag.Drums == null;
302             }
303
304             string directory = CDTXMania.DTX.strフォルダ名;
305             string filename = CDTXMania.DTX.strファイル名 + ".";
306             E楽器パート inst = E楽器パート.UNKNOWN;
307
308             if ( sectionIndex == 0 )
309             {
310                 filename += "hiscore.dr.ghost";
311                 inst = E楽器パート.DRUMS;
312             }
313             else if (sectionIndex == 1 )
314             {
315                 filename += "hiskill.dr.ghost";
316                 inst = E楽器パート.DRUMS;
317             }
318             if (sectionIndex == 2 )
319             {
320                 filename += "hiscore.gt.ghost";
321                 inst = E楽器パート.GUITAR;
322             }
323             else if (sectionIndex == 3 )
324             {
325                 filename += "hiskill.gt.ghost";
326                 inst = E楽器パート.GUITAR;
327             }
328             if (sectionIndex == 4 )
329             {
330                 filename += "hiscore.bs.ghost";
331                 inst = E楽器パート.BASS;
332             }
333             else if (sectionIndex == 5)
334             {
335                 filename += "hiskill.bs.ghost";
336                 inst = E楽器パート.BASS;
337             }
338             else if (sectionIndex == 6)
339             {
340                 filename += "lastplay.dr.ghost";
341                 inst = E楽器パート.DRUMS;
342             }
343             else if (sectionIndex == 7 )
344             {
345                 filename += "lastplay.gt.ghost";
346                 inst = E楽器パート.GUITAR;
347             }
348             else if (sectionIndex == 8)
349             {
350                 filename += "lastplay.bs.ghost";
351                 inst = E楽器パート.BASS;
352             }
353
354             if (inst == E楽器パート.UNKNOWN)
355             {
356                 return;
357             }
358
359             int cnt = 0;
360             foreach (DTXMania.CDTX.CChip chip in CDTXMania.DTX.listChip)
361             {
362                 if (chip.e楽器パート == inst)
363                 {
364                     ++cnt;
365                 }
366             }
367
368             if( saveCond[(int)inst] )
369             {
370                 using (FileStream fs = new FileStream(directory + "\\" + filename, FileMode.Create, FileAccess.Write))
371                 {
372                     using (BinaryWriter bw = new BinaryWriter(fs))
373                     {
374                         bw.Write((Int32)cnt);
375                         foreach (DTXMania.CDTX.CChip chip in CDTXMania.DTX.listChip)
376                         {
377                             if (chip.e楽器パート == inst)
378                             {
379                                 // -128 ms から 127 ms までのラグしか保存しない
380                                 // その範囲を超えているラグはクランプ
381                                                                 // ラグデータの 上位8ビットでそのチップの前でギター空打ちBADがあったことを示す
382                                                                 int lag = chip.nLag;
383                                                                 if (lag < -128)
384                                                                 {
385                                                                         lag = -128;
386                                                                 }
387                                                                 if (lag > 127)
388                                                                 {
389                                                                         lag = 127;
390                                                                 }
391                                                                 byte lower = (byte)(lag + 128);
392                                                                 int upper = chip.nCurrentComboForGhost == 0 ? 1 : 0;
393                                                                 bw.Write((short)( (upper<<8) | lower));
394                             }
395                         }
396                     }
397                 }
398                 //Ver.K追加 演奏結果の記録
399                 CScoreIni.C演奏記録 cScoreData;
400                 cScoreData = this.st演奏記録[ (int)inst ];
401                 using (FileStream fs = new FileStream(directory + "\\" + filename + ".score", FileMode.Create, FileAccess.Write))
402                 {
403                     using (StreamWriter sw = new StreamWriter(fs))
404                     {
405                         sw.WriteLine( "Score=" + cScoreData.nスコア );
406                         sw.WriteLine( "PlaySkill=" + cScoreData.db演奏型スキル値 );
407                         sw.WriteLine( "Skill=" + cScoreData.dbゲーム型スキル値 );
408                         sw.WriteLine( "Perfect=" + cScoreData.nPerfect数_Auto含まない );
409                         sw.WriteLine( "Great=" + cScoreData.nGreat数_Auto含まない );
410                         sw.WriteLine( "Good=" + cScoreData.nGood数_Auto含まない );
411                         sw.WriteLine( "Poor=" + cScoreData.nPoor数_Auto含まない );
412                         sw.WriteLine( "Miss=" + cScoreData.nMiss数_Auto含まない );
413                         sw.WriteLine( "MaxCombo=" + cScoreData.n最大コンボ数 );
414                     }
415                 }
416             }
417         }
418
419                 public override void On非活性化()
420                 {
421                         if( this.rResultSound != null )
422                         {
423                                 CDTXMania.Sound管理.tサウンドを破棄する( this.rResultSound );
424                                 this.rResultSound = null;
425                         }
426                         base.On非活性化();
427                 }
428                 public override void OnManagedリソースの作成()
429                 {
430                         if( !base.b活性化してない )
431                         {
432                                 this.tx背景 = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\8_background.png" ) );
433                                 this.tx上部パネル = CDTXMania.tテクスチャの生成Af( CSkin.Path( @"Graphics\8_header panel.png" ) );
434                                 this.tx下部パネル = CDTXMania.tテクスチャの生成Af( CSkin.Path( @"Graphics\8_footer panel.png" ) );
435                                 base.OnManagedリソースの作成();
436                         }
437                 }
438                 public override void OnManagedリソースの解放()
439                 {
440                         if( !base.b活性化してない )
441                         {
442                                 if( this.ct登場用 != null )
443                                 {
444                                         this.ct登場用 = null;
445                                 }
446                                 CDTXMania.tテクスチャの解放( ref this.tx背景 );
447                                 CDTXMania.tテクスチャの解放( ref this.tx上部パネル );
448                                 CDTXMania.tテクスチャの解放( ref this.tx下部パネル );
449                                 base.OnManagedリソースの解放();
450                         }
451                 }
452                 public override int On進行描画()
453                 {
454                         if( !base.b活性化してない )
455                         {
456                                 int num;
457                                 if( base.b初めての進行描画 )
458                                 {
459                                         this.ct登場用 = new CCounter( 0, 100, 5, CDTXMania.Timer );
460                                         this.actFI.tフェードイン開始();
461                                         base.eフェーズID = CStage.Eフェーズ.共通_フェードイン;
462                                         if( this.rResultSound != null )
463                                         {
464                                                 this.rResultSound.t再生を開始する();
465                                         }
466                                         base.b初めての進行描画 = false;
467                                 }
468                                 this.bアニメが完了 = true;
469                                 if( this.ct登場用.b進行中 )
470                                 {
471                                         this.ct登場用.t進行();
472                                         if( this.ct登場用.b終了値に達した )
473                                         {
474                                                 this.ct登場用.t停止();
475                                         }
476                                         else
477                                         {
478                                                 this.bアニメが完了 = false;
479                                         }
480                                 }
481
482                                 // 描画
483
484                                 if( this.tx背景 != null )
485                                 {
486                                         this.tx背景.t2D描画( CDTXMania.app.Device, 0, 0 );
487                                 }
488                                 if( this.ct登場用.b進行中 && ( this.tx上部パネル != null ) )
489                                 {
490                                         double num2 = ( (double) this.ct登場用.n現在の値 ) / 100.0;
491                                         double num3 = Math.Sin( Math.PI / 2 * num2 );
492                                         num = ( (int) ( this.tx上部パネル.sz画像サイズ.Height * num3 ) ) - this.tx上部パネル.sz画像サイズ.Height;
493                                 }
494                                 else
495                                 {
496                                         num = 0;
497                                 }
498                 //if( this.tx上部パネル != null )
499                 //{
500                 //    this.tx上部パネル.t2D描画( CDTXMania.app.Device, 0, num * Scale.Y );
501                 //}
502                 //if( this.tx下部パネル != null )
503                 //{
504                 //    this.tx下部パネル.t2D描画( CDTXMania.app.Device, 0, ( SampleFramework.GameWindowSize.Height - this.tx下部パネル.sz画像サイズ.Height) );
505                 //}
506                 //this.actOption.On進行描画();
507                 if( this.actResultImage.On進行描画() == 0 )
508                 {
509                     this.bアニメが完了 = false;
510                 }
511                 if ( this.actParameterPanel.On進行描画() == 0 )
512                 {
513                     this.bアニメが完了 = false;
514                 }
515                 if ( this.actRank.On進行描画() == 0 )
516                 {
517                     this.bアニメが完了 = false;
518                 }
519                                 if( base.eフェーズID == CStage.Eフェーズ.共通_フェードイン )
520                                 {
521                                         if( this.actFI.On進行描画() != 0 )
522                                         {
523                                                 base.eフェーズID = CStage.Eフェーズ.共通_通常状態;
524                                         }
525                                 }
526                                 else if( ( base.eフェーズID == CStage.Eフェーズ.共通_フェードアウト ) )                        //&& ( this.actFO.On進行描画() != 0 ) )
527                                 {
528                                         return (int) this.eフェードアウト完了時の戻り値;
529                                 }
530                                 #region [ #24609 2011.3.14 yyagi ランク更新or演奏型スキル更新時、リザルト画像をpngで保存する ]
531                                 if ( this.bアニメが完了 == true && this.bIsCheckedWhetherResultScreenShouldSaveOrNot == false     // #24609 2011.3.14 yyagi; to save result screen in case BestRank or HiSkill.
532                                         && CDTXMania.ConfigIni.bScoreIniを出力する
533                                         && CDTXMania.ConfigIni.bIsAutoResultCapture)                                                                                            // #25399 2011.6.9 yyagi
534                                 {
535                                         CheckAndSaveResultScreen(true);
536                                         this.bIsCheckedWhetherResultScreenShouldSaveOrNot = true;
537                                 }
538                                 #endregion
539
540                                 // キー入力
541
542                                 if( CDTXMania.act現在入力を占有中のプラグイン == null )
543                                 {
544                                         if( CDTXMania.ConfigIni.bドラム打音を発声する && CDTXMania.ConfigIni.bDrums有効 )
545                                         {
546                                                 for( int i = 0; i < 11; i++ )
547                                                 {
548                                                         List<STInputEvent> events = CDTXMania.Pad.GetEvents( E楽器パート.DRUMS, (Eパッド) i );
549                                                         if( ( events != null ) && ( events.Count > 0 ) )
550                                                         {
551                                                                 foreach( STInputEvent event2 in events )
552                                                                 {
553                                                                         if( !event2.b押された )
554                                                                         {
555                                                                                 continue;
556                                                                         }
557                                                                         CDTX.CChip rChip = this.r空うちドラムチップ[ i ];
558                                                                         if( rChip == null )
559                                                                         {
560                                                                                 switch( ( (Eパッド) i ) )
561                                                                                 {
562                                                                                         case Eパッド.HH:
563                                                                                                 rChip = this.r空うちドラムチップ[ 7 ];
564                                                                                                 if( rChip == null )
565                                                                                                 {
566                                                                                                         rChip = this.r空うちドラムチップ[ 9 ];
567                                                                                                 }
568                                                                                                 break;
569
570                                                                                         case Eパッド.FT:
571                                                                                                 rChip = this.r空うちドラムチップ[ 4 ];
572                                                                                                 break;
573
574                                                                                         case Eパッド.CY:
575                                                                                                 rChip = this.r空うちドラムチップ[ 8 ];
576                                                                                                 break;
577
578                                                                                         case Eパッド.HHO:
579                                                                                                 rChip = this.r空うちドラムチップ[ 0 ];
580                                                                                                 if( rChip == null )
581                                                                                                 {
582                                                                                                         rChip = this.r空うちドラムチップ[ 9 ];
583                                                                                                 }
584                                                                                                 break;
585
586                                                                                         case Eパッド.RD:
587                                                                                                 rChip = this.r空うちドラムチップ[ 6 ];
588                                                                                                 break;
589
590                                                                                         case Eパッド.LC:
591                                                                                                 rChip = this.r空うちドラムチップ[ 0 ];
592                                                                                                 if( rChip == null )
593                                                                                                 {
594                                                                                                         rChip = this.r空うちドラムチップ[ 7 ];
595                                                                                                 }
596
597                                                                                                 break;
598                                                                                 }
599                                                                         }
600                                                                         if( ( ( rChip != null ) && ( rChip.nチャンネル番号 >= 0x11 ) ) && ( rChip.nチャンネル番号 <= 0x1C ) )
601                                                                         {
602                                                                                 int nLane = this.nチャンネル0Atoレーン07[ rChip.nチャンネル番号 - 0x11 ];
603                                                                                 if( ( nLane == 1 ) && ( ( rChip.nチャンネル番号 == 0x11 ) || ( ( rChip.nチャンネル番号 == 0x18 ) && ( this.n最後に再生したHHのチャンネル番号 != 0x18 ) ) ) )
604                                                                                 {
605                                                                                         CDTXMania.DTX.tWavの再生停止( this.n最後に再生したHHのWAV番号 );
606                                                                                         this.n最後に再生したHHのWAV番号 = rChip.n整数値_内部番号;
607                                                                                         this.n最後に再生したHHのチャンネル番号 = rChip.nチャンネル番号;
608                                                                                 }
609                                                                                 if( ( nLane == 9 ) && ( ( rChip.nチャンネル番号 == 0x1B ) || ( ( rChip.nチャンネル番号 == 0x1B ) && ( this.n最後に再生したHHのチャンネル番号 != 0x18 ) ) ) )
610                                                                                 {
611                                                                                         CDTXMania.DTX.tWavの再生停止( this.n最後に再生したHHのWAV番号 );
612                                                                                         this.n最後に再生したHHのWAV番号 = rChip.n整数値_内部番号;
613                                                                                         this.n最後に再生したHHのチャンネル番号 = rChip.nチャンネル番号;
614                                                                                 }
615                                                                                 CDTXMania.DTX.tチップの再生( rChip, CDTXMania.Timer.nシステム時刻, nLane, CDTXMania.ConfigIni.n手動再生音量, CDTXMania.ConfigIni.b演奏音を強調する.Drums );
616                                                                         }
617                                                                 }
618                                                         }
619                                                 }
620                                         }
621                                         if( ( ( CDTXMania.Pad.b押されたDGB( Eパッド.CY ) || CDTXMania.Pad.b押された( E楽器パート.DRUMS, Eパッド.RD ) ) || ( CDTXMania.Pad.b押された( E楽器パート.DRUMS, Eパッド.LC ) || CDTXMania.Input管理.Keyboard.bキーが押された( (int)SlimDX.DirectInput.Key.Return ) ) ) && !this.bアニメが完了 )
622                                         {
623                                                 this.actFI.tフェードイン完了();                                 // #25406 2011.6.9 yyagi
624                                                 this.actResultImage.tアニメを完了させる();
625                                                 this.actParameterPanel.tアニメを完了させる();
626                                                 this.actRank.tアニメを完了させる();
627                                                 this.ct登場用.t停止();
628                                         }
629                                         #region [ #24609 2011.4.7 yyagi リザルト画面で[F12]を押下すると、リザルト画像をpngで保存する機能は、CDTXManiaに移管。 ]
630 //                                      if ( CDTXMania.Input管理.Keyboard.bキーが押された( (int) SlimDX.DirectInput.Key.F12 ) &&
631 //                                              CDTXMania.ConfigIni.bScoreIniを出力する )
632 //                                      {
633 //                                              CheckAndSaveResultScreen(false);
634 //                                              this.bIsCheckedWhetherResultScreenShouldSaveOrNot = true;
635 //                                      }
636                                         #endregion
637                                         if ( base.eフェーズID == CStage.Eフェーズ.共通_通常状態 )
638                                         {
639                                                 if ( CDTXMania.Input管理.Keyboard.bキーが押された( (int)SlimDX.DirectInput.Key.Escape ) )
640                                                 {
641                                                         CDTXMania.Skin.sound取消音.t再生する();
642                                                         this.actFO.tフェードアウト開始();
643                                                         base.eフェーズID = CStage.Eフェーズ.共通_フェードアウト;
644                                                         this.eフェードアウト完了時の戻り値 = E戻り値.完了;
645                                                 }
646                                                 if ( ( ( CDTXMania.Pad.b押されたDGB( Eパッド.CY ) || CDTXMania.Pad.b押された( E楽器パート.DRUMS, Eパッド.RD ) ) || ( CDTXMania.Pad.b押された( E楽器パート.DRUMS, Eパッド.LC ) || CDTXMania.Input管理.Keyboard.bキーが押された( (int) SlimDX.DirectInput.Key.Return ) ) ) && this.bアニメが完了 )
647                                                 {
648                                                         CDTXMania.Skin.sound取消音.t再生する();
649 //                                                      this.actFO.tフェードアウト開始();
650                                                         base.eフェーズID = CStage.Eフェーズ.共通_フェードアウト;
651                                                         this.eフェードアウト完了時の戻り値 = E戻り値.完了;
652                                                 }
653                                         }
654                                 }
655                         }
656                         return 0;
657                 }
658
659                 public enum E戻り値 : int
660                 {
661                         継続,
662                         完了
663                 }
664
665
666                 // その他
667
668                 #region [ private ]
669                 //-----------------
670                 private CCounter ct登場用;
671                 private E戻り値 eフェードアウト完了時の戻り値;
672                 private CActFIFOWhite actFI;
673                 private CActFIFOBlack actFO;
674                 private CActオプションパネル actOption;
675                 private CAct演奏AVI actAVI;
676                 private CActResultParameterPanel actParameterPanel;
677                 private CActResultRank actRank;
678                 private CActResultImage共通 actResultImage;
679                 private CActResultSongBar actSongBar;
680                 private bool bアニメが完了;
681                 private bool bIsCheckedWhetherResultScreenShouldSaveOrNot;                              // #24509 2011.3.14 yyagi
682                 private readonly int[] nチャンネル0Atoレーン07;
683                 private int n最後に再生したHHのWAV番号;
684                 private int n最後に再生したHHのチャンネル番号;
685                 private CSound rResultSound;
686                 private CTextureAf tx下部パネル;
687                 private CTextureAf tx上部パネル;
688                 private CTexture tx背景;
689
690                 #region [ #24609 リザルト画像をpngで保存する ]              // #24609 2011.3.14 yyagi; to save result screen in case BestRank or HiSkill.
691                 /// <summary>
692                 /// リザルト画像のキャプチャと保存。
693                 /// 自動保存モード時は、ランク更新or演奏型スキル更新時に自動保存。
694                 /// 手動保存モード時は、ランクに依らず保存。
695                 /// </summary>
696                 /// <param name="bIsAutoSave">true=自動保存モード, false=手動保存モード</param>
697                 private void CheckAndSaveResultScreen(bool bIsAutoSave)
698                 {
699                         string path = Path.GetDirectoryName( CDTXMania.DTX.strファイル名の絶対パス );
700                         string datetime = DateTime.Now.ToString( "yyyyMMddHHmmss" );
701                         if ( bIsAutoSave )
702                         {
703                                 // リザルト画像を自動保存するときは、dtxファイル名.yyMMddHHmmss_DRUMS_SS.png という形式で保存。
704                                 for ( int i = 0; i < 3; i++ )
705                                 {
706                                         if ( this.b新記録ランク[ i ] == true || this.b新記録スキル[ i ] == true )
707                                         {
708                                                 string strPart = ( (E楽器パート) ( i ) ).ToString();
709                                                 string strRank = ( (CScoreIni.ERANK) ( this.nランク値[ i ] ) ).ToString();
710                                                 string strFullPath = CDTXMania.DTX.strファイル名の絶対パス + "." + datetime + "_" + strPart + "_" + strRank + ".png";
711                                                 //Surface.ToFile( pSurface, strFullPath, ImageFileFormat.Png );
712                                                 CDTXMania.app.SaveResultScreen( strFullPath );
713                                         }
714                                 }
715                         }
716                         #region [ #24609 2011.4.11 yyagi; リザルトの手動保存ロジックは、CDTXManiaに移管した。]
717 //                      else
718 //                      {
719 //                              // リザルト画像を手動保存するときは、dtxファイル名.yyMMddHHmmss_SS.png という形式で保存。(楽器名無し)
720 //                              string strRank = ( (CScoreIni.ERANK) ( CDTXMania.stage結果.n総合ランク値 ) ).ToString();
721 //                              string strSavePath = CDTXMania.strEXEのあるフォルダ + "\\" + "Capture_img";
722 //                              if ( !Directory.Exists( strSavePath ) )
723 //                              {
724 //                                      try
725 //                                      {
726 //                                              Directory.CreateDirectory( strSavePath );
727 //                                      }
728 //                                      catch
729 //                                      {
730 //                                      }
731 //                              }
732 //                              string strSetDefDifficulty = CDTXMania.stage選曲.r確定された曲.ar難易度ラベル[ CDTXMania.stage選曲.n確定された曲の難易度 ];
733 //                              if ( strSetDefDifficulty != null )
734 //                              {
735 //                                      strSetDefDifficulty = "(" + strSetDefDifficulty + ")";
736 //                              }
737 //                              string strFullPath = strSavePath + "\\" + CDTXMania.DTX.TITLE + strSetDefDifficulty +
738 //                                      "." + datetime + "_" + strRank + ".png";
739 //                              // Surface.ToFile( pSurface, strFullPath, ImageFileFormat.Png );
740 //                              CDTXMania.app.SaveResultScreen( strFullPath );
741 //                      }
742                         #endregion
743                 }
744                 #endregion
745                 //-----------------
746                 #endregion
747         }
748 }