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 302 - (show annotations) (download)
Fri Feb 7 10:57:57 2014 UTC (10 years, 1 month ago) by ron1120
File size: 41865 byte(s)
#xxxxx 演奏中のドラムパッドをプログラム上でなく画像で管理するようにした、それに伴う画像の変更。
#xxxxx XG側でShowScoreとShowMusicInfoでギミックを用意(隠し要素)。
#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.list子Activities.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 base.OnManagedリソスの作成();
233 }
234 }
235 public override void OnManagedリソスの解放()
236 {
237 if( !base.b活性化してない )
238 {
239 CDTXMania.t安全にDisposeする( ref this.ds背景動画 );
240 CDTXMania.tテクスチャの解放( ref this.tx背景 );
241 CDTXMania.tテクスチャの解放( ref this.tx上部パネル );
242 CDTXMania.tテクスチャの解放( ref this.tx下部パネル );
243 base.OnManagedリソスの解放();
244 }
245 }
246 public override int On進行描画()
247 {
248 if( !base.b活性化してない )
249 {
250 #region [ 初めての進行描画 ]
251 //---------------------
252 if( base.b初めての進行描画 )
253 {
254 this.ct登場時アニメ用共通 = new CCounter( 0, 100, 4, CDTXMania.Timer );
255 if( CDTXMania.r直前のステ == CDTXMania.stage結果 )
256 {
257 this.actFIfrom結果画面.tフェドイン開始();
258 base.eフェID = CStage.Eフェ.選曲_結果画面からのフェドイン;
259 }
260 else
261 {
262 this.actFIFO.tフェドイン開始();
263 base.eフェID = CStage.Eフェ.共通_フェドイン;
264 }
265 CDTXMania.Skin.soundSelectMusic.t再生する();
266 this.t選択曲変更通知();
267 base.b初めての進行描画 = false;
268 }
269 //---------------------
270 #endregion
271
272 this.ct登場時アニメ用共通.t進行();
273
274 if( this.ds背景動画 != null )
275 {
276 this.ds背景動画.t現時点における最新のスナップイメジをTextureに転写する( this.tx背景 );
277 this.ds背景動画.t再生開始();
278 this.ds背景動画.MediaSeeking.GetPositions(out this.lDshowPosition, out this.lStopPosition);
279 if (this.lDshowPosition == this.lStopPosition)
280 {
281 this.ds背景動画.MediaSeeking.SetPositions(
282 DsLong.FromInt64((long)(0)),
283 AMSeekingSeekingFlags.AbsolutePositioning,
284 0,
285 AMSeekingSeekingFlags.NoPositioning);
286 }
287 }
288
289 if( this.tx背景 != null )
290 {
291 if( this.ds背景動画 != null && this.ds背景動画.b上下反転 )
292 this.tx背景.t2D上下反転描画( CDTXMania.app.Device, 0, 0 );
293 else
294 this.tx背景.t2D描画( CDTXMania.app.Device, 0, 0 );
295 }
296
297 // this.actPreimageパネル.On進行描画();
298 // this.bIsEnumeratingSongs = !this.actPreimageパネル.bIsPlayingPremovie; // #27060 2011.3.2 yyagi: #PREMOVIE再生中は曲検索を中断する
299
300 this.act曲リスト.On進行描画();
301 int y = 0;
302 if( this.ct登場時アニメ用共通.b進行中 )
303 {
304 double db登場割合 = ( (double) this.ct登場時アニメ用共通.n現在の値 ) / 100.0; // 100が最終値
305 double dbY表示割合 = Math.Sin( Math.PI / 2 * db登場割合 );
306 y = ( (int) ( this.tx上部パネル.sz画像サイズ.Height * dbY表示割合 ) ) - this.tx上部パネル.sz画像サイズ.Height;
307 }
308 if( this.tx上部パネル != null )
309 {
310 this.tx上部パネル.t2D描画( CDTXMania.app.Device, 0f, 78.0f - ( this.ct登場時アニメ用共通.n現在の値 * 0.61f ) , new Rectangle(0, 17, 200, 55 ) );
311 this.tx上部パネル.t2D描画( CDTXMania.app.Device, 0f, 24.0f + ( this.ct登場時アニメ用共通.n現在の値 * 0.57f ) , new Rectangle(0, 81, 200, 55 ) );
312 this.tx上部パネル.t2D描画( CDTXMania.app.Device, 0f, 150.0f, new Rectangle(0, 150, 200, 12 ) );
313 this.tx上部パネル.t2D描画( CDTXMania.app.Device, 0f, 143.0f, new Rectangle(0, 143, 200, 3 ) );
314 }
315
316 this.actInformation.On進行描画();
317 if( this.tx下部パネル != null )
318 this.tx下部パネル.t2D描画( CDTXMania.app.Device, 0, 720 - this.tx下部パネル.sz画像サイズ.Height );
319
320 this.actステタスパネル.On進行描画();
321 if( CDTXMania.ConfigIni.bDrums有効 )
322 {
323 this.act演奏履歴パネル.On進行描画();
324 }
325 this.actPresound.On進行描画();
326 this.actArtistComment.On進行描画();
327 //this.actオプションパネル.On進行描画();
328 this.actShowCurrentPosition.On進行描画(); // #27648 2011.3.28 yyagi
329
330 switch ( base.eフェID )
331 {
332 case CStage.Eフェ.共通_フェドイン:
333 if( this.actFIFO.On進行描画() != 0 )
334 {
335 base.eフェID = CStage.Eフェ.共通_通常状態;
336 }
337 break;
338
339 case CStage.Eフェ.共通_フェドアウト:
340 if( this.actFIFO.On進行描画() == 0 )
341 {
342 break;
343 }
344 return (int) this.eフェドアウト完了時の戻り値;
345
346 case CStage.Eフェ.選曲_結果画面からのフェドイン:
347 if( this.actFIfrom結果画面.On進行描画() != 0 )
348 {
349 base.eフェID = CStage.Eフェ.共通_通常状態;
350 }
351 break;
352
353 case CStage.Eフェ.選曲_NowLoading画面へのフェドアウト:
354 // if( this.actFOtoNowLoading.On進行描画() == 0 )
355 // {
356 // break;
357 // }
358 return (int) this.eフェドアウト完了時の戻り値;
359 }
360 if( !this.bBGM再生済み && ( base.eフェID == CStage.Eフェ.共通_通常状態 ) )
361 {
362 CDTXMania.Skin.bgm選曲画面.n音量・次に鳴るサウンド = 100;
363 CDTXMania.Skin.bgm選曲画面.t再生する();
364 this.bBGM再生済み = true;
365 }
366
367
368 //Debug.WriteLine( "パンくず=" + this.r現在選択中の曲.strBreadcrumbs );
369
370
371 // キー入力
372 if( base.eフェID == CStage.Eフェ.共通_通常状態
373 && CDTXMania.act現在入力を占有中のプラグイン == null )
374 {
375 #region [ 簡易CONFIGでMore、またはShift+F1: 詳細CONFIG呼び出し ]
376 if ( actQuickConfig.bGotoDetailConfig )
377 { // 詳細CONFIG呼び出し
378 actQuickConfig.tDeativatePopupMenu();
379 this.actPresound.tサウンド停止();
380 this.eフェドアウト完了時の戻り値 = E戻り値.コンフィグ呼び出し; // #24525 2011.3.16 yyagi: [SHIFT]-[F1]でCONFIG呼び出し
381 this.actFIFO.tフェドアウト開始();
382 base.eフェID = CStage.Eフェ.共通_フェドアウト;
383 CDTXMania.Skin.sound取消音.t再生する();
384 return 0;
385 }
386 #endregion
387 if ( !this.actSortSongs.bIsActivePopupMenu && !this.actQuickConfig.bIsActivePopupMenu )
388 {
389 #region [ ESC ]
390 if ( CDTXMania.Input管理.Keyboard.bが押された( (int) SlimDX.DirectInput.Key.Escape ) || ( ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.LC ) || CDTXMania.Pad.b押されたGB( Eパッド.Pick ) ) && ( ( this.act曲リスト.r現在選択中の曲 != null ) && ( this.act曲リスト.r現在選択中の曲.r親ノ == null ) ) ) )
391 { // [ESC]
392 CDTXMania.Skin.sound取消音.t再生する();
393 this.eフェドアウト完了時の戻り値 = E戻り値.タイトルに戻る;
394 this.actFIFO.tフェドアウト開始();
395 base.eフェID = CStage.Eフェ.共通_フェドアウト;
396 return 0;
397 }
398 #endregion
399 #region [ CONFIG画面 ]
400 if ( CDTXMania.Pad.b押された( E楽器パ.GUITAR, Eパッド.Help ) )
401 { // [SHIFT] + [F1] CONFIG
402 this.actPresound.tサウンド停止();
403 this.eフェドアウト完了時の戻り値 = E戻り値.コンフィグ呼び出し; // #24525 2011.3.16 yyagi: [SHIFT]-[F1]でCONFIG呼び出し
404 this.actFIFO.tフェドアウト開始();
405 base.eフェID = CStage.Eフェ.共通_フェドアウト;
406 CDTXMania.Skin.sound取消音.t再生する();
407 return 0;
408 }
409 #endregion
410 #region [ Shift-F2: 未使用 ]
411 // #24525 2011.3.16 yyagi: [SHIFT]+[F2]は廃止(将来発生するかもしれない別用途のためにキープ)
412 /*
413 if ((CDTXMania.Input管理.Keyboard.bキーが押されている((int)SlimDX.DirectInput.Key.RightShift) || CDTXMania.Input管理.Keyboard.bキーが押されている((int)SlimDX.DirectInput.Key.LeftShift)) &&
414 CDTXMania.Input管理.Keyboard.bキーが押された((int)SlimDX.DirectInput.Key.F2))
415 { // [SHIFT] + [F2] CONFIGURATION
416 this.actPresound.tサウンド停止();
417 this.eフェードアウト完了時の戻り値 = E戻り値.オプション呼び出し;
418 this.actFIFO.tフェードアウト開始();
419 base.eフェーズID = CStage.Eフェーズ.共通_フェードアウト;
420 CDTXMania.Skin.sound取消音.t再生する();
421 return 0;
422 }
423 */
424 #endregion
425 if ( this.act曲リスト.r現在選択中の曲 != null )
426 {
427 #region [ Decide ]
428 if ( ( CDTXMania.Pad.b押されたDGB( Eパッド.Decide ) || CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.CY ) || CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.RD ) ) ||
429 ( CDTXMania.ConfigIni.bEnterがキ割り当てのどこにも使用されていない && CDTXMania.Input管理.Keyboard.bが押された( (int) SlimDX.DirectInput.Key.Return ) ) )
430 {
431 if ( this.act曲リスト.r現在選択中の曲 != null )
432 {
433 switch ( this.act曲リスト.r現在選択中の曲.eド種別 )
434 {
435 case C曲リストノ.Eド種別.SCORE:
436 CDTXMania.Skin.sound決定音.t再生する();
437 this.t曲を選択する();
438 break;
439
440 case C曲リストノ.Eド種別.SCORE_MIDI:
441 CDTXMania.Skin.sound決定音.t再生する();
442 this.t曲を選択する();
443 break;
444
445 case C曲リストノ.Eド種別.BOX:
446 {
447 CDTXMania.Skin.sound決定音.t再生する();
448 bool bNeedChangeSkin = this.act曲リスト.tBOXに入る();
449 if ( bNeedChangeSkin )
450 {
451 this.eフェドアウト完了時の戻り値 = E戻り値.スキン変更;
452 base.eフェID = Eフェ.選曲_NowLoading画面へのフェドアウト;
453 }
454 }
455 break;
456
457 case C曲リストノ.Eド種別.BACKBOX:
458 {
459 CDTXMania.Skin.sound取消音.t再生する();
460 bool bNeedChangeSkin = this.act曲リスト.tBOXを出る();
461 if ( bNeedChangeSkin )
462 {
463 this.eフェドアウト完了時の戻り値 = E戻り値.スキン変更;
464 base.eフェID = Eフェ.選曲_NowLoading画面へのフェドアウト;
465 }
466 }
467 break;
468
469 case C曲リストノ.Eド種別.RANDOM:
470 CDTXMania.Skin.sound決定音.t再生する();
471 this.t曲をランダム選択する();
472 break;
473 }
474 }
475 }
476 #endregion
477 #region [ Up ]
478 this.ct反復用.Up.t反復( CDTXMania.Input管理.Keyboard.bが押されている( (int) SlimDX.DirectInput.Key.LeftArrow ), new CCounter.DG処理( this.tソルを上へ移動する ) );
479 this.ct反復用.R.t反復( CDTXMania.Pad.b押されているGB( Eパッド.R ), new CCounter.DG処理( this.tソルを上へ移動する ) );
480 if ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.SD ) )
481 {
482 this.tソルを上へ移動する();
483 }
484 #endregion
485 #region [ Down ]
486 this.ct反復用.Down.t反復( CDTXMania.Input管理.Keyboard.bが押されている( (int) SlimDX.DirectInput.Key.RightArrow ), new CCounter.DG処理( this.tソルを下へ移動する ) );
487 this.ct反復用.B.t反復( CDTXMania.Pad.b押されているGB( Eパッド.G ), new CCounter.DG処理( this.tソルを下へ移動する ) );
488 if ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.FT ) )
489 {
490 this.tソルを下へ移動する();
491 }
492 #endregion
493 #region [ Upstairs ]
494 if ( ( ( this.act曲リスト.r現在選択中の曲 != null ) && ( this.act曲リスト.r現在選択中の曲.r親ノ != null ) ) && ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.LC ) || CDTXMania.Pad.b押されたGB( Eパッド.Pick ) ) )
495 {
496 this.actPresound.tサウンド停止();
497 CDTXMania.Skin.sound取消音.t再生する();
498 this.act曲リスト.tBOXを出る();
499 this.t選択曲変更通知();
500 }
501 #endregion
502 #region [ BDx2: 簡易CONFIG ]
503 if ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.BD ) )
504 { // [BD]x2 スクロール速度変更
505 CommandHistory.Add( E楽器パ.DRUMS, EパッドFlag.BD );
506 EパッドFlag[] comChangeScrollSpeed = new EパッドFlag[] { EパッドFlag.BD, EパッドFlag.BD };
507 if ( CommandHistory.CheckCommand( comChangeScrollSpeed, E楽器パ.DRUMS ) )
508 {
509 // Debug.WriteLine( "ドラムススクロール速度変更" );
510 // CDTXMania.ConfigIni.n譜面スクロール速度.Drums = ( CDTXMania.ConfigIni.n譜面スクロール速度.Drums + 1 ) % 0x10;
511 CDTXMania.Skin.sound変更音.t再生する();
512 this.actQuickConfig.tActivatePopupMenu( E楽器パ.DRUMS );
513 }
514 }
515 #endregion
516 #region [ HHx2: 難易度変更 ]
517 if ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.HH ) || CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.HHO ) )
518 { // [HH]x2 難易度変更
519 CommandHistory.Add( E楽器パ.DRUMS, EパッドFlag.HH );
520 EパッドFlag[] comChangeDifficulty = new EパッドFlag[] { EパッドFlag.HH, EパッドFlag.HH };
521 if ( CommandHistory.CheckCommand( comChangeDifficulty, E楽器パ.DRUMS ) )
522 {
523 Debug.WriteLine( "ドラムス難易度変更" );
524 this.act曲リスト.t難易度レベルをひとつ進める();
525 //CDTXMania.Skin.sound変更音.t再生する();
526 }
527 }
528 #endregion
529 #region [ Bx2 Guitar: 難易度変更 ]
530 if ( CDTXMania.Pad.b押された( E楽器パ.GUITAR, Eパッド.B ) ) // #24177 2011.1.17 yyagi || -> &&
531 { // [B]x2 ギター難易度変更
532 CommandHistory.Add( E楽器パ.GUITAR, EパッドFlag.B );
533 EパッドFlag[] comChangeDifficultyG = new EパッドFlag[] { EパッドFlag.B, EパッドFlag.B };
534 if ( CommandHistory.CheckCommand( comChangeDifficultyG, E楽器パ.GUITAR ) )
535 {
536 Debug.WriteLine( "ギター難易度変更" );
537 this.act曲リスト.t難易度レベルをひとつ進める();
538 //CDTXMania.Skin.sound変更音.t再生する();
539 }
540 }
541 #endregion
542 #region [ Bx2 Bass: 難易度変更 ]
543 if ( CDTXMania.Pad.b押された( E楽器パ.BASS, Eパッド.B ) ) // #24177 2011.1.17 yyagi || -> &&
544 { // [B]x2 ベース難易度変更
545 CommandHistory.Add( E楽器パ.BASS, EパッドFlag.B );
546 EパッドFlag[] comChangeDifficultyB = new EパッドFlag[] { EパッドFlag.B, EパッドFlag.B };
547 if ( CommandHistory.CheckCommand( comChangeDifficultyB, E楽器パ.BASS ) )
548 {
549 Debug.WriteLine( "ベース難易度変更" );
550 this.act曲リスト.t難易度レベルをひとつ進める();
551 //CDTXMania.Skin.sound変更音.t再生する();
552 }
553 }
554 #endregion
555 #region [ Yx2 Guitar: ギターとベースを入れ替え ]
556 if ( CDTXMania.Pad.b押された( E楽器パ.GUITAR, Eパッド.Y ) )
557 { // Pick, Y, Y, Pick で、ギターとベースを入れ替え
558 CommandHistory.Add( E楽器パ.GUITAR, EパッドFlag.Y );
559 EパッドFlag[] comSwapGtBs1 = new EパッドFlag[] { EパッドFlag.Y, EパッドFlag.Y };
560 if ( CommandHistory.CheckCommand( comSwapGtBs1, E楽器パ.GUITAR ) )
561 {
562 Debug.WriteLine( "ギターとベースの入れ替え1" );
563 CDTXMania.Skin.sound変更音.t再生する();
564 // ギターとベースのキーを入れ替え
565 //CDTXMania.ConfigIni.SwapGuitarBassKeyAssign();
566 CDTXMania.ConfigIni.bIsSwappedGuitarBass = !CDTXMania.ConfigIni.bIsSwappedGuitarBass;
567 }
568 }
569 #endregion
570 #region [ Yx2 Bass: ギターとベースを入れ替え ]
571 if ( CDTXMania.Pad.b押された( E楽器パ.BASS, Eパッド.Y ) )
572 { // ベース[Pick]: コマンドとしてEnqueue
573 CommandHistory.Add( E楽器パ.BASS, EパッドFlag.Y );
574 // Pick, Y, Y, Pick で、ギターとベースを入れ替え
575 EパッドFlag[] comSwapGtBs1 = new EパッドFlag[] { EパッドFlag.Y, EパッドFlag.Y };
576 if ( CommandHistory.CheckCommand( comSwapGtBs1, E楽器パ.BASS ) )
577 {
578 Debug.WriteLine( "ギターとベースの入れ替え2" );
579 CDTXMania.Skin.sound変更音.t再生する();
580 // ギターとベースのキーを入れ替え
581 //CDTXMania.ConfigIni.SwapGuitarBassKeyAssign();
582 CDTXMania.ConfigIni.bIsSwappedGuitarBass = !CDTXMania.ConfigIni.bIsSwappedGuitarBass;
583 }
584 }
585 #endregion
586 #region [ Px2 Guitar: 簡易CONFIG ]
587 if ( CDTXMania.Pad.b押された( E楽器パ.GUITAR, Eパッド.P ) )
588 { // [BD]x2 スクロール速度変更
589 CommandHistory.Add( E楽器パ.GUITAR, EパッドFlag.P );
590 EパッドFlag[] comChangeScrollSpeed = new EパッドFlag[] { EパッドFlag.P, EパッドFlag.P };
591 if ( CommandHistory.CheckCommand( comChangeScrollSpeed, E楽器パ.GUITAR ) )
592 {
593 // Debug.WriteLine( "ドラムススクロール速度変更" );
594 // CDTXMania.ConfigIni.n譜面スクロール速度.Drums = ( CDTXMania.ConfigIni.n譜面スクロール速度.Drums + 1 ) % 0x10;
595 CDTXMania.Skin.sound変更音.t再生する();
596 this.actQuickConfig.tActivatePopupMenu( E楽器パ.GUITAR );
597 }
598 }
599 #endregion
600 #region [ Px2 Bass: 簡易CONFIG ]
601 if ( CDTXMania.Pad.b押された( E楽器パ.BASS, Eパッド.P ) )
602 { // [BD]x2 スクロール速度変更
603 CommandHistory.Add( E楽器パ.BASS, EパッドFlag.P );
604 EパッドFlag[] comChangeScrollSpeed = new EパッドFlag[] { EパッドFlag.P, EパッドFlag.P };
605 if ( CommandHistory.CheckCommand( comChangeScrollSpeed, E楽器パ.BASS ) )
606 {
607 // Debug.WriteLine( "ドラムススクロール速度変更" );
608 // CDTXMania.ConfigIni.n譜面スクロール速度.Drums = ( CDTXMania.ConfigIni.n譜面スクロール速度.Drums + 1 ) % 0x10;
609 CDTXMania.Skin.sound変更音.t再生する();
610 this.actQuickConfig.tActivatePopupMenu( E楽器パ.BASS );
611 }
612 }
613 #endregion
614 #region [ Y P Guitar: ソート画面 ]
615 if ( CDTXMania.Pad.b押されている( E楽器パ.GUITAR, Eパッド.Y ) && CDTXMania.Pad.b押された( E楽器パ.GUITAR, Eパッド.P ) )
616 { // ギター[Pick]: コマンドとしてEnqueue
617 CDTXMania.Skin.sound変更音.t再生する();
618 this.actSortSongs.tActivatePopupMenu(E楽器パ.GUITAR, ref this.act曲リスト);
619 }
620 #endregion
621 #region [ Y P Bass: ソート画面 ]
622 if ( CDTXMania.Pad.b押されている( E楽器パ.BASS, Eパッド.Y ) && CDTXMania.Pad.b押された( E楽器パ.BASS, Eパッド.P ) )
623 { // ベース[Pick]: コマンドとしてEnqueue
624 CDTXMania.Skin.sound変更音.t再生する();
625 this.actSortSongs.tActivatePopupMenu( E楽器パ.BASS, ref this.act曲リスト );
626 }
627 #endregion
628 #region [ HTx2 Drums: ソート画面 ]
629 if ( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.HT ) )
630 { // [HT]x2 ソート画面 2013.12.31.kairera0467
631 //
632 CommandHistory.Add( E楽器パ.DRUMS, EパッドFlag.HT );
633 EパッドFlag[] comSort = new EパッドFlag[] { EパッドFlag.HT, EパッドFlag.HT };
634 if ( CommandHistory.CheckCommand( comSort, E楽器パ.DRUMS ) )
635 {
636 CDTXMania.Skin.sound変更音.t再生する();
637 this.actSortSongs.tActivatePopupMenu( E楽器パ.DRUMS, ref this.act曲リスト );
638 }
639 }
640 #endregion
641 }
642 }
643 this.actSortSongs.t進行描画();
644 this.actQuickConfig.t進行描画();
645 }
646 }
647 return 0;
648 }
649 public enum E戻り値 : int
650 {
651 継続,
652 タイトルに戻る,
653 選曲した,
654 オプション呼び出し,
655 コンフィグ呼び出し,
656 スキン変更
657 }
658
659
660 // その他
661
662 #region [ private ]
663 //-----------------
664 [StructLayout( LayoutKind.Sequential )]
665 private struct ST反復用カウンタ
666 {
667 public CCounter Up;
668 public CCounter Down;
669 public CCounter R;
670 public CCounter B;
671 public CCounter this[ int index ]
672 {
673 get
674 {
675 switch( index )
676 {
677 case 0:
678 return this.Up;
679
680 case 1:
681 return this.Down;
682
683 case 2:
684 return this.R;
685
686 case 3:
687 return this.B;
688 }
689 throw new IndexOutOfRangeException();
690 }
691 set
692 {
693 switch( index )
694 {
695 case 0:
696 this.Up = value;
697 return;
698
699 case 1:
700 this.Down = value;
701 return;
702
703 case 2:
704 this.R = value;
705 return;
706
707 case 3:
708 this.B = value;
709 return;
710 }
711 throw new IndexOutOfRangeException();
712 }
713 }
714 }
715 private CActSelectArtistComment actArtistComment;
716 private CActFIFOBlack actFIFO;
717 private CActFIFOBlack actFIfrom結果画面;
718 // private CActFIFOBlack actFOtoNowLoading; // #27787 2012.3.10 yyagi 曲決定時の画面フェードアウトの省略
719 private CActSelectInformation actInformation;
720 private CActSelectPreimageパネル actPreimageパネル;
721 private CActSelectPresound actPresound;
722 // private CActオプションパネル actオプションパネル;
723 public CActSelectステタスパネル actステタスパネル;
724 private CActSelect演奏履歴パネル act演奏履歴パネル;
725 public CActSelect曲リスト act曲リスト;
726 private CActSelectShowCurrentPosition actShowCurrentPosition;
727
728 private CActSortSongs actSortSongs;
729 private CActSelectQuickConfig actQuickConfig;
730
731 private bool bBGM再生済み;
732 private ST反復用カウンタ ct反復用;
733 public CCounter ct登場時アニメ用共通;
734 private E戻り値 eフェドアウト完了時の戻り値;
735 private Font ftフォント;
736 private CTexture tx下部パネル;
737 private CTexture tx上部パネル;
738 private CTexture tx背景;
739 private CDirectShow ds背景動画;
740 private long lDshowPosition;
741 private long lStopPosition;
742
743 private struct STCommandTime // #24063 2011.1.16 yyagi コマンド入力時刻の記録用
744 {
745 public E楽器パ eInst; // 使用楽器
746 public EパッドFlag ePad; // 押されたコマンド(同時押しはOR演算で列挙する)
747 public long time; // コマンド入力時刻
748 }
749 public class CCommandHistory // #24063 2011.1.16 yyagi コマンド入力履歴を保持・確認するクラス
750 {
751 readonly int buffersize = 16;
752 private List<STCommandTime> stct;
753
754 public CCommandHistory() // コンストラクタ
755 {
756 stct = new List<STCommandTime>( buffersize );
757 }
758
759 /// <summary>
760 /// コマンド入力履歴へのコマンド追加
761 /// </summary>
762 /// <param name="_eInst">楽器の種類</param>
763 /// <param name="_ePad">入力コマンド(同時押しはOR演算で列挙すること)</param>
764 public void Add( E楽器パ _eInst, EパッドFlag _ePad )
765 {
766 STCommandTime _stct = new STCommandTime {
767 eInst = _eInst,
768 ePad = _ePad,
769 time = CDTXMania.Timer.n現在時刻
770 };
771
772 if ( stct.Count >= buffersize )
773 {
774 stct.RemoveAt( 0 );
775 }
776 stct.Add(_stct);
777 //Debug.WriteLine( "CMDHIS: 楽器=" + _stct.eInst + ", CMD=" + _stct.ePad + ", time=" + _stct.time );
778 }
779 public void RemoveAt( int index )
780 {
781 stct.RemoveAt( index );
782 }
783
784 /// <summary>
785 /// コマンド入力に成功しているか調べる
786 /// </summary>
787 /// <param name="_ePad">入力が成功したか調べたいコマンド</param>
788 /// <param name="_eInst">対象楽器</param>
789 /// <returns>コマンド入力成功時true</returns>
790 public bool CheckCommand( EパッドFlag[] _ePad, E楽器パ _eInst)
791 {
792 int targetCount = _ePad.Length;
793 int stciCount = stct.Count;
794 if ( stciCount < targetCount )
795 {
796 //Debug.WriteLine("NOT start checking...stciCount=" + stciCount + ", targetCount=" + targetCount);
797 return false;
798 }
799
800 long curTime = CDTXMania.Timer.n現在時刻;
801 //Debug.WriteLine("Start checking...targetCount=" + targetCount);
802 for ( int i = targetCount - 1, j = stciCount - 1; i >= 0; i--, j-- )
803 {
804 if ( _ePad[ i ] != stct[ j ].ePad )
805 {
806 //Debug.WriteLine( "CMD解析: false targetCount=" + targetCount + ", i=" + i + ", j=" + j + ": ePad[]=" + _ePad[i] + ", stci[j] = " + stct[j].ePad );
807 return false;
808 }
809 if ( stct[ j ].eInst != _eInst )
810 {
811 //Debug.WriteLine( "CMD解析: false " + i );
812 return false;
813 }
814 if ( curTime - stct[ j ].time > 500 )
815 {
816 //Debug.WriteLine( "CMD解析: false " + i + "; over 500ms" );
817 return false;
818 }
819 curTime = stct[ j ].time;
820 }
821
822 //Debug.Write( "CMD解析: 成功!(" + _ePad.Length + ") " );
823 //for ( int i = 0; i < _ePad.Length; i++ ) Debug.Write( _ePad[ i ] + ", " );
824 //Debug.WriteLine( "" );
825 //stct.RemoveRange( 0, targetCount ); // #24396 2011.2.13 yyagi
826 stct.Clear(); // #24396 2011.2.13 yyagi Clear all command input history in case you succeeded inputting some command
827
828 return true;
829 }
830 }
831 public CCommandHistory CommandHistory;
832
833 private void tソルを下へ移動する()
834 {
835 CDTXMania.Skin.soundソル移動音.t再生する();
836 this.act曲リスト.t次に移動();
837 }
838 private void tソルを上へ移動する()
839 {
840 CDTXMania.Skin.soundソル移動音.t再生する();
841 this.act曲リスト.t前に移動();
842 }
843 private void t曲をランダム選択する()
844 {
845 C曲リストノ song = this.act曲リスト.r現在選択中の曲;
846 if( ( song.stackランダム演奏番号.Count == 0 ) || ( song.listランダム用ノドリスト == null ) )
847 {
848 if( song.listランダム用ノドリスト == null )
849 {
850 song.listランダム用ノドリスト = this.t指定された曲が存在する場所の曲を列挙する・子リスト含む( song );
851 }
852 int count = song.listランダム用ノドリスト.Count;
853 if( count == 0 )
854 {
855 return;
856 }
857 int[] numArray = new int[ count ];
858 for( int i = 0; i < count; i++ )
859 {
860 numArray[ i ] = i;
861 }
862 for( int j = 0; j < ( count * 1.5 ); j++ )
863 {
864 int index = CDTXMania.Random.Next( count );
865 int num5 = CDTXMania.Random.Next( count );
866 int num6 = numArray[ num5 ];
867 numArray[ num5 ] = numArray[ index ];
868 numArray[ index ] = num6;
869 }
870 for( int k = 0; k < count; k++ )
871 {
872 song.stackランダム演奏番号.Push( numArray[ k ] );
873 }
874 if( CDTXMania.ConfigIni.bLogDTX詳細ログ出力 )
875 {
876 StringBuilder builder = new StringBuilder( 0x400 );
877 builder.Append( string.Format( "ランダムインデックスリストを作成しました: {0}曲: ", song.stackランダム演奏番号.Count ) );
878 for( int m = 0; m < count; m++ )
879 {
880 builder.Append( string.Format( "{0} ", numArray[ m ] ) );
881 }
882 Trace.TraceInformation( builder.ToString() );
883 }
884 }
885 this.r確定された曲 = song.listランダム用ノドリスト[ song.stackランダム演奏番号.Pop() ];
886 this.n確定された曲の難易度 = this.act曲リスト.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( this.r確定された曲 );
887 this.r確定されたスコア = this.r確定された曲.arスコア[ this.n確定された曲の難易度 ];
888 this.eフェドアウト完了時の戻り値 = E戻り値.選曲した;
889 // this.actFOtoNowLoading.tフェードアウト開始(); // #27787 2012.3.10 yyagi 曲決定時の画面フェードアウトの省略
890 base.eフェID = CStage.Eフェ.選曲_NowLoading画面へのフェドアウト;
891 if( CDTXMania.ConfigIni.bLogDTX詳細ログ出力 )
892 {
893 int[] numArray2 = song.stackランダム演奏番号.ToArray();
894 StringBuilder builder2 = new StringBuilder( 0x400 );
895 builder2.Append( "ランダムインデックスリスト残り: " );
896 if( numArray2.Length > 0 )
897 {
898 for( int n = 0; n < numArray2.Length; n++ )
899 {
900 builder2.Append( string.Format( "{0} ", numArray2[ n ] ) );
901 }
902 }
903 else
904 {
905 builder2.Append( "(なし)" );
906 }
907 Trace.TraceInformation( builder2.ToString() );
908 }
909 CDTXMania.Skin.bgm選曲画面.t停止する();
910 }
911 private void t曲を選択する()
912 {
913 this.r確定された曲 = this.act曲リスト.r現在選択中の曲;
914 this.r確定されたスコア = this.act曲リスト.r現在選択中のスコア;
915 this.n確定された曲の難易度 = this.act曲リスト.n現在選択中の曲の現在の難易度レベル;
916 if( ( this.r確定された曲 != null ) && ( this.r確定されたスコア != null ) )
917 {
918 this.eフェドアウト完了時の戻り値 = E戻り値.選曲した;
919 // this.actFOtoNowLoading.tフェードアウト開始(); // #27787 2012.3.10 yyagi 曲決定時の画面フェードアウトの省略
920 base.eフェID = CStage.Eフェ.選曲_NowLoading画面へのフェドアウト;
921 }
922 CDTXMania.Skin.bgm選曲画面.t停止する();
923 }
924 private List<C曲リストノ> t指定された曲が存在する場所の曲を列挙する・子リスト含む( C曲リストノ song )
925 {
926 List<C曲リストノ> list = new List<C曲リストノ>();
927 song = song.r親ノ;
928 if( ( song == null ) && ( CDTXMania.Songs管理.list曲ル.Count > 0 ) )
929 {
930 foreach( C曲リストノ c曲リストノ in CDTXMania.Songs管理.list曲ル )
931 {
932 if( ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.SCORE ) || ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.SCORE_MIDI ) )
933 {
934 list.Add( c曲リストノ );
935 }
936 if( ( c曲リストノ.list子リスト != null ) && CDTXMania.ConfigIni.bランダムセレクトで子BOXを検索対象とする )
937 {
938 this.t指定された曲の子リストの曲を列挙する・孫リスト含む( c曲リストノ, ref list );
939 }
940 }
941 return list;
942 }
943 this.t指定された曲の子リストの曲を列挙する・孫リスト含む( song, ref list );
944 return list;
945 }
946 private void t指定された曲の子リストの曲を列挙する・孫リスト含む( C曲リストノ r, ref List<C曲リストノ> list )
947 {
948 if( ( r != null ) && ( r.list子リスト != null ) )
949 {
950 foreach( C曲リストノ c曲リストノ in r.list子リスト )
951 {
952 if( ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.SCORE ) || ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.SCORE_MIDI ) )
953 {
954 list.Add( c曲リストノ );
955 }
956 if( ( c曲リストノ.list子リスト != null ) && CDTXMania.ConfigIni.bランダムセレクトで子BOXを検索対象とする )
957 {
958 this.t指定された曲の子リストの曲を列挙する・孫リスト含む( c曲リストノ, ref list );
959 }
960 }
961 }
962 }
963 //-----------------
964 #endregion
965 }
966 }

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