Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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