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

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