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 201 - (hide annotations) (download)
Mon Dec 30 03:33:49 2013 UTC (10 years, 3 months ago) by kairera0467
File size: 43514 byte(s)
#32743 Bのキー判定を修正。一部キー操作の変更。選曲画面以外の場所の適用。

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

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