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 2 - (hide annotations) (download)
Sat Feb 16 12:17:56 2013 UTC (11 years, 1 month ago) by kairera0467
Original Path: trunk/trunk/DTXManiaプロジェクト/コード/ステージ/05.選曲/CActSelect曲リスト.cs
File size: 49800 byte(s)


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

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