2 using System.Collections.Generic;
5 using System.Diagnostics;
9 using Rectangle = System.Drawing.Rectangle;
13 internal class CActSelectArtistComment : CActivity
17 public CActSelectArtistComment()
21 public void t選択曲が変更された()
23 Cスコア cスコア = CDTXMania.Instance.stage選曲.r現在選択中のスコア;
26 Bitmap image = new Bitmap(1, 1);
27 TextureFactory.tテクスチャの解放(ref this.txArtist);
28 this.strArtist = cスコア.譜面情報.アーティスト名;
29 if ((this.strArtist != null) && (this.strArtist.Length > 0))
31 Graphics graphics = Graphics.FromImage(image);
32 graphics.PageUnit = GraphicsUnit.Pixel;
33 SizeF ef = graphics.MeasureString(this.strArtist, this.ft描画用フォント);
35 if (ef.Width > SampleFramework.GameWindowSize.Width)
37 ef.Width = SampleFramework.GameWindowSize.Width;
41 Bitmap bitmap2 = new Bitmap((int)Math.Ceiling((double)ef.Width), (int)Math.Ceiling((double)this.ft描画用フォント.Size));
42 graphics = Graphics.FromImage(bitmap2);
43 graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
44 graphics.DrawString(this.strArtist, this.ft描画用フォント, Brushes.White, (float)0f, (float)0f);
46 this.txArtist = new CTexture(CDTXMania.Instance.Device, bitmap2, CDTXMania.Instance.TextureFormat);
47 this.txArtist.vc拡大縮小倍率 = new Vector3(0.5f, 0.5f, 1f);
50 catch (CTextureCreateFailedException)
52 Trace.TraceError("ARTISTテクスチャの生成に失敗しました。");
56 TextureFactory.tテクスチャの解放(ref this.txComment);
57 this.strComment = cスコア.譜面情報.コメント;
58 if ((this.strComment != null) && (this.strComment.Length > 0))
60 Graphics graphics2 = Graphics.FromImage(image);
61 graphics2.PageUnit = GraphicsUnit.Pixel;
62 SizeF ef2 = graphics2.MeasureString(this.strComment, this.ft描画用フォント);
63 Size size = new Size((int)Math.Ceiling((double)ef2.Width), (int)Math.Ceiling((double)ef2.Height));
65 this.nテクスチャの最大幅 = CDTXMania.Instance.Device.Capabilities.MaxTextureWidth;
66 int maxTextureHeight = CDTXMania.Instance.Device.Capabilities.MaxTextureHeight;
67 Bitmap bitmap3 = new Bitmap(size.Width, (int)Math.Ceiling((double)this.ft描画用フォント.Size));
68 graphics2 = Graphics.FromImage(bitmap3);
69 graphics2.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
70 graphics2.DrawString(this.strComment, this.ft描画用フォント, Brushes.White, (float)0f, (float)0f);
73 this.nComment最終行の幅 = size.Width;
74 while (this.nComment最終行の幅 > this.nテクスチャの最大幅)
77 this.nComment最終行の幅 -= this.nテクスチャの最大幅;
79 while ((this.nComment行数 * ((int)Math.Ceiling((double)this.ft描画用フォント.Size))) > maxTextureHeight)
82 this.nComment最終行の幅 = this.nテクスチャの最大幅;
84 Bitmap bitmap4 = new Bitmap((this.nComment行数 > 1) ? this.nテクスチャの最大幅 : this.nComment最終行の幅, this.nComment行数 * ((int)Math.Ceiling((double)this.ft描画用フォント.Size)));
85 graphics2 = Graphics.FromImage(bitmap4);
86 Rectangle srcRect = new Rectangle();
87 Rectangle destRect = new Rectangle();
88 for (int i = 0; i < this.nComment行数; i++)
90 srcRect.X = i * this.nテクスチャの最大幅;
92 srcRect.Width = ((i + 1) == this.nComment行数) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;
93 srcRect.Height = bitmap3.Height;
95 destRect.Y = i * bitmap3.Height;
96 destRect.Width = srcRect.Width;
97 destRect.Height = srcRect.Height;
98 graphics2.DrawImage(bitmap3, destRect, srcRect, GraphicsUnit.Pixel);
103 this.txComment = new CTexture(CDTXMania.Instance.Device, bitmap4, CDTXMania.Instance.TextureFormat);
104 this.txComment.vc拡大縮小倍率 = new Vector3(0.5f, 0.5f, 1f);
106 catch (CTextureCreateFailedException)
108 Trace.TraceError("COMMENTテクスチャの生成に失敗しました。");
109 this.txComment = null;
115 if (this.txComment != null)
117 this.ctComment = new CCounter(
119 (int)((((this.nComment行数 - 1) * this.nテクスチャの最大幅) + this.nComment最終行の幅) * this.txComment.vc拡大縮小倍率.X),
120 unchecked((int)(10 * 2 / Scale.X)),
121 CDTXMania.Instance.Timer
130 public override void On活性化()
132 this.ft描画用フォント = new Font("MS PGothic", 26f * Scale.Y, GraphicsUnit.Pixel);
133 this.txArtist = null;
134 this.txComment = null;
136 this.strComment = "";
137 this.nComment最終行の幅 = 0;
140 this.ctComment = new CCounter();
143 public override void On非活性化()
145 TextureFactory.tテクスチャの解放(ref this.txArtist);
146 TextureFactory.tテクスチャの解放(ref this.txComment);
147 if (this.ft描画用フォント != null)
149 this.ft描画用フォント.Dispose();
150 this.ft描画用フォント = null;
152 this.ctComment = null;
155 public override void OnManagedリソースの作成()
160 base.OnManagedリソースの作成();
163 public override void OnManagedリソースの解放()
167 TextureFactory.tテクスチャの解放(ref this.txArtist);
168 TextureFactory.tテクスチャの解放(ref this.txComment);
169 base.OnManagedリソースの解放();
172 public override int On進行描画()
176 if (this.ctComment.b進行中)
178 this.ctComment.t進行Loop();
180 if (this.txArtist != null)
182 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
183 int y = (int)(231 * Scale.Y);
184 this.txArtist.t2D描画(CDTXMania.Instance.Device, x, y);
186 if ((this.txComment != null) && ((this.ctComment.n現在の値 + nComment表示幅) >= 0))
188 int num3 = (int)(0xf8 * Scale.X);
189 int num4 = (int)(0xf5 * Scale.Y);
190 Rectangle rectangle = new Rectangle(this.ctComment.n現在の値, 0, nComment表示幅, (int)this.ft描画用フォント.Size);
193 num3 += -rectangle.X;
194 rectangle.Width -= -rectangle.X;
197 int num5 = ((int)(((float)rectangle.X) / this.txComment.vc拡大縮小倍率.X)) / this.nテクスチャの最大幅;
198 Rectangle rectangle2 = new Rectangle();
199 while (rectangle.Width > 0)
201 rectangle2.X = ((int)(((float)rectangle.X) / this.txComment.vc拡大縮小倍率.X)) % this.nテクスチャの最大幅;
202 rectangle2.Y = num5 * ((int)this.ft描画用フォント.Size);
203 int num6 = ((num5 + 1) == this.nComment行数) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;
204 int num7 = num6 - rectangle2.X;
205 rectangle2.Width = num7;
206 rectangle2.Height = (int)this.ft描画用フォント.Size;
207 this.txComment.t2D描画(CDTXMania.Instance.Device, num3, num4, rectangle2);
208 if (++num5 == this.nComment行数)
212 int num8 = (int)(rectangle2.Width * this.txComment.vc拡大縮小倍率.X);
214 rectangle.Width -= num8;
227 private CCounter ctComment;
228 private Font ft描画用フォント;
229 private int nComment行数;
230 private int nComment最終行の幅;
231 private const int nComment表示幅 = (int)(0x182 * Scale.X);
232 private int nテクスチャの最大幅;
233 private string strArtist;
234 private string strComment;
235 private CTexture txArtist;
236 private CTexture txComment;