2 using System.Collections.Generic;
\r
4 using System.Drawing;
\r
5 using System.Diagnostics;
\r
11 internal class CActSelectArtistComment : CActivity
\r
14 public CActSelectArtistComment()
\r
16 base.b活性化してない = true;
\r
18 public void t選択曲が変更された()
\r
20 Cスコア cスコア = CDTXMania.app.stage選曲.r現在選択中のスコア;
\r
23 Bitmap image = new Bitmap( 1, 1 );
\r
24 TextureFactory.tテクスチャの解放( ref this.txArtist );
\r
25 this.strArtist = cスコア.譜面情報.アーティスト名;
\r
26 if( ( this.strArtist != null ) && ( this.strArtist.Length > 0 ) )
\r
28 Graphics graphics = Graphics.FromImage( image );
\r
29 graphics.PageUnit = GraphicsUnit.Pixel;
\r
30 SizeF ef = graphics.MeasureString( this.strArtist, this.ft描画用フォント );
\r
32 if (ef.Width > SampleFramework.GameWindowSize.Width)
\r
34 ef.Width = SampleFramework.GameWindowSize.Width;
\r
38 Bitmap bitmap2 = new Bitmap( (int) Math.Ceiling( (double) ef.Width ), (int) Math.Ceiling( (double) this.ft描画用フォント.Size ) );
\r
39 graphics = Graphics.FromImage( bitmap2 );
\r
40 graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
\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.app.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 TextureFactory.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.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
\r
67 graphics2.DrawString( this.strComment, this.ft描画用フォント, Brushes.White, ( float ) 0f, ( float ) 0f );
\r
68 graphics2.Dispose();
\r
69 this.nComment行数 = 1;
\r
70 this.nComment最終行の幅 = size.Width;
\r
71 while( this.nComment最終行の幅 > this.nテクスチャの最大幅 )
\r
74 this.nComment最終行の幅 -= this.nテクスチャの最大幅;
\r
76 while( ( this.nComment行数 * ( (int) Math.Ceiling( (double) this.ft描画用フォント.Size ) ) ) > maxTextureHeight )
\r
79 this.nComment最終行の幅 = this.nテクスチャの最大幅;
\r
81 Bitmap bitmap4 = new Bitmap( ( this.nComment行数 > 1 ) ? this.nテクスチャの最大幅 : this.nComment最終行の幅, this.nComment行数 * ( (int) Math.Ceiling( (double) this.ft描画用フォント.Size ) ) );
\r
82 graphics2 = Graphics.FromImage( bitmap4 );
\r
83 Rectangle srcRect = new Rectangle();
\r
84 Rectangle destRect = new Rectangle();
\r
85 for( int i = 0; i < this.nComment行数; i++ )
\r
87 srcRect.X = i * this.nテクスチャの最大幅;
\r
89 srcRect.Width = ( ( i + 1 ) == this.nComment行数 ) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;
\r
90 srcRect.Height = bitmap3.Height;
\r
92 destRect.Y = i * bitmap3.Height;
\r
93 destRect.Width = srcRect.Width;
\r
94 destRect.Height = srcRect.Height;
\r
95 graphics2.DrawImage( bitmap3, destRect, srcRect, GraphicsUnit.Pixel );
\r
97 graphics2.Dispose();
\r
100 this.txComment = new CTexture( CDTXMania.app.Device, bitmap4, CDTXMania.app.TextureFormat );
\r
101 this.txComment.vc拡大縮小倍率 = new Vector3( 0.5f, 0.5f, 1f );
\r
103 catch( CTextureCreateFailedException )
\r
105 Trace.TraceError( "COMMENTテクスチャの生成に失敗しました。" );
\r
106 this.txComment = null;
\r
112 if( this.txComment != null )
\r
114 this.ctComment = new CCounter(
\r
116 (int) ( ( ( ( this.nComment行数 - 1 ) * this.nテクスチャの最大幅 ) + this.nComment最終行の幅 ) * this.txComment.vc拡大縮小倍率.X ),
\r
117 unchecked((int)(10 * 2 / Scale.X)),
\r
118 CDTXMania.app.Timer
\r
127 public override void On活性化()
\r
129 this.ft描画用フォント = new Font( "MS PGothic", 26f * Scale.Y, GraphicsUnit.Pixel );
\r
130 this.txArtist = null;
\r
131 this.txComment = null;
\r
132 this.strArtist = "";
\r
133 this.strComment = "";
\r
134 this.nComment最終行の幅 = 0;
\r
135 this.nComment行数 = 0;
\r
136 this.nテクスチャの最大幅 = 0;
\r
137 this.ctComment = new CCounter();
\r
140 public override void On非活性化()
\r
142 TextureFactory.tテクスチャの解放( ref this.txArtist );
\r
143 TextureFactory.tテクスチャの解放( ref this.txComment );
\r
144 if( this.ft描画用フォント != null )
\r
146 this.ft描画用フォント.Dispose();
\r
147 this.ft描画用フォント = null;
\r
149 this.ctComment = null;
\r
152 public override void OnManagedリソースの作成()
\r
154 if( !base.b活性化してない )
\r
157 base.OnManagedリソースの作成();
\r
160 public override void OnManagedリソースの解放()
\r
162 if( !base.b活性化してない )
\r
164 TextureFactory.tテクスチャの解放( ref this.txArtist );
\r
165 TextureFactory.tテクスチャの解放( ref this.txComment );
\r
166 base.OnManagedリソースの解放();
\r
169 public override int On進行描画()
\r
171 if( !base.b活性化してない )
\r
173 if( this.ctComment.b進行中 )
\r
175 this.ctComment.t進行Loop();
\r
177 if( this.txArtist != null )
\r
179 int x = (int)(SampleFramework.GameWindowSize.Width - (6 + 12) * Scale.X) - ( (int) ( this.txArtist.szテクスチャサイズ.Width * this.txArtist.vc拡大縮小倍率.X ) ); // #27648 2012.3.14 yyagi: -12 for scrollbar
\r
180 int y = (int)(231 * Scale.Y);
\r
181 this.txArtist.t2D描画( CDTXMania.app.Device, x, y );
\r
183 if ( ( this.txComment != null ) && ( ( this.ctComment.n現在の値 + nComment表示幅 ) >= 0 ) )
\r
185 int num3 = (int)(0xf8 * Scale.X);
\r
186 int num4 = (int)(0xf5 * Scale.Y);
\r
187 Rectangle rectangle = new Rectangle( this.ctComment.n現在の値, 0, nComment表示幅, (int) this.ft描画用フォント.Size );
\r
188 if( rectangle.X < 0 )
\r
190 num3 += -rectangle.X;
\r
191 rectangle.Width -= -rectangle.X;
\r
194 int num5 = ( (int) ( ( (float) rectangle.X ) / this.txComment.vc拡大縮小倍率.X ) ) / this.nテクスチャの最大幅;
\r
195 Rectangle rectangle2 = new Rectangle();
\r
196 while( rectangle.Width > 0 )
\r
198 rectangle2.X = ( (int) ( ( (float) rectangle.X ) / this.txComment.vc拡大縮小倍率.X ) ) % this.nテクスチャの最大幅;
\r
199 rectangle2.Y = num5 * ( (int) this.ft描画用フォント.Size );
\r
200 int num6 = ( ( num5 + 1 ) == this.nComment行数 ) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;
\r
201 int num7 = num6 - rectangle2.X;
\r
202 rectangle2.Width = num7;
\r
203 rectangle2.Height = (int) this.ft描画用フォント.Size;
\r
204 this.txComment.t2D描画( CDTXMania.app.Device, num3, num4, rectangle2 );
\r
205 if( ++num5 == this.nComment行数 )
\r
209 int num8 = (int) ( rectangle2.Width * this.txComment.vc拡大縮小倍率.X );
\r
210 rectangle.X += num8;
\r
211 rectangle.Width -= num8;
\r
222 #region [ private ]
\r
223 //-----------------
\r
224 private CCounter ctComment;
\r
225 private Font ft描画用フォント;
\r
226 private int nComment行数;
\r
227 private int nComment最終行の幅;
\r
228 private const int nComment表示幅 = (int)(0x182 * Scale.X);
\r
229 private int nテクスチャの最大幅;
\r
230 private string strArtist;
\r
231 private string strComment;
\r
232 private CTexture txArtist;
\r
233 private CTexture txComment;
\r
234 //-----------------
\r