Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 581 - (show annotations) (download)
Sun May 24 05:50:14 2020 UTC (3 years, 10 months ago) by kairera0467
File size: 129702 byte(s)
#35379 ジャケット画像の描画でtxTumbnailを使用しないよう変更
#35379 前回の修正で発生した不具合を修正
#35379 ランクEまたはオート演奏した場合、リザルトのランク画像でメモリリークが発生していたのを修正
#xxxxx バージョンの変更
#xxxxx DTXMania rev:2033adeeee1e46267cf36b50919c9ecee8804076の変更を取り込み
1 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 using System.IO;
11 using SlimDX;
12 using FDK;
13
14 namespace DTXMania
15 {
16 //ここをXG風にする際に使ったコードはSSTから拝借、改造している。
17 internal class CActSelect曲リスト : CActivity
18 {
19
20 // プロパティ
21
22 public bool bIsEnumeratingSongs
23 {
24 get;
25 set;
26 }
27 public bool bスクロル中
28 {
29 get
30 {
31 if( this.n目標のスクロルカウンタ == 0 )
32 {
33 return ( this.n現在のスクロルカウンタ != 0 );
34 }
35 return true;
36 }
37 }
38 public int n現在のアンカ難易度レベル
39 {
40 get;
41 private set;
42 }
43 public int n現在選択中の曲の現在の難易度レベル
44 {
45 get
46 {
47 return this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( this.r現在選択中の曲 );
48 }
49 }
50 public Cスコア r現在選択中のスコア
51 {
52 get
53 {
54 if( this.r現在選択中の曲 != null )
55 {
56 return this.r現在選択中の曲.arスコア[ this.n現在選択中の曲の現在の難易度レベル ];
57 }
58 return null;
59 }
60 }
61 public C曲リストノ r現在選択中の曲
62 {
63 get;
64 private set;
65 }
66
67 public int nスクロルバ相対y座標
68 {
69 get;
70 private set;
71 }
72
73 // t選択曲が変更された()内で使う、直前の選曲の保持
74 // (前と同じ曲なら選択曲変更に掛かる再計算を省略して高速化するため)
75 private C曲リストノ song_last = null;
76
77
78 // コンストラクタ
79
80 public CActSelect曲リスト()
81 {
82 this.r現在選択中の曲 = null;
83 this.n現在のアンカ難易度レベル = 0;
84 base.b活性化してない = true;
85 this.bIsEnumeratingSongs = false;
86
87
88 this.stパネルマップ = null;
89 this.stパネルマップ = new STATUSPANEL[12]; // yyagi: 以下、手抜きの初期化でスマン
90 string[] labels = new string[12] {
91 "DTXMANIA", //0
92 "DEBUT", //1
93 "NOVICE", //2
94 "REGULAR", //3
95 "EXPERT", //4
96 "MASTER", //5
97 "BASIC", //6
98 "ADVANCED", //7
99 "EXTREME", //8
100 "RAW", //9
101 "RWS", //10
102 "REAL" //11
103 };
104 int[] status = new int[12] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
105
106 for (int i = 0; i < 12; i++)
107 {
108 this.stパネルマップ[i] = default(STATUSPANEL);
109 this.stパネルマップ[i].status = status[i];
110 this.stパネルマップ[i].label = labels[i];
111 }
112 }
113
114
115 // メソッド
116
117 public int n現在のアンカ難易度レベルに最も近い難易度レベルを返す( C曲リストノ song )
118 {
119 // 事前チェック。
120
121 if( song == null )
122 return this.n現在のアンカ難易度レベル; // 曲がまったくないよ
123
124 if( song.arスコア[ this.n現在のアンカ難易度レベル ] != null )
125 return this.n現在のアンカ難易度レベル; // 難易度ぴったりの曲があったよ
126
127 if( ( song.eド種別 == C曲リストノ.Eド種別.BOX ) || ( song.eド種別 == C曲リストノ.Eド種別.BACKBOX ) )
128 return 0; // BOX と BACKBOX は関係無いよ
129
130
131 // 現在のアンカレベルから、難易度上向きに検索開始。
132
133 int n最も近いレベル = this.n現在のアンカ難易度レベル;
134
135 for( int i = 0; i < 5; i++ )
136 {
137 if( song.arスコア[ n最も近いレベル ] != null )
138 break; // 曲があった。
139
140 n最も近いレベル = ( n最も近いレベル + 1 ) % 5; // 曲がなかったので次の難易度レベルへGo。(5以上になったら0に戻る。)
141 }
142
143
144 // 見つかった曲がアンカより下のレベルだった場合……
145 // アンカから下向きに検索すれば、もっとアンカに近い曲があるんじゃね?
146
147 if( n最も近いレベル < this.n現在のアンカ難易度レベル )
148 {
149 // 現在のアンカレベルから、難易度下向きに検索開始。
150
151 n最も近いレベル = this.n現在のアンカ難易度レベル;
152
153 for( int i = 0; i < 5; i++ )
154 {
155 if( song.arスコア[ n最も近いレベル ] != null )
156 break; // 曲があった。
157
158 n最も近いレベル = ( ( n最も近いレベル - 1 ) + 5 ) % 5; // 曲がなかったので次の難易度レベルへGo。(0未満になったら4に戻る。)
159 }
160 }
161
162 return n最も近いレベル;
163 }
164 public C曲リストノ r指定された曲が存在するリストの先頭の曲( C曲リストノ song )
165 {
166 List<C曲リストノ> songList = GetSongListWithinMe( song );
167 return ( songList == null ) ? null : songList[ 0 ];
168 }
169 public C曲リストノ r指定された曲が存在するリストの末尾の曲( C曲リストノ song )
170 {
171 List<C曲リストノ> songList = GetSongListWithinMe( song );
172 return ( songList == null ) ? null : songList[ songList.Count - 1 ];
173 }
174
175 private List<C曲リストノ> GetSongListWithinMe( C曲リストノ song )
176 {
177 if ( song.r親ノ == null ) // root階層のノートだったら
178 {
179 return CDTXMania.Songs管理.list曲ル; // rootのリストを返す
180 }
181 else
182 {
183 if ( ( song.r親ノ.list子リスト != null ) && ( song.r親ノ.list子リスト.Count > 0 ) )
184 {
185 return song.r親ノ.list子リスト;
186 }
187 else
188 {
189 return null;
190 }
191 }
192 }
193
194
195 public delegate void DGSortFunc( List<C曲リストノ> songList, E楽器パ eInst, int order, params object[] p);
196 /// <summary>
197 /// 主にCSong管理.cs内にあるソート機能を、delegateで呼び出す。
198 /// </summary>
199 /// <param name="sf">ソート用に呼び出すメソッド</param>
200 /// <param name="eInst">ソート基準とする楽器</param>
201 /// <param name="order">-1=降順, 1=昇順</param>
202 public void t曲リストのソ( DGSortFunc sf, E楽器パ eInst, int order, params object[] p )
203 {
204 List<C曲リストノ> songList = GetSongListWithinMe( this.r現在選択中の曲 );
205 if ( songList == null )
206 {
207 // 何もしない;
208 }
209 else
210 {
211 // CDTXMania.Songs管理.t曲リストのソート3_演奏回数の多い順( songList, eInst, order );
212 sf( songList, eInst, order, p );
213 // this.r現在選択中の曲 = CDTXMania
214 this.t現在選択中の曲を元に曲バを再構成する();
215 }
216 }
217
218 public bool tBOXに入る()
219 {
220 //Trace.TraceInformation( "box enter" );
221 //Trace.TraceInformation( "Skin現在Current : " + CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) );
222 //Trace.TraceInformation( "Skin現在System : " + CSkin.strSystemSkinSubfolderFullName );
223 //Trace.TraceInformation( "Skin現在BoxDef : " + CSkin.strBoxDefSkinSubfolderFullName );
224 //Trace.TraceInformation( "Skin現在: " + CSkin.GetSkinName( CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) ) );
225 //Trace.TraceInformation( "Skin現pt: " + CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) );
226 //Trace.TraceInformation( "Skin指定: " + CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath ) );
227 //Trace.TraceInformation( "Skinpath: " + this.r現在選択中の曲.strSkinPath );
228 bool ret = false;
229 if ( CSkin.GetSkinName( CDTXMania.Skin.GetCurrentSkinSubfolderFullName( false ) ) != CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath )
230 && CSkin.bUseBoxDefSkin )
231 {
232 ret = true;
233 // BOXに入るときは、スキン変更発生時のみboxdefスキン設定の更新を行う
234 CDTXMania.Skin.SetCurrentSkinSubfolderFullName(
235 CDTXMania.Skin.GetSkinSubfolderFullNameFromSkinName( CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath ) ), false );
236 }
237
238 //Trace.TraceInformation( "Skin変更: " + CSkin.GetSkinName( CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) ) );
239 //Trace.TraceInformation( "Skin変更Current : "+ CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) );
240 //Trace.TraceInformation( "Skin変更System : "+ CSkin.strSystemSkinSubfolderFullName );
241 //Trace.TraceInformation( "Skin変更BoxDef : "+ CSkin.strBoxDefSkinSubfolderFullName );
242 if( this.tx選択されている曲の曲名 != null )
243 {
244 this.tx選択されている曲の曲名.Dispose();
245 this.tx選択されている曲の曲名 = null;
246 }
247 if( this.tx選択されている曲のアティスト名 != null )
248 {
249 this.tx選択されている曲のアティスト名.Dispose();
250 this.tx選択されている曲のアティスト名 = null;
251 }
252 if( ( this.r現在選択中の曲.list子リスト != null ) && ( this.r現在選択中の曲.list子リスト.Count > 0 ) )
253 {
254 this.r現在選択中の曲 = this.r現在選択中の曲.list子リスト[ 0 ];
255 this.t現在選択中の曲を元に曲バを再構成する();
256 this.t選択曲が変更された(false); // #27648 項目数変更を反映させる
257 }
258 return ret;
259 }
260 public bool tBOXを出る()
261 {
262 //Trace.TraceInformation( "box exit" );
263 //Trace.TraceInformation( "Skin現在Current : " + CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) );
264 //Trace.TraceInformation( "Skin現在System : " + CSkin.strSystemSkinSubfolderFullName );
265 //Trace.TraceInformation( "Skin現在BoxDef : " + CSkin.strBoxDefSkinSubfolderFullName );
266 //Trace.TraceInformation( "Skin現在: " + CSkin.GetSkinName( CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) ) );
267 //Trace.TraceInformation( "Skin現pt: " + CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) );
268 //Trace.TraceInformation( "Skin指定: " + CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath ) );
269 //Trace.TraceInformation( "Skinpath: " + this.r現在選択中の曲.strSkinPath );
270 bool ret = false;
271 if ( CSkin.GetSkinName( CDTXMania.Skin.GetCurrentSkinSubfolderFullName( false ) ) != CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath )
272 && CSkin.bUseBoxDefSkin )
273 {
274 ret = true;
275 }
276 // スキン変更が発生しなくても、boxdef圏外に出る場合は、boxdefスキン設定の更新が必要
277 // (ユーザーがboxdefスキンをConfig指定している場合への対応のために必要)
278 // tBoxに入る()とは処理が微妙に異なるので注意
279 CDTXMania.Skin.SetCurrentSkinSubfolderFullName(
280 ( this.r現在選択中の曲.strSkinPath == "" ) ? "" : CDTXMania.Skin.GetSkinSubfolderFullNameFromSkinName( CSkin.GetSkinName( this.r現在選択中の曲.strSkinPath ) ), false );
281 //Trace.TraceInformation( "SKIN変更: " + CSkin.GetSkinName( CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) ) );
282 //Trace.TraceInformation( "SKIN変更Current : "+ CDTXMania.Skin.GetCurrentSkinSubfolderFullName(false) );
283 //Trace.TraceInformation( "SKIN変更System : "+ CSkin.strSystemSkinSubfolderFullName );
284 //Trace.TraceInformation( "SKIN変更BoxDef : "+ CSkin.strBoxDefSkinSubfolderFullName );
285 if( this.tx選択されている曲の曲名 != null )
286 {
287 this.tx選択されている曲の曲名.Dispose();
288 this.tx選択されている曲の曲名 = null;
289 }
290 if( this.tx選択されている曲のアティスト名 != null )
291 {
292 this.tx選択されている曲のアティスト名.Dispose();
293 this.tx選択されている曲のアティスト名 = null;
294 }
295 if ( this.r現在選択中の曲.r親ノ != null )
296 {
297 this.r現在選択中の曲 = this.r現在選択中の曲.r親ノ;
298 this.t現在選択中の曲を元に曲バを再構成する();
299 this.t選択曲が変更された(false); // #27648 項目数変更を反映させる
300 }
301 return ret;
302 }
303 public void t現在選択中の曲を元に曲バを再構成する()
304 {
305 this.tの初期化();
306 for( int i = 0; i < 15; i++ )
307 {
308 //this.t曲名バーの生成( i, this.stバー情報[ i ].strタイトル文字列, this.stバー情報[ i ].col文字色 );
309 this.tティスト名テクスチャの生成( i, this.st情報[ i ].strティスト名 );
310 this.tパネルの生成( i, this.st情報[ i ].strタイトル文字列, this.st情報[ i ].strティスト名, this.st情報[ i ].col文字色 );
311 // if( !this.dicThumbnail.ContainsKey( this.stバー情報[ i ].strPreimageのパス ) )
312 // {
313 // //txTumbnail = this.tサムネイルテクスチャを作成する( Path.GetDirectoryName( song.ScoreFile ) );
314 // this.tパスを指定してサムネイル画像を生成する( i, this.stバー情報[ i ].strPreimageのパス, this.stバー情報[ i ].eバー種別 );
315 // this.dicThumbnail.Add( this.stバー情報[ i ].strPreimageのパス, this.txTumbnail[ i ] );
316 //}
317 // this.txTumbnail[ i ] = this.dicThumbnail[ this.stバー情報[ i ].strPreimageのパス ];
318 }
319 }
320 public void t次に移動()
321 {
322 if( this.r現在選択中の曲 != null )
323 {
324 this.n目標のスクロルカウンタ += 100;
325 }
326 }
327 public void t前に移動()
328 {
329 if( this.r現在選択中の曲 != null )
330 {
331 this.n目標のスクロルカウンタ -= 100;
332 }
333 }
334 public void t難易度レベルをひとつ進める()
335 {
336 if( ( this.r現在選択中の曲 == null ) || ( this.r現在選択中の曲.nスコア数 <= 1 ) )
337 return; // 曲にスコアが0~1個しかないなら進める意味なし。
338
339
340 // 難易度レベルを+1し、現在選曲中のスコアを変更する。
341
342 this.n現在のアンカ難易度レベル = this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( this.r現在選択中の曲 );
343
344 for( int i = 0; i < 5; i++ )
345 {
346 this.n現在のアンカ難易度レベル = ( this.n現在のアンカ難易度レベル + 1 ) % 5; // 5以上になったら0に戻る。
347 if( this.r現在選択中の曲.arスコア[ this.n現在のアンカ難易度レベル ] != null ) // 曲が存在してるならここで終了。存在してないなら次のレベルへGo。
348 break;
349 }
350
351
352 // 曲毎に表示しているスキル値を、新しい難易度レベルに合わせて取得し直す。(表示されている13曲全部。)
353
354 C曲リストノ song = this.r現在選択中の曲;
355 for( int i = 0; i < 5; i++ )
356 song = this.r前の曲( song );
357
358 for( int i = this.n現在の選択行 - 7; i < ( ( this.n現在の選択行 - 7 ) + 15 ); i++ )
359 {
360 int index = ( i + 15 ) % 15;
361 for( int m = 0; m < 3; m++ )
362 {
363 this.st情報[ index ].nスキル値[ m ] = (int) song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.最大スキル[ m ];
364 }
365 song = this.r次の曲( song );
366 }
367
368 this.tラベル名からステタスパネルを決定する( this.r現在選択中の曲.ar難易度ラベル[ this.n現在選択中の曲の現在の難易度レベル ] );
369
370 switch( this.nIndex )
371 {
372 case 2:
373 CDTXMania.Skin.soundNovice.t再生する();
374 string strnov = CSkin.Path( @"Sounds\Novice.ogg" );
375 if( !File.Exists( strnov ) )
376 CDTXMania.Skin.sound変更音.t再生する();
377 break;
378
379 case 3:
380 CDTXMania.Skin.soundRegular.t再生する();
381 string strreg = CSkin.Path( @"Sounds\Regular.ogg" );
382 if( !File.Exists( strreg ) )
383 CDTXMania.Skin.sound変更音.t再生する();
384 break;
385
386 case 4:
387 CDTXMania.Skin.soundExpert.t再生する();
388 string strexp = CSkin.Path( @"Sounds\Expert.ogg" );
389 if( !File.Exists( strexp ) )
390 CDTXMania.Skin.sound変更音.t再生する();
391 break;
392
393 case 5:
394 CDTXMania.Skin.soundMaster.t再生する();
395 string strmas = CSkin.Path( @"Sounds\Master.ogg" );
396 if( !File.Exists( strmas ) )
397 CDTXMania.Skin.sound変更音.t再生する();
398 break;
399
400 case 6:
401 CDTXMania.Skin.soundBasic.t再生する();
402 string strbsc = CSkin.Path( @"Sounds\Basic.ogg" );
403 if( !File.Exists( strbsc ) )
404 CDTXMania.Skin.sound変更音.t再生する();
405 break;
406
407 case 7:
408 CDTXMania.Skin.soundAdvanced.t再生する();
409 string stradv = CSkin.Path( @"Sounds\Advanced.ogg" );
410 if( !File.Exists( stradv ) )
411 CDTXMania.Skin.sound変更音.t再生する();
412 break;
413
414 case 8:
415 CDTXMania.Skin.soundExtreme.t再生する();
416 string strext = CSkin.Path( @"Sounds\Extreme.ogg" );
417 if( !File.Exists( strext ) )
418 CDTXMania.Skin.sound変更音.t再生する();
419 break;
420
421 default:
422 CDTXMania.Skin.sound変更音.t再生する();
423 break;
424 }
425
426 // 選曲ステージに変更通知を発出し、関係Activityの対応を行ってもらう。
427
428 CDTXMania.stage選曲.t選択曲変更通知();
429 }
430
431
432 public void tラベル名からステタスパネルを決定する(string strラベル名)
433 {
434 if (string.IsNullOrEmpty(strラベル名))
435 {
436 this.nIndex = 0;
437 }
438 else
439 {
440 STATUSPANEL[] array = this.stパネルマップ;
441 for (int i = 0; i < array.Length; i++)
442 {
443 STATUSPANEL sTATUSPANEL = array[i];
444 if (strラベル名.Equals(sTATUSPANEL.label, StringComparison.CurrentCultureIgnoreCase))
445 {
446 this.nIndex = sTATUSPANEL.status;
447 return;
448 }
449 this.nIndex++;
450 }
451 }
452 }
453
454 /// <summary>
455 /// 曲リストをリセットする
456 /// </summary>
457 /// <param name="cs"></param>
458 public void Refresh(CSongs管理 cs, bool bRemakeSongTitleBar ) // #26070 2012.2.28 yyagi
459 {
460 // this.On非活性化();
461
462 if ( cs != null && cs.list曲ル.Count > 0 ) // 新しい曲リストを検索して、1曲以上あった
463 {
464 CDTXMania.Songs管理 = cs;
465
466 if ( this.r現在選択中の曲 != null ) // r現在選択中の曲==null とは、「最初songlist.dbが無かった or 検索したが1曲もない」
467 {
468 this.r現在選択中の曲 = searchCurrentBreadcrumbsPosition( CDTXMania.Songs管理.list曲ル, this.r現在選択中の曲.strBreadcrumbs );
469 if ( bRemakeSongTitleBar ) // 選曲画面以外に居るときには再構成しない (非活性化しているときに実行すると例外となる)
470 {
471 this.t現在選択中の曲を元に曲バを再構成する();
472 }
473 #if false // list子リストの中まではmatchしてくれないので、検索ロジックは手書きで実装 (searchCurrentBreadcrumbs())
474 string bc = this.r現在選択中の曲.strBreadcrumbs;
475 Predicate<C曲リストノ> match = delegate( C曲リストノ c )
476 {
477 return ( c.strBreadcrumbs.Equals( bc ) );
478 };
479 int nMatched = CDTXMania.Songs管理.list曲ル.FindIndex( match );
480
481 this.r現在選択中の曲 = ( nMatched == -1 ) ? null : CDTXMania.Songs管理.list曲ル[ nMatched ];
482 this.t現在選択中の曲を元に曲バを再構成する();
483 #endif
484 return;
485 }
486 }
487 this.On非活性化();
488 this.r現在選択中の曲 = null;
489 //this.On活性化();
490 #region[ 再度活性化処理を行う ]
491 this.b登場アニメ全部完了 = false;
492 this.n目標のスクロルカウンタ = 0;
493 this.n現在のスクロルカウンタ = 0;
494 this.nスクロルタイマ = -1;
495
496 // フォント作成。
497 // 曲リスト文字は2倍(面積4倍)でテクスチャに描画してから縮小表示するので、フォントサイズは2倍とする。
498 if( this.ft曲リスト用フォント == null )
499 {
500 FontStyle regular = FontStyle.Regular;
501 if( CDTXMania.ConfigIni.b選曲リストフォントを太字にする ) regular |= FontStyle.Bold;
502 this.ft曲リスト用フォント = new Font( CDTXMania.ConfigIni.str選曲リストフォント, (float) ( CDTXMania.ConfigIni.n選曲リストフォントのサイズdot * 2 ), regular, GraphicsUnit.Pixel );
503 //this.prvFont = new CPrivateFont( new FontFamily( CDTXMania.ConfigIni.str選曲リストフォント ), 28, FontStyle.Regular );
504 }
505
506 if( ( this.r現在選択中の曲 == null ) && ( CDTXMania.Songs管理.list曲ル.Count > 0 ) )
507 this.r現在選択中の曲 = CDTXMania.Songs管理.list曲ル[ 0 ];
508 if( CDTXMania.r現在のステ.eステID == CStage.Eステ.選曲 )
509 this.tの初期化();
510
511 //base.On活性化();
512
513 this.t選択曲が変更された(true); // #27648 2012.3.31 yyagi 選曲画面に入った直後の 現在位置/全アイテム数 の表示を正しく行うため
514 #endregion
515 }
516
517
518 /// <summary>
519 /// 現在選曲している位置を検索する
520 /// (曲一覧クラスを新しいものに入れ替える際に用いる)
521 /// </summary>
522 /// <param name="ln">検索対象のList</param>
523 /// <param name="bc">検索するパンくずリスト(文字列)</param>
524 /// <returns></returns>
525 private C曲リストノ searchCurrentBreadcrumbsPosition( List<C曲リストノ> ln, string bc )
526 {
527 foreach (C曲リストノ n in ln)
528 {
529 if ( n.strBreadcrumbs == bc )
530 {
531 return n;
532 }
533 else if ( n.list子リスト != null && n.list子リスト.Count > 0 ) // 子リストが存在するなら、再帰で探す
534 {
535 C曲リストノ r = searchCurrentBreadcrumbsPosition( n.list子リスト, bc );
536 if ( r != null ) return r;
537 }
538 }
539 return null;
540 }
541
542 /// <summary>
543 /// BOXのアイテム数と、今何番目を選択しているかをセットする
544 /// </summary>
545 public void t選択曲が変更された( bool bForce ) // #27648
546 {
547 C曲リストノ song = CDTXMania.stage選曲.r現在選択中の曲;
548 if ( song == null )
549 return;
550 if ( song == song_last && bForce == false )
551 return;
552
553 song_last = song;
554 List<C曲リストノ> list = ( song.r親ノ != null ) ? song.r親ノ.list子リスト : CDTXMania.Songs管理.list曲ル;
555 int index = list.IndexOf( song ) + 1;
556 if ( index <= 0 )
557 {
558 nCurrentPosition = nNumOfItems = 0;
559 }
560 else
561 {
562 nCurrentPosition = index;
563 nNumOfItems = list.Count;
564 }
565
566 if( this.tx選択されている曲の曲名 != null )
567 {
568 this.tx選択されている曲の曲名.Dispose();
569 this.tx選択されている曲の曲名 = null;
570 }
571 if( this.tx選択されている曲のアティスト名 != null )
572 {
573 this.tx選択されている曲のアティスト名.Dispose();
574 this.tx選択されている曲のアティスト名 = null;
575 }
576 }
577
578 // CActivity 実装
579
580 public override void On活性化()
581 {
582 if( this.b活性化してる )
583 return;
584
585 this.b登場アニメ全部完了 = false;
586 this.n目標のスクロルカウンタ = 0;
587 this.n現在のスクロルカウンタ = 0;
588 this.nスクロルタイマ = -1;
589
590 // フォント作成。
591 // 曲リスト文字は2倍(面積4倍)でテクスチャに描画してから縮小表示するので、フォントサイズは2倍とする。
592 if( this.ft曲リスト用フォント == null )
593 {
594 FontStyle regular = FontStyle.Regular;
595 if( CDTXMania.ConfigIni.b選曲リストフォントを太字にする ) regular |= FontStyle.Bold;
596 this.ft曲リスト用フォント = new Font( CDTXMania.ConfigIni.str選曲リストフォント, (float) ( CDTXMania.ConfigIni.n選曲リストフォントのサイズdot * 2 ), regular, GraphicsUnit.Pixel );
597 //this.prvFont = new CPrivateFont( new FontFamily( CDTXMania.ConfigIni.str選曲リストフォント ), 28, FontStyle.Regular );
598 }
599
600 // 現在選択中の曲がない(=はじめての活性化)なら、現在選択中の曲をルートの先頭ノードに設定する。
601
602 if( ( this.r現在選択中の曲 == null ) && ( CDTXMania.Songs管理.list曲ル.Count > 0 ) )
603 this.r現在選択中の曲 = CDTXMania.Songs管理.list曲ル[ 0 ];
604
605
606 // バー情報を初期化する。
607
608 this.tの初期化();
609
610 base.On活性化();
611
612 this.t選択曲が変更された(true); // #27648 2012.3.31 yyagi 選曲画面に入った直後の 現在位置/全アイテム数 の表示を正しく行うため
613 }
614 public override void On非活性化()
615 {
616 if( this.b活性化してない )
617 return;
618
619 CDTXMania.t安全にDisposeする( ref this.ft曲リスト用フォント );
620 if( this.prvFont != null )
621 this.prvFont.Dispose();
622
623 for( int i = 0; i < 15; i++ )
624 this.ct登場アニメ用[ i ] = null;
625
626 base.On非活性化();
627 }
628 public override void OnManagedリソスの作成()
629 {
630 if( this.b活性化してない )
631 return;
632
633 if ( this.tx選曲パネル == null && CDTXMania.ConfigIni.bDrums有効 )
634 this.tx選曲パネル = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_image_panel.png" ) );
635 else if( this.tx選曲パネル == null && CDTXMania.ConfigIni.bGuitar有効 )
636 this.tx選曲パネル = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\5_image_panel_guitar.png" ) );
637
638 this.txパネル = CDTXMania.tテクスチャの生成(CSkin.Path(@"Graphics\5_music panel.png"));
639 //this.tx帯 = CDTXMania.tテクスチャの生成Af( CSkin.Path( @"Graphics\5_backpanel.png" ) );
640 this.txパネル帯 = CDTXMania.tテクスチャの生成Af( CSkin.Path( @"Graphics\5_Backbar.png" ) );
641 //this.tx色帯 = CDTXMania.tテクスチャの生成Af( CSkin.Path( @"Graphics\5_ColorBar.png" ) );
642 //this.txランプ用帯 = CDTXMania.tテクスチャの生成( CSkin.Path(@"Graphics\5_lamppanel.png" ));
643
644 this.txクリアランプ = CDTXMania.tテクスチャの生成( CSkin.Path(@"Graphics\5_Clearlamp.png") );
645 #region[ テクスチャの復元 ]
646 int nKeys = this.dicThumbnail.Count;
647 string[] keys = new string[ nKeys ];
648 this.dicThumbnail.Keys.CopyTo( keys, 0 );
649 //foreach (var key in keys)
650 // this.dicThumbnail[ key ] = this.tパスを指定してサムネイル画像を生成して返す( 0, key, this.stバー情報[ 0 ].eバー種別 );
651
652 // //ここは最初に表示される画像の復元に必要。
653 // for (int i = 0; i < 15; i++)
654 // {
655 // //this.t曲名バーの生成(i, this.stバー情報[i].strタイトル文字列, this.stバー情報[i].col文字色);
656 // this.tアーティスト名テクスチャの生成( i, this.stバー情報[ i ].strアーティスト名 );
657 // //this.tパネルの生成( i, this.stバー情報[ i ].strタイトル文字列, this.stバー情報[ i ].strアーティスト名, this.stバー情報[ i ].col文字色 );
658 // //this.tパスを指定してサムネイル画像を生成する(i, this.stバー情報[i].strDTXフォルダのパス, this.stバー情報[i].eバー種別);
659 // if( this.stバー情報[ i ].strPreimageのパス != null )
660 // {
661 // if( !this.dicThumbnail.ContainsKey( this.stバー情報[ i ].strPreimageのパス ) )
662 // {
663 // //txTumbnail = this.tサムネイルテクスチャを作成する( Path.GetDirectoryName( song.ScoreFile ) );
664 // this.tパスを指定してサムネイル画像を生成する( i, this.stバー情報[ i ].strPreimageのパス, this.stバー情報[ i ].eバー種別 );
665 // this.dicThumbnail.Add( this.stバー情報[ i ].strPreimageのパス, this.txTumbnail[ i ] );
666 //}
667 // //txTumbnail[ i ] = this.dicThumbnail[ this.stバー情報[ i ].strPreimageのパス ];
668 // txTumbnail[ i ] = this.dicThumbnail[ this.stバー情報[ i ].strPreimageのパス ];
669 // }
670 // }
671 #endregion
672
673
674 int c = ( CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ja" ) ? 0 : 1;
675 #region [ Songs not found画像 ]
676 try
677 {
678 using( Bitmap image = new Bitmap( 640, 128 ) )
679 using( Graphics graphics = Graphics.FromImage( image ) )
680 {
681 string[] s1 = { "曲データが見つかりません。", "Songs not found." };
682 string[] s2 = { "曲データをDTXManiaGR.exe以下の", "You need to install songs." };
683 string[] s3 = { "フォルダにインストールして下さい。", "" };
684 graphics.DrawString( s1[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 2f );
685 graphics.DrawString( s1[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 0f );
686 graphics.DrawString( s2[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 44f );
687 graphics.DrawString( s2[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 42f );
688 graphics.DrawString( s3[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 86f );
689 graphics.DrawString( s3[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 84f );
690
691 this.txSongNotFound = new CTexture( CDTXMania.app.Device, image, CDTXMania.TextureFormat );
692
693 this.txSongNotFound.vc拡大縮小倍率 = new Vector3( 0.5f, 0.5f, 1f ); // 半分のサイズで表示する。
694 }
695 }
696 catch( CTextureCreateFailedException )
697 {
698 Trace.TraceError( "SoungNotFoundテクスチャの作成に失敗しました。" );
699 this.txSongNotFound = null;
700 }
701 #endregion
702 #region [ "曲データを検索しています"画像 ]
703 try
704 {
705 using ( Bitmap image = new Bitmap( 640, 96 ) )
706 using ( Graphics graphics = Graphics.FromImage( image ) )
707 {
708 string[] s1 = { "曲データを検索しています。", "Now enumerating songs." };
709 string[] s2 = { "そのまましばらくお待ち下さい。", "Please wait..." };
710 graphics.DrawString( s1[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 2f );
711 graphics.DrawString( s1[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 0f );
712 graphics.DrawString( s2[c], this.ft曲リスト用フォント, Brushes.DarkGray, (float) 2f, (float) 44f );
713 graphics.DrawString( s2[c], this.ft曲リスト用フォント, Brushes.White, (float) 0f, (float) 42f );
714
715 this.txEnumeratingSongs = new CTexture( CDTXMania.app.Device, image, CDTXMania.TextureFormat );
716
717 this.txEnumeratingSongs.vc拡大縮小倍率 = new Vector3( 0.5f, 0.5f, 1f ); // 半分のサイズで表示する。
718 }
719 }
720 catch ( CTextureCreateFailedException )
721 {
722 Trace.TraceError( "txEnumeratingSongsテクスチャの作成に失敗しました。" );
723 this.txEnumeratingSongs = null;
724 }
725 #endregion
726 #region [ 曲数表示 ]
727 this.txアイテム数数字 = CDTXMania.tテクスチャの生成(CSkin.Path(@"Graphics\5_skill number on gauge etc.png"), false);
728 #endregion
729
730 base.OnManagedリソスの作成();
731 }
732 public override void OnManagedリソスの解放()
733 {
734 if( this.b活性化してない )
735 return;
736
737 CDTXMania.t安全にDisposeする( ref this.txアイテム数数字 );
738
739 for ( int i = 0; i < 15; i++ )
740 {
741 CDTXMania.t安全にDisposeする( ref this.st情報[ i ].txパネル );
742 CDTXMania.t安全にDisposeする( ref this.st情報[ i ].txタイトル名 );
743 CDTXMania.t安全にDisposeする( ref this.st情報[ i ].txティスト名 );
744 CDTXMania.t安全にDisposeする( ref this.st情報[ i ].txカスタム曲名テクスチャ );
745 CDTXMania.t安全にDisposeする( ref this.st情報[ i ].txカスタムアティスト名テクスチャ );
746
747 CDTXMania.tテクスチャの解放( ref this.txTumbnail[ i ] );
748 }
749
750 CDTXMania.tテクスチャの解放( ref this.tx選択されている曲の曲名 );
751 CDTXMania.tテクスチャの解放( ref this.tx選択されている曲のアティスト名 );
752 #region[ ジャケット画像の解放 ]
753 int nKeys = this.dicThumbnail.Count;
754 string[] keys = new string[ nKeys ];
755 this.dicThumbnail.Keys.CopyTo( keys, 0 );
756 foreach( var key in keys )
757 {
758 C共通.tDisposeする( this.dicThumbnail[ key ] );
759 this.dicThumbnail[ key ] = null;
760 }
761 if( CDTXMania.ConfigIni.bJacketDicClear )
762 this.dicThumbnail.Clear();
763 #endregion
764
765 CDTXMania.t安全にDisposeする( ref this.txEnumeratingSongs );
766 CDTXMania.t安全にDisposeする( ref this.txSongNotFound );
767 CDTXMania.t安全にDisposeする( ref this.tx選曲パネル );
768 CDTXMania.t安全にDisposeする( ref this.txパネル );
769 CDTXMania.t安全にDisposeする( ref this.txクリアランプ );
770 //CDTXMania.t安全にDisposeする( ref this.tx帯 );
771 CDTXMania.t安全にDisposeする( ref this.txパネル帯 );
772 //CDTXMania.t安全にDisposeする( ref this.tx色帯 );
773 //CDTXMania.t安全にDisposeする( ref this.txランプ用帯 );
774
775 base.OnManagedリソスの解放();
776 }
777 public override int On進行描画()
778 {
779 if( this.b活性化してない )
780 return 0;
781
782 #region [ 初めての進行描画 ]
783 //-----------------
784 if( this.b初めての進行描画 )
785 {
786 for( int i = 0; i < 15; i++ )
787 this.ct登場アニメ用[ i ] = new CCounter( -i * 10, 100, 3, CDTXMania.Timer );
788
789 this.nスクロルタイマ = CSound管理.rc演奏用タイマ.n現在時刻;
790 CDTXMania.stage選曲.t選択曲変更通知();
791
792 base.b初めての進行描画 = false;
793 }
794 //-----------------
795 #endregion
796
797
798 // まだ選択中の曲が決まってなければ、曲ツリールートの最初の曲にセットする。
799
800 if( ( this.r現在選択中の曲 == null ) && ( CDTXMania.Songs管理.list曲ル.Count > 0 ) )
801 this.r現在選択中の曲 = CDTXMania.Songs管理.list曲ル[ 0 ];
802
803
804 // 本ステージは、(1)登場アニメフェーズ → (2)通常フェーズ と二段階にわけて進む。
805 // 2つしかフェーズがないので CStage.eフェーズID を使ってないところがまた本末転倒。
806
807
808 // 進行。
809
810 if( !this.b登場アニメ全部完了 )
811 {
812 #region [ (1) 登場アニメフェーズの進行。]
813 //-----------------
814 for( int i = 0; i < 15; i++ ) // パネルは全13枚。
815 {
816 this.ct登場アニメ用[ i ].t進行();
817
818 if( this.ct登場アニメ用[ i ].b終了値に達した )
819 this.ct登場アニメ用[ i ].t停止();
820 }
821
822 // 全部の進行が終わったら、this.b登場アニメ全部完了 を true にする。
823
824 this.b登場アニメ全部完了 = true;
825 for( int i = 0; i < 15; i++ ) // パネルは全13枚。
826 {
827 if( this.ct登場アニメ用[ i ].b進行中 )
828 {
829 this.b登場アニメ全部完了 = false; // まだ進行中のアニメがあるなら false のまま。
830 break;
831 }
832 }
833 //-----------------
834 #endregion
835 }
836 else
837 {
838 #region [ (2) 通常フェーズの進行。]
839 //-----------------
840 long n現在時刻 = CSound管理.rc演奏用タイマ.n現在時刻;
841
842 if( n現在時刻 < this.nスクロルタイマ ) // 念のため
843 this.nスクロルタイマ = n現在時刻;
844
845 const int nアニメ間隔 = 2;
846 while( ( n現在時刻 - this.nスクロルタイマ ) >= nアニメ間隔 )
847 {
848 int n加速度 = 1;
849 int n残距離 = Math.Abs( (int) ( this.n目標のスクロルカウンタ - this.n現在のスクロルカウンタ ) );
850
851 #region [ 残距離が遠いほどスクロールを速くする(=n加速度を多くする)。]
852 //-----------------
853 if( n残距離 <= 100 )
854 {
855 n加速度 = 2;
856 }
857 else if( n残距離 <= 300 )
858 {
859 n加速度 = 3;
860 }
861 else if( n残距離 <= 500 )
862 {
863 n加速度 = 4;
864 }
865 else
866 {
867 n加速度 = 8;
868 }
869 //-----------------
870 #endregion
871
872 #region [ 加速度を加算し、現在のスクロールカウンタを目標のスクロールカウンタまで近づける。 ]
873 //-----------------
874 if( this.n現在のスクロルカウンタ < this.n目標のスクロルカウンタ ) // (A) 正の方向に未達の場合:
875 {
876 this.n現在のスクロルカウンタ += n加速度; // カウンタを正方向に移動する。
877
878 if( this.n現在のスクロルカウンタ > this.n目標のスクロルカウンタ )
879 this.n現在のスクロルカウンタ = this.n目標のスクロルカウンタ; // 到着!スクロール停止!
880 }
881
882 else if( this.n現在のスクロルカウンタ > this.n目標のスクロルカウンタ ) // (B) 負の方向に未達の場合:
883 {
884 this.n現在のスクロルカウンタ -= n加速度; // カウンタを負方向に移動する。
885
886 if( this.n現在のスクロルカウンタ < this.n目標のスクロルカウンタ ) // 到着!スクロール停止!
887 this.n現在のスクロルカウンタ = this.n目標のスクロルカウンタ;
888 }
889 //-----------------
890 #endregion
891
892 if( this.n現在のスクロルカウンタ >= 100 ) // 1行=100カウント。
893 {
894 #region [ パネルを1行上にシフトする。]
895 //-----------------
896
897 // 選択曲と選択行を1つ下の行に移動。
898
899 this.r現在選択中の曲 = this.r次の曲( this.r現在選択中の曲 );
900 this.n現在の選択行 = ( this.n現在の選択行 + 1 ) % 15;
901
902 // 選択曲から7つ下のパネル(=新しく最下部に表示されるパネル。消えてしまう一番上のパネルを再利用する)に、新しい曲の情報を記載する。
903
904 C曲リストノ song = this.r現在選択中の曲;
905 for( int i = 0; i < 7; i++ )
906 song = this.r次の曲( song );
907
908 int index = ( this.n現在の選択行 + 7 ) % 15; // 新しく最下部に表示されるパネルのインデックス(0~12)。
909 this.st情報[ index ].strタイトル文字列 = song.strタイトル;
910 this.st情報[ index ].strティスト名 = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.ティスト名;
911 this.st情報[ index ].col文字色 = song.col文字色;
912 this.st情報[ index ].strDTXフォルダのパス = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].ファイル情報.フォルダの絶対パス;
913 this.st情報[ index ].strPreimageのパス = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].ファイル情報.フォルダの絶対パス + song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.Preimage;
914 //this.t曲名バーの生成( index, this.stバー情報[ index ].strタイトル文字列, this.stバー情報[ index ].col文字色 );
915 this.tティスト名テクスチャの生成( index, this.st情報[ index ].strティスト名 );
916 this.tパネルの生成( index, this.st情報[ index ].strタイトル文字列, this.st情報[ index ].strティスト名, this.st情報[ index ].col文字色 );
917
918 //Trace.TraceInformation( "パネルを1行上にシフト" );
919 if( !this.dicThumbnail.ContainsKey( this.st情報[ index ].strPreimageのパス ) )
920 {
921 //txTumbnail = this.tサムネイルテクスチャを作成する( Path.GetDirectoryName( song.ScoreFile ) );
922 //this.tパスを指定してサムネイル画像を生成する( index, this.stバー情報[ index ].strPreimageのパス, this.stバー情報[ index ].eバー種別 );
923 this.dicThumbnail.Add( this.st情報[ index ].strPreimageのパス,
924 this.tパスを指定してサムネイル画像を生成して返す(index, this.st情報[ index ].strPreimageのパス, this.st情報[ index ].e種別) );
925 //this.dicThumbnail.Add( this.stバー情報[ index ].strPreimageのパス, this.txTumbnail[ index ] );
926 }
927 //else if( this.dicThumbnail[ this.stバー情報[ index ].strPreimageのパス ]?.texture == null )
928 //{
929 // Trace.TraceWarning( string.Format( "予期しない解放が発生していたため再生成を行いました。 ({0})", this.stバー情報[ index ].strPreimageのパス ) );
930 // this.dicThumbnail[ this.stバー情報[ index ].strPreimageのパス ]?.Dispose();
931 // this.dicThumbnail[ this.stバー情報[ index ].strPreimageのパス ] = CDTXMania.tテクスチャの生成( this.stバー情報[ index ].strPreimageのパス );
932 //}
933 //txTumbnail[ index ] = this.dicThumbnail[ this.stバー情報[ index ].strPreimageのパス ];
934
935
936 // stバー情報[] の内容を1行ずつずらす。
937
938 C曲リストノ song2 = this.r現在選択中の曲;
939 for( int i = 0; i < 7; i++ )
940 song2 = this.r前の曲( song2 );
941
942 for( int i = 0; i < 15; i++ )
943 {
944 int n = ( ( ( this.n現在の選択行 - 7 ) + i ) + 15 ) % 15;
945 this.st情報[ n ].e種別 = this.e曲のバ種別を返す( song2 );
946 song2 = this.r次の曲( song2 );
947 }
948
949
950 // 新しく最下部に表示されるパネル用のスキル値を取得。
951
952 for( int i = 0; i < 3; i++ )
953 this.st情報[ index ].nスキル値[ i ] = (int) song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.最大スキル[ i ];
954
955 // 1行(100カウント)移動完了。
956
957 this.n現在のスクロルカウンタ -= 100;
958 this.n目標のスクロルカウンタ -= 100;
959
960 this.t選択曲が変更された( false ); // スクロールバー用に今何番目を選択しているかを更新
961 CDTXMania.t安全にDisposeする( ref this.tx選択されている曲の曲名 );
962 CDTXMania.t安全にDisposeする( ref this.tx選択されている曲のアティスト名 );
963
964 if( this.n目標のスクロルカウンタ == 0 )
965 CDTXMania.stage選曲.t選択曲変更通知(); // スクロール完了=選択曲変更!
966
967 //-----------------
968 #endregion
969 }
970 else if( this.n現在のスクロルカウンタ <= -100 )
971 {
972 #region [ パネルを1行下にシフトする。]
973 //-----------------
974
975 // 選択曲と選択行を1つ上の行に移動。
976
977 this.r現在選択中の曲 = this.r前の曲( this.r現在選択中の曲 );
978 this.n現在の選択行 = ( ( this.n現在の選択行 - 1 ) + 15 ) % 15;
979
980 // 選択曲から5つ上のパネル(=新しく最上部に表示されるパネル。消えてしまう一番下のパネルを再利用する)に、新しい曲の情報を記載する。
981
982 C曲リストノ song = this.r現在選択中の曲;
983 for( int i = 0; i < 7; i++ )
984 song = this.r前の曲( song );
985
986 int index = ( ( this.n現在の選択行 - 7 ) + 15 ) % 15; // 新しく最上部に表示されるパネルのインデックス(0~12)。
987 this.st情報[ index ].strタイトル文字列 = song.strタイトル;
988 this.st情報[ index ].strティスト名 = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す(song) ].譜面情報.ティスト名;
989 this.st情報[ index ].col文字色 = song.col文字色;
990 this.st情報[ index ].strDTXフォルダのパス = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].ファイル情報.フォルダの絶対パス;
991 this.st情報[ index ].strPreimageのパス = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].ファイル情報.フォルダの絶対パス + song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.Preimage;
992 //this.t曲名バーの生成( index, this.stバー情報[ index ].strタイトル文字列, this.stバー情報[ index ].col文字色 );
993 this.tティスト名テクスチャの生成( index, this.st情報[ index ].strティスト名 );
994 this.tパネルの生成( index, this.st情報[ index ].strタイトル文字列, this.st情報[ index ].strティスト名, this.st情報[ index ].col文字色 );
995
996 //Trace.TraceInformation( "パネルを1行下にシフト" );
997 if( !this.dicThumbnail.ContainsKey( this.st情報[ index ].strPreimageのパス ) )
998 {
999 //txTumbnail = this.tサムネイルテクスチャを作成する( Path.GetDirectoryName( song.ScoreFile ) );
1000 //this.tパスを指定してサムネイル画像を生成する( index, this.stバー情報[ index ].strPreimageのパス, this.stバー情報[ index ].eバー種別 );
1001 this.dicThumbnail.Add( this.st情報[ index ].strPreimageのパス,
1002 this.tパスを指定してサムネイル画像を生成して返す(index, this.st情報[ index ].strPreimageのパス, this.st情報[ index ].e種別) );
1003 //this.dicThumbnail.Add( this.stバー情報[ index ].strPreimageのパス, this.txTumbnail[ index ] );
1004 }
1005 //txTumbnail[ index ] = this.dicThumbnail[ this.stバー情報[ index ].strPreimageのパス ];
1006
1007
1008 // stバー情報[] の内容を1行ずつずらす。
1009
1010 C曲リストノ song2 = this.r現在選択中の曲;
1011 for( int i = 0; i < 7; i++ )
1012 song2 = this.r前の曲( song2 );
1013
1014 for( int i = 0; i < 15; i++ )
1015 {
1016 int n = ( ( ( this.n現在の選択行 - 7 ) + i ) + 15 ) % 15;
1017 this.st情報[ n ].e種別 = this.e曲のバ種別を返す( song2 );
1018 song2 = this.r次の曲( song2 );
1019 }
1020
1021
1022 // 新しく最上部に表示されるパネル用のスキル値を取得。
1023
1024 for( int i = 0; i < 3; i++ )
1025 this.st情報[ index ].nスキル値[ i ] = (int) song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.最大スキル[ i ];
1026
1027
1028 // 1行(100カウント)移動完了。
1029
1030 this.n現在のスクロルカウンタ += 100;
1031 this.n目標のスクロルカウンタ += 100;
1032
1033
1034 this.t選択曲が変更された( false ); // スクロールバー用に今何番目を選択しているかを更新
1035 CDTXMania.t安全にDisposeする( ref this.tx選択されている曲の曲名 );
1036 CDTXMania.t安全にDisposeする( ref this.tx選択されている曲のアティスト名 );
1037
1038 if( this.n目標のスクロルカウンタ == 0 )
1039 CDTXMania.stage選曲.t選択曲変更通知(); // スクロール完了=選択曲変更!
1040 //-----------------
1041 #endregion
1042 }
1043
1044 this.nスクロルタイマ += nアニメ間隔;
1045 }
1046 //-----------------
1047 #endregion
1048 }
1049
1050 //if( this.txTumbnail != null )
1051 //{
1052 // this.txTumbnail[0]?.t2D描画( CDTXMania.app.Device, 0, 0 );
1053 //}
1054 if( this.st情報 != null )
1055 {
1056 this.st情報[0].txパネル?.t2D描画(CDTXMania.app.Device, 0, 0);
1057 }
1058
1059 // 描画。
1060
1061 if( this.r現在選択中の曲 == null )
1062 {
1063 #region [ 曲が1つもないなら「Songs not found.」を表示してここで帰れ。]
1064 //-----------------
1065 if ( bIsEnumeratingSongs )
1066 {
1067 if ( this.txEnumeratingSongs != null )
1068 {
1069 this.txEnumeratingSongs.t2D描画( CDTXMania.app.Device, 530, 240 );
1070 }
1071 }
1072 else
1073 {
1074 if ( this.txSongNotFound != null )
1075 this.txSongNotFound.t2D描画( CDTXMania.app.Device, 500, 190 );
1076 }
1077 //-----------------
1078 #endregion
1079
1080 return 0;
1081 }
1082 var bar = SlimDX.Matrix.Identity;
1083
1084 var barL = SlimDX.Matrix.Identity;
1085
1086 Matrix[] barC = new Matrix[2];
1087 Matrix[] barLa = new Matrix[2];
1088 Matrix[] barU = new Matrix[2];
1089
1090 #region[ビルボードの実験コード。「ここでするなよ...」とか言わないであげて...]
1091 //Z座標はプラス方向にすると動かなくなるので注意。
1092
1093 //共通
1094 Vector3 VecCam = new Vector3( 0.0f, 0.0f, -1.0f ); //Zをマイナス方向にしないと描画されない(?)
1095 Vector3 VecTarg = new Vector3( 0.0f, 0.0f, 0.0f );
1096 Vector3 VecUp = new Vector3( 0.0f, 1.0f, 0.0f );
1097
1098 bar *= SlimDX.Matrix.LookAtLH( VecCam, VecTarg, VecUp );
1099 barL *= SlimDX.Matrix.LookAtLH( VecCam, VecTarg, VecUp );
1100
1101 bar *= SlimDX.Matrix.RotationYawPitchRoll( -0.40f, 0.0f, 0.0f ); ////通常のRotationと何が違うのかわからない(Axisから倍率を抜いただけ?)
1102 barL *= SlimDX.Matrix.RotationYawPitchRoll( 0.40f, 0.0f, 0.0f );
1103
1104
1105 //bar *= SlimDX.Matrix.PerspectiveFovLH( C変換.DegreeToRadian(45), 1280.0f/720.0f, 1.0f, 500000.0f ); //カメラの視野角など調整
1106
1107 //ワールド変換とか意味ワカンネ
1108 #endregion
1109
1110 //bar *= SlimDX.Matrix.RotationY(-0.415f);
1111 //barL *= SlimDX.Matrix.RotationY(0.415f);
1112 //bar *= SlimDX.Matrix.Translation(540f, 20f, -24f);
1113 bar *= SlimDX.Matrix.Translation(600f, 121f, 190f);
1114 barL *= SlimDX.Matrix.Translation(-600f, 121f, 190f);
1115 //barL *= SlimDX.Matrix.Translation(-540f, 20f, -24f);
1116 //bar *= SlimDX.Matrix.Scaling(1.0f, 0.65f, 1.0f);
1117 //bar *= SlimDX.Matrix.Scaling( 1.0f, 1.0f, 1.0f );
1118 //barL *= SlimDX.Matrix.Scaling(1.0f, 0.65f, 1.0f);
1119
1120 //bar *= SlimDX.Matrix.RotationAxis( new Vector3( 0f, -0.415f, 0f ), 0.5f );
1121
1122 for( int i = 0; i < 2; i++ )
1123 {
1124 float fRate = 1.0f;
1125 if( i == 0 ) fRate = -1.0f;
1126
1127 barC[ i ] = Matrix.Identity;
1128 barC[ i ] *= SlimDX.Matrix.LookAtLH( VecCam, VecTarg, VecUp );
1129 barC[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( -0.41f * fRate, 0.0f, 0.0f );
1130 barC[ i ] *= SlimDX.Matrix.Translation( 592f * fRate, 148f, 186f);
1131
1132 barLa[ i ] = Matrix.Identity;
1133 barLa[ i ] *= SlimDX.Matrix.LookAtLH( VecCam, VecTarg, VecUp );
1134 barLa[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( -0.41f * fRate, 0.0f, 0.0f );
1135 barLa[ i ] *= SlimDX.Matrix.Translation( 592f * fRate, 100f, 186f);
1136
1137 barU[ i ] = Matrix.Identity;
1138 barU[ i ] *= SlimDX.Matrix.LookAtLH( VecCam, VecTarg, VecUp );
1139 barU[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( -0.41f * fRate, 0.0f, 0.0f );
1140 barU[ i ] *= SlimDX.Matrix.Translation( 592f * fRate, -106f, 186f);
1141 }
1142
1143 if( this.txパネル帯 != null )
1144 {
1145 this.txパネル帯.t3D描画( CDTXMania.app.Device, barU[ 0 ], new Rectangle( 2, 74, 1000, 30 ) );
1146 this.txパネル帯.t3D描画( CDTXMania.app.Device, barU[ 1 ], new Rectangle( 2, 74, 1000, 30 ) );
1147 this.txパネル帯.t3D描画( CDTXMania.app.Device, bar, new Rectangle( 2, 38, 1000, 30 ) ); //右の帯。
1148 this.txパネル帯.t3D描画( CDTXMania.app.Device, barL, new Rectangle( 2, 38, 1000, 30 ) ); //左の帯。
1149 //this.tx帯.t3D描画(CDTXMania.app.Device, barL); //左の帯。
1150 //this.txパネル帯.n透明度 = 155 + this.ct登場アニメ用[10].n現在の値;
1151 this.txパネル帯.t3D描画( CDTXMania.app.Device, barC[ 0 ], new Rectangle( 2, 2, 1000, 30 ) );
1152 this.txパネル帯.t3D描画( CDTXMania.app.Device, barC[ 1 ], new Rectangle( 2, 2, 1000, 30 ) );
1153 }
1154
1155 #region [ デバッグ補助 ]
1156 //-----------------
1157 /*
1158 stマトリックス座標 = new ST中心点[] {
1159 new ST中心点() { x = -980.0000f, y = 4f, z = 350f, rotY = 0.4000f },
1160 new ST中心点() { x = -780.0000f, y = 4f, z = 264f, rotY = 0.4000f },
1161 new ST中心点() { x = -590.0000f, y = 4f, z = 174f, rotY = 0.4000f },
1162 new ST中心点() { x = -400.0000f, y = 4f, z = 92f, rotY = 0.4000f },
1163 new ST中心点() { x = -210.0000f, y = 4f, z = 10f, rotY = 0.4000f },
1164 new ST中心点() { x = 6.00002622683f, y = 2f, z = 0f, rotY = 0f },
1165 new ST中心点() { x = 210.0000f, y = 2f, z = 10f, rotY = -0.4000f },
1166 new ST中心点() { x = 400.0000f, y = 2f, z = 92f, rotY = -0.4f },
1167 new ST中心点() { x = 590.0000f, y = 2f, z = 174f, rotY = -0.4f },
1168 new ST中心点() { x = 780.0000f, y = 2f, z = 264f, rotY = -0.4f },
1169 new ST中心点() { x = 980.0000f, y = 2f, z = 350f, rotY = -0.4f },
1170 new ST中心点() { x = 1200.0000f, y = 2f, z = 450f, rotY = -0.4f },
1171 new ST中心点() { x = 1500.0000f, y = 2f, z = -289.5575f, rotY = -0.9279888f },
1172 new ST中心点() { x = 1500.0000f, y = 2f, z = -289.5575f, rotY = -0.9279888f },
1173 };
1174 */
1175 //-----------------
1176 #endregion
1177
1178 #region[ ジャケット画像のMatrix配列 ]
1179 //パネル1枚1枚にMatrixを割り当ててみる。
1180 //とりあえず構造の最適化無しで地味に作ってみる。
1181 Matrix[] matSongPanel = new SlimDX.Matrix[ 15 ];
1182 Matrix[] matJacket = new SlimDX.Matrix[ 15 ];
1183 ST中心点[] st3D座標 = new ST中心点[] {
1184 #region [ 計算なんてしていない。 ]
1185 //-----------------
1186 //new ST中心点() { x = -1100.0000f, y = 8f, z = 400.0f, rotY = 0.410f },
1187 new ST中心点() { x = -2000.0000f, y = 8f, z = 400.0f, rotY = 0.410f },
1188 new ST中心点() { x = -990.0000f, y = 8f, z = 344.0f, rotY = 0.410f },
1189 new ST中心点() { x = -820.0000f, y = 8f, z = 264f, rotY = 0.410f },
1190 new ST中心点() { x = -666.0000f, y = 8f, z = 198f, rotY = 0.410f },
1191 new ST中心点() { x = -506.0000f, y = 8f, z = 127f, rotY = 0.410f },
1192 new ST中心点() { x = -350.0000f, y = 8f, z = 60f, rotY = 0.410f },
1193 new ST中心点() { x = -194.0000f, y = 8f, z = -6f, rotY = 0.410f },
1194 new ST中心点() { x = 6.00002622683f, y = 8f, z = 0f, rotY = 0.0f }, //7
1195 new ST中心点() { x = 208.0000f, y = 8f, z = 0f, rotY = -0.410f },
1196 new ST中心点() { x = 362.0000f, y = 8f, z = 66f, rotY = -0.410f },
1197 new ST中心点() { x = 518.0000f, y = 8f, z = 132f, rotY = -0.410f },
1198 new ST中心点() { x = 676.0000f, y = 8f, z = 200.0f, rotY = -0.410f },
1199 new ST中心点() { x = 837.0000f, y = 8f, z = 270.0f, rotY = -0.410f },
1200 new ST中心点() { x = 1010.0000f, y = 8f, z = 350.0f, rotY = -0.410f },
1201 new ST中心点() { x = 2000.0000f, y = 8f, z = 450.0f, rotY = -0.410f }
1202 //new ST中心点() { x = 1190.0000f, y = 8f, z = 450.0f, rotY = -0.410f }
1203
1204 //-----------------
1205 #endregion
1206 };
1207
1208 for( int i = 0; i < 15; i++ )
1209 {
1210 matSongPanel[ i ] = Matrix.Identity;
1211 matSongPanel[ i ] *= SlimDX.Matrix.LookAtLH( VecCam, VecTarg, VecUp );
1212 matSongPanel[ i ] *= SlimDX.Matrix.Scaling(0.62f, 0.88f, 1.0f);
1213 //matSongPanel[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( st3D座標[ i ].rotY, 0.0f, 0.0f );
1214 //matSongPanel[ i ] *= SlimDX.Matrix.Translation( st3D座標[ i ].x, st3D座標[ i ].y, st3D座標[ i ].z );
1215
1216
1217 matJacket[ i ] = Matrix.Identity;
1218 matJacket[ i ] *= SlimDX.Matrix.LookAtLH( VecCam, VecTarg, VecUp );
1219 //matJacket[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( st3D座標[ i ].rotY, 0.0f, 0.0f ); //ジャケット画像は計算順序を変える。
1220
1221 //matJacket[ i ] *= SlimDX.Matrix.Translation( st3D座標[ i ].x, 0f, st3D座標[ i ].z );
1222 }
1223 #endregion
1224
1225 if( !this.b登場アニメ全部完了 )
1226 {
1227 #region [ (1) 登場アニメフェーズの描画。]
1228 //-----------------
1229 for( int i = 0; i < 15; i++ ) // パネルは全13枚。
1230 {
1231 if( this.ct登場アニメ用[ i ].n現在の値 >= 0 )
1232 {
1233 int nパネル番号 = ( ( ( this.n現在の選択行 - 7 ) + i ) + 15 ) % 15;
1234
1235 if( i == 8 )
1236 {
1237 #region [ ジャケット画像の描画 ]
1238 //-----------------
1239 if( this.st情報[ nパネル番号 ].txパネル != null )
1240 {
1241 matSongPanel[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( st3D座標[ i ].rotY, 0.0f, 0.0f );
1242 matSongPanel[ i ] *= SlimDX.Matrix.Translation( st3D座標[ i ].x, st3D座標[ i ].y, st3D座標[ i ].z );
1243 this.st情報[ nパネル番号 ].txパネル.t3D描画( CDTXMania.app.Device, matSongPanel[ i ] );
1244 }
1245 if( this.txTumbnail[nパネル番号] != null )
1246 {
1247 float f拡大率 = (float)172.0 / this.txTumbnail[ nパネル番号 ].szテクスチャサイズ.Width;
1248 float f拡大率2 = (float)172.0 / this.txTumbnail[ nパネル番号 ].szテクスチャサイズ.Height;
1249
1250 matJacket[ i ] *= SlimDX.Matrix.Scaling( f拡大率 * CTexture.f画面比率 - 0.084f, f拡大率2 * CTexture.f画面比率 + 0.05f, 1.0f );
1251 matJacket[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( st3D座標[ i ].rotY, 0.0f, 0.0f );
1252 matJacket[ i ] *= SlimDX.Matrix.Translation( st3D座標[ i ].x, st3D座標[ i ].y - 1.5f, st3D座標[ i ].z );
1253
1254 this.txTumbnail[ nパネル番号 ].t3D描画(CDTXMania.app.Device, matJacket[ i ] );
1255 }
1256 //-----------------
1257 #endregion
1258 #region [ タイトル名テクスチャを描画。]
1259 //-----------------
1260 if( this.st情報[nパネル番号].txタイトル名 != null )
1261 {
1262 var mat = SlimDX.Matrix.Identity;
1263 mat *= SlimDX.Matrix.Scaling( 0.35f, 0.45f, 1.0f );
1264 mat *= SlimDX.Matrix.RotationY(this.stマトリックス座標[ i ].rotY + (this.stマトリックス座標[i].rotY - this.stマトリックス座標[i].rotY));
1265 mat *= SlimDX.Matrix.Translation(
1266 (this.stマトリックス座標[i].x + (int)((this.stマトリックス座標[i].x - this.stマトリックス座標[i].x))) * CTexture.f画面比率,
1267 (this.stマトリックス座標[i].y + 110 + (int)((this.stマトリックス座標[i].y - this.stマトリックス座標[i].y))) * CTexture.f画面比率,
1268 (this.stマトリックス座標[i].z + (int)((this.stマトリックス座標[i].z - this.stマトリックス座標[i].z))) * CTexture.f画面比率);
1269 }
1270 if (this.st情報[nパネル番号].txティスト名 != null)
1271 {
1272 var mat = SlimDX.Matrix.Identity;
1273 mat *= SlimDX.Matrix.Scaling(0.35f, 0.45f, 1.0f);
1274 mat *= SlimDX.Matrix.RotationY(this.stマトリックス座標[i].rotY + (this.stマトリックス座標[i].rotY - this.stマトリックス座標[i].rotY));
1275 mat *= SlimDX.Matrix.Translation(
1276 (this.stマトリックス座標[i].x + (int)((this.stマトリックス座標[i].x - this.stマトリックス座標[i].x))) * CTexture.f画面比率,
1277 (this.stマトリックス座標[i].y - 110 + (int)((this.stマトリックス座標[i].y - this.stマトリックス座標[i].y))) * CTexture.f画面比率,
1278 (this.stマトリックス座標[i].z + (int)((this.stマトリックス座標[i].z - this.stマトリックス座標[i].z))) * CTexture.f画面比率);
1279 }
1280 //-----------------
1281 #endregion
1282 if( this.tx選曲パネル != null )
1283 this.tx選曲パネル.t2D描画( CDTXMania.app.Device, 761, 233, new Rectangle( 304, 70, 59, 242 ) );
1284 }
1285 else if( i == 7 )
1286 {
1287 }
1288 else
1289 {
1290 // (B) その他のパネルの描画。
1291 #region [ ジャケット画像の描画 ]
1292 //-----------------
1293 if( this.st情報[ nパネル番号 ].txパネル != null )
1294 {
1295 matSongPanel[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( st3D座標[ i ].rotY, 0.0f, 0.0f );
1296 matSongPanel[ i ] *= SlimDX.Matrix.Translation( st3D座標[ i ].x, st3D座標[ i ].y, st3D座標[ i ].z );
1297 this.st情報[ nパネル番号 ].txパネル.t3D描画( CDTXMania.app.Device, matSongPanel[ i ] );
1298 }
1299 if( this.txTumbnail[nパネル番号] != null )
1300 {
1301 float f拡大率 = (float)172.0 / this.txTumbnail[nパネル番号].szテクスチャサイズ.Width ;
1302 float f拡大率2 = (float)172.0 / this.txTumbnail[nパネル番号].szテクスチャサイズ.Height;
1303
1304 matJacket[ i ] *= SlimDX.Matrix.Scaling( f拡大率 * CTexture.f画面比率 - 0.084f, f拡大率2 * CTexture.f画面比率 + 0.05f, 1.0f );
1305 matJacket[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( st3D座標[ i ].rotY, 0.0f, 0.0f );
1306 matJacket[ i ] *= SlimDX.Matrix.Translation( st3D座標[ i ].x, st3D座標[ i ].y - 1.5f, st3D座標[ i ].z );
1307
1308 this.txTumbnail[nパネル番号].t3D描画( CDTXMania.app.Device, matJacket[ i ] );
1309 }
1310 //-----------------
1311 #endregion
1312 }
1313 }
1314 }
1315
1316 int n選択曲のパネル番号 = ( ( ( this.n現在の選択行 - 7 ) + 7 ) + 15 ) % 15;
1317 #region[ ランプ帯 ]
1318 if( this.txパネル帯 != null )
1319 {
1320 this.txパネル帯.t3D描画( CDTXMania.app.Device, barLa[ 0 ], new Rectangle( 2, 110, 1000, 20 ) );
1321 this.txパネル帯.t3D描画( CDTXMania.app.Device, barLa[ 1 ], new Rectangle( 2, 110, 1000, 20 ) );
1322 }
1323 #endregion
1324 #region[ 中央パネル ]
1325 if( this.tx選曲パネル != null )
1326 this.tx選曲パネル.t2D描画(CDTXMania.app.Device, 457, 163, new Rectangle( 0, 0, 363, 368 ) );
1327 #endregion
1328 #region[ クリアランプ ]
1329 for( int la = 0; la < 5 ; la++ )
1330 {
1331 if( this.txクリアランプ != null && CDTXMania.stage選曲.r現在選択中の曲.ar難易度ラベル[ la ] != null && CDTXMania.stage選曲.r現在選択中の曲.arスコア[ la ] != null )
1332 this.txクリアランプ.t2D描画( CDTXMania.app.Device, 506, 292 - la * 13, new Rectangle(( CDTXMania.stage選曲.r現在選択中の曲.arスコア[ la ].譜面情報.最大スキル.Drums != 0 ? 11 + la * 11 : 0), ( CDTXMania.stage選曲.r現在選択中の曲.arスコア[ la ].譜面情報.フルコンボ.Drums ? 10 : 0 ), 11, 10 ));
1333 }
1334 #endregion
1335 #region[ ジャケット画像 ]
1336 if ( this.txTumbnail[ n選択曲のパネル番号 ] != null )
1337 {
1338 float f拡大率 = (float)218.0 / this.txTumbnail[ n選択曲のパネル番号 ].szテクスチャサイズ.Width;
1339 float f拡大率2 = (float)218.0 / this.txTumbnail[ n選択曲のパネル番号 ].szテクスチャサイズ.Height;
1340 this.txTumbnail[ n選択曲のパネル番号 ].vc拡大縮小倍率 = new Vector3( f拡大率, f拡大率2, 1.0f );
1341 this.txTumbnail[ n選択曲のパネル番号 ].t2D描画(CDTXMania.app.Device, 537, 249 );
1342 this.txTumbnail[ n選択曲のパネル番号 ].vc拡大縮小倍率 = new Vector3( 1.0f, 1.0f, 1.0f );
1343 }
1344 #endregion
1345 #region[ タイトル・アーティスト名 ]
1346 //曲名テクスチャ 生成
1347 if( File.Exists( this.st情報[ n選択曲のパネル番号 ].strDTXフォルダのパス + "TitleTexture.png" ) && this.tx選択されている曲の曲名 == null )
1348 {
1349 this.tx選択されている曲の曲名 = this.tカスタム曲名の生成( n選択曲のパネル番号 );
1350 }
1351 else
1352 {
1353 if( this.st情報[ n選択曲のパネル番号 ].strタイトル文字列 != "" && this.st情報[ n選択曲のパネル番号 ].strタイトル文字列 != null && this.tx選択されている曲の曲名 == null )
1354 this.tx選択されている曲の曲名 = this.t指定された文字テクスチャを生成する( this.st情報[ n選択曲のパネル番号 ].strタイトル文字列, this.st情報[ n選択曲のパネル番号 ].col文字色 );
1355 }
1356 //曲名テクスチャ 描画
1357 if( this.tx選択されている曲の曲名 != null )
1358 this.tx選択されている曲の曲名.t2D描画( CDTXMania.app.Device, 552, 210 );
1359
1360 //アーティスト名テクスチャ 生成と描画
1361
1362 if( File.Exists( this.st情報[ n選択曲のパネル番号 ].strDTXフォルダのパス + "ArtistTexture.png" ) )
1363 {
1364 if( this.tx選択されている曲のアティスト名 == null )
1365 this.tx選択されている曲のアティスト名 = this.tカスタムアティスト名テクスチャの生成( n選択曲のパネル番号 );
1366
1367 if( this.tx選択されている曲のアティスト名 != null )
1368 this.tx選択されている曲のアティスト名.t2D描画( CDTXMania.app.Device, 552, 470 );
1369 }
1370 else if( !File.Exists( this.st情報[ n選択曲のパネル番号 ].strDTXフォルダのパス + "ArtistTexture.png" ) )
1371 {
1372 if( this.st情報[ n選択曲のパネル番号 ].strティスト名 != "" && this.st情報[ n選択曲のパネル番号 ].strティスト名 != null && this.tx選択されている曲のアティスト名 == null )
1373 this.tx選択されている曲のアティスト名 = this.t指定された文字テクスチャを生成する( this.st情報[ n選択曲のパネル番号 ].strティスト名, Color.Black );
1374
1375 if( this.tx選択されている曲のアティスト名 != null )
1376 {
1377 int nティスト名X座標 = 763 - (int)( this.tx選択されている曲のアティスト名.szテクスチャサイズ.Width * 0.75f );
1378 this.tx選択されている曲のアティスト名.t2D描画( CDTXMania.app.Device, nティスト名X座標, 470 );
1379 }
1380 }
1381 #endregion
1382 //-----------------
1383 #endregion
1384
1385 }
1386 else
1387 {
1388 //CDTXMania.act文字コンソール.tPrint( 0, 0, C文字コンソール.Eフォント種別.白, this.n現在のスクロールカウンタ.ToString() );
1389 #region [ (2) 通常フェーズの描画。]
1390 //-----------------
1391 for( int i = 0; i < 15; i++ ) // パネルは全13枚。
1392 {
1393 int nパネル番号 = ( ( ( this.n現在の選択行 - 7 ) + i ) + 15 ) % 15;
1394 int n見た目の行番号 = i;
1395 int n次のパネル番号 = ( this.n現在のスクロルカウンタ <= 0 ) ? ( ( i + 1 ) % 15 ) : ( ( ( i - 1 ) + 15 ) % 15 );
1396 int x = this.ptの基本座標[ n見た目の行番号 ].X + ( (int) ( ( this.ptの基本座標[ n次のパネル番号 ].X - this.ptの基本座標[ n見た目の行番号 ].X ) * ( ( (double) Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0 ) ) );
1397 int y = this.ptの基本座標[ n見た目の行番号 ].Y + ( (int) ( ( this.ptの基本座標[ n次のパネル番号 ].Y - this.ptの基本座標[ n見た目の行番号 ].Y ) * ( ( (double) Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0 ) ) );
1398 float fX = this.n現在のスクロルカウンタ <= 0 ? st3D座標[ n見た目の行番号 ].x + ( ( ( st3D座標[ n次のパネル番号 ].x - st3D座標[ n見た目の行番号 ].x ) * ( Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0f ) ) :
1399 st3D座標[ n見た目の行番号 ].x + ( ( ( st3D座標[ n次のパネル番号 ].x - st3D座標[ n見た目の行番号 ].x ) * ( Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0f ) );
1400
1401 float fY = this.n現在のスクロルカウンタ <= 0 ? st3D座標[ n見た目の行番号 ].y + ( ( ( st3D座標[ n次のパネル番号 ].y + st3D座標[ n見た目の行番号 ].y ) * ( Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0f ) ) :
1402 st3D座標[ n見た目の行番号 ].y + ( ( ( st3D座標[ n次のパネル番号 ].y + st3D座標[ n見た目の行番号 ].y ) * ( Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0f ) );
1403
1404 float fZ = this.n現在のスクロルカウンタ <= 0 ? st3D座標[ n見た目の行番号 ].z + ( ( ( st3D座標[ n次のパネル番号 ].z - st3D座標[ n見た目の行番号 ].z ) * ( Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0f ) ) :
1405 st3D座標[ n見た目の行番号 ].z + ( ( ( st3D座標[ n次のパネル番号 ].z - st3D座標[ n見た目の行番号 ].z ) * ( Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0f ) );
1406
1407 float fR = this.n現在のスクロルカウンタ <= 0 ? st3D座標[ n見た目の行番号 ].rotY + ( ( ( st3D座標[ n次のパネル番号 ].rotY - st3D座標[ n見た目の行番号 ].rotY ) * ( Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0f ) ) :
1408 st3D座標[ n見た目の行番号 ].rotY + ( ( ( st3D座標[ n次のパネル番号 ].rotY - st3D座標[ n見た目の行番号 ].rotY ) * ( Math.Abs( this.n現在のスクロルカウンタ ) ) / 100.0f ) );
1409
1410 //デバッグ用
1411 //if( i == 7 ){
1412 // CDTXMania.act文字コンソール.tPrint( 0, 16 * i, C文字コンソール.Eフォント種別.赤, i.ToString() + " " + this.stバー情報[ nパネル番号 ].strタイトル文字列.ToString() );
1413 //}else{
1414 // CDTXMania.act文字コンソール.tPrint( 0, 16 * i, C文字コンソール.Eフォント種別.白, i.ToString() + " " + this.stバー情報[ nパネル番号 ].strタイトル文字列.ToString() );
1415 //}
1416
1417
1418
1419 if( i == 8 )
1420 {
1421 #region [ ジャケット画像の描画 ]
1422 //-----------------
1423 if( this.st情報[ nパネル番号 ].txパネル != null )
1424 {
1425 matSongPanel[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( fR, 0.0f, 0.0f );
1426 matSongPanel[ i ] *= SlimDX.Matrix.Translation( fX, st3D座標[ i ].y, fZ );
1427 this.st情報[ nパネル番号 ].txパネル.t3D描画( CDTXMania.app.Device, matSongPanel[ i ] );
1428 }
1429 if( this.dicThumbnail[ this.st情報[ nパネル番号 ].strPreimageのパス ] != null )
1430 {
1431 float f拡大率X = (float) 172.0 / this.dicThumbnail[ this.st情報[ nパネル番号 ].strPreimageのパス ].szテクスチャサイズ.Width;
1432 float f拡大率Y = (float) 172.0 / this.dicThumbnail[ this.st情報[ nパネル番号 ].strPreimageのパス ].szテクスチャサイズ.Height;
1433
1434
1435 matJacket[ i ] *= SlimDX.Matrix.Scaling( f拡大率X * CTexture.f画面比率 - 0.084f, f拡大率Y * CTexture.f画面比率 + 0.05f, 1.0f );
1436 matJacket[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( fR, 0.0f, 0.0f );
1437 matJacket[ i ] *= SlimDX.Matrix.Translation( fX, st3D座標[ i ].y - 1.5f, fZ );
1438
1439 this.dicThumbnail[ this.st情報[ nパネル番号 ].strPreimageのパス ].t3D描画(CDTXMania.app.Device, matJacket[ i ] );
1440 }
1441 //if (this.txTumbnail[ nパネル番号 ] != null)
1442 //{
1443 // float f拡大率 = (float)172.0 / this.txTumbnail[nパネル番号].szテクスチャサイズ.Width;
1444 // float f拡大率2 = (float)172.0 / this.txTumbnail[nパネル番号].szテクスチャサイズ.Height;
1445
1446 // matJacket[ i ] *= SlimDX.Matrix.Scaling( f拡大率 * CTexture.f画面比率 - 0.084f, f拡大率2 * CTexture.f画面比率 + 0.05f, 1.0f );
1447 // matJacket[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( fR, 0.0f, 0.0f );
1448 // matJacket[ i ] *= SlimDX.Matrix.Translation( fX, st3D座標[ i ].y - 1.5f, fZ );
1449
1450 // this.txTumbnail[ nパネル番号 ].t3D描画(CDTXMania.app.Device, matJacket[ i ] );
1451 //}
1452 //-----------------
1453 #endregion
1454 }
1455 else if( i == 7 || i == 0 || i == 14)
1456 {
1457 //選択曲、画面外の曲のジャケット画像は表示しない。
1458 }
1459 else
1460 {
1461 #region [ ジャケット画像の描画 ]
1462 //-----------------
1463 if( this.st情報[ nパネル番号 ].txパネル != null )
1464 {
1465 matSongPanel[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( st3D座標[ i ].rotY, 0.0f, 0.0f );
1466 matSongPanel[ i ] *= SlimDX.Matrix.Translation( fX, st3D座標[ i ].y, fZ );
1467 this.st情報[ nパネル番号 ].txパネル.t3D描画( CDTXMania.app.Device, matSongPanel[ i ] );
1468 }
1469 if( this.dicThumbnail[ this.st情報[ nパネル番号 ].strPreimageのパス ] != null )
1470 {
1471 float f拡大率X = (float) 172.0 / this.dicThumbnail[ this.st情報[ nパネル番号 ].strPreimageのパス ].szテクスチャサイズ.Width;
1472 float f拡大率Y = (float) 172.0 / this.dicThumbnail[ this.st情報[ nパネル番号 ].strPreimageのパス ].szテクスチャサイズ.Height;
1473
1474
1475 matJacket[ i ] *= SlimDX.Matrix.Scaling( f拡大率X * CTexture.f画面比率 - 0.084f, f拡大率Y * CTexture.f画面比率 + 0.05f, 1.0f );
1476 matJacket[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( st3D座標[ i ].rotY, 0.0f, 0.0f );
1477 matJacket[ i ] *= SlimDX.Matrix.Translation( fX, st3D座標[ i ].y - 1.5f, fZ );
1478
1479 this.dicThumbnail[ this.st情報[ nパネル番号 ].strPreimageのパス ].t3D描画(CDTXMania.app.Device, matJacket[ i ] );
1480 }
1481 //if( this.txTumbnail[ nパネル番号 ] != null )
1482 //{
1483 // float f拡大率 = (float)172.0 / this.txTumbnail[ nパネル番号 ].szテクスチャサイズ.Width ;
1484 // float f拡大率2 = (float)172.0 / this.txTumbnail[ nパネル番号 ].szテクスチャサイズ.Height;
1485
1486 // matJacket[ i ] *= SlimDX.Matrix.Scaling( f拡大率 * CTexture.f画面比率 - 0.084f, f拡大率2 * CTexture.f画面比率 + 0.05f, 1.0f );
1487 // matJacket[ i ] *= SlimDX.Matrix.RotationYawPitchRoll( );
1488 // matJacket[ i ] *= SlimDX.Matrix.Translation( fX, st3D座標[ i ].y - 1.5f, fZ );
1489
1490 // this.txTumbnail[ nパネル番号 ].t3D描画( CDTXMania.app.Device, matJacket[ i ] );
1491 //}
1492 //-----------------
1493 #endregion
1494 }
1495 }
1496
1497 //選択中の曲
1498 int n選択曲のパネル番号 = ( ( ( this.n現在の選択行 - 7 ) + 7 ) + 15 ) % 15;
1499 #region[ ランプ帯 ]
1500 if( this.txパネル帯 != null )
1501 {
1502 this.txパネル帯.t3D描画( CDTXMania.app.Device, barLa[ 0 ], new Rectangle( 2, 110, 1000, 20 ) );
1503 this.txパネル帯.t3D描画( CDTXMania.app.Device, barLa[ 1 ], new Rectangle( 2, 110, 1000, 20 ) );
1504 }
1505 #endregion
1506 #region[ 中央パネル ]
1507 if( this.tx選曲パネル != null )
1508 this.tx選曲パネル.t2D描画(CDTXMania.app.Device, 457, 163, new Rectangle( 0, 0, 363, 368 ) );
1509 #endregion
1510 #region[ クリアランプ ]
1511 for( int la = 0; la < 5 ; la++ )
1512 {
1513 if( this.txクリアランプ != null && CDTXMania.stage選曲.r現在選択中の曲.ar難易度ラベル[ la ] != null && CDTXMania.stage選曲.r現在選択中の曲.arスコア[ la ] != null )
1514 this.txクリアランプ.t2D描画( CDTXMania.app.Device, 506, 292 - la * 13, new Rectangle(( CDTXMania.stage選曲.r現在選択中の曲.arスコア[ la ].譜面情報.最大スキル.Drums != 0 ? 11 + la * 11 : 0), ( CDTXMania.stage選曲.r現在選択中の曲.arスコア[ la ].譜面情報.フルコンボ.Drums ? 10 : 0 ), 11, 10 ));
1515 }
1516 #endregion
1517 #region[ ジャケット画像 ]
1518 if( this.dicThumbnail[ this.st情報[ n選択曲のパネル番号 ].strPreimageのパス ] != null )
1519 {
1520 float f拡大率X = (float) 218.0 / this.dicThumbnail[ this.st情報[n選択曲のパネル番号].strPreimageのパス ].szテクスチャサイズ.Width;
1521 float f拡大率Y = (float) 218.0 / this.dicThumbnail[ this.st情報[n選択曲のパネル番号].strPreimageのパス ].szテクスチャサイズ.Height;
1522
1523 this.dicThumbnail[ this.st情報[n選択曲のパネル番号].strPreimageのパス ].vc拡大縮小倍率 = new Vector3( f拡大率X, f拡大率Y, 1.0f );
1524 this.dicThumbnail[ this.st情報[n選択曲のパネル番号].strPreimageのパス ].t2D描画(CDTXMania.app.Device, 537, 249 );
1525 this.dicThumbnail[ this.st情報[n選択曲のパネル番号].strPreimageのパス ].vc拡大縮小倍率 = new Vector3( 1.0f, 1.0f, 1.0f );
1526 }
1527 //if ( this.txTumbnail[ n選択曲のパネル番号 ] != null )
1528 //{
1529 // float f拡大率 = (float)218.0 / this.txTumbnail[ n選択曲のパネル番号 ].szテクスチャサイズ.Width;
1530 // float f拡大率2 = (float)218.0 / this.txTumbnail[ n選択曲のパネル番号 ].szテクスチャサイズ.Height;
1531 // this.txTumbnail[ n選択曲のパネル番号 ].vc拡大縮小倍率 = new Vector3( f拡大率, f拡大率2, 1.0f );
1532 // this.txTumbnail[ n選択曲のパネル番号 ].t2D描画(CDTXMania.app.Device, 537, 249 );
1533 // this.txTumbnail[ n選択曲のパネル番号 ].vc拡大縮小倍率 = new Vector3( 1.0f, 1.0f, 1.0f );
1534 //}
1535 #endregion
1536 #region[ タイトル・アーティスト名 ]
1537 //曲名テクスチャ 生成
1538 if( File.Exists( this.st情報[ n選択曲のパネル番号 ].strDTXフォルダのパス + "TitleTexture.png" ) && this.tx選択されている曲の曲名 == null )
1539 {
1540 this.tx選択されている曲の曲名 = this.tカスタム曲名の生成( n選択曲のパネル番号 );
1541 }
1542 else
1543 {
1544 if( this.st情報[ n選択曲のパネル番号 ].strタイトル文字列 != "" && this.st情報[ n選択曲のパネル番号 ].strタイトル文字列 != null && this.tx選択されている曲の曲名 == null )
1545 this.tx選択されている曲の曲名 = this.t指定された文字テクスチャを生成する( this.st情報[ n選択曲のパネル番号 ].strタイトル文字列, this.st情報[ n選択曲のパネル番号 ].col文字色 );
1546 }
1547 //曲名テクスチャ 描画
1548 if( this.tx選択されている曲の曲名 != null )
1549 this.tx選択されている曲の曲名.t2D描画( CDTXMania.app.Device, 552, 210 );
1550
1551 //アーティスト名テクスチャ 生成と描画
1552
1553 if( File.Exists( this.st情報[ n選択曲のパネル番号 ].strDTXフォルダのパス + "ArtistTexture.png" ) )
1554 {
1555 if( this.tx選択されている曲のアティスト名 == null )
1556 this.tx選択されている曲のアティスト名 = this.tカスタムアティスト名テクスチャの生成( n選択曲のパネル番号 );
1557
1558 if( this.tx選択されている曲のアティスト名 != null )
1559 this.tx選択されている曲のアティスト名.t2D描画( CDTXMania.app.Device, 552, 470 );
1560 }
1561 else if( !File.Exists( this.st情報[ n選択曲のパネル番号 ].strDTXフォルダのパス + "ArtistTexture.png" ) )
1562 {
1563 if( this.st情報[ n選択曲のパネル番号 ].strティスト名 != "" && this.st情報[ n選択曲のパネル番号 ].strティスト名 != null && this.tx選択されている曲のアティスト名 == null )
1564 this.tx選択されている曲のアティスト名 = this.t指定された文字テクスチャを生成する( this.st情報[ n選択曲のパネル番号 ].strティスト名, Color.Black );
1565
1566 if( this.tx選択されている曲のアティスト名 != null )
1567 {
1568 int nティスト名X座標 = 763 - (int)( this.tx選択されている曲のアティスト名.szテクスチャサイズ.Width * 0.75f );
1569 this.tx選択されている曲のアティスト名.t2D描画( CDTXMania.app.Device, nティスト名X座標, 470 );
1570 }
1571 }
1572 #endregion
1573 //-----------------
1574 #endregion
1575
1576 }
1577 #region [ スクロール地点の計算(描画はCActSelectShowCurrentPositionにて行う) #27648 ]
1578 int py;
1579 double d = 0;
1580 if ( nNumOfItems > 1 )
1581 {
1582 d = ( 336 - 8 ) / (double) ( nNumOfItems - 1 );
1583 py = (int) ( d * ( nCurrentPosition - 1 ) );
1584 }
1585 else
1586 {
1587 d = 0;
1588 py = 0;
1589 }
1590 int delta = (int) ( d * this.n現在のスクロルカウンタ / 100 );
1591 if ( py + delta <= 336 - 8 )
1592 {
1593 this.nスクロルバ相対y座標 = py + delta;
1594 }
1595 #endregion
1596
1597 #region [ アイテム数の描画 #27648 ]
1598 tアイテム数の描画();
1599 #endregion
1600 return 0;
1601 }
1602
1603
1604 // その他
1605
1606 #region [ private ]
1607 //-----------------
1608 private enum E種別 { Score, Box, Other, Random, BackBox }
1609
1610 private struct ST
1611 {
1612 public CTexture Score;
1613 public CTexture Box;
1614 public CTexture Other;
1615 public CTexture Random;
1616 public CTexture BackBox;
1617 public CTexture this[ int index ]
1618 {
1619 get
1620 {
1621 switch( index )
1622 {
1623 case 0:
1624 return this.Score;
1625
1626 case 1:
1627 return this.Box;
1628
1629 case 2:
1630 return this.Other;
1631
1632 case 3:
1633 return this.Random;
1634
1635 case 4:
1636 return this.BackBox;
1637 }
1638 throw new IndexOutOfRangeException();
1639 }
1640 set
1641 {
1642 switch( index )
1643 {
1644 case 0:
1645 this.Score = value;
1646 return;
1647
1648 case 1:
1649 this.Box = value;
1650 return;
1651
1652 case 2:
1653 this.Other = value;
1654 return;
1655
1656 case 3:
1657 this.Random = value;
1658 return;
1659
1660 case 4:
1661 this.BackBox = value;
1662 return;
1663 }
1664 throw new IndexOutOfRangeException();
1665 }
1666 }
1667 }
1668
1669 private struct ST情報
1670 {
1671 public CActSelect曲リスト.E種別 e種別;
1672 public string strタイトル文字列;
1673 public string strティスト名;
1674 public CTexture txタイトル名;
1675 public CTexture txティスト名;
1676 public CTexture txパネル;
1677 public CTexture txカスタム曲名テクスチャ;
1678 public CTexture txカスタムアティスト名テクスチャ;
1679 public int nティスト名テクスチャの長さdot;
1680 public int nタイトル名テクスチャの長さdot;
1681 public STDGBVALUE<int> nスキル値;
1682 public Color col文字色;
1683 public string strDTXフォルダのパス;
1684 public string strPreimageのパス;
1685 public Cスコア.ST譜面情報 ar譜面情報;
1686 }
1687
1688 private struct ST選曲バ
1689 {
1690 public CTexture Score;
1691 public CTexture Box;
1692 public CTexture Other;
1693 public CTexture this[ int index ]
1694 {
1695 get
1696 {
1697 switch( index )
1698 {
1699 case 0:
1700 return this.Score;
1701
1702 case 1:
1703 return this.Box;
1704
1705 case 2:
1706 return this.Other;
1707 }
1708 throw new IndexOutOfRangeException();
1709 }
1710 set
1711 {
1712 switch( index )
1713 {
1714 case 0:
1715 this.Score = value;
1716 return;
1717
1718 case 1:
1719 this.Box = value;
1720 return;
1721
1722 case 2:
1723 this.Other = value;
1724 return;
1725 }
1726 throw new IndexOutOfRangeException();
1727 }
1728 }
1729 }
1730
1731 protected struct ST中心点
1732 {
1733 public float x;
1734 public float y;
1735 public float z;
1736 public float rotY;
1737 }
1738 /// <summary>
1739 /// <para>SSTFファイル絶対パス(key)とサムネイル画像(value)との辞書。</para>
1740 /// <para>アプリの起動から終了まで単純に増加を続け、要素が減ることはない。</para>
1741 /// </summary>
1742 protected Dictionary<string, CTexture> dicThumbnail = new Dictionary<string, CTexture>();
1743
1744 /// <summary>
1745 /// <para>SSTFファイル絶対パス(key)とプロパティ画像(value)との辞書。</para>
1746 /// <para>アプリの起動から終了まで単純に増加を続け、要素が減ることはない。</para>
1747 /// </summary>
1748 protected Dictionary<string, CTexture> dicProperty = new Dictionary<string, CTexture>();
1749
1750 protected ST中心点[] stマトリックス座標 = new ST中心点[] {
1751 #region [ 実は円弧配置になってない。射影行列間違ってるよスターレインボウ見せる気かよ… ]
1752 //-----------------
1753 new ST中心点() { x = -940.0000f, y = 4f, z = 320f, rotY = 0.4150f },
1754 new ST中心点() { x = -740.0000f, y = 4f, z = 230f, rotY = 0.4150f },
1755 new ST中心点() { x = -550.0000f, y = 4f, z = 150f, rotY = 0.4150f },
1756 new ST中心点() { x = -370.0000f, y = 4f, z = 70f, rotY = 0.4150f },
1757 new ST中心点() { x = -194.0000f, y = 4f, z = -6f, rotY = 0.4150f },
1758 new ST中心点() { x = 6.00002622683f, y = 2f, z = 0f, rotY = 0f },
1759 new ST中心点() { x = 204.0000f, y = 4f, z = 0f, rotY = -0.4150f },
1760 new ST中心点() { x = 362.0000f, y = 4f, z = 70f, rotY = -0.4150f },
1761 new ST中心点() { x = 528.0000f, y = 4f, z = 146f, rotY = -0.4150f },
1762 new ST中心点() { x = 686.0000f, y = 4f, z = 212f, rotY = -0.4150f },
1763 new ST中心点() { x = 848.0000f, y = 4f, z = 282f, rotY = -0.4150f },
1764 new ST中心点() { x = 1200.0000f, y = 4f, z = 450f, rotY = -0.4150f },
1765 new ST中心点() { x = 1500.0000f, y = 4f, z = -289.5575f, rotY = -0.9279888f },
1766 new ST中心点() { x = 1500.0000f, y = 4f, z = -289.5575f, rotY = -0.9279888f },
1767 //-----------------
1768 #endregion
1769 };
1770
1771 protected readonly ST中心点[] stマトリックス曲名座標 = new ST中心点[] {
1772 #region [ 実は円弧配置になってない。射影行列間違ってるよスターレインボウ見せる気かよ… ]
1773 //-----------------
1774 new ST中心点() { x = -980.0000f, y = 4f, z = 350f, rotY = 0.4000f },
1775 new ST中心点() { x = -780.0000f, y = 4f, z = 264f, rotY = 0.4000f },
1776 new ST中心点() { x = -590.0000f, y = 4f, z = 174f, rotY = 0.4000f },
1777 new ST中心点() { x = -400.0000f, y = 4f, z = 92f, rotY = 0.4000f },
1778 new ST中心点() { x = -210.0000f, y = 4f, z = 10f, rotY = 0.4000f },
1779 new ST中心点() { x = 6.00002622683f, y = 2f, z = 0f, rotY = 0f },
1780 new ST中心点() { x = 210.0000f, y = 2f, z = 10f, rotY = -0.4000f },
1781 new ST中心点() { x = 400.0000f, y = 2f, z = 92f, rotY = -0.4f },
1782 new ST中心点() { x = 590.0000f, y = 2f, z = 174f, rotY = -0.4f },
1783 new ST中心点() { x = 780.0000f, y = 2f, z = 264f, rotY = -0.4f },
1784 new ST中心点() { x = 980.0000f, y = 2f, z = 350f, rotY = -0.4f },
1785 new ST中心点() { x = 1200.0000f, y = 2f, z = 450f, rotY = -0.4f },
1786 new ST中心点() { x = 1500.0000f, y = 2f, z = -289.5575f, rotY = -0.9279888f },
1787 new ST中心点() { x = 1500.0000f, y = 2f, z = -289.5575f, rotY = -0.9279888f },
1788 //-----------------
1789 #endregion
1790 };
1791 [StructLayout(LayoutKind.Sequential)]
1792 public struct STATUSPANEL
1793 {
1794 public string label;
1795 public int status;
1796 }
1797 public int nIndex;
1798 public STATUSPANEL[] stパネルマップ;
1799
1800 public bool b登場アニメ全部完了;
1801 private Color color文字影 = Color.FromArgb( 0x40, 10, 10, 10 );
1802 public CCounter[] ct登場アニメ用 = new CCounter[ 15 ];
1803 private Font ft曲リスト用フォント;
1804 private long nスクロルタイマ;
1805 private int n現在のスクロルカウンタ;
1806 private int n現在の選択行;
1807 private int n目標のスクロルカウンタ;
1808 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), new Point(0x3e4, 0x282), new Point(0x500, 0x2b5) };
1809 private ST情報[] st情報 = new ST情報[ 15 ];
1810 private CTexture txSongNotFound, txEnumeratingSongs;
1811 private CTexture txアイテム数数字;
1812 private CTexture[] txTumbnail = new CTexture[15];
1813 private CTexture tx選曲パネル;
1814 private CTexture txパネル;
1815 private CTexture txパネル帯;
1816 private CTexture tx選択されている曲の曲名;
1817 private CTexture tx選択されている曲のアティスト名;
1818 private CTexture txクリアランプ;
1819 //CPrivateFont prvFont;
1820 private CPrivateFastFont prvFont;
1821
1822 private int nCurrentPosition = 0;
1823 private int nNumOfItems = 0;
1824
1825 //private string strBoxDefSkinPath = "";
1826 private E種別 e曲のバ種別を返す( C曲リストノ song )
1827 {
1828 if( song != null )
1829 {
1830 switch( song.eド種別 )
1831 {
1832 case C曲リストノ.Eド種別.SCORE:
1833 case C曲リストノ.Eド種別.SCORE_MIDI:
1834 return E種別.Score;
1835
1836 case C曲リストノ.Eド種別.BOX:
1837 return E種別.Box;
1838
1839 case C曲リストノ.Eド種別.BACKBOX:
1840 return E種別.BackBox;
1841
1842 case C曲リストノ.Eド種別.RANDOM:
1843 return E種別.Random;
1844 }
1845 }
1846 return E種別.Other;
1847 }
1848 private C曲リストノ r次の曲( C曲リストノ song )
1849 {
1850 if( song == null )
1851 return null;
1852
1853 List<C曲リストノ> list = ( song.r親ノ != null ) ? song.r親ノ.list子リスト : CDTXMania.Songs管理.list曲ル;
1854
1855 int index = list.IndexOf( song );
1856
1857 if( index < 0 )
1858 return null;
1859
1860 if( index == ( list.Count - 1 ) )
1861 return list[ 0 ];
1862
1863 return list[ index + 1 ];
1864 }
1865 private C曲リストノ r前の曲( C曲リストノ song )
1866 {
1867 if( song == null )
1868 return null;
1869
1870 List<C曲リストノ> list = ( song.r親ノ != null ) ? song.r親ノ.list子リスト : CDTXMania.Songs管理.list曲ル;
1871
1872 int index = list.IndexOf( song );
1873
1874 if( index < 0 )
1875 return null;
1876
1877 if( index == 0 )
1878 return list[ list.Count - 1 ];
1879
1880 return list[ index - 1 ];
1881 }
1882
1883 private void tの初期化()
1884 {
1885 C曲リストノ song = this.r現在選択中の曲;
1886
1887 if( song == null )
1888 return;
1889
1890 //Trace.TraceInformation("バーの初期化処理開始");
1891
1892 for( int i = 0; i < 7; i++ )
1893 song = this.r前の曲( song );
1894
1895 for( int i = 0; i < 15; i++ )
1896 {
1897 this.st情報[ i ].strタイトル文字列 = song.strタイトル;
1898 this.st情報[ i ].strティスト名 = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.ティスト名;
1899 this.st情報[ i ].col文字色 = song.col文字色;
1900 this.st情報[ i ].e種別 = this.e曲のバ種別を返す( song );
1901 this.st情報[ i ].ar譜面情報 = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報;
1902
1903 //for( int n = 0; n < 5; n++ )
1904 {
1905 //this.stバー情報[ i ].ar難易度ラベル[ n ];
1906
1907 //if( this.stバー情報[ i ].ar難易度ラベル[ n ] != null )
1908 //this.stバー情報[ i ].ar難易度ラベル[ n ] = song.ar難易度ラベル[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ];
1909 }
1910
1911 this.st情報[ i ].strDTXフォルダのパス = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].ファイル情報.フォルダの絶対パス;
1912 this.st情報[ i ].strPreimageのパス = song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].ファイル情報.フォルダの絶対パス + song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.Preimage;
1913
1914 // 2019.4.26 kairera0467 バーの初期化は複数回行われる場合があるので、再構築する時には一度解放してから構築するほうが解放漏れは少なくなるはず。
1915 CDTXMania.tテクスチャの解放( ref this.st情報[ i ].txパネル );
1916 // CDTXMania.tテクスチャの解放( ref this.txTumbnail[ i ] );
1917
1918 this.tパネルの生成( i, song.strタイトル, this.st情報[ i ].strティスト名, song.col文字色 );
1919 if( this.st情報[ i ].strPreimageのパス != null )
1920 {
1921 if( !this.dicThumbnail.ContainsKey( this.st情報[ i ].strPreimageのパス ) )
1922 {
1923 //txTumbnail = this.tサムネイルテクスチャを作成する( Path.GetDirectoryName( song.ScoreFile ) );
1924 //this.tパスを指定してサムネイル画像を生成する( i, this.stバー情報[ i ].strPreimageのパス, this.stバー情報[ i ].eバー種別 );
1925
1926 this.dicThumbnail.Add( this.st情報[ i ].strPreimageのパス,
1927 this.tパスを指定してサムネイル画像を生成して返す(i, this.st情報[ i ].strPreimageのパス, this.st情報[ i ].e種別) );
1928 }
1929 //else if( this.dicThumbnail[ this.stバー情報[ i ].strPreimageのパス ]?.texture == null )
1930 //{
1931 // // キーは存在するがテクスチャがnullの場合は再生成のみ行う
1932 // Trace.TraceInformation(string.Format("キーがあるけどnullになってるCTextureのテクスチャ再生成 {0}", this.stバー情報[ i ].strPreimageのパス));
1933 // this.dicThumbnail[ this.stバー情報[ i ].strPreimageのパス ] = CDTXMania.tテクスチャの生成( this.stバー情報[ i ].strPreimageのパス );
1934 //}
1935 //txTumbnail[ i ] = this.dicThumbnail[ this.stバー情報[ i ].strPreimageのパス ];
1936 }
1937
1938 for( int j = 0; j < 3; j++ )
1939 this.st情報[ i ].nスキル値[ j ] = (int) song.arスコア[ this.n現在のアンカ難易度レベルに最も近い難易度レベルを返す( song ) ].譜面情報.最大スキル[ j ];
1940
1941 song = this.r次の曲( song );
1942 }
1943
1944 //Trace.TraceInformation("バーの初期化処理終了");
1945
1946 this.n現在の選択行 = 7;
1947 }
1948 private void tパスを指定してサムネイル画像を生成する( int n番号, string strDTXPath, E種別 eType )
1949 {
1950 if( n番号 < 0 || n番号 > 15 )
1951 return;
1952
1953 //try
1954 {
1955 //if ( this.stバー情報[ nバー番号 ].eバー種別 == Eバー種別.Score || this.stバー情報[ nバー番号 ].eバー種別 == Eバー種別.Box)
1956 {
1957 // 2019.04.27 kairera0467 使っていないようなのでコメントアウト
1958 //if (!File.Exists(strDTXPath))
1959 //{
1960 // this.txTumbnail[nバー番号] = CDTXMania.tテクスチャの生成(CSkin.Path(@"Graphics\5_preimage default.png"), false);
1961 //}
1962 //else
1963 //{
1964 // this.txTumbnail[nバー番号] = CDTXMania.tテクスチャの生成(strDTXPath);
1965 //}
1966 }
1967 //else if( this.stバー情報[ nバー番号 ].eバー種別 == Eバー種別.Random)
1968 //{
1969 // if( this.txジャケットランダム != null )
1970 // this.txTumbnail[ nバー番号 ] = this.txジャケットランダム;
1971 //}
1972 //else if( this.stバー情報[ nバー番号 ].eバー種別 == Eバー種別.BackBox)
1973 //{
1974 // if( this.txジャケットボックスクローズ != null )
1975 // this.txTumbnail[ nバー番号 ] = this.txジャケットボックスクローズ;
1976 //}
1977 }
1978 /*
1979 catch( CTextureCreateFailedException )
1980 {
1981 if ( this.txジャケット指定が無い場合の画像 != null )
1982 {
1983 this.txTumbnail[ nバー番号 ] = this.txジャケット指定が無い場合の画像;
1984 }
1985 else
1986 {
1987 this.txTumbnail[ nバー番号 ] = null;
1988 }
1989 }
1990 */
1991 }
1992 private CTexture tパスを指定してサムネイル画像を生成して返す( int n番号, string strDTXPath, E種別 eType )
1993 {
1994 if (n番号 < 0 || n番号 > 15)
1995 return CDTXMania.tテクスチャの生成(CSkin.Path(@"Graphics\5_preimage default.png"), false);
1996
1997 // 2020.5.23 kairera0467 memo
1998 // ここではtxTumbnailに生成結果を格納すると同時に、returnしたCTextureをdicTumbnailに格納している...
1999 // はずだが、nバー番号が0で固定されているため、本当は無駄が発生しているかもしれない。
2000
2001 //try
2002 {
2003 //if (eType == Eバー種別.Score || eType == Eバー種別.Box)
2004 {
2005 // 一度txTumbnailへの格納をやめてみる。
2006 if (!File.Exists(strDTXPath))
2007 {
2008 return CDTXMania.tテクスチャの生成(CSkin.Path(@"Graphics\5_preimage default.png"), "FILE NOT EXISTS:" + strDTXPath);
2009 }
2010 else
2011 {
2012 return CDTXMania.tテクスチャの生成(strDTXPath, "PRE:" + strDTXPath);
2013 }
2014
2015 //if (!File.Exists(strDTXPath))
2016 //{
2017 // return this.txTumbnail[nバー番号] = CDTXMania.tテクスチャの生成(CSkin.Path(@"Graphics\5_preimage default.png"), "FILE NOT EXISTS:" + strDTXPath);
2018 //}
2019 //else
2020 //{
2021 // return this.txTumbnail[nバー番号] = CDTXMania.tテクスチャの生成(strDTXPath, "PRE:" + strDTXPath);
2022 //}
2023 }
2024 //else if (eType == Eバー種別.Random)
2025 {
2026 // if(this.txジャケットランダム != null)
2027 // this.txTumbnail[nバー番号] = this.txジャケットランダム;
2028 }
2029 //else if (eType == Eバー種別.BackBox)
2030 {
2031 // if(this.txジャケットボックスクローズ != null)
2032 // this.txTumbnail[nバー番号] = this.txジャケットボックスクローズ;
2033 }
2034 }
2035 /*
2036 catch( CTextureCreateFailedException )
2037 {
2038 if ( this.txジャケット指定が無い場合の画像 != null )
2039 {
2040 this.txTumbnail[ nバー番号 ] = this.txジャケット指定が無い場合の画像;
2041 }
2042 else
2043 {
2044 this.txTumbnail[ nバー番号 ] = null;
2045 }
2046 }
2047 */
2048 }
2049 public void tTumbDictionaryClear()
2050 {
2051 // デバッグ用
2052 // dicThumbnailに登録されたものを全部消去
2053 this.dicThumbnail.Clear();
2054 }
2055 private CTexture t指定された文字テクスチャを生成する( string str文字, Color color )
2056 {
2057 //2013.09.05.kairera0467 中央にしか使用することはないので、色は黒固定。
2058 //現在は機能しない(面倒なので実装してない)が、そのうち使用する予定。
2059 //PrivateFontの試験運転も兼ねて。
2060 //CPrivateFastFont
2061 prvFont = new CPrivateFastFont( new FontFamily( CDTXMania.ConfigIni.str選曲リストフォント ), 14, FontStyle.Regular );
2062 Bitmap bmp;
2063
2064 bmp = prvFont.DrawPrivateFont( str文字, Color.Black, Color.Transparent );
2065 //bmp = prvFont.DrawPrivateFont( str文字, color == Color.White ? Color.Black : color, color == Color.White ? Color.Transparent : Color.FromArgb( 64, 0, 0, 0 ) );
2066
2067 CTexture tx文字テクスチャ = CDTXMania.tテクスチャの生成( bmp, false );
2068
2069 if( tx文字テクスチャ != null )
2070 //tx文字テクスチャ.vc拡大縮小倍率 = new Vector3( 1f, 1f, 1f );
2071 tx文字テクスチャ.vc拡大縮小倍率 = new Vector3( CDTXMania.ConfigIni.f選曲リストフォントのX縮小率, 1f, 1f );
2072
2073
2074
2075 int n最大幅 = 290;
2076 if( tx文字テクスチャ.szテクスチャサイズ.Width > n最大幅 )
2077 {
2078 tx文字テクスチャ.vc拡大縮小倍率 = new Vector3( ( n最大幅 / ( tx文字テクスチャ.szテクスチャサイズ.Width / 0.75f ) ), 1f, 1f );
2079 }
2080
2081 bmp.Dispose();
2082
2083 return tx文字テクスチャ;
2084 }
2085 private void tパネルの生成( int n番号, string str曲名, string strティスト名, Color color )
2086 {
2087 //t3D描画の仕様上左詰や右詰が面倒になってしまうので、
2088 //パネルにあらかじめ曲名とアーティスト名を埋め込んでおく。
2089
2090 if( n番号 < 0 || n番号 > 15 )
2091 return;
2092 try
2093 {
2094 Bitmap b4font;
2095 Bitmap bSongPanel;
2096 Image imgSongPanel;
2097 Image imgCustomSongNameTexture;
2098 Image imgCuttomArtistNameTexture;
2099 SizeF sz曲名;
2100 SizeF szティスト名;
2101
2102 bool bFoundTitleTexture = false;
2103 bool bFoundArtistTexture = false;
2104
2105 b4font = new Bitmap( 1, 1 );
2106 Graphics graphics = Graphics.FromImage( b4font );
2107 graphics.PageUnit = GraphicsUnit.Pixel;
2108 imgSongPanel = Image.FromFile( CSkin.Path( @"Graphics\5_music panel.png" ) );
2109
2110 bSongPanel = new Bitmap( 223, 279 );
2111
2112 graphics = Graphics.FromImage( bSongPanel );
2113 graphics.DrawImage( imgSongPanel, 0, 0, 223, 279 );
2114
2115 string strPassBefore = "";
2116 string strPassAfter = "";
2117 try
2118 {
2119 strPassBefore = this.st情報[ n番号 ].strDTXフォルダのパス;
2120 strPassAfter = strPassBefore.Replace( this.st情報[ n番号 ].ar譜面情報.Preimage, "" );
2121 }
2122 catch
2123 {
2124 //Replaceでエラーが出たらここで適切な処理ができるようにしたい。
2125 strPassBefore = "";
2126 strPassAfter = "";
2127
2128 }
2129 string strPath = ( strPassAfter + "TitleTexture.png" );
2130 if( File.Exists( ( strPath ) ) )
2131 {
2132 imgCustomSongNameTexture = Image.FromFile( strPath );
2133 graphics.DrawImage( imgCustomSongNameTexture, 4, -1, 223, 33 );
2134 bFoundTitleTexture = true;
2135 }
2136 if( File.Exists( ( strPassAfter + "ArtistTexture.png" ) ) )
2137 {
2138 imgCuttomArtistNameTexture = Image.FromFile( strPassAfter + "ArtistTexture.png" );
2139 graphics.DrawImage(imgCuttomArtistNameTexture, 0, 252, 223, 26);
2140 bFoundArtistTexture = true;
2141 }
2142
2143
2144 #region [ 曲名表示に必要となるサイズを取得する。]
2145 //-----------------
2146 using( var bmpDummy = new Bitmap( 1, 1 ) )
2147 {
2148 var g = Graphics.FromImage( bmpDummy );
2149 g.PageUnit = GraphicsUnit.Pixel;
2150 sz曲名 = g.MeasureString( str曲名, this.ft曲リスト用フォント );
2151 szティスト名 = g.MeasureString( strティスト名, this.ft曲リスト用フォント );
2152 this.st情報[ n番号 ].nタイトル名テクスチャの長さdot = (int) g.MeasureString( strティスト名, new Font( CDTXMania.ConfigIni.str選曲リストフォント, 16 ) ).Width;
2153 g.Dispose();
2154 }
2155 //-----------------
2156 #endregion
2157
2158 int n最大幅px = 200;
2159 int height = 25;
2160 int width = (int) ( ( sz曲名.Width + 2 ) );
2161 if( width > ( CDTXMania.app.Device.Capabilities.MaxTextureWidth ) )
2162 width = CDTXMania.app.Device.Capabilities.MaxTextureWidth; // 右端断ち切れ仕方ないよね
2163
2164 float f拡大率X = ( width <= n最大幅px ) ? 1 : ( ( (float) n最大幅px / (float) width ) ); // 長い文字列は横方向に圧縮。
2165
2166 using( var bmp = new Bitmap( width, height, PixelFormat.Format32bppArgb ) ) // 2倍(面積4倍)のBitmapを確保。(0.5倍で表示する前提。)
2167 using( var g = Graphics.FromImage( bmp ) )
2168 {
2169 graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
2170 float y = ( ( ( float ) bmp.Height ) ) - ( ( CDTXMania.ConfigIni.n選曲リストフォントのサイズdot ) );
2171 //graphics.DrawString( str曲名, this.ft曲リスト用フォント, new SolidBrush( this.color文字影 ), (float) 2f, (float) ( y + 2f ) );
2172 if( bFoundTitleTexture == false )
2173 graphics.DrawString( str曲名, new Font( CDTXMania.ConfigIni.str選曲リストフォント, 16 ), new SolidBrush( color ), 5f, y - 2 );
2174 if( bFoundArtistTexture == false )
2175 graphics.DrawString( strティスト名, new Font( CDTXMania.ConfigIni.str選曲リストフォント, 16 ), new SolidBrush( Color.White ), (float)218f - this.st情報[ n番号 ].nタイトル名テクスチャの長さdot, 255f);
2176 //graphics.DrawString( strアーティスト名, this.ft曲リスト用フォント, new SolidBrush( Color.White ), 234f, 258f );
2177
2178 CDTXMania.t安全にDisposeする( ref this.st情報[ n番号 ].txパネル );
2179
2180 this.st情報[ n番号 ].txパネル = new CTexture( CDTXMania.app.Device, bSongPanel, CDTXMania.TextureFormat, false );
2181
2182 bmp.Dispose();
2183 g.Dispose();
2184 }
2185
2186 b4font.Dispose();
2187 bSongPanel.Dispose();
2188 imgSongPanel.Dispose();
2189 graphics.Dispose();
2190 }
2191 catch( CTextureCreateFailedException )
2192 {
2193 Trace.TraceError( "曲名テクスチャの作成に失敗しました。[{0}]", str曲名 );
2194 this.st情報[ n番号 ].txパネル = null;
2195 }
2196
2197 }
2198
2199 private CTexture tカスタム曲名の生成( int n番号 )
2200 {
2201 //t3D描画の仕様上左詰や右詰が面倒になってしまうので、
2202 //パネルにあらかじめ曲名とアーティスト名を埋め込んでおく。
2203
2204 Bitmap b4font;
2205 Bitmap bCustomSongNameTexture;
2206 Image imgCustomSongNameTexture;
2207
2208 b4font = new Bitmap( 1, 1 );
2209 Graphics graphicsA = Graphics.FromImage( b4font );
2210
2211 graphicsA.PageUnit = GraphicsUnit.Pixel;
2212
2213
2214
2215 bCustomSongNameTexture = new Bitmap( 240, 40 );
2216
2217 graphicsA = Graphics.FromImage( bCustomSongNameTexture );
2218 graphicsA.DrawImage( bCustomSongNameTexture, 0, 0, 180, 25 );
2219
2220
2221 string strPassAfter = "";
2222 try
2223 {
2224 strPassAfter = this.st情報[ n番号 ].strDTXフォルダのパス;
2225 }
2226 catch
2227 {
2228 strPassAfter = "";
2229 }
2230
2231 string strPath = ( strPassAfter + "TitleTexture.png" );
2232 if( File.Exists( ( strPath ) ) )
2233 {
2234 imgCustomSongNameTexture = Image.FromFile( strPath );
2235 imgCustomSongNameTexture = this.CreateNegativeImage( imgCustomSongNameTexture );
2236 graphicsA.DrawImage( imgCustomSongNameTexture, 6, 1, 180, 25 );
2237 imgCustomSongNameTexture.Dispose();
2238 }
2239
2240
2241 //CDTXMania.t安全にDisposeする( ref this.stバー情報[ nバー番号 ].txカスタム曲名テクスチャ );
2242 //CDTXMania.t安全にDisposeする( ref this.stバー情報[ nバー番号 ].txカスタムアーティスト名テクスチャ );
2243 CTexture txTex = new CTexture( CDTXMania.app.Device, bCustomSongNameTexture, CDTXMania.TextureFormat, false );
2244
2245 b4font.Dispose();
2246 graphicsA.Dispose();
2247 bCustomSongNameTexture.Dispose();
2248
2249 return txTex;
2250 }
2251 private CTexture tカスタムアティスト名テクスチャの生成( int n番号 )
2252 {
2253 //t3D描画の仕様上左詰や右詰が面倒になってしまうので、
2254 //パネルにあらかじめ曲名とアーティスト名を埋め込んでおく。
2255
2256 Bitmap b4font;
2257 Bitmap bCustomArtistNameTexture;
2258 Image imgCustomArtistNameTexture;
2259
2260 b4font = new Bitmap( 1, 1 );
2261 Graphics graphics = Graphics.FromImage( b4font );
2262
2263 graphics.PageUnit = GraphicsUnit.Pixel;
2264 bCustomArtistNameTexture = new Bitmap( 210, 27 );
2265
2266 graphics = Graphics.FromImage( bCustomArtistNameTexture );
2267 graphics.DrawImage( bCustomArtistNameTexture, 0, 0, 196, 27 );
2268
2269
2270 string strPassAfter = "";
2271 try
2272 {
2273 strPassAfter = this.st情報[ n番号 ].strDTXフォルダのパス;
2274 }
2275 catch
2276 {
2277 strPassAfter = "";
2278 }
2279
2280 string strPath = (strPassAfter + "ArtistTexture.png");
2281 if (File.Exists((strPath)))
2282 {
2283 imgCustomArtistNameTexture = Image.FromFile(strPath);
2284 imgCustomArtistNameTexture = this.CreateNegativeImage( imgCustomArtistNameTexture );
2285 graphics.DrawImage(imgCustomArtistNameTexture, 16, 2, 196, 27);
2286 }
2287
2288 //CDTXMania.t安全にDisposeする( ref this.stバー情報[ nバー番号 ].txカスタム曲名テクスチャ );
2289 //CDTXMania.t安全にDisposeする( ref this.stバー情報[ nバー番号 ].txカスタムアーティスト名テクスチャ );
2290 this.st情報[n番号].nティスト名テクスチャの長さdot = 210;
2291 CTexture txTex = new CTexture( CDTXMania.app.Device, bCustomArtistNameTexture, CDTXMania.TextureFormat, false );
2292 return txTex;
2293 }
2294 private void t曲名バの生成( int n番号, string str曲名, Color color )
2295 {
2296 if( n番号 < 0 || n番号 > 15 )
2297 return;
2298
2299 try
2300 {
2301 SizeF sz曲名;
2302
2303 #region [ 曲名表示に必要となるサイズを取得する。]
2304 //-----------------
2305 using( var bmpDummy = new Bitmap( 1, 1 ) )
2306 {
2307 var g = Graphics.FromImage( bmpDummy );
2308 g.PageUnit = GraphicsUnit.Pixel;
2309 sz曲名 = g.MeasureString( str曲名, this.ft曲リスト用フォント );
2310 this.st情報[ n番号 ].nタイトル名テクスチャの長さdot = (int) g.MeasureString( str曲名, this.ft曲リスト用フォント ).Width;
2311 }
2312 //-----------------
2313 #endregion
2314
2315 int n最大幅px = 200;
2316 int height = 25;
2317 int width = (int) ( ( sz曲名.Width + 2 ) * 0.5f );
2318 if( width > ( CDTXMania.app.Device.Capabilities.MaxTextureWidth / 2 ) )
2319 width = CDTXMania.app.Device.Capabilities.MaxTextureWidth / 2; // 右端断ち切れ仕方ないよね
2320
2321 float f拡大率X = ( width <= n最大幅px ) ? 0.5f : ( ( (float) n最大幅px / (float) width ) * 0.5f ); // 長い文字列は横方向に圧縮。
2322
2323 using( var bmp = new Bitmap( width * 2, height * 2, PixelFormat.Format32bppArgb ) ) // 2倍(面積4倍)のBitmapを確保。(0.5倍で表示する前提。)
2324 using( var g = Graphics.FromImage( bmp ) )
2325 {
2326 g.TextRenderingHint = TextRenderingHint.AntiAlias;
2327 float y = ( ( ( float ) bmp.Height ) / 2f ) - ( ( CDTXMania.ConfigIni.n選曲リストフォントのサイズdot * 2f ) / 2f );
2328 g.DrawString( str曲名, this.ft曲リスト用フォント, new SolidBrush( this.color文字影 ), (float) 2f, (float) ( y + 2f ) );
2329 g.DrawString( str曲名, this.ft曲リスト用フォント, new SolidBrush( color ), 0f, y );
2330
2331 CDTXMania.t安全にDisposeする( ref this.st情報[ n番号 ].txタイトル名 );
2332
2333 this.st情報[ n番号 ].txタイトル名 = new CTexture( CDTXMania.app.Device, bmp, CDTXMania.TextureFormat, false );
2334 this.st情報[ n番号 ].txタイトル名.vc拡大縮小倍率 = new Vector3( f拡大率X, 0.5f, 1f );
2335 }
2336 }
2337 catch( CTextureCreateFailedException )
2338 {
2339 Trace.TraceError( "曲名テクスチャの作成に失敗しました。[{0}]", str曲名 );
2340 this.st情報[ n番号 ].txタイトル名 = null;
2341 }
2342 }
2343 private void tティスト名テクスチャの生成( int n番号, string strティスト名 )
2344 {
2345 if( n番号 < 0 || n番号 > 15 )
2346 return;
2347
2348 try
2349 {
2350 SizeF szティスト名;
2351
2352 #region [ 曲名表示に必要となるサイズを取得する。]
2353 //-----------------
2354 using( var bmpDummy = new Bitmap( 1, 1 ) )
2355 {
2356 var g = Graphics.FromImage( bmpDummy );
2357 g.PageUnit = GraphicsUnit.Pixel;
2358 szティスト名 = g.MeasureString( strティスト名, this.ft曲リスト用フォント );
2359 }
2360 //-----------------
2361 #endregion
2362
2363 int n最大幅px = 210;
2364 int height = 25;
2365 int width = (int) ( ( szティスト名.Width + 2 ) * 0.5f );
2366 if( width > ( CDTXMania.app.Device.Capabilities.MaxTextureWidth / 2 ) )
2367 width = CDTXMania.app.Device.Capabilities.MaxTextureWidth / 2; // 右端断ち切れ仕方ないよね
2368
2369 float f拡大率X = ( width <= n最大幅px ) ? 0.5f : ( ( (float) n最大幅px / (float) width ) * 0.5f ); // 長い文字列は横方向に圧縮。
2370
2371 using( var bmp = new Bitmap( width * 2, height * 2, PixelFormat.Format32bppArgb ) ) // 2倍(面積4倍)のBitmapを確保。(0.5倍で表示する前提。)
2372 using( var g = Graphics.FromImage( bmp ) )
2373 {
2374 g.TextRenderingHint = TextRenderingHint.AntiAlias;
2375 float y = ( ( ( float ) bmp.Height ) / 2f ) - ( ( CDTXMania.ConfigIni.n選曲リストフォントのサイズdot * 2f ) / 2f );
2376 g.DrawString( strティスト名, this.ft曲リスト用フォント, new SolidBrush( this.color文字影 ), (float)2f, (float)(y + 2f));
2377 g.DrawString( strティスト名, this.ft曲リスト用フォント, new SolidBrush( Color.White ), 0f, y );
2378
2379 CDTXMania.t安全にDisposeする( ref this.st情報[ n番号 ].txティスト名 );
2380 this.st情報[ n番号 ].nティスト名テクスチャの長さdot = (int)((g.MeasureString(strティスト名, this.ft曲リスト用フォント).Width) * f拡大率X);
2381 this.st情報[ n番号 ].txティスト名 = new CTexture( CDTXMania.app.Device, bmp, CDTXMania.TextureFormat, false );
2382 this.st情報[ n番号 ].txティスト名.vc拡大縮小倍率 = new Vector3( f拡大率X, 0.5f, 1f );
2383 }
2384 }
2385 catch( CTextureCreateFailedException )
2386 {
2387 Trace.TraceError( "曲名テクスチャの作成に失敗しました。[{0}]", strティスト名 );
2388 this.st情報[ n番号 ].txティスト名 = null;
2389 }
2390 }
2391 private void tアイテム数の描画()
2392 {
2393 string s = nCurrentPosition.ToString() + "/" + nNumOfItems.ToString();
2394 int x = 1150;
2395 int y = 200;
2396
2397 for (int p = s.Length - 1; p >= 0; p--)
2398 {
2399 tアイテム数の描画_1桁描画(x, y, s[p]);
2400 x -= 16;
2401 }
2402 }
2403 private void tアイテム数の描画_1桁描画(int x, int y, char s数値)
2404 {
2405 int dx, dy;
2406 if (s数値 == '/')
2407 {
2408 dx = 96;
2409 dy = 0;
2410 }
2411 else
2412 {
2413 int n = (int)s数値 - (int)'0';
2414 dx = (n % 6) * 16;
2415 dy = (n / 6) * 16;
2416 }
2417 if (this.txアイテム数数字 != null)
2418 {
2419 this.txアイテム数数字.t2D描画(CDTXMania.app.Device, x, y, new Rectangle(dx, dy, 16, 16));
2420 }
2421 }
2422
2423
2424 //DOBON.NETから拝借。
2425 //http://dobon.net/vb/dotnet/graphics/drawnegativeimage.html
2426 /// <summary>
2427 /// 指定された画像からネガティブイメージを作成する
2428 /// </summary>
2429 /// <param name="img">基の画像</param>
2430 /// <returns>作成されたネガティブイメージ</returns>
2431 public Image CreateNegativeImage(Image img)
2432 {
2433 //ネガティブイメージの描画先となるImageオブジェクトを作成
2434 Bitmap negaImg = new Bitmap(img.Width, img.Height);
2435 //negaImgのGraphicsオブジェクトを取得
2436 Graphics g = Graphics.FromImage(negaImg);
2437
2438 //ColorMatrixオブジェクトの作成
2439 System.Drawing.Imaging.ColorMatrix cm =
2440 new System.Drawing.Imaging.ColorMatrix();
2441 //ColorMatrixの行列の値を変更して、色が反転されるようにする
2442 cm.Matrix00 = -1;
2443 cm.Matrix11 = -1;
2444 cm.Matrix22 = -1;
2445 cm.Matrix33 = 1;
2446 cm.Matrix40 = cm.Matrix41 = cm.Matrix42 = cm.Matrix44 = 1;
2447
2448 //ImageAttributesオブジェクトの作成
2449 System.Drawing.Imaging.ImageAttributes ia =
2450 new System.Drawing.Imaging.ImageAttributes();
2451 //ColorMatrixを設定する
2452 ia.SetColorMatrix(cm);
2453
2454 //ImageAttributesを使用して色が反転した画像を描画
2455 g.DrawImage(img,
2456 new Rectangle(0, 0, img.Width, img.Height),
2457 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, ia);
2458
2459 //リソースを解放する
2460 g.Dispose();
2461
2462 return negaImg;
2463 }
2464 //-----------------
2465 #endregion
2466 }
2467 }

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