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

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