2 using System.Collections.Generic;
\r
4 using System.Drawing;
\r
5 using System.Diagnostics;
\r
11 internal class CActSelectArtistComment : CActivity
\r
15 public CActSelectArtistComment()
\r
17 base.b活性化してない = true;
\r
19 public void t選択曲が変更された()
\r
21 Cスコア cスコア = CDTXMania.stage選曲.r現在選択中のスコア;
\r
24 Bitmap image = new Bitmap( 1, 1 );
\r
25 CDTXMania.tテクスチャの解放( ref this.txArtist );
\r
26 this.strArtist = cスコア.譜面情報.アーティスト名;
\r
27 if( ( this.strArtist != null ) && ( this.strArtist.Length > 0 ) )
\r
29 Graphics graphics = Graphics.FromImage( image );
\r
30 graphics.PageUnit = GraphicsUnit.Pixel;
\r
31 SizeF ef = graphics.MeasureString( this.strArtist, this.ft描画用フォント );
\r
33 if( ef.Width > 640f )
\r
39 Bitmap bitmap2 = new Bitmap( (int) Math.Ceiling( (double) ef.Width ), (int) Math.Ceiling( (double) this.ft描画用フォント.Size ) );
\r
40 graphics = Graphics.FromImage( bitmap2 );
\r
41 graphics.DrawString( this.strArtist, this.ft描画用フォント, Brushes.White, (float) 0f, (float) 0f );
\r
43 this.txArtist = new CTexture( CDTXMania.app.Device, bitmap2, CDTXMania.TextureFormat );
\r
44 this.txArtist.vc拡大縮小倍率 = new Vector3( 0.5f, 0.5f, 1f );
\r
47 catch( CTextureCreateFailedException )
\r
49 Trace.TraceError( "ARTISTテクスチャの生成に失敗しました。" );
\r
50 this.txArtist = null;
\r
53 CDTXMania.tテクスチャの解放( ref this.txComment );
\r
54 this.strComment = cスコア.譜面情報.コメント;
\r
55 if( ( this.strComment != null ) && ( this.strComment.Length > 0 ) )
\r
57 Graphics graphics2 = Graphics.FromImage( image );
\r
58 graphics2.PageUnit = GraphicsUnit.Pixel;
\r
59 SizeF ef2 = graphics2.MeasureString( this.strComment, this.ft描画用フォント );
\r
60 Size size = new Size( (int) Math.Ceiling( (double) ef2.Width ), (int) Math.Ceiling( (double) ef2.Height ) );
\r
61 graphics2.Dispose();
\r
62 this.nテクスチャの最大幅 = CDTXMania.app.Device.Capabilities.MaxTextureWidth;
\r
63 int maxTextureHeight = CDTXMania.app.Device.Capabilities.MaxTextureHeight;
\r
64 Bitmap bitmap3 = new Bitmap( size.Width, (int) Math.Ceiling( (double) this.ft描画用フォント.Size ) );
\r
65 graphics2 = Graphics.FromImage( bitmap3 );
\r
66 graphics2.DrawString( this.strComment, this.ft描画用フォント, Brushes.White, (float) 0f, (float) 0f );
\r
67 graphics2.Dispose();
\r
68 this.nComment行数 = 1;
\r
69 this.nComment最終行の幅 = size.Width;
\r
70 while( this.nComment最終行の幅 > this.nテクスチャの最大幅 )
\r
73 this.nComment最終行の幅 -= this.nテクスチャの最大幅;
\r
75 while( ( this.nComment行数 * ( (int) Math.Ceiling( (double) this.ft描画用フォント.Size ) ) ) > maxTextureHeight )
\r
78 this.nComment最終行の幅 = this.nテクスチャの最大幅;
\r
80 Bitmap bitmap4 = new Bitmap( ( this.nComment行数 > 1 ) ? this.nテクスチャの最大幅 : this.nComment最終行の幅, this.nComment行数 * ( (int) Math.Ceiling( (double) this.ft描画用フォント.Size ) ) );
\r
81 graphics2 = Graphics.FromImage( bitmap4 );
\r
82 Rectangle srcRect = new Rectangle();
\r
83 Rectangle destRect = new Rectangle();
\r
84 for( int i = 0; i < this.nComment行数; i++ )
\r
86 srcRect.X = i * this.nテクスチャの最大幅;
\r
88 srcRect.Width = ( ( i + 1 ) == this.nComment行数 ) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;
\r
89 srcRect.Height = bitmap3.Height;
\r
91 destRect.Y = i * bitmap3.Height;
\r
92 destRect.Width = srcRect.Width;
\r
93 destRect.Height = srcRect.Height;
\r
94 graphics2.DrawImage( bitmap3, destRect, srcRect, GraphicsUnit.Pixel );
\r
96 graphics2.Dispose();
\r
99 this.txComment = new CTexture( CDTXMania.app.Device, bitmap4, CDTXMania.TextureFormat );
\r
100 this.txComment.vc拡大縮小倍率 = new Vector3( 0.5f, 0.5f, 1f );
\r
102 catch( CTextureCreateFailedException )
\r
104 Trace.TraceError( "COMMENTテクスチャの生成に失敗しました。" );
\r
105 this.txComment = null;
\r
111 if( this.txComment != null )
\r
113 this.ctComment = new CCounter( -386, (int) ( ( ( ( this.nComment行数 - 1 ) * this.nテクスチャの最大幅 ) + this.nComment最終行の幅 ) * this.txComment.vc拡大縮小倍率.X ), 10, CDTXMania.Timer );
\r
121 public override void On活性化()
\r
123 this.ft描画用フォント = new Font( "MS PGothic", 26f, GraphicsUnit.Pixel );
\r
124 this.txArtist = null;
\r
125 this.txComment = null;
\r
126 this.strArtist = "";
\r
127 this.strComment = "";
\r
128 this.nComment最終行の幅 = 0;
\r
129 this.nComment行数 = 0;
\r
130 this.nテクスチャの最大幅 = 0;
\r
131 this.ctComment = new CCounter();
\r
134 public override void On非活性化()
\r
136 CDTXMania.tテクスチャの解放( ref this.txArtist );
\r
137 CDTXMania.tテクスチャの解放( ref this.txComment );
\r
138 if( this.ft描画用フォント != null )
\r
140 this.ft描画用フォント.Dispose();
\r
141 this.ft描画用フォント = null;
\r
143 this.ctComment = null;
\r
146 public override void OnManagedリソースの作成()
\r
148 if( !base.b活性化してない )
\r
151 base.OnManagedリソースの作成();
\r
154 public override void OnManagedリソースの解放()
\r
156 if( !base.b活性化してない )
\r
158 CDTXMania.tテクスチャの解放( ref this.txArtist );
\r
159 CDTXMania.tテクスチャの解放( ref this.txComment );
\r
160 base.OnManagedリソースの解放();
\r
163 public override int On進行描画()
\r
165 if( !base.b活性化してない )
\r
167 if( this.ctComment.b進行中 )
\r
169 this.ctComment.t進行Loop();
\r
171 if( this.txArtist != null )
\r
173 int x = 0x27a - ( (int) ( this.txArtist.szテクスチャサイズ.Width * this.txArtist.vc拡大縮小倍率.X ) );
\r
175 this.txArtist.t2D描画( CDTXMania.app.Device, x, y );
\r
177 if( ( this.txComment != null ) && ( ( this.ctComment.n現在の値 + 0x182 ) >= 0 ) )
\r
181 Rectangle rectangle = new Rectangle( this.ctComment.n現在の値, 0, 0x182, (int) this.ft描画用フォント.Size );
\r
182 if( rectangle.X < 0 )
\r
184 num3 += -rectangle.X;
\r
185 rectangle.Width -= -rectangle.X;
\r
188 int num5 = ( (int) ( ( (float) rectangle.X ) / this.txComment.vc拡大縮小倍率.X ) ) / this.nテクスチャの最大幅;
\r
189 Rectangle rectangle2 = new Rectangle();
\r
190 while( rectangle.Width > 0 )
\r
192 rectangle2.X = ( (int) ( ( (float) rectangle.X ) / this.txComment.vc拡大縮小倍率.X ) ) % this.nテクスチャの最大幅;
\r
193 rectangle2.Y = num5 * ( (int) this.ft描画用フォント.Size );
\r
194 int num6 = ( ( num5 + 1 ) == this.nComment行数 ) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;
\r
195 int num7 = num6 - rectangle2.X;
\r
196 rectangle2.Width = num7;
\r
197 rectangle2.Height = (int) this.ft描画用フォント.Size;
\r
198 this.txComment.t2D描画( CDTXMania.app.Device, num3, num4, rectangle2 );
\r
199 if( ++num5 == this.nComment行数 )
\r
203 int num8 = (int) ( rectangle2.Width * this.txComment.vc拡大縮小倍率.X );
\r
204 rectangle.X += num8;
\r
205 rectangle.Width -= num8;
\r
216 #region [ private ]
\r
217 //-----------------
\r
218 private CCounter ctComment;
\r
219 private Font ft描画用フォント;
\r
220 private int nComment行数;
\r
221 private int nComment最終行の幅;
\r
222 private const int nComment表示幅 = 0x182;
\r
223 private int nテクスチャの最大幅;
\r
224 private string strArtist;
\r
225 private string strComment;
\r
226 private CTexture txArtist;
\r
227 private CTexture txComment;
\r
228 //-----------------
\r