Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 121 - (hide annotations) (download)
Tue Jun 25 10:40:45 2013 UTC (10 years, 9 months ago) by kairera0467
File size: 49928 byte(s)
#xxxxx 6_LevelNumber.pngを差し替え。
#xxxxx 本家rev556の適用でチップファイアが移動していなかったのを修正。
#xxxxx 本家rev557の適用。
1 kairera0467 2 using System;
2     using System.Collections.Generic;
3     using System.Text;
4     using System.Globalization;
5     using System.Runtime.InteropServices;
6     using System.Drawing;
7     using System.Drawing.Imaging;
8     using System.Diagnostics;
9     using System.Drawing.Text;
10    
11     using SlimDX;
12     using FDK;
13    
14     namespace DTXMania
15     {
16     internal class CActSelect曲リスト : CActivity
17     {
18     // プロパティ
19    
20     public bool bIsEnumeratingSongs
21     {
22     get;
23     set;
24     }
25     public bool bスクロル中
26     {
27     get
28     {
29     if( this.n目標のスクロルカウンタ == 0 )
30     {
31     return ( this.n現在のスクロルカウンタ != 0 );
32     }
33     return true;
34     }
35     }
36     public int n現在のアンカ難易度レベル
37     {
38     get;
39     private set;
40     }
41     public int n現在選択中の曲の現在の難易度レベル
42     {
43     get
44     {
45     return this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( this.r現在選択中の曲 );
46     }
47     }
48     public Cスコア r現在選択中のスコア
49     {
50     get
51     {
52     if( this.r現在選択中の曲 != null )
53     {
54     return this.r現在選択中の曲.arスコア[ this.n現在選択中の曲の現在の難易度レベル ];
55     }
56     return null;
57     }
58     }
59     public C曲リストノ r現在選択中の曲
60     {
61     get;
62     private set;
63     }
64    
65     public int nスクロルバ相対y座標
66     {
67     get;
68     private set;
69     }
70    
71     // t選択曲が変更された()内で使う、直前の選曲の保持
72     // (前と同じ曲なら選択曲変更に掛かる再計算を省略して高速化するため)
73     private C曲リストノ song_last = null;
74    
75    
76     // コンストラクタ
77    
78     public CActSelect曲リスト()
79     {
80     this.r現在選択中の曲 = null;
81     this.n現在のアンカ難易度レベル = 0;
82     base.b活性化してない = true;
83     this.bIsEnumeratingSongs = false;
84     }
85    
86    
87     // メソッド
88    
89     public int n現在のアンカ難易度レベルに最も近い難易度レベルを返す( C曲リストノ song )
90     {
91     // 事前チェック。
92    
93     if( song == null )
94     return this.n現在のアンカ難易度レベル; // 曲がまったくないよ
95    
96     if( song.arスコア[ this.n現在のアンカ難易度レベル ] != null )
97     return this.n現在のアンカ難易度レベル; // 難易度ぴったりの曲があったよ
98    
99     if( ( song.eド種別 == C曲リストノ.Eド種別.BOX ) || ( song.eド種別 == C曲リストノ.Eド種別.BACKBOX ) )
100     return 0; // BOX と BACKBOX は関係無いよ
101    
102    
103     // 現在のアンカレベルから、難易度上向きに検索開始。
104    
105     int n最も近いレベル = this.n現在のアンカ難易度レベル;
106    
107     for( int i = 0; i < 5; i++ )
108     {
109     if( song.arスコア[ n最も近いレベル ] != null )
110     break; // 曲があった。
111    
112     n最も近いレベル = ( n最も近いレベル + 1 ) % 5; // 曲がなかったので次の難易度レベルへGo。(5以上になったら0に戻る。)
113     }
114    
115    
116     // 見つかった曲がアンカより下のレベルだった場合……
117     // アンカから下向きに検索すれば、もっとアンカに近い曲があるんじゃね?
118    
119     if( n最も近いレベル < this.n現在のアンカ難易度レベル )
120     {
121     // 現在のアンカレベルから、難易度下向きに検索開始。
122    
123     n最も近いレベル = this.n現在のアンカ難易度レベル;
124    
125     for( int i = 0; i < 5; i++ )
126     {
127     if( song.arスコア[ n最も近いレベル ] != null )
128     break; // 曲があった。
129    
130     n最も近いレベル = ( ( n最も近いレベル - 1 ) + 5 ) % 5; // 曲がなかったので次の難易度レベルへGo。(0未満になったら4に戻る。)
131     }
132     }
133    
134     return n最も近いレベル;
135     }
136     public C曲リストノ r指定された曲が存在するリストの先頭の曲( C曲リストノ song )
137     {
138     List<C曲リストノ> songList = GetSongListWithinMe( song );
139     return ( songList == null ) ? null : songList[ 0 ];
140     }
141     public C曲リストノ r指定された曲が存在するリストの末尾の曲( C曲リストノ song )
142     {
143     List<C曲リストノ> songList = GetSongListWithinMe( song );
144     return ( songList == null ) ? null : songList[ songList.Count - 1 ];
145     }
146    
147     private List<C曲リストノ> GetSongListWithinMe( C曲リストノ song )
148     {
149     if ( song.r親ノ == null ) // root階層のノートだったら
150     {
151     return CDTXMania.Songs管理.list曲ル; // rootのリストを返す
152     }
153     else
154     {
155     if ( ( song.r親ノ.list子リスト != null ) && ( song.r親ノ.list子リスト.Count > 0 ) )
156     {
157     return song.r親ノ.list子リスト;
158     }
159     else
160     {
161     return null;
162     }
163     }
164     }
165    
166    
167     public delegate void DGSortFunc( List<C曲リストノ> songList, E楽器パ eInst, int order, params object[] p);
168    
169     public void t曲リストのソ( DGSortFunc sf, E楽器パ eInst, int order, params object[] p )
170     {
171     List<C曲リストノ> songList = GetSongListWithinMe( this.r現在選択中の曲 );
172     if ( songList == null )
173     {
174     }
175     else
176     {
177     sf( songList, eInst, order, p );
178     this.t現在選択中の曲を元に曲バを再構成する();
179     }
180     }
181    
182     public bool tBOXに入る()
183     {
184     bool ret = false;
185     if ( CSkin.GetSkinName( CDTXMania.Skin.GetCurrentSkinSubfolderFullName( false ) ) != CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath )
186     && CSkin.bUseBoxDefSkin )
187     {
188     ret = true;
189 kairera0467 21 // BOXに入るときは、スキン変更発生時のみboxdefスキン設定の更新を行う
190     CDTXMania.Skin.SetCurrentSkinSubfolderFullName(
191     CDTXMania.Skin.GetSkinSubfolderFullNameFromSkinName( CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath ) ), false );
192 kairera0467 2 }
193    
194     if( ( this.r現在選択中の曲.list子リスト != null ) && ( this.r現在選択中の曲.list子リスト.Count > 0 ) )
195     {
196     this.r現在選択中の曲 = this.r現在選択中の曲.list子リスト[ 0 ];
197     this.t現在選択中の曲を元に曲バを再構成する();
198     this.t選択曲が変更された(false); // #27648 項目数変更を反映させる
199     }
200     return ret;
201     }
202     public bool tBOXを出る()
203     {
204     bool ret = false;
205     if ( CSkin.GetSkinName( CDTXMania.Skin.GetCurrentSkinSubfolderFullName( false ) ) != CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath )
206     && CSkin.bUseBoxDefSkin )
207     {
208     ret = true;
209     }
210     CDTXMania.Skin.SetCurrentSkinSubfolderFullName(
211     ( this.r現在選択中の曲.strSkinPath == "" ) ? "" : CDTXMania.Skin.GetSkinSubfolderFullNameFromSkinName( CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath ) ), false );
212     if ( this.r現在選択中の曲.r親ノ != null )
213     {
214     this.r現在選択中の曲 = this.r現在選択中の曲.r親ノ;
215     this.t現在選択中の曲を元に曲バを再構成する();
216     this.t選択曲が変更された(false); // #27648 項目数変更を反映させる
217     }
218     return ret;
219     }
220     public void t現在選択中の曲を元に曲バを再構成する()
221     {
222     this.tの初期化();
223     for( int i = 0; i < 13; i++ )
224     {
225     this.t曲名バの生成( i, this.st情報[ i ].strタイトル文字列, this.st情報[ i ].col文字色 );
226     }
227     }
228     public void t次に移動()
229     {
230     if( this.r現在選択中の曲 != null )
231     {
232     this.n目標のスクロルカウンタ += 100;
233     }
234     }
235     public void t前に移動()
236     {
237     if( this.r現在選択中の曲 != null )
238     {
239     this.n目標のスクロルカウンタ -= 100;
240     }
241     }
242     public void t難易度レベルをひとつ進める()
243     {
244     if( ( this.r現在選択中の曲 == null ) || ( this.r現在選択中の曲.nスコア数 <= 1 ) )
245     return; // 曲にスコアが0~1個しかないなら進める意味なし。
246    
247    
248     // 難易度レベルを+1し、現在選曲中のスコアを変更する。
249    
250     this.n現在のアンカ難易度レベル = this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( this.r現在選択中の曲 );
251    
252     for( int i = 0; i < 5; i++ )
253     {
254     this.n現在のアンカ難易度レベル = ( this.n現在のアンカ難易度レベル + 1 ) % 5; // 5以上になったら0に戻る。
255     if( this.r現在選択中の曲.arスコア[ this.n現在のアンカ難易度レベル ] != null ) // 曲が存在してるならここで終了。存在してないなら次のレベルへGo。
256     break;
257     }
258    
259    
260     // 曲毎に表示しているスキル値を、新しい難易度レベルに合わせて取得し直す。(表示されている13曲全部。)
261    
262     C曲リストノ song = this.r現在選択中の曲;
263     for( int i = 0; i < 5; i++ )
264     song = this.r前の曲( song );
265    
266     for( int i = this.n現在の選択行 - 5; i < ( ( this.n現在の選択行 - 5 ) + 13 ); i++ )
267     {
268     int index = ( i + 13 ) % 13;
269     for( int m = 0; m < 3; m++ )
270     {
271     this.st情報[ index ].nスキル値[ m ] = (int) song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.最大スキル[ m ];
272     }
273     song = this.r次の曲( song );
274     }
275    
276    
277     // 選曲ステージに変更通知を発出し、関係Activityの対応を行ってもらう。
278    
279     CDTXMania.stage選曲.t選択曲変更通知();
280     }
281    
282    
283     /// <summary>
284     /// 曲リストをリセットする
285     /// </summary>
286     /// <param name="cs"></param>
287     public void Refresh(CSongs管理 cs, bool bRemakeSongTitleBar ) // #26070 2012.2.28 yyagi
288     {
289     // this.On非活性化();
290    
291     if ( cs != null && cs.list曲ル.Count > 0 ) // 新しい曲リストを検索して、1曲以上あった
292     {
293     CDTXMania.Songs管理 = cs;
294    
295     if ( this.r現在選択中の曲 != null ) // r現在選択中の曲==null とは、「最初songlist.dbが無かった or 検索したが1曲もない」
296     {
297     this.r現在選択中の曲 = searchCurrentBreadcrumbsPosition( CDTXMania.Songs管理.list曲ル, this.r現在選択中の曲.strBreadcrumbs );
298     if ( bRemakeSongTitleBar ) // 選曲画面以外に居るときには再構成しない (非活性化しているときに実行すると例外となる)
299     {
300     this.t現在選択中の曲を元に曲バを再構成する();
301     }
302     #if false // list子リストの中まではmatchしてくれないので、検索ロジックは手書きで実装 (searchCurrentBreadcrumbs())
303     string bc = this.r現在選択中の曲.strBreadcrumbs;
304     Predicate<C曲リストノ> match = delegate( C曲リストノ c )
305     {
306     return ( c.strBreadcrumbs.Equals( bc ) );
307     };
308     int nMatched = CDTXMania.Songs管理.list曲ル.FindIndex( match );
309    
310     this.r現在選択中の曲 = ( nMatched == -1 ) ? null : CDTXMania.Songs管理.list曲ル[ nMatched ];
311     this.t現在選択中の曲を元に曲バを再構成する();
312     #endif
313     return;
314     }
315     }
316     this.On非活性化();
317     this.r現在選択中の曲 = null;
318     this.On活性化();
319     }
320    
321    
322     /// <summary>
323     /// 現在選曲している位置を検索する
324     /// (曲一覧クラスを新しいものに入れ替える際に用いる)
325     /// </summary>
326     /// <param name="ln">検索対象のList</param>
327     /// <param name="bc">検索するパンくずリスト(文字列)</param>
328     /// <returns></returns>
329     private C曲リストノ searchCurrentBreadcrumbsPosition( List<C曲リストノ> ln, string bc )
330     {
331     foreach (C曲リストノ n in ln)
332     {
333     if ( n.strBreadcrumbs == bc )
334     {
335     return n;
336     }
337     else if ( n.list子リスト != null && n.list子リスト.Count > 0 ) // 子リストが存在するなら、再帰で探す
338     {
339     C曲リストノ r = searchCurrentBreadcrumbsPosition( n.list子リスト, bc );
340     if ( r != null ) return r;
341     }
342     }
343     return null;
344     }
345    
346     /// <summary>
347     /// BOXのアイテム数と、今何番目を選択しているかをセットする
348     /// </summary>
349     public void t選択曲が変更された( bool bForce ) // #27648
350     {
351     C曲リストノ song = CDTXMania.stage選曲.r現在選択中の曲;
352     if ( song == null )
353     return;
354     if ( song == song_last && bForce == false )
355     return;
356    
357     song_last = song;
358     List<C曲リストノ> list = ( song.r親ノ != null ) ? song.r親ノ.list子リスト : CDTXMania.Songs管理.list曲ル;
359     int index = list.IndexOf( song ) + 1;
360     if ( index <= 0 )
361     {
362     nCurrentPosition = nNumOfItems = 0;
363     }
364     else
365     {
366     nCurrentPosition = index;
367     nNumOfItems = list.Count;
368     }
369     }
370    
371     // CActivity 実装
372    
373     public override void On活性化()
374     {
375     if( this.b活性化してる )
376     return;
377    
378     this.e楽器パ = E楽器パ.DRUMS;
379     this.b登場アニメ全部完了 = false;
380     this.n目標のスクロルカウンタ = 0;
381     this.n現在のスクロルカウンタ = 0;
382     this.nスクロルタイマ = -1;
383    
384     // フォント作成。
385     // 曲リスト文字は2倍(面積4倍)でテクスチャに描画してから縮小表示するので、フォントサイズは2倍とする。
386    
387     FontStyle regular = FontStyle.Regular;
388     if( CDTXMania.ConfigIni.b選曲リストフォントを斜体にする ) regular |= FontStyle.Italic;
389     if( CDTXMania.ConfigIni.b選曲リストフォントを太字にする ) regular |= FontStyle.Bold;
390     this.ft曲リスト用フォント = new Font( CDTXMania.ConfigIni.str選曲リストフォント, (float) ( CDTXMania.ConfigIni.n選曲リストフォントのサイズdot * 2 ), regular, GraphicsUnit.Pixel );
391    
392    
393     // 現在選択中の曲がない(=はじめての活性化)なら、現在選択中の曲をルートの先頭ノードに設定する。
394    
395     if( ( this.r現在選択中の曲 == null ) && ( CDTXMania.Songs管理.list曲ル.Count > 0 ) )
396     this.r現在選択中の曲 = CDTXMania.Songs管理.list曲ル[ 0 ];
397    
398    
399     // バー情報を初期化する。
400    
401     this.tの初期化();
402    
403     base.On活性化();
404    
405     this.t選択曲が変更された(true); // #27648 2012.3.31 yyagi 選曲画面に入った直後の 現在位置/全アイテム数 の表示を正しく行うため
406     }
407     public override void On非活性化()
408     {
409     if( this.b活性化してない )
410     return;
411    
412     CDTXMania.t安全にDisposeする( ref this.ft曲リスト用フォント );
413    
414     for( int i = 0; i < 13; i++ )
415     this.ct登場アニメ用[ i ] = null;
416    
417     base.On非活性化();
418     }
419     public override void OnManagedリソスの作成()
420     {
421     if( this.b活性化してない )
422     return;
423    
424     this.tx曲名バ.Score = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_bar score.png" ), false );
425     this.tx曲名バ.Box = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_bar box.png" ), false );
426     this.tx曲名バ.Other = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_bar other.png" ), false );
427     this.tx選曲バ.Score = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_bar score selected.png" ), false );
428     this.tx選曲バ.Box = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_bar box selected.png" ), false );
429     this.tx選曲バ.Other = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_bar other selected.png" ), false );
430     this.txスキル数字 = CDTXMania.tテクスチャの生成(CSkin.Path(@"Graphics\ScreenSelect skill number on list.png"), false);
431     for( int i = 0; i < 13; i++ )
432     this.t曲名バの生成( i, this.st情報[ i ].strタイトル文字列, this.st情報[ i ].col文字色 );
433    
434     int c = ( CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ja" ) ? 0 : 1;
435     #region [ Songs not found画像 ]
436     try
437     {
438     using( Bitmap image = new Bitmap( 640, 128 ) )
439     using( Graphics graphics = Graphics.FromImage( image ) )
440     {
441     string[] s1 = { "曲データが見つかりません。", "Songs not found." };
442     string[] s2 = { "曲データをDTXManiaGR.exe以下の", "You need to install songs." };
443     string[] s3 = { "フォルダにインストールして下さい。", "" };
444     graphics.DrawString( s1[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 2f );
445     graphics.DrawString( s1[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 0f );
446     graphics.DrawString( s2[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 44f );
447     graphics.DrawString( s2[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 42f );
448     graphics.DrawString( s3[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 86f );
449     graphics.DrawString( s3[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 84f );
450    
451     this.txSongNotFound = new CTexture( CDTXMania.app.Device, image, CDTXMania.TextureFormat );
452    
453     this.txSongNotFound.vc拡大縮小倍率 = new Vector3( 0.5f, 0.5f, 1f ); // 半分のサイズで表示する。
454     }
455     }
456     catch( CTextureCreateFailedException )
457     {
458     Trace.TraceError( "SoungNotFoundテクスチャの作成に失敗しました。" );
459     this.txSongNotFound = null;
460     }
461     #endregion
462     #region [ "曲データを検索しています"画像 ]
463     try
464     {
465     using ( Bitmap image = new Bitmap( 1280, 200 ) )
466     using ( Graphics graphics = Graphics.FromImage( image ) )
467     {
468     string[] s1 = { "曲データを検索しています。", "Now enumerating songs." };
469     string[] s2 = { "そのまましばらくお待ち下さい。", "Please wait..." };
470     graphics.DrawString( s1[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 2f );
471     graphics.DrawString( s1[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 0f );
472     graphics.DrawString( s2[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 44f );
473     graphics.DrawString( s2[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 42f );
474    
475     this.txEnumeratingSongs = new CTexture( CDTXMania.app.Device, image, CDTXMania.TextureFormat );
476    
477     this.txEnumeratingSongs.vc拡大縮小倍率 = new Vector3( 0.5f, 0.5f, 1f ); // 半分のサイズで表示する。
478     }
479     }
480     catch ( CTextureCreateFailedException )
481     {
482     Trace.TraceError( "txEnumeratingSongsテクスチャの作成に失敗しました。" );
483     this.txEnumeratingSongs = null;
484     }
485     #endregion
486     #region [ 曲数表示 ]
487     this.txアイテム数数字 = CDTXMania.tテクスチャの生成(CSkin.Path(@"Graphics\5_skill number on gauge etc.png"), false);
488     #endregion
489     base.OnManagedリソスの作成();
490     }
491     public override void OnManagedリソスの解放()
492     {
493     if( this.b活性化してない )
494     return;
495    
496     CDTXMania.t安全にDisposeする( ref this.txアイテム数数字 );
497    
498     for( int i = 0; i < 13; i++ )
499     CDTXMania.t安全にDisposeする( ref this.st情報[ i ].txタイトル名 );
500    
501     CDTXMania.t安全にDisposeする( ref this.txスキル数字 );
502     CDTXMania.t安全にDisposeする( ref this.txEnumeratingSongs );
503     CDTXMania.t安全にDisposeする( ref this.txSongNotFound );
504     CDTXMania.t安全にDisposeする( ref this.tx曲名バ.Score );
505     CDTXMania.t安全にDisposeする( ref this.tx曲名バ.Box );
506     CDTXMania.t安全にDisposeする( ref this.tx曲名バ.Other );
507     CDTXMania.t安全にDisposeする( ref this.tx選曲バ.Score );
508     CDTXMania.t安全にDisposeする( ref this.tx選曲バ.Box );
509     CDTXMania.t安全にDisposeする( ref this.tx選曲バ.Other );
510    
511     base.OnManagedリソスの解放();
512     }
513     public override int On進行描画()
514     {
515     if( this.b活性化してない )
516     return 0;
517    
518     #region [ 初めての進行描画 ]
519     //-----------------
520     if( this.b初めての進行描画 )
521     {
522     for( int i = 0; i < 13; i++ )
523     this.ct登場アニメ用[ i ] = new CCounter( -i * 10, 100, 3, CDTXMania.Timer );
524    
525     this.nスクロルタイマ = CSound管理.rc演奏用タイマ.n現在時刻;
526     CDTXMania.stage選曲.t選択曲変更通知();
527    
528     base.b初めての進行描画 = false;
529     }
530     //-----------------
531     #endregion
532    
533    
534     // まだ選択中の曲が決まってなければ、曲ツリールートの最初の曲にセットする。
535    
536     if( ( this.r現在選択中の曲 == null ) && ( CDTXMania.Songs管理.list曲ル.Count > 0 ) )
537     this.r現在選択中の曲 = CDTXMania.Songs管理.list曲ル[ 0 ];
538    
539    
540     // 本ステージは、(1)登場アニメフェーズ → (2)通常フェーズ と二段階にわけて進む。
541     // 2つしかフェーズがないので CStage.eフェーズID を使ってないところがまた本末転倒。
542    
543    
544     // 進行。
545    
546     if( !this.b登場アニメ全部完了 )
547     {
548     #region [ (1) 登場アニメフェーズの進行。]
549     //-----------------
550     for( int i = 0; i < 13; i++ ) // パネルは全13枚。
551     {
552     this.ct登場アニメ用[ i ].t進行();
553    
554     if( this.ct登場アニメ用[ i ].b終了値に達した )
555     this.ct登場アニメ用[ i ].t停止();
556     }
557    
558     // 全部の進行が終わったら、this.b登場アニメ全部完了 を true にする。
559    
560     this.b登場アニメ全部完了 = true;
561     for( int i = 0; i < 13; i++ ) // パネルは全13枚。
562     {
563     if( this.ct登場アニメ用[ i ].b進行中 )
564     {
565     this.b登場アニメ全部完了 = false; // まだ進行中のアニメがあるなら false のまま。
566     break;
567     }
568     }
569    
570    
571     //-----------------
572     #endregion
573     }
574     else
575     {
576     #region [ (2) 通常フェーズの進行。]
577     //-----------------
578     long n現在時刻 = CDTXMania.Timer.n現在時刻;
579    
580     if( n現在時刻 < this.nスクロルタイマ ) // 念のため
581     this.nスクロルタイマ = n現在時刻;
582    
583     const int nアニメ間隔 = 2;
584     while( ( n現在時刻 - this.nスクロルタイマ ) >= nアニメ間隔 )
585     {
586     int n加速度 = 1;
587     int n残距離 = Math.Abs( (int) ( this.n目標のスクロルカウンタ - this.n現在のスクロルカウンタ ) );
588    
589     #region [ 残距離が遠いほどスクロールを速くする(=n加速度を多くする)。]
590     //-----------------
591     if( n残距離 <= 100 )
592     {
593     n加速度 = 2;
594     }
595     else if( n残距離 <= 300 )
596     {
597     n加速度 = 3;
598     }
599     else if( n残距離 <= 500 )
600     {
601     n加速度 = 4;
602     }
603     else
604     {
605     n加速度 = 8;
606     }
607     //-----------------
608     #endregion
609    
610     #region [ 加速度を加算し、現在のスクロールカウンタを目標のスクロールカウンタまで近づける。 ]
611     //-----------------
612     if( this.n現在のスクロルカウンタ < this.n目標のスクロルカウンタ ) // (A) 正の方向に未達の場合:
613     {
614     this.n現在のスクロルカウンタ += n加速度; // カウンタを正方向に移動する。
615    
616     if( this.n現在のスクロルカウンタ > this.n目標のスクロルカウンタ )
617     this.n現在のスクロルカウンタ = this.n目標のスクロルカウンタ; // 到着!スクロール停止!
618     }
619    
620     else if( this.n現在のスクロルカウンタ > this.n目標のスクロルカウンタ ) // (B) 負の方向に未達の場合:
621     {
622     this.n現在のスクロルカウンタ -= n加速度; // カウンタを負方向に移動する。
623    
624     if( this.n現在のスクロルカウンタ < this.n目標のスクロルカウンタ ) // 到着!スクロール停止!
625     this.n現在のスクロルカウンタ = this.n目標のスクロルカウンタ;
626     }
627     //-----------------
628     #endregion
629    
630     if( this.n現在のスクロルカウンタ >= 100 ) // 1行=100カウント。
631     {
632     #region [ パネルを1行上にシフトする。]
633     //-----------------
634    
635     // 選択曲と選択行を1つ下の行に移動。
636    
637     this.r現在選択中の曲 = this.r次の曲( this.r現在選択中の曲 );
638     this.n現在の選択行 = ( this.n現在の選択行 + 1 ) % 13;
639    
640    
641     // 選択曲から7つ下のパネル(=新しく最下部に表示されるパネル。消えてしまう一番上のパネルを再利用する)に、新しい曲の情報を記載する。
642    
643     C曲リストノ song = this.r現在選択中の曲;
644     for( int i = 0; i < 7; i++ )
645     song = this.r次の曲( song );
646    
647     int index = ( this.n現在の選択行 + 7 ) % 13; // 新しく最下部に表示されるパネルのインデックス(0~12)。
648     this.st情報[ index ].strタイトル文字列 = song.strタイトル;
649     this.st情報[ index ].col文字色 = song.col文字色;
650     this.t曲名バの生成( index, this.st情報[ index ].strタイトル文字列, this.st情報[ index ].col文字色 );
651    
652    
653     // stバー情報[] の内容を1行ずつずらす。
654    
655     C曲リストノ song2 = this.r現在選択中の曲;
656     for( int i = 0; i < 5; i++ )
657     song2 = this.r前の曲( song2 );
658    
659     for( int i = 0; i < 13; i++ )
660     {
661     int n = ( ( ( this.n現在の選択行 - 5 ) + i ) + 13 ) % 13;
662     this.st情報[ n ].e種別 = this.e曲のバ種別を返す( song2 );
663     song2 = this.r次の曲( song2 );
664     }
665    
666    
667     // 新しく最下部に表示されるパネル用のスキル値を取得。
668    
669     for( int i = 0; i < 3; i++ )
670     this.st情報[ index ].nスキル値[ i ] = (int) song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.最大スキル[ i ];
671    
672    
673     // 1行(100カウント)移動完了。
674    
675     this.n現在のスクロルカウンタ -= 100;
676     this.n目標のスクロルカウンタ -= 100;
677    
678     this.t選択曲が変更された(false); // スクロールバー用に今何番目を選択しているかを更新
679    
680     if( this.n目標のスクロルカウンタ == 0 )
681     CDTXMania.stage選曲.t選択曲変更通知(); // スクロール完了=選択曲変更!
682    
683     //-----------------
684     #endregion
685     }
686     else if( this.n現在のスクロルカウンタ <= -100 )
687     {
688     #region [ パネルを1行下にシフトする。]
689     //-----------------
690    
691     // 選択曲と選択行を1つ上の行に移動。
692    
693     this.r現在選択中の曲 = this.r前の曲( this.r現在選択中の曲 );
694     this.n現在の選択行 = ( ( this.n現在の選択行 - 1 ) + 13 ) % 13;
695    
696    
697     // 選択曲から5つ上のパネル(=新しく最上部に表示されるパネル。消えてしまう一番下のパネルを再利用する)に、新しい曲の情報を記載する。
698    
699     C曲リストノ song = this.r現在選択中の曲;
700     for( int i = 0; i < 5; i++ )
701     song = this.r前の曲( song );
702    
703     int index = ( ( this.n現在の選択行 - 5 ) + 13 ) % 13; // 新しく最上部に表示されるパネルのインデックス(0~12)。
704     this.st情報[ index ].strタイトル文字列 = song.strタイトル;
705     this.st情報[ index ].col文字色 = song.col文字色;
706     this.t曲名バの生成( index, this.st情報[ index ].strタイトル文字列, this.st情報[ index ].col文字色 );
707    
708    
709     // stバー情報[] の内容を1行ずつずらす。
710    
711     C曲リストノ song2 = this.r現在選択中の曲;
712     for( int i = 0; i < 5; i++ )
713     song2 = this.r前の曲( song2 );
714    
715     for( int i = 0; i < 13; i++ )
716     {
717     int n = ( ( ( this.n現在の選択行 - 5 ) + i ) + 13 ) % 13;
718     this.st情報[ n ].e種別 = this.e曲のバ種別を返す( song2 );
719     song2 = this.r次の曲( song2 );
720     }
721    
722    
723     // 新しく最上部に表示されるパネル用のスキル値を取得。
724    
725     for( int i = 0; i < 3; i++ )
726     this.st情報[ index ].nスキル値[ i ] = (int) song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.最大スキル[ i ];
727    
728    
729     // 1行(100カウント)移動完了。
730    
731     this.n現在のスクロルカウンタ += 100;
732     this.n目標のスクロルカウンタ += 100;
733    
734     this.t選択曲が変更された(false); // スクロールバー用に今何番目を選択しているかを更新
735    
736     if( this.n目標のスクロルカウンタ == 0 )
737     CDTXMania.stage選曲.t選択曲変更通知(); // スクロール完了=選択曲変更!
738     //-----------------
739     #endregion
740     }
741    
742     this.nスクロルタイマ += nアニメ間隔;
743     }
744     //-----------------
745     #endregion
746     }
747    
748    
749     // 描画。
750    
751     if( this.r現在選択中の曲 == null )
752     {
753     #region [ 曲が1つもないなら「Songs not found.」を表示してここで帰れ。]
754     //-----------------
755     if ( bIsEnumeratingSongs )
756     {
757     if ( this.txEnumeratingSongs != null )
758     {
759     this.txEnumeratingSongs.t2D描画( CDTXMania.app.Device, 320, 160 );
760     }
761     }
762     else
763     {
764     if ( this.txSongNotFound != null )
765     this.txSongNotFound.t2D描画( CDTXMania.app.Device, 640, 400 );
766     }
767     //-----------------
768     #endregion
769    
770     return 0;
771     }
772    
773     if( !this.b登場アニメ全部完了 )
774     {
775     #region [ (1) 登場アニメフェーズの描画。]
776     //-----------------
777     for( int i = 0; i < 13; i++ ) // パネルは全13枚。
778     {
779     if( this.ct登場アニメ用[ i ].n現在の値 >= 0 )
780     {
781     double db割合0to1 = ( (double) this.ct登場アニメ用[ i ].n現在の値 ) / 100.0;
782     double db回転率 = Math.Sin( Math.PI * 3 / 5 * db割合0to1 );
783     int nパネル番号 = ( ( ( this.n現在の選択行 - 5 ) + i ) + 13 ) % 13;
784    
785     if( i == 5 )
786     {
787     // (A) 選択曲パネルを描画。
788    
789     #region [ バーテクスチャを描画。]
790     //-----------------
791     int width = (int) ( 425.0 / Math.Sin( Math.PI * 3 / 5 ) );
792     int x = 410 - ( (int) ( width * db回転率 ) );
793     int y = 300;
794     this.tの描画( 410, 270, this.st情報[ nパネル番号 ].e種別, true );
795     //-----------------
796     #endregion
797     #region [ タイトル名テクスチャを描画。]
798     //-----------------
799     if( this.st情報[ nパネル番号 ].txタイトル名 != null )
800     this.st情報[ nパネル番号 ].txタイトル名.t2D描画( CDTXMania.app.Device, 530 , 300 );
801     //-----------------
802     #endregion
803     #region [ スキル値を描画。]
804     //-----------------
805     if( ( this.st情報[ nパネル番号 ].e種別 == E種別.Score ) && ( this.e楽器パ != E楽器パ.UNKNOWN ) )
806     this.tスキル値の描画( 490, 312 , this.st情報[ nパネル番号 ].nスキル値[ (int) this.e楽器パ ] );
807     //-----------------
808     #endregion
809     }
810     else
811     {
812     // (B) その他のパネルの描画。
813    
814     #region [ バーテクスチャの描画。]
815     //-----------------
816     int width = (int) ( ( (double) ( ( 720 - this.ptの基本座標[ i ].X ) + 1 ) ) / Math.Sin( Math.PI * 3 / 5 ) );
817     int x = 720 - ( (int) ( width * db回転率 ) );
818     int y = this.ptの基本座標[ i ].Y;
819     this.tの描画( x, y, this.st情報[ nパネル番号 ].e種別, false );
820     //-----------------
821     #endregion
822     #region [ タイトル名テクスチャを描画。]
823     //-----------------
824     if( this.st情報[ nパネル番号 ].txタイトル名 != null )
825     this.st情報[ nパネル番号 ].txタイトル名.t2D描画( CDTXMania.app.Device, x + 88 , y + 6 );
826     //-----------------
827     #endregion
828     #region [ スキル値を描画。]
829     //-----------------
830     if( ( this.st情報[ nパネル番号 ].e種別 == E種別.Score ) && ( this.e楽器パ != E楽器パ.UNKNOWN ) )
831     this.tスキル値の描画( x + 34, y + 18, this.st情報[ nパネル番号 ].nスキル値[ (int) this.e楽器パ ] );
832     //-----------------
833     #endregion
834     }
835     }
836     }
837     //-----------------
838     #endregion
839     }
840     else
841     {
842     #region [ (2) 通常フェーズの描画。]
843     //-----------------
844     for( int i = 0; i < 13; i++ ) // パネルは全13枚。
845     {
846     if( ( i == 0 && this.n現在のスクロルカウンタ > 0 ) || // 最上行は、上に移動中なら表示しない。
847     ( i == 12 && this.n現在のスクロルカウンタ < 0 ) ) // 最下行は、下に移動中なら表示しない。
848     continue;
849    
850     int nパネル番号 = ( ( ( this.n現在の選択行 - 5 ) + i ) + 13 ) % 13;
851     int n見た目の行番号 = i;
852     int n次のパネル番号 = ( this.n現在のスクロルカウンタ <= 0 ) ? ( ( i + 1 ) % 13 ) : ( ( ( i - 1 ) + 13 ) % 13 );
853     int x = this.ptの基本座標[ n見た目の行番号 ].X + ( (int) ( ( this.ptの基本座標[ n次のパネル番号 ].X - this.ptの基本座標[ n見た目の行番号 ].X ) * ( ( (double) Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0 ) ) );
854     int y = this.ptの基本座標[ n見た目の行番号 ].Y + ( (int) ( ( this.ptの基本座標[ n次のパネル番号 ].Y - this.ptの基本座標[ n見た目の行番号 ].Y ) * ( ( (double) Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0 ) ) );
855    
856     if( ( i == 5 ) && ( this.n現在のスクロルカウンタ == 0 ) )
857     {
858     // (A) スクロールが停止しているときの選択曲バーの描画。
859    
860     #region [ バーテクスチャを描画。]
861     //-----------------
862     this.tの描画( 410, 270, this.st情報[ nパネル番号 ].e種別, true );
863     //-----------------
864     #endregion
865     #region [ タイトル名テクスチャを描画。]
866     //-----------------
867     if( this.st情報[ nパネル番号 ].txタイトル名 != null )
868     this.st情報[ nパネル番号 ].txタイトル名.t2D描画( CDTXMania.app.Device, 530, 300 );
869     //-----------------
870     #endregion
871     #region [ スキル値を描画。]
872     //-----------------
873     if( ( this.st情報[ nパネル番号 ].e種別 == E種別.Score ) && ( this.e楽器パ != E楽器パ.UNKNOWN ) )
874     this.tスキル値の描画( 490, 312, this.st情報[ nパネル番号 ].nスキル値[ (int) this.e楽器パ ] );
875     //-----------------
876     #endregion
877     }
878     else
879     {
880     // (B) スクロール中の選択曲バー、またはその他のバーの描画。
881    
882     #region [ バーテクスチャを描画。]
883     //-----------------
884     this.tの描画( x, y, this.st情報[ nパネル番号 ].e種別, false );
885     //-----------------
886     #endregion
887     #region [ タイトル名テクスチャを描画。]
888     //-----------------
889     if( this.st情報[ nパネル番号 ].txタイトル名 != null )
890     this.st情報[ nパネル番号 ].txタイトル名.t2D描画( CDTXMania.app.Device, x + 0x58, y + 6 );
891     //-----------------
892     #endregion
893     #region [ スキル値を描画。]
894     //-----------------
895     if( ( this.st情報[ nパネル番号 ].e種別 == E種別.Score ) && ( this.e楽器パ != E楽器パ.UNKNOWN ) )
896     this.tスキル値の描画( x + 34, y + 18, this.st情報[ nパネル番号 ].nスキル値[ (int) this.e楽器パ ] );
897     //-----------------
898     #endregion
899     }
900     }
901     //-----------------
902     #endregion
903     }
904     #region [ スクロール地点の計算(描画はCActSelectShowCurrentPositionにて行う) #27648 ]
905     int py;
906     double d = 0;
907     if ( nNumOfItems > 1 )
908     {
909     d = ( 336 - 6 - 8 ) / (double) ( nNumOfItems - 1 );
910     py = (int) ( d * ( nCurrentPosition - 1 ) );
911     }
912     else
913     {
914     d = 0;
915     py = 0;
916     }
917     int delta = (int) ( d * this.n現在のスクロルカウンタ / 100 );
918     if ( py + delta <= 336 - 6 - 8 )
919     {
920     this.nスクロルバ相対y座標 = py + delta;
921     }
922     #endregion
923    
924     #region [ アイテム数の描画 #27648 ]
925     tアイテム数の描画();
926     #endregion
927     return 0;
928     }
929    
930    
931     // その他
932    
933     #region [ private ]
934     //-----------------
935     private enum E種別 { Score, Box, Other }
936    
937     private struct ST
938     {
939     public CTexture Score;
940     public CTexture Box;
941     public CTexture Other;
942     public CTexture this[ int index ]
943     {
944     get
945     {
946     switch( index )
947     {
948     case 0:
949     return this.Score;
950    
951     case 1:
952     return this.Box;
953    
954     case 2:
955     return this.Other;
956     }
957     throw new IndexOutOfRangeException();
958     }
959     set
960     {
961     switch( index )
962     {
963     case 0:
964     this.Score = value;
965     return;
966    
967     case 1:
968     this.Box = value;
969     return;
970    
971     case 2:
972     this.Other = value;
973     return;
974     }
975     throw new IndexOutOfRangeException();
976     }
977     }
978     }
979    
980     private struct ST情報
981     {
982     public CActSelect曲リスト.E種別 e種別;
983     public string strタイトル文字列;
984     public CTexture txタイトル名;
985     public STDGBVALUE<int> nスキル値;
986     public Color col文字色;
987     }
988    
989     private struct ST選曲バ
990     {
991     public CTexture Score;
992     public CTexture Box;
993     public CTexture Other;
994     public CTexture this[ int index ]
995     {
996     get
997     {
998     switch( index )
999     {
1000     case 0:
1001     return this.Score;
1002    
1003     case 1:
1004     return this.Box;
1005    
1006     case 2:
1007     return this.Other;
1008     }
1009     throw new IndexOutOfRangeException();
1010     }
1011     set
1012     {
1013     switch( index )
1014     {
1015     case 0:
1016     this.Score = value;
1017     return;
1018    
1019     case 1:
1020     this.Box = value;
1021     return;
1022    
1023     case 2:
1024     this.Other = value;
1025     return;
1026     }
1027     throw new IndexOutOfRangeException();
1028     }
1029     }
1030     }
1031    
1032     private bool b登場アニメ全部完了;
1033     private Color color文字影 = Color.FromArgb( 0x40, 10, 10, 10 );
1034     private CCounter[] ct登場アニメ用 = new CCounter[ 13 ];
1035     private E楽器パ e楽器パ;
1036     private Font ft曲リスト用フォント;
1037     private long nスクロルタイマ;
1038     private int n現在のスクロルカウンタ;
1039     private int n現在の選択行;
1040     private int n目標のスクロルカウンタ;
1041     private readonly Point[] ptの基本座標 = new Point[] { new Point(0x2c4, 30), new Point(0x272, 0x51), new Point(0x242, 0x84), new Point(0x222, 0xb7), new Point(0x210, 0xea), new Point(0x1d0, 0x127), new Point(0x224, 0x183), new Point(0x242, 0x1b6), new Point(0x270, 0x1e9), new Point(0x2ae, 540), new Point(0x314, 0x24f), new Point(0x3e4, 0x282), new Point(0x500, 0x2b5) };
1042     private ST情報[] st情報 = new ST情報[ 13 ];
1043     private CTexture txSongNotFound, txEnumeratingSongs;
1044     private CTexture txスキル数字;
1045     private CTexture txアイテム数数字;
1046     private ST tx曲名バ;
1047     private ST選曲バ tx選曲バ;
1048    
1049     private int nCurrentPosition = 0;
1050     private int nNumOfItems = 0;
1051    
1052     //private string strBoxDefSkinPath = "";
1053     private E種別 e曲のバ種別を返す( C曲リストノ song )
1054     {
1055     if( song != null )
1056     {
1057     switch( song.eド種別 )
1058     {
1059     case C曲リストノ.Eド種別.SCORE:
1060     case C曲リストノ.Eド種別.SCORE_MIDI:
1061     return E種別.Score;
1062    
1063     case C曲リストノ.Eド種別.BOX:
1064     case C曲リストノ.Eド種別.BACKBOX:
1065     return E種別.Box;
1066     }
1067     }
1068     return E種別.Other;
1069     }
1070     private C曲リストノ r次の曲( C曲リストノ song )
1071     {
1072     if( song == null )
1073     return null;
1074    
1075     List<C曲リストノ> list = ( song.r親ノ != null ) ? song.r親ノ.list子リスト : CDTXMania.Songs管理.list曲ル;
1076    
1077     int index = list.IndexOf( song );
1078    
1079     if( index < 0 )
1080     return null;
1081    
1082     if( index == ( list.Count - 1 ) )
1083     return list[ 0 ];
1084    
1085     return list[ index + 1 ];
1086     }
1087     private C曲リストノ r前の曲( C曲リストノ song )
1088     {
1089     if( song == null )
1090     return null;
1091    
1092     List<C曲リストノ> list = ( song.r親ノ != null ) ? song.r親ノ.list子リスト : CDTXMania.Songs管理.list曲ル;
1093    
1094     int index = list.IndexOf( song );
1095    
1096     if( index < 0 )
1097     return null;
1098    
1099     if( index == 0 )
1100     return list[ list.Count - 1 ];
1101    
1102     return list[ index - 1 ];
1103     }
1104     private void tスキル値の描画( int x, int y, int nスキル値 )
1105     {
1106     if( nスキル値 <= 0 || nスキル値 > 100 ) // スキル値 0 = 未プレイ なので表示しない。
1107     return;
1108    
1109     int color = ( nスキル値 == 100 ) ? 3 : ( nスキル値 / 25 );
1110    
1111     int n百の位 = nスキル値 / 100;
1112     int n十の位 = ( nスキル値 % 100 ) / 10;
1113     int n一の位 = ( nスキル値 % 100 ) % 10;
1114    
1115    
1116     // 百の位の描画。
1117    
1118     if( n百の位 > 0 )
1119     this.tスキル値の描画・1桁描画( x, y, n百の位, color );
1120    
1121    
1122     // 十の位の描画。
1123    
1124     if( n百の位 != 0 || n十の位 != 0 )
1125     this.tスキル値の描画・1桁描画( x + 14, y, n十の位, color );
1126    
1127    
1128     // 一の位の描画。
1129    
1130     this.tスキル値の描画・1桁描画( x + 0x1c, y, n一の位, color );
1131     }
1132     private void tスキル値の描画・1桁描画( int x, int y, int n数値, int color )
1133     {
1134     int dx = ( n数値 % 5 ) * 9;
1135     int dy = ( n数値 / 5 ) * 12;
1136    
1137     switch( color )
1138     {
1139     case 0:
1140     if( this.txスキル数字 != null )
1141     this.txスキル数字.t2D描画( CDTXMania.app.Device, x, y, new Rectangle( 45 + dx, 24 + dy, 9, 12 ) );
1142     break;
1143    
1144     case 1:
1145     if( this.txスキル数字 != null )
1146     this.txスキル数字.t2D描画( CDTXMania.app.Device, x, y, new Rectangle( 45 + dx, dy, 9, 12 ) );
1147     break;
1148    
1149     case 2:
1150     if( this.txスキル数字 != null )
1151     this.txスキル数字.t2D描画( CDTXMania.app.Device, x, y, new Rectangle( dx, 24 + dy, 9, 12 ) );
1152     break;
1153    
1154     case 3:
1155     if( this.txスキル数字 != null )
1156     this.txスキル数字.t2D描画( CDTXMania.app.Device, x, y, new Rectangle( dx, dy, 9, 12 ) );
1157     break;
1158     }
1159     }
1160     private void tの初期化()
1161     {
1162     C曲リストノ song = this.r現在選択中の曲;
1163    
1164     if( song == null )
1165     return;
1166    
1167     for( int i = 0; i < 5; i++ )
1168     song = this.r前の曲( song );
1169    
1170     for( int i = 0; i < 13; i++ )
1171     {
1172     this.st情報[ i ].strタイトル文字列 = song.strタイトル;
1173     this.st情報[ i ].col文字色 = song.col文字色;
1174     this.st情報[ i ].e種別 = this.e曲のバ種別を返す( song );
1175    
1176     for( int j = 0; j < 3; j++ )
1177     this.st情報[ i ].nスキル値[ j ] = (int) song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.最大スキル[ j ];
1178    
1179     song = this.r次の曲( song );
1180     }
1181    
1182     this.n現在の選択行 = 5;
1183     }
1184     private void tの描画( int x, int y, E種別 type, bool b選択曲 )
1185     {
1186     if( x >= SampleFramework.GameWindowSize.Width || y >= SampleFramework.GameWindowSize.Height )
1187     return;
1188    
1189     if (b選択曲)
1190     {
1191     #region [ (A) 選択曲の場合 ]
1192     //-----------------
1193     if (this.tx選曲バ[(int)type] != null)
1194     this.tx選曲バ[(int)type].t2D描画(CDTXMania.app.Device, x, y, new Rectangle(0, 0, 128, 96)); // ヘサキ
1195     x += 128;
1196    
1197     var rc = new Rectangle(128, 0, 128, 96);
1198     while (x < 1280)
1199     {
1200     if (this.tx選曲バ[(int)type] != null)
1201     this.tx選曲バ[(int)type].t2D描画(CDTXMania.app.Device, x, y, rc); // 胴体;64pxずつ横につなげていく。
1202     x += 128;
1203     }
1204     //-----------------
1205     #endregion
1206     }
1207     else
1208     {
1209     #region [ (B) その他の場合 ]
1210     //-----------------
1211     if (this.tx曲名バ[(int)type] != null)
1212     this.tx曲名バ[(int)type].t2D描画(CDTXMania.app.Device, x, y, new Rectangle(0, 0, 128, 48)); // ヘサキ
1213     x += 128;
1214    
1215     var rc = new Rectangle(0, 48, 128, 48);
1216     while (x < 1280)
1217     {
1218     if (this.tx曲名バ[(int)type] != null)
1219     this.tx曲名バ[(int)type].t2D描画(CDTXMania.app.Device, x, y, rc); // 胴体;64pxずつ横につなげていく。
1220     x += 128;
1221     }
1222     //-----------------
1223     #endregion
1224     }
1225     }
1226     private void t曲名バの生成( int n番号, string str曲名, Color color )
1227     {
1228     if( n番号 < 0 || n番号 > 12 )
1229     return;
1230    
1231     try
1232     {
1233     SizeF sz曲名;
1234    
1235     #region [ 曲名表示に必要となるサイズを取得する。]
1236     //-----------------
1237     using( var bmpDummy = new Bitmap( 1, 1 ) )
1238     {
1239     var g = Graphics.FromImage( bmpDummy );
1240     g.PageUnit = GraphicsUnit.Pixel;
1241     sz曲名 = g.MeasureString( str曲名, this.ft曲リスト用フォント );
1242     }
1243     //-----------------
1244     #endregion
1245    
1246     int n最大幅px = 0x310;
1247     int height = 0x25;
1248     int width = (int) ( ( sz曲名.Width + 2 ) * 0.5f );
1249     if( width > ( CDTXMania.app.Device.Capabilities.MaxTextureWidth / 2 ) )
1250     width = CDTXMania.app.Device.Capabilities.MaxTextureWidth / 2; // 右端断ち切れ仕方ないよね
1251    
1252     float f拡大率X = ( width <= n最大幅px ) ? 0.5f : ( ( (float) n最大幅px / (float) width ) * 0.5f ); // 長い文字列は横方向に圧縮。
1253    
1254     using( var bmp = new Bitmap( width * 2, height * 2, PixelFormat.Format32bppArgb ) ) // 2倍(面積4倍)のBitmapを確保。(0.5倍で表示する前提。)
1255     using( var g = Graphics.FromImage( bmp ) )
1256     {
1257     g.TextRenderingHint = TextRenderingHint.AntiAlias;
1258     float y = ( ( ( float ) bmp.Height ) / 2f ) - ( ( CDTXMania.ConfigIni.n選曲リストフォントのサイズdot * 2f ) / 2f );
1259     g.DrawString( str曲名, this.ft曲リスト用フォント, new SolidBrush( this.color文字影 ), (float) 2f, (float) ( y + 2f ) );
1260     g.DrawString( str曲名, this.ft曲リスト用フォント, new SolidBrush( color ), 0f, y );
1261    
1262     CDTXMania.t安全にDisposeする( ref this.st情報[ n番号 ].txタイトル名 );
1263    
1264     this.st情報[ n番号 ].txタイトル名 = new CTexture( CDTXMania.app.Device, bmp, CDTXMania.TextureFormat );
1265     this.st情報[ n番号 ].txタイトル名.vc拡大縮小倍率 = new Vector3( f拡大率X, 0.5f, 1f );
1266     }
1267     }
1268     catch( CTextureCreateFailedException )
1269     {
1270     Trace.TraceError( "曲名テクスチャの作成に失敗しました。[{0}]", str曲名 );
1271     this.st情報[ n番号 ].txタイトル名 = null;
1272     }
1273     }
1274     private void tアイテム数の描画()
1275     {
1276     string s = nCurrentPosition.ToString() + "/" + nNumOfItems.ToString();
1277 kairera0467 121 int x = 1280 - 8 - 12;
1278 kairera0467 2 int y = 500;
1279    
1280     for ( int p = s.Length - 1; p >= 0; p-- )
1281     {
1282     tアイテム数の描画・1桁描画( x, y, s[ p ] );
1283 kairera0467 121 x -= 10;
1284 kairera0467 2 }
1285     }
1286     private void tアイテム数の描画・1桁描画( int x, int y, char s数値 )
1287     {
1288     int dx, dy;
1289     if ( s数値 == '/' )
1290     {
1291 kairera0467 121 dx = 96;
1292 kairera0467 2 dy = 0;
1293     }
1294     else
1295     {
1296     int n = (int) s数値 - (int) '0';
1297     dx = ( n % 6 ) * 16;
1298     dy = ( n / 6 ) * 16;
1299     }
1300     if ( this.txアイテム数数字 != null )
1301     {
1302     this.txアイテム数数字.t2D描画( CDTXMania.app.Device, x, y, new Rectangle( dx, dy, 16, 16 ) );
1303     }
1304     }
1305     //-----------------
1306     #endregion
1307     }
1308     }

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