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.Instance.stage選曲.r現在選択中のスコア;
\r
24 Bitmap image = new Bitmap(1, 1);
\r
25 TextureFactory.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 > SampleFramework.GameWindowSize.Width)
\r
35 ef.Width = SampleFramework.GameWindowSize.Width;
\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.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
\r
42 graphics.DrawString(this.strArtist, this.ft描画用フォント, Brushes.White, (float)0f, (float)0f);
\r
44 this.txArtist = new CTexture(CDTXMania.Instance.Device, bitmap2, CDTXMania.Instance.TextureFormat);
\r
45 this.txArtist.vc拡大縮小倍率 = new Vector3(0.5f, 0.5f, 1f);
\r
48 catch (CTextureCreateFailedException)
\r
50 Trace.TraceError("ARTISTテクスチャの生成に失敗しました。");
\r
51 this.txArtist = null;
\r
54 TextureFactory.tテクスチャの解放(ref this.txComment);
\r
55 this.strComment = cスコア.譜面情報.コメント;
\r
56 if ((this.strComment != null) && (this.strComment.Length > 0))
\r
58 Graphics graphics2 = Graphics.FromImage(image);
\r
59 graphics2.PageUnit = GraphicsUnit.Pixel;
\r
60 SizeF ef2 = graphics2.MeasureString(this.strComment, this.ft描画用フォント);
\r
61 Size size = new Size((int)Math.Ceiling((double)ef2.Width), (int)Math.Ceiling((double)ef2.Height));
\r
62 graphics2.Dispose();
\r
63 this.nテクスチャの最大幅 = CDTXMania.Instance.Device.Capabilities.MaxTextureWidth;
\r
64 int maxTextureHeight = CDTXMania.Instance.Device.Capabilities.MaxTextureHeight;
\r
65 Bitmap bitmap3 = new Bitmap(size.Width, (int)Math.Ceiling((double)this.ft描画用フォント.Size));
\r
66 graphics2 = Graphics.FromImage(bitmap3);
\r
67 graphics2.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
\r
68 graphics2.DrawString(this.strComment, this.ft描画用フォント, Brushes.White, (float)0f, (float)0f);
\r
69 graphics2.Dispose();
\r
70 this.nComment行数 = 1;
\r
71 this.nComment最終行の幅 = size.Width;
\r
72 while (this.nComment最終行の幅 > this.nテクスチャの最大幅)
\r
75 this.nComment最終行の幅 -= this.nテクスチャの最大幅;
\r
77 while ((this.nComment行数 * ((int)Math.Ceiling((double)this.ft描画用フォント.Size))) > maxTextureHeight)
\r
80 this.nComment最終行の幅 = this.nテクスチャの最大幅;
\r
82 Bitmap bitmap4 = new Bitmap((this.nComment行数 > 1) ? this.nテクスチャの最大幅 : this.nComment最終行の幅, this.nComment行数 * ((int)Math.Ceiling((double)this.ft描画用フォント.Size)));
\r
83 graphics2 = Graphics.FromImage(bitmap4);
\r
84 Rectangle srcRect = new Rectangle();
\r
85 Rectangle destRect = new Rectangle();
\r
86 for (int i = 0; i < this.nComment行数; i++)
\r
88 srcRect.X = i * this.nテクスチャの最大幅;
\r
90 srcRect.Width = ((i + 1) == this.nComment行数) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;
\r
91 srcRect.Height = bitmap3.Height;
\r
93 destRect.Y = i * bitmap3.Height;
\r
94 destRect.Width = srcRect.Width;
\r
95 destRect.Height = srcRect.Height;
\r
96 graphics2.DrawImage(bitmap3, destRect, srcRect, GraphicsUnit.Pixel);
\r
98 graphics2.Dispose();
\r
101 this.txComment = new CTexture(CDTXMania.Instance.Device, bitmap4, CDTXMania.Instance.TextureFormat);
\r
102 this.txComment.vc拡大縮小倍率 = new Vector3(0.5f, 0.5f, 1f);
\r
104 catch (CTextureCreateFailedException)
\r
106 Trace.TraceError("COMMENTテクスチャの生成に失敗しました。");
\r
107 this.txComment = null;
\r
113 if (this.txComment != null)
\r
115 this.ctComment = new CCounter(
\r
117 (int)((((this.nComment行数 - 1) * this.nテクスチャの最大幅) + this.nComment最終行の幅) * this.txComment.vc拡大縮小倍率.X),
\r
118 unchecked((int)(10 * 2 / Scale.X)),
\r
119 CDTXMania.Instance.Timer
\r
128 public override void On活性化()
\r
130 this.ft描画用フォント = new Font("MS PGothic", 26f * Scale.Y, GraphicsUnit.Pixel);
\r
131 this.txArtist = null;
\r
132 this.txComment = null;
\r
133 this.strArtist = "";
\r
134 this.strComment = "";
\r
135 this.nComment最終行の幅 = 0;
\r
136 this.nComment行数 = 0;
\r
137 this.nテクスチャの最大幅 = 0;
\r
138 this.ctComment = new CCounter();
\r
141 public override void On非活性化()
\r
143 TextureFactory.tテクスチャの解放(ref this.txArtist);
\r
144 TextureFactory.tテクスチャの解放(ref this.txComment);
\r
145 if (this.ft描画用フォント != null)
\r
147 this.ft描画用フォント.Dispose();
\r
148 this.ft描画用フォント = null;
\r
150 this.ctComment = null;
\r
153 public override void OnManagedリソースの作成()
\r
155 if (!base.b活性化してない)
\r
158 base.OnManagedリソースの作成();
\r
161 public override void OnManagedリソースの解放()
\r
163 if (!base.b活性化してない)
\r
165 TextureFactory.tテクスチャの解放(ref this.txArtist);
\r
166 TextureFactory.tテクスチャの解放(ref this.txComment);
\r
167 base.OnManagedリソースの解放();
\r
170 public override int On進行描画()
\r
172 if (!base.b活性化してない)
\r
174 if (this.ctComment.b進行中)
\r
176 this.ctComment.t進行Loop();
\r
178 if (this.txArtist != null)
\r
180 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
181 int y = (int)(231 * Scale.Y);
\r
182 this.txArtist.t2D描画(CDTXMania.Instance.Device, x, y);
\r
184 if ((this.txComment != null) && ((this.ctComment.n現在の値 + nComment表示幅) >= 0))
\r
186 int num3 = (int)(0xf8 * Scale.X);
\r
187 int num4 = (int)(0xf5 * Scale.Y);
\r
188 Rectangle rectangle = new Rectangle(this.ctComment.n現在の値, 0, nComment表示幅, (int)this.ft描画用フォント.Size);
\r
189 if (rectangle.X < 0)
\r
191 num3 += -rectangle.X;
\r
192 rectangle.Width -= -rectangle.X;
\r
195 int num5 = ((int)(((float)rectangle.X) / this.txComment.vc拡大縮小倍率.X)) / this.nテクスチャの最大幅;
\r
196 Rectangle rectangle2 = new Rectangle();
\r
197 while (rectangle.Width > 0)
\r
199 rectangle2.X = ((int)(((float)rectangle.X) / this.txComment.vc拡大縮小倍率.X)) % this.nテクスチャの最大幅;
\r
200 rectangle2.Y = num5 * ((int)this.ft描画用フォント.Size);
\r
201 int num6 = ((num5 + 1) == this.nComment行数) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;
\r
202 int num7 = num6 - rectangle2.X;
\r
203 rectangle2.Width = num7;
\r
204 rectangle2.Height = (int)this.ft描画用フォント.Size;
\r
205 this.txComment.t2D描画(CDTXMania.Instance.Device, num3, num4, rectangle2);
\r
206 if (++num5 == this.nComment行数)
\r
210 int num8 = (int)(rectangle2.Width * this.txComment.vc拡大縮小倍率.X);
\r
211 rectangle.X += num8;
\r
212 rectangle.Width -= num8;
\r
223 #region [ private ]
\r
224 //-----------------
\r
225 private CCounter ctComment;
\r
226 private Font ft描画用フォント;
\r
227 private int nComment行数;
\r
228 private int nComment最終行の幅;
\r
229 private const int nComment表示幅 = (int)(0x182 * Scale.X);
\r
230 private int nテクスチャの最大幅;
\r
231 private string strArtist;
\r
232 private string strComment;
\r
233 private CTexture txArtist;
\r
234 private CTexture txComment;
\r
235 //-----------------
\r