Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/DTXManiaプロジェクト/コード/ステージ/05.選曲/CStage選曲.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 176 - (show annotations) (download)
Sun Oct 13 04:52:11 2013 UTC (10 years, 5 months ago) by kairera0467
File size: 41713 byte(s)
#xxxxx 選曲画面の背景動画がない時に例外発生していたのを修正。
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Runtime.InteropServices;
5 using System.Drawing;
6 using System.Diagnostics;
7 using System.IO;
8 using DirectShowLib;
9 using FDK;
10
11 namespace DTXMania
12 {
13 internal class CStage選曲 : CStage
14 {
15 // プロパティ
16 public int nスクロルバ相対y座標
17 {
18 get
19 {
20 if ( act曲リスト != null )
21 {
22 return act曲リスト.nスクロルバ相対y座標;
23 }
24 else
25 {
26 return 0;
27 }
28 }
29 }
30 public bool bIsEnumeratingSongs
31 {
32 get
33 {
34 return act曲リスト.bIsEnumeratingSongs;
35 }
36 set
37 {
38 act曲リスト.bIsEnumeratingSongs = value;
39 }
40 }
41 public bool bIsPlayingPremovie
42 {
43 get
44 {
45 return this.actPreimageパネル.bIsPlayingPremovie;
46 }
47 }
48 public bool bスクロル中
49 {
50 get
51 {
52 return this.act曲リスト.bスクロル中;
53 }
54 }
55 public int n確定された曲の難易度
56 {
57 get;
58 private set;
59 }
60 public Cスコア r確定されたスコア
61 {
62 get;
63 private set;
64 }
65 public C曲リストノ r確定された曲
66 {
67 get;
68 private set;
69 }
70 /// <summary>
71 /// <para>現在演奏中の曲のスコアに対応する背景動画。</para>
72 /// <para>r現在演奏中の曲のスコア の読み込み時に、自動検索・抽出・生成される。</para>
73 /// </summary>
74 public CDirectShow r現在演奏中のスコアの背景動画 = null;
75 public int n現在選択中の曲の難易度
76 {
77 get
78 {
79 return this.act曲リスト.n現在選択中の曲の現在の難易度レベル;
80 }
81 }
82 public Cスコア r現在選択中のスコア
83 {
84 get
85 {
86 return this.act曲リスト.r現在選択中のスコア;
87 }
88 }
89 public C曲リストノ r現在選択中の曲
90 {
91 get
92 {
93 return this.act曲リスト.r現在選択中の曲;
94 }
95 }
96
97 // コンストラクタ
98 public CStage選曲()
99 {
100 base.eステID = CStage.Eステ.選曲;
101 base.eフェID = CStage.Eフェ.共通_通常状態;
102 base.b活性化してない = true;
103 base.listActivities.Add( this.actオプションパネル = new CActオプションパネル() );
104 base.listActivities.Add( this.actFIFO = new CActFIFOBlack() );
105 base.listActivities.Add( this.actFIfrom結果画面 = new CActFIFOBlack() );
106 // base.list子Activities.Add( this.actFOtoNowLoading = new CActFIFOBlack() ); // #27787 2012.3.10 yyagi 曲決定時の画面フェードアウトの省略
107 base.listActivities.Add( this.act曲リスト = new CActSelect曲リスト() );
108 base.listActivities.Add( this.actステタスパネル = new CActSelectステタスパネル() );
109 base.listActivities.Add( this.act演奏履歴パネル = new CActSelect演奏履歴パネル() );
110 base.listActivities.Add( this.actPreimageパネル = new CActSelectPreimageパネル() );
111 base.listActivities.Add( this.actPresound = new CActSelectPresound() );
112 base.listActivities.Add( this.actArtistComment = new CActSelectArtistComment() );
113 base.listActivities.Add( this.actInformation = new CActSelectInformation() );
114 base.listActivities.Add( this.actSortSongs = new CActSortSongs() );
115 base.listActivities.Add( this.actShowCurrentPosition = new CActSelectShowCurrentPosition() );
116 base.listActivities.Add( this.actQuickConfig = new CActSelectQuickConfig() );
117
118 this.CommandHistory = new CCommandHistory(); // #24063 2011.1.16 yyagi
119 }
120
121
122 // メソッド
123
124 public void t選択曲変更通知()
125 {
126 this.actPreimageパネル.t選択曲が変更された();
127 this.actPresound.t選択曲が変更された();
128 this.act演奏履歴パネル.t選択曲が変更された();
129 this.actステタスパネル.t選択曲が変更された();
130 this.actArtistComment.t選択曲が変更された();
131
132 #region [ プラグインにも通知する(BOX, RANDOM, BACK なら通知しない)]
133 //---------------------
134 if( CDTXMania.app != null )
135 {
136 var c曲リストノ = CDTXMania.stage選曲.r現在選択中の曲;
137 var cスコア = CDTXMania.stage選曲.r現在選択中のスコア;
138
139 if( c曲リストノ != null && cスコア != null && c曲リストノ.eド種別 == C曲リストノ.Eド種別.SCORE )
140 {
141 string str選択曲ファイル名 = cスコア.ファイル情報.ファイルの絶対パス;
142 CSetDef setDef = null;
143 int nブロック番号inSetDef = -1;
144 int n曲番号inブロック = -1;
145
146 if( !string.IsNullOrEmpty( c曲リストノ.pathSetDefの絶対パス ) && File.Exists( c曲リストノ.pathSetDefの絶対パス ) )
147 {
148 setDef = new CSetDef( c曲リストノ.pathSetDefの絶対パス );
149 nブロック番号inSetDef = c曲リストノ.SetDefのブロック番号;
150 n曲番号inブロック = CDTXMania.stage選曲.act曲リスト.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( c曲リストノ );
151 }
152
153 foreach( CDTXMania.STPlugin stPlugin in CDTXMania.app.listプラグイン )
154 {
155 Directory.SetCurrentDirectory( stPlugin.strプラグインフォルダ );
156 stPlugin.plugin.On選択曲変更( str選択曲ファイル名, setDef, nブロック番号inSetDef, n曲番号inブロック );
157 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
158 }
159 }
160 }
161 //---------------------
162 #endregion
163 }
164
165 // CStage 実装
166
167 /// <summary>
168 /// 曲リストをリセットする
169 /// </summary>
170 /// <param name="cs"></param>
171 public void Refresh( CSongs管理 cs, bool bRemakeSongTitleBar)
172 {
173 this.act曲リスト.Refresh( cs, bRemakeSongTitleBar );
174 }
175
176 public override void On活性化()
177 {
178 Trace.TraceInformation( "選曲ステージを活性化します。" );
179 Trace.Indent();
180 try
181 {
182 this.eフェドアウト完了時の戻り値 = E戻り値.継続;
183 this.bBGM再生済み = false;
184 this.ftフォント = new Font( "MS PGothic", 26f, GraphicsUnit.Pixel );
185 for( int i = 0; i < 4; i++ )
186 this.ct反復用[ i ] = new CCounter( 0, 0, 0, CDTXMania.Timer );
187
188 base.On活性化();
189
190 this.actステタスパネル.t選択曲が変更された(); // 最大ランクを更新
191 }
192 finally
193 {
194 Trace.TraceInformation( "選曲ステージの活性化を完了しました。" );
195 Trace.Unindent();
196 }
197 }
198 public override void On非活性化()
199 {
200 Trace.TraceInformation( "選曲ステージを非活性化します。" );
201 Trace.Indent();
202 try
203 {
204 if( this.ftフォント != null )
205 {
206 this.ftフォント.Dispose();
207 this.ftフォント = null;
208 }
209 for( int i = 0; i < 4; i++ )
210 {
211 this.ct反復用[ i ] = null;
212 }
213 base.On非活性化();
214 }
215 finally
216 {
217 Trace.TraceInformation( "選曲ステージの非活性化を完了しました。" );
218 Trace.Unindent();
219 }
220 }
221 public override void OnManagedリソスの作成()
222 {
223 if( !base.b活性化してない )
224 {
225 this.tx背景 = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_background.jpg" ), false );
226 if( File.Exists (CSkin.Path(@"Graphics\5_background.mp4")))
227 {
228 this.ds背景動画 = CDTXMania.t失敗してもスキップ可能なDirectShowを生成する( CSkin.Path(@"Graphics\5_background.mp4"), CDTXMania.app.WindowHandle, true );
229 }
230 this.tx上部パネル = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_header panel.png" ), false );
231 this.tx下部パネル = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_footer panel.png" ), false );
232 this.txコメントバ = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_comment bar.png" ), true );
233 this.txFLIP = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_skill number on gauge etc.png" ), false );
234 base.OnManagedリソスの作成();
235 }
236 }
237 public override void OnManagedリソスの解放()
238 {
239 if( !base.b活性化してない )
240 {
241 if(this.ds背景動画 != null)
242 CDTXMania.t安全にDisposeする( ref this.ds背景動画 );
243 CDTXMania.tテクスチャの解放( ref this.tx背景 );
244 CDTXMania.tテクスチャの解放( ref this.tx上部パネル );
245 CDTXMania.tテクスチャの解放( ref this.tx下部パネル );
246 CDTXMania.tテクスチャの解放( ref this.txコメントバ );
247 CDTXMania.tテクスチャの解放( ref this.txFLIP );
248 base.OnManagedリソスの解放();
249 }
250 }
251 public override int On進行描画()
252 {
253 if( !base.b活性化してない )
254 {
255 #region [ 初めての進行描画 ]
256 //---------------------
257 if( base.b初めての進行描画 )
258 {
259 this.ct登場時アニメ用共通 = new CCounter( 0, 100, 3, CDTXMania.Timer );
260 if( CDTXMania.r直前のステ == CDTXMania.stage結果 )
261 {
262 this.actFIfrom結果画面.tフェドイン開始();
263 base.eフェID = CStage.Eフェ.選曲_結果画面からのフェドイン;
264 }
265 else
266 {
267 this.actFIFO.tフェドイン開始();
268 base.eフェID = CStage.Eフェ.共通_フェドイン;
269 }
270 this.t選択曲変更通知();
271 base.b初めての進行描画 = false;
272 }
273 //---------------------
274 #endregion
275
276 this.ct登場時アニメ用共通.t進行();
277
278 if( this.ds背景動画 != null )
279 {
280 this.ds背景動画.t現時点における最新のスナップイメジをTextureに転写する( this.tx背景 );
281 this.ds背景動画.t再生開始();
282 this.ds背景動画.MediaSeeking.GetPositions(out this.lDshowPosition, out this.lStopPosition);
283 if (this.lDshowPosition == this.lStopPosition)
284 {
285 this.ds背景動画.MediaSeeking.SetPositions(
286 DsLong.FromInt64((long)(0)),
287 AMSeekingSeekingFlags.AbsolutePositioning,
288 0,
289 AMSeekingSeekingFlags.NoPositioning);
290 }
291 }
292
293 if( this.tx背景 != null )
294 {
295 if( this.ds背景動画 != null ? this.ds背景動画.b上下反転 : false )
296 this.tx背景.t2D上下反転描画( CDTXMania.app.Device, 0, 0 );
297 else
298 this.tx背景.t2D描画( CDTXMania.app.Device, 0, 0 );
299 }
300
301 this.actPreimageパネル.On進行描画();
302 // this.bIsEnumeratingSongs = !this.actPreimageパネル.bIsPlayingPremovie; // #27060 2011.3.2 yyagi: #PREMOVIE再生中は曲検索を中断する
303
304 this.act曲リスト.On進行描画();
305 int y = 0;
306 if( this.ct登場時アニメ用共通.b進行中 )
307 {
308 double db登場割合 = ( (double) this.ct登場時アニメ用共通.n現在の値 ) / 100.0; // 100が最終値
309 double dbY表示割合 = Math.Sin( Math.PI / 2 * db登場割合 );
310 y = ( (int) ( this.tx上部パネル.sz画像サイズ.Height * dbY表示割合 ) ) - this.tx上部パネル.sz画像サイズ.Height;
311 }
312 if( this.tx上部パネル != null )
313 this.tx上部パネル.t2D描画( CDTXMania.app.Device, 0, y );
314
315 this.actInformation.On進行描画();
316 if( this.tx下部パネル != null )
317 this.tx下部パネル.t2D描画( CDTXMania.app.Device, 0, 720 - this.tx下部パネル.sz画像サイズ.Height );
318
319 this.actステタスパネル.On進行描画();
320 this.act演奏履歴パネル.On進行描画();
321 this.actPresound.On進行描画();
322 if( this.txコメントバ != null )
323 {
324 this.txコメントバ.t2D描画(CDTXMania.app.Device, 484, 342);
325 }
326 this.actArtistComment.On進行描画();
327 this.actオプションパネル.On進行描画();
328 if ( this.txFLIP != null && CDTXMania.ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.16 yyagi
329 {
330 Rectangle rect = new Rectangle(0x1f, 0x31, 20, 11);
331 this.txFLIP.t2D描画( CDTXMania.app.Device, 80, 654, rect );
332 }
333 this.actShowCurrentPosition.On進行描画(); // #27648 2011.3.28 yyagi
334
335 switch ( base.eフェID )
336 {
337 case CStage.Eフェ.共通_フェドイン:
338 if( this.actFIFO.On進行描画() != 0 )
339 {
340 base.eフェID = CStage.Eフェ.共通_通常状態;
341 }
342 break;
343
344 case CStage.Eフェ.共通_フェドアウト:
345 if( this.actFIFO.On進行描画() == 0 )
346 {
347 break;
348 }
349 return (int) this.eフェドアウト完了時の戻り値;
350
351 case CStage.Eフェ.選曲_結果画面からのフェドイン:
352 if( this.actFIfrom結果画面.On進行描画() != 0 )
353 {
354 base.eフェID = CStage.Eフェ.共通_通常状態;
355 }
356 break;
357
358 case CStage.Eフェ.選曲_NowLoading画面へのフェドアウト:
359 // if( this.actFOtoNowLoading.On進行描画() == 0 )
360 // {
361 // break;
362 // }
363 return (int) this.eフェドアウト完了時の戻り値;
364 }
365 if( !this.bBGM再生済み && ( base.eフェID == CStage.Eフェ.共通_通常状態 ) )
366 {
367 CDTXMania.Skin.bgm選曲画面.n音量・次に鳴るサウンド = 100;
368 CDTXMania.Skin.bgm選曲画面.t再生する();
369 this.bBGM再生済み = true;
370 }
371
372
373 //Debug.WriteLine( "パンくず=" + this.r現在選択中の曲.strBreadcrumbs );
374
375
376 // キー入力
377 if( base.eフェID == CStage.Eフェ.共通_通常状態
378 && CDTXMania.act現在入力を占有中のプラグイン == null )
379 {
380 #region [ 簡易CONFIGでMore、またはShift+F1: 詳細CONFIG呼び出し ]
381 if ( actQuickConfig.bGotoDetailConfig )
382 { // 詳細CONFIG呼び出し
383 actQuickConfig.tDeativatePopupMenu();
384 this.actPresound.tサウンド停止();
385 this.eフェドアウト完了時の戻り値 = E戻り値.コンフィグ呼び出し; // #24525 2011.3.16 yyagi: [SHIFT]-[F1]でCONFIG呼び出し
386 this.actFIFO.tフェドアウト開始();
387 base.eフェID = CStage.Eフェ.共通_フェドアウト;
388 CDTXMania.Skin.sound取消音.t再生する();
389 return 0;
390 }
391 #endregion
392 if ( !this.actSortSongs.bIsActivePopupMenu && !this.actQuickConfig.bIsActivePopupMenu )
393 {
394 #region [ ESC ]
395 if ( CDTXMania.Input管理.Keyboard.bが押された( (int) SlimDX.DirectInput.Key.Escape ) || ( ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.LC ) || CDTXMania.Pad.b押されたGB( Eパッド.Cancel ) ) && ( ( this.act曲リスト.r現在選択中の曲 != null ) && ( this.act曲リスト.r現在選択中の曲.r親ノ == null ) ) ) )
396 { // [ESC]
397 CDTXMania.Skin.sound取消音.t再生する();
398 this.eフェドアウト完了時の戻り値 = E戻り値.タイトルに戻る;
399 this.actFIFO.tフェドアウト開始();
400 base.eフェID = CStage.Eフェ.共通_フェドアウト;
401 return 0;
402 }
403 #endregion
404 #region [ Shift-F1: CONFIG画面 ]
405 if ( ( CDTXMania.Input管理.Keyboard.bが押されている( (int) SlimDX.DirectInput.Key.RightShift ) || CDTXMania.Input管理.Keyboard.bが押されている( (int) SlimDX.DirectInput.Key.LeftShift ) ) &&
406 CDTXMania.Input管理.Keyboard.bが押された( (int) SlimDX.DirectInput.Key.F1 ) )
407 { // [SHIFT] + [F1] CONFIG
408 this.actPresound.tサウンド停止();
409 this.eフェドアウト完了時の戻り値 = E戻り値.コンフィグ呼び出し; // #24525 2011.3.16 yyagi: [SHIFT]-[F1]でCONFIG呼び出し
410 this.actFIFO.tフェドアウト開始();
411 base.eフェID = CStage.Eフェ.共通_フェドアウト;
412 CDTXMania.Skin.sound取消音.t再生する();
413 return 0;
414 }
415 #endregion
416 #region [ Shift-F2: 未使用 ]
417 // #24525 2011.3.16 yyagi: [SHIFT]+[F2]は廃止(将来発生するかもしれない別用途のためにキープ)
418 /*
419 if ((CDTXMania.Input管理.Keyboard.bキーが押されている((int)SlimDX.DirectInput.Key.RightShift) || CDTXMania.Input管理.Keyboard.bキーが押されている((int)SlimDX.DirectInput.Key.LeftShift)) &&
420 CDTXMania.Input管理.Keyboard.bキーが押された((int)SlimDX.DirectInput.Key.F2))
421 { // [SHIFT] + [F2] CONFIGURATION
422 this.actPresound.tサウンド停止();
423 this.eフェードアウト完了時の戻り値 = E戻り値.オプション呼び出し;
424 this.actFIFO.tフェードアウト開始();
425 base.eフェーズID = CStage.Eフェーズ.共通_フェードアウト;
426 CDTXMania.Skin.sound取消音.t再生する();
427 return 0;
428 }
429 */
430 #endregion
431 if ( this.act曲リスト.r現在選択中の曲 != null )
432 {
433 #region [ Decide ]
434 if ( ( CDTXMania.Pad.b押されたDGB( Eパッド.Decide ) || CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.CY ) || CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.RD ) ) ||
435 ( CDTXMania.ConfigIni.bEnterがキ割り当てのどこにも使用されていない && CDTXMania.Input管理.Keyboard.bが押された( (int) SlimDX.DirectInput.Key.Return ) ) )
436 {
437 if ( this.act曲リスト.r現在選択中の曲 != null )
438 {
439 switch ( this.act曲リスト.r現在選択中の曲.eド種別 )
440 {
441 case C曲リストノ.Eド種別.SCORE:
442 CDTXMania.Skin.sound決定音.t再生する();
443 this.t曲を選択する();
444 break;
445
446 case C曲リストノ.Eド種別.SCORE_MIDI:
447 CDTXMania.Skin.sound決定音.t再生する();
448 this.t曲を選択する();
449 break;
450
451 case C曲リストノ.Eド種別.BOX:
452 {
453 CDTXMania.Skin.sound決定音.t再生する();
454 bool bNeedChangeSkin = this.act曲リスト.tBOXに入る();
455 if ( bNeedChangeSkin )
456 {
457 this.eフェドアウト完了時の戻り値 = E戻り値.スキン変更;
458 base.eフェID = Eフェ.選曲_NowLoading画面へのフェドアウト;
459 }
460 }
461 break;
462
463 case C曲リストノ.Eド種別.BACKBOX:
464 {
465 CDTXMania.Skin.sound取消音.t再生する();
466 bool bNeedChangeSkin = this.act曲リスト.tBOXを出る();
467 if ( bNeedChangeSkin )
468 {
469 this.eフェドアウト完了時の戻り値 = E戻り値.スキン変更;
470 base.eフェID = Eフェ.選曲_NowLoading画面へのフェドアウト;
471 }
472 }
473 break;
474
475 case C曲リストノ.Eド種別.RANDOM:
476 CDTXMania.Skin.sound決定音.t再生する();
477 this.t曲をランダム選択する();
478 break;
479 }
480 }
481 }
482 #endregion
483 #region [ Up ]
484 this.ct反復用.Up.t反復( CDTXMania.Input管理.Keyboard.bが押されている( (int) SlimDX.DirectInput.Key.UpArrow ), new CCounter.DG処理( this.tソルを上へ移動する ) );
485 this.ct反復用.R.t反復( CDTXMania.Pad.b押されているGB( Eパッド.R ), new CCounter.DG処理( this.tソルを上へ移動する ) );
486 if ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.SD ) )
487 {
488 this.tソルを上へ移動する();
489 }
490 #endregion
491 #region [ Down ]
492 this.ct反復用.Down.t反復( CDTXMania.Input管理.Keyboard.bが押されている( (int) SlimDX.DirectInput.Key.DownArrow ), new CCounter.DG処理( this.tソルを下へ移動する ) );
493 this.ct反復用.B.t反復( CDTXMania.Pad.b押されているGB( Eパッド.B ), new CCounter.DG処理( this.tソルを下へ移動する ) );
494 if ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.FT ) )
495 {
496 this.tソルを下へ移動する();
497 }
498 #endregion
499 #region [ Upstairs ]
500 if ( ( ( this.act曲リスト.r現在選択中の曲 != null ) && ( this.act曲リスト.r現在選択中の曲.r親ノ != null ) ) && ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.LC ) || CDTXMania.Pad.b押されたGB( Eパッド.Cancel ) ) )
501 {
502 this.actPresound.tサウンド停止();
503 CDTXMania.Skin.sound取消音.t再生する();
504 this.act曲リスト.tBOXを出る();
505 this.t選択曲変更通知();
506 }
507 #endregion
508 #region [ BDx2: 簡易CONFIG ]
509 if ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.BD ) )
510 { // [BD]x2 スクロール速度変更
511 CommandHistory.Add( E楽器パ.DRUMS, EパッドFlag.BD );
512 EパッドFlag[] comChangeScrollSpeed = new EパッドFlag[] { EパッドFlag.BD, EパッドFlag.BD };
513 if ( CommandHistory.CheckCommand( comChangeScrollSpeed, E楽器パ.DRUMS ) )
514 {
515 // Debug.WriteLine( "ドラムススクロール速度変更" );
516 // CDTXMania.ConfigIni.n譜面スクロール速度.Drums = ( CDTXMania.ConfigIni.n譜面スクロール速度.Drums + 1 ) % 0x10;
517 CDTXMania.Skin.sound変更音.t再生する();
518 this.actQuickConfig.tActivatePopupMenu( E楽器パ.DRUMS );
519 }
520 }
521 #endregion
522 #region [ HHx2: 難易度変更 ]
523 if ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.HH ) || CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.HHO ) )
524 { // [HH]x2 難易度変更
525 CommandHistory.Add( E楽器パ.DRUMS, EパッドFlag.HH );
526 EパッドFlag[] comChangeDifficulty = new EパッドFlag[] { EパッドFlag.HH, EパッドFlag.HH };
527 if ( CommandHistory.CheckCommand( comChangeDifficulty, E楽器パ.DRUMS ) )
528 {
529 Debug.WriteLine( "ドラムス難易度変更" );
530 this.act曲リスト.t難易度レベルをひとつ進める();
531 CDTXMania.Skin.sound変更音.t再生する();
532 }
533 }
534 #endregion
535 #region [ G + PickPick Guitar: 難易度変更 ]
536 if ( CDTXMania.Pad.b押されている( E楽器パ.GUITAR, Eパッド.G ) && CDTXMania.Pad.b押された( E楽器パ.GUITAR, Eパッド.Pick ) ) // #24177 2011.1.17 yyagi || -> &&
537 { // [G] + [Pick][Pick] ギター難易度変更
538 CommandHistory.Add( E楽器パ.GUITAR, EパッドFlag.Pick | EパッドFlag.G );
539 EパッドFlag[] comChangeDifficulty = new EパッドFlag[] { EパッドFlag.Pick | EパッドFlag.G, EパッドFlag.Pick | EパッドFlag.G };
540 if ( CommandHistory.CheckCommand( comChangeDifficulty, E楽器パ.GUITAR ) )
541 {
542 Debug.WriteLine( "ギター難易度変更" );
543 this.act曲リスト.t難易度レベルをひとつ進める();
544 CDTXMania.Skin.sound変更音.t再生する();
545 }
546 }
547 #endregion
548 #region [ G + PickPick Bass: 難易度変更 ]
549 if ( CDTXMania.Pad.b押されている( E楽器パ.BASS, Eパッド.G ) && CDTXMania.Pad.b押された( E楽器パ.BASS, Eパッド.Pick ) ) // #24177 2011.1.17 yyagi || -> &&
550 { // [G] + [Pick][Pick] ベース難易度変更
551 CommandHistory.Add( E楽器パ.BASS, EパッドFlag.Pick | EパッドFlag.G );
552 EパッドFlag[] comChangeDifficulty = new EパッドFlag[] { EパッドFlag.Pick | EパッドFlag.G, EパッドFlag.Pick | EパッドFlag.G };
553 if ( CommandHistory.CheckCommand( comChangeDifficulty, E楽器パ.BASS ) )
554 {
555 Debug.WriteLine( "ベース難易度変更" );
556 this.act曲リスト.t難易度レベルをひとつ進める();
557 CDTXMania.Skin.sound変更音.t再生する();
558 }
559 }
560 #endregion
561 #region [ Pick G G Pick Guitar: ギターとベースを入れ替え ]
562 if ( CDTXMania.Pad.b押された( E楽器パ.GUITAR, Eパッド.Pick ) && !CDTXMania.Pad.b押されている( E楽器パ.GUITAR, Eパッド.G ) )
563 { // ギター[Pick]: コマンドとしてEnqueue
564 CommandHistory.Add( E楽器パ.GUITAR, EパッドFlag.Pick );
565 // Pick, G, G, Pick で、ギターとベースを入れ替え
566 EパッドFlag[] comSwapGtBs1 = new EパッドFlag[] { EパッドFlag.Pick, EパッドFlag.G, EパッドFlag.G, EパッドFlag.Pick };
567 if ( CommandHistory.CheckCommand( comSwapGtBs1, E楽器パ.GUITAR ) )
568 {
569 Debug.WriteLine( "ギターとベースの入れ替え1" );
570 CDTXMania.Skin.sound変更音.t再生する();
571 // ギターとベースのキーを入れ替え
572 //CDTXMania.ConfigIni.SwapGuitarBassKeyAssign();
573 CDTXMania.ConfigIni.bIsSwappedGuitarBass = !CDTXMania.ConfigIni.bIsSwappedGuitarBass;
574 }
575 }
576 #endregion
577 #region [ Pick G G Pick Bass: ギターとベースを入れ替え ]
578 if ( CDTXMania.Pad.b押された( E楽器パ.BASS, Eパッド.Pick ) && !CDTXMania.Pad.b押されている( E楽器パ.BASS, Eパッド.G ) )
579 { // ベース[Pick]: コマンドとしてEnqueue
580 CommandHistory.Add( E楽器パ.BASS, EパッドFlag.Pick );
581 // Pick, G, G, Pick で、ギターとベースを入れ替え
582 EパッドFlag[] comSwapGtBs1 = new EパッドFlag[] { EパッドFlag.Pick, EパッドFlag.G, EパッドFlag.G, EパッドFlag.Pick };
583 if ( CommandHistory.CheckCommand( comSwapGtBs1, E楽器パ.BASS ) )
584 {
585 Debug.WriteLine( "ギターとベースの入れ替え2" );
586 CDTXMania.Skin.sound変更音.t再生する();
587 // ギターとベースのキーを入れ替え
588 //CDTXMania.ConfigIni.SwapGuitarBassKeyAssign();
589 CDTXMania.ConfigIni.bIsSwappedGuitarBass = !CDTXMania.ConfigIni.bIsSwappedGuitarBass;
590 }
591 }
592 #endregion
593 #region [ G G G Guitar: ソート画面 ]
594 if ( CDTXMania.Pad.b押された( E楽器パ.GUITAR, Eパッド.G ) )
595 { // ギター[G]: コマンドとしてEnqueue
596 CommandHistory.Add( E楽器パ.GUITAR, EパッドFlag.G );
597 // ギター G, G, G で、ソート画面に遷移
598 EパッドFlag[] comSortGt = new EパッドFlag[] { EパッドFlag.G, EパッドFlag.G, EパッドFlag.G };
599 if ( CommandHistory.CheckCommand( comSortGt, E楽器パ.GUITAR ) )
600 {
601 CDTXMania.Skin.sound変更音.t再生する();
602 this.actSortSongs.tActivatePopupMenu( E楽器パ.GUITAR, ref this.act曲リスト );
603 }
604 }
605 #endregion
606 #region [ G G G Bass: ソート画面 ]
607 if ( CDTXMania.Pad.b押された( E楽器パ.BASS, Eパッド.G ) )
608 { // ベース[G]: コマンドとしてEnqueue
609 CommandHistory.Add( E楽器パ.BASS, EパッドFlag.G );
610 // ベース G, G, G で、ソート画面に遷移
611 EパッドFlag[] comSortBs = new EパッドFlag[] { EパッドFlag.G, EパッドFlag.G, EパッドFlag.G };
612 if ( CommandHistory.CheckCommand( comSortBs, E楽器パ.BASS ) )
613 {
614 CDTXMania.Skin.sound変更音.t再生する();
615 this.actSortSongs.tActivatePopupMenu( E楽器パ.BASS, ref this.act曲リスト );
616 }
617 }
618 #endregion
619 #region [ BD HT Drums: ソート画面 ]
620 if ( CDTXMania.Pad.b押されている( E楽器パ.DRUMS, Eパッド.BD ) && CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.HT ) )
621 { // [BD]+[HT] 未使用
622 //
623 //CommandHistory.Add( E楽器パート.DRUMS, EパッドFlag.HT );
624 //EパッドFlag[] comSort = new EパッドFlag[] { EパッドFlag.BD, EパッドFlag.HT };
625 //if ( CommandHistory.CheckCommand( comSort, E楽器パート.DRUMS ) )
626 {
627 CDTXMania.Skin.sound変更音.t再生する();
628 this.actSortSongs.tActivatePopupMenu( E楽器パ.DRUMS, ref this.act曲リスト );
629 }
630 }
631 #endregion
632 }
633 }
634 this.actSortSongs.t進行描画();
635 this.actQuickConfig.t進行描画();
636 }
637 }
638 return 0;
639 }
640 public enum E戻り値 : int
641 {
642 継続,
643 タイトルに戻る,
644 選曲した,
645 オプション呼び出し,
646 コンフィグ呼び出し,
647 スキン変更
648 }
649
650
651 // その他
652
653 #region [ private ]
654 //-----------------
655 [StructLayout( LayoutKind.Sequential )]
656 private struct ST反復用カウンタ
657 {
658 public CCounter Up;
659 public CCounter Down;
660 public CCounter R;
661 public CCounter B;
662 public CCounter this[ int index ]
663 {
664 get
665 {
666 switch( index )
667 {
668 case 0:
669 return this.Up;
670
671 case 1:
672 return this.Down;
673
674 case 2:
675 return this.R;
676
677 case 3:
678 return this.B;
679 }
680 throw new IndexOutOfRangeException();
681 }
682 set
683 {
684 switch( index )
685 {
686 case 0:
687 this.Up = value;
688 return;
689
690 case 1:
691 this.Down = value;
692 return;
693
694 case 2:
695 this.R = value;
696 return;
697
698 case 3:
699 this.B = value;
700 return;
701 }
702 throw new IndexOutOfRangeException();
703 }
704 }
705 }
706 private CActSelectArtistComment actArtistComment;
707 private CActFIFOBlack actFIFO;
708 private CActFIFOBlack actFIfrom結果画面;
709 // private CActFIFOBlack actFOtoNowLoading; // #27787 2012.3.10 yyagi 曲決定時の画面フェードアウトの省略
710 private CActSelectInformation actInformation;
711 private CActSelectPreimageパネル actPreimageパネル;
712 private CActSelectPresound actPresound;
713 private CActオプションパネル actオプションパネル;
714 public CActSelectステタスパネル actステタスパネル;
715 private CActSelect演奏履歴パネル act演奏履歴パネル;
716 private CActSelect曲リスト act曲リスト;
717 private CActSelectShowCurrentPosition actShowCurrentPosition;
718
719 private CActSortSongs actSortSongs;
720 private CActSelectQuickConfig actQuickConfig;
721
722 private bool bBGM再生済み;
723 private ST反復用カウンタ ct反復用;
724 private CCounter ct登場時アニメ用共通;
725 private E戻り値 eフェドアウト完了時の戻り値;
726 private Font ftフォント;
727 private CTexture txコメントバ;
728 private CTexture tx下部パネル;
729 private CTexture tx上部パネル;
730 private CTexture tx背景;
731 private CTexture txFLIP;
732 private CDirectShow ds背景動画;
733 private long lDshowPosition;
734 private long lStopPosition;
735
736 private struct STCommandTime // #24063 2011.1.16 yyagi コマンド入力時刻の記録用
737 {
738 public E楽器パ eInst; // 使用楽器
739 public EパッドFlag ePad; // 押されたコマンド(同時押しはOR演算で列挙する)
740 public long time; // コマンド入力時刻
741 }
742 public class CCommandHistory // #24063 2011.1.16 yyagi コマンド入力履歴を保持・確認するクラス
743 {
744 readonly int buffersize = 16;
745 private List<STCommandTime> stct;
746
747 public CCommandHistory() // コンストラクタ
748 {
749 stct = new List<STCommandTime>( buffersize );
750 }
751
752 /// <summary>
753 /// コマンド入力履歴へのコマンド追加
754 /// </summary>
755 /// <param name="_eInst">楽器の種類</param>
756 /// <param name="_ePad">入力コマンド(同時押しはOR演算で列挙すること)</param>
757 public void Add( E楽器パ _eInst, EパッドFlag _ePad )
758 {
759 STCommandTime _stct = new STCommandTime {
760 eInst = _eInst,
761 ePad = _ePad,
762 time = CDTXMania.Timer.n現在時刻
763 };
764
765 if ( stct.Count >= buffersize )
766 {
767 stct.RemoveAt( 0 );
768 }
769 stct.Add(_stct);
770 //Debug.WriteLine( "CMDHIS: 楽器=" + _stct.eInst + ", CMD=" + _stct.ePad + ", time=" + _stct.time );
771 }
772 public void RemoveAt( int index )
773 {
774 stct.RemoveAt( index );
775 }
776
777 /// <summary>
778 /// コマンド入力に成功しているか調べる
779 /// </summary>
780 /// <param name="_ePad">入力が成功したか調べたいコマンド</param>
781 /// <param name="_eInst">対象楽器</param>
782 /// <returns>コマンド入力成功時true</returns>
783 public bool CheckCommand( EパッドFlag[] _ePad, E楽器パ _eInst)
784 {
785 int targetCount = _ePad.Length;
786 int stciCount = stct.Count;
787 if ( stciCount < targetCount )
788 {
789 //Debug.WriteLine("NOT start checking...stciCount=" + stciCount + ", targetCount=" + targetCount);
790 return false;
791 }
792
793 long curTime = CDTXMania.Timer.n現在時刻;
794 //Debug.WriteLine("Start checking...targetCount=" + targetCount);
795 for ( int i = targetCount - 1, j = stciCount - 1; i >= 0; i--, j-- )
796 {
797 if ( _ePad[ i ] != stct[ j ].ePad )
798 {
799 //Debug.WriteLine( "CMD解析: false targetCount=" + targetCount + ", i=" + i + ", j=" + j + ": ePad[]=" + _ePad[i] + ", stci[j] = " + stct[j].ePad );
800 return false;
801 }
802 if ( stct[ j ].eInst != _eInst )
803 {
804 //Debug.WriteLine( "CMD解析: false " + i );
805 return false;
806 }
807 if ( curTime - stct[ j ].time > 500 )
808 {
809 //Debug.WriteLine( "CMD解析: false " + i + "; over 500ms" );
810 return false;
811 }
812 curTime = stct[ j ].time;
813 }
814
815 //Debug.Write( "CMD解析: 成功!(" + _ePad.Length + ") " );
816 //for ( int i = 0; i < _ePad.Length; i++ ) Debug.Write( _ePad[ i ] + ", " );
817 //Debug.WriteLine( "" );
818 //stct.RemoveRange( 0, targetCount ); // #24396 2011.2.13 yyagi
819 stct.Clear(); // #24396 2011.2.13 yyagi Clear all command input history in case you succeeded inputting some command
820
821 return true;
822 }
823 }
824 public CCommandHistory CommandHistory;
825
826 private void tソルを下へ移動する()
827 {
828 CDTXMania.Skin.soundソル移動音.t再生する();
829 this.act曲リスト.t次に移動();
830 }
831 private void tソルを上へ移動する()
832 {
833 CDTXMania.Skin.soundソル移動音.t再生する();
834 this.act曲リスト.t前に移動();
835 }
836 private void t曲をランダム選択する()
837 {
838 C曲リストノ song = this.act曲リスト.r現在選択中の曲;
839 if( ( song.stackランダム演奏番号.Count == 0 ) || ( song.listランダム用ノドリスト == null ) )
840 {
841 if( song.listランダム用ノドリスト == null )
842 {
843 song.listランダム用ノドリスト = this.t指定された曲が存在する場所の曲を列挙する・子リスト含む( song );
844 }
845 int count = song.listランダム用ノドリスト.Count;
846 if( count == 0 )
847 {
848 return;
849 }
850 int[] numArray = new int[ count ];
851 for( int i = 0; i < count; i++ )
852 {
853 numArray[ i ] = i;
854 }
855 for( int j = 0; j < ( count * 1.5 ); j++ )
856 {
857 int index = CDTXMania.Random.Next( count );
858 int num5 = CDTXMania.Random.Next( count );
859 int num6 = numArray[ num5 ];
860 numArray[ num5 ] = numArray[ index ];
861 numArray[ index ] = num6;
862 }
863 for( int k = 0; k < count; k++ )
864 {
865 song.stackランダム演奏番号.Push( numArray[ k ] );
866 }
867 if( CDTXMania.ConfigIni.bLogDTX詳細ログ出力 )
868 {
869 StringBuilder builder = new StringBuilder( 0x400 );
870 builder.Append( string.Format( "ランダムインデックスリストを作成しました: {0}曲: ", song.stackランダム演奏番号.Count ) );
871 for( int m = 0; m < count; m++ )
872 {
873 builder.Append( string.Format( "{0} ", numArray[ m ] ) );
874 }
875 Trace.TraceInformation( builder.ToString() );
876 }
877 }
878 this.r確定された曲 = song.listランダム用ノドリスト[ song.stackランダム演奏番号.Pop() ];
879 this.n確定された曲の難易度 = this.act曲リスト.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( this.r確定された曲 );
880 this.r確定されたスコア = this.r確定された曲.arスコア[ this.n確定された曲の難易度 ];
881 this.eフェドアウト完了時の戻り値 = E戻り値.選曲した;
882 // this.actFOtoNowLoading.tフェードアウト開始(); // #27787 2012.3.10 yyagi 曲決定時の画面フェードアウトの省略
883 base.eフェID = CStage.Eフェ.選曲_NowLoading画面へのフェドアウト;
884 if( CDTXMania.ConfigIni.bLogDTX詳細ログ出力 )
885 {
886 int[] numArray2 = song.stackランダム演奏番号.ToArray();
887 StringBuilder builder2 = new StringBuilder( 0x400 );
888 builder2.Append( "ランダムインデックスリスト残り: " );
889 if( numArray2.Length > 0 )
890 {
891 for( int n = 0; n < numArray2.Length; n++ )
892 {
893 builder2.Append( string.Format( "{0} ", numArray2[ n ] ) );
894 }
895 }
896 else
897 {
898 builder2.Append( "(なし)" );
899 }
900 Trace.TraceInformation( builder2.ToString() );
901 }
902 CDTXMania.Skin.bgm選曲画面.t停止する();
903 }
904 private void t曲を選択する()
905 {
906 this.r確定された曲 = this.act曲リスト.r現在選択中の曲;
907 this.r確定されたスコア = this.act曲リスト.r現在選択中のスコア;
908 this.n確定された曲の難易度 = this.act曲リスト.n現在選択中の曲の現在の難易度レベル;
909 if( ( this.r確定された曲 != null ) && ( this.r確定されたスコア != null ) )
910 {
911 this.eフェドアウト完了時の戻り値 = E戻り値.選曲した;
912 // this.actFOtoNowLoading.tフェードアウト開始(); // #27787 2012.3.10 yyagi 曲決定時の画面フェードアウトの省略
913 base.eフェID = CStage.Eフェ.選曲_NowLoading画面へのフェドアウト;
914 }
915 CDTXMania.Skin.bgm選曲画面.t停止する();
916 }
917 private List<C曲リストノ> t指定された曲が存在する場所の曲を列挙する・子リスト含む( C曲リストノ song )
918 {
919 List<C曲リストノ> list = new List<C曲リストノ>();
920 song = song.r親ノ;
921 if( ( song == null ) && ( CDTXMania.Songs管理.list曲ル.Count > 0 ) )
922 {
923 foreach( C曲リストノ c曲リストノ in CDTXMania.Songs管理.list曲ル )
924 {
925 if( ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.SCORE ) || ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.SCORE_MIDI ) )
926 {
927 list.Add( c曲リストノ );
928 }
929 if( ( c曲リストノ.list子リスト != null ) && CDTXMania.ConfigIni.bランダムセレクトで子BOXを検索対象とする )
930 {
931 this.t指定された曲の子リストの曲を列挙する・孫リスト含む( c曲リストノ, ref list );
932 }
933 }
934 return list;
935 }
936 this.t指定された曲の子リストの曲を列挙する・孫リスト含む( song, ref list );
937 return list;
938 }
939 private void t指定された曲の子リストの曲を列挙する・孫リスト含む( C曲リストノ r, ref List<C曲リストノ> list )
940 {
941 if( ( r != null ) && ( r.list子リスト != null ) )
942 {
943 foreach( C曲リストノ c曲リストノ in r.list子リスト )
944 {
945 if( ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.SCORE ) || ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.SCORE_MIDI ) )
946 {
947 list.Add( c曲リストノ );
948 }
949 if( ( c曲リストノ.list子リスト != null ) && CDTXMania.ConfigIni.bランダムセレクトで子BOXを検索対象とする )
950 {
951 this.t指定された曲の子リストの曲を列挙する・孫リスト含む( c曲リストノ, ref list );
952 }
953 }
954 }
955 }
956 //-----------------
957 #endregion
958 }
959 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26