+++ /dev/null
-using System;\r
-using System.Collections.Generic;\r
-using System.Text;\r
-using System.Drawing;\r
-using System.Diagnostics;\r
-using SharpDX;\r
-using FDK;\r
-\r
-using Rectangle = System.Drawing.Rectangle;\r
-\r
-namespace DTXMania\r
-{\r
- internal class CActSelectArtistComment : CActivity\r
- {\r
- // メソッド\r
-\r
- public CActSelectArtistComment()\r
- {\r
- base.b活性化してない = true;\r
- }\r
- public void t選択曲が変更された()\r
- {\r
- Cスコア cスコア = CDTXMania.Instance.stage選曲.r現在選択中のスコア;\r
- if (cスコア != null)\r
- {\r
- Bitmap image = new Bitmap(1, 1);\r
- TextureFactory.tテクスチャの解放(ref this.txArtist);\r
- this.strArtist = cスコア.譜面情報.アーティスト名;\r
- if ((this.strArtist != null) && (this.strArtist.Length > 0))\r
- {\r
- Graphics graphics = Graphics.FromImage(image);\r
- graphics.PageUnit = GraphicsUnit.Pixel;\r
- SizeF ef = graphics.MeasureString(this.strArtist, this.ft描画用フォント);\r
- graphics.Dispose();\r
- if (ef.Width > SampleFramework.GameWindowSize.Width)\r
- {\r
- ef.Width = SampleFramework.GameWindowSize.Width;\r
- }\r
- try\r
- {\r
- Bitmap bitmap2 = new Bitmap((int)Math.Ceiling((double)ef.Width), (int)Math.Ceiling((double)this.ft描画用フォント.Size));\r
- graphics = Graphics.FromImage(bitmap2);\r
- graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;\r
- graphics.DrawString(this.strArtist, this.ft描画用フォント, Brushes.White, (float)0f, (float)0f);\r
- graphics.Dispose();\r
- this.txArtist = new CTexture(CDTXMania.Instance.Device, bitmap2, CDTXMania.Instance.TextureFormat);\r
- this.txArtist.vc拡大縮小倍率 = new Vector3(0.5f, 0.5f, 1f);\r
- bitmap2.Dispose();\r
- }\r
- catch (CTextureCreateFailedException)\r
- {\r
- Trace.TraceError("ARTISTテクスチャの生成に失敗しました。");\r
- this.txArtist = null;\r
- }\r
- }\r
- TextureFactory.tテクスチャの解放(ref this.txComment);\r
- this.strComment = cスコア.譜面情報.コメント;\r
- if ((this.strComment != null) && (this.strComment.Length > 0))\r
- {\r
- Graphics graphics2 = Graphics.FromImage(image);\r
- graphics2.PageUnit = GraphicsUnit.Pixel;\r
- SizeF ef2 = graphics2.MeasureString(this.strComment, this.ft描画用フォント);\r
- Size size = new Size((int)Math.Ceiling((double)ef2.Width), (int)Math.Ceiling((double)ef2.Height));\r
- graphics2.Dispose();\r
- this.nテクスチャの最大幅 = CDTXMania.Instance.Device.Capabilities.MaxTextureWidth;\r
- int maxTextureHeight = CDTXMania.Instance.Device.Capabilities.MaxTextureHeight;\r
- Bitmap bitmap3 = new Bitmap(size.Width, (int)Math.Ceiling((double)this.ft描画用フォント.Size));\r
- graphics2 = Graphics.FromImage(bitmap3);\r
- graphics2.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;\r
- graphics2.DrawString(this.strComment, this.ft描画用フォント, Brushes.White, (float)0f, (float)0f);\r
- graphics2.Dispose();\r
- this.nComment行数 = 1;\r
- this.nComment最終行の幅 = size.Width;\r
- while (this.nComment最終行の幅 > this.nテクスチャの最大幅)\r
- {\r
- this.nComment行数++;\r
- this.nComment最終行の幅 -= this.nテクスチャの最大幅;\r
- }\r
- while ((this.nComment行数 * ((int)Math.Ceiling((double)this.ft描画用フォント.Size))) > maxTextureHeight)\r
- {\r
- this.nComment行数--;\r
- this.nComment最終行の幅 = this.nテクスチャの最大幅;\r
- }\r
- Bitmap bitmap4 = new Bitmap((this.nComment行数 > 1) ? this.nテクスチャの最大幅 : this.nComment最終行の幅, this.nComment行数 * ((int)Math.Ceiling((double)this.ft描画用フォント.Size)));\r
- graphics2 = Graphics.FromImage(bitmap4);\r
- Rectangle srcRect = new Rectangle();\r
- Rectangle destRect = new Rectangle();\r
- for (int i = 0; i < this.nComment行数; i++)\r
- {\r
- srcRect.X = i * this.nテクスチャの最大幅;\r
- srcRect.Y = 0;\r
- srcRect.Width = ((i + 1) == this.nComment行数) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;\r
- srcRect.Height = bitmap3.Height;\r
- destRect.X = 0;\r
- destRect.Y = i * bitmap3.Height;\r
- destRect.Width = srcRect.Width;\r
- destRect.Height = srcRect.Height;\r
- graphics2.DrawImage(bitmap3, destRect, srcRect, GraphicsUnit.Pixel);\r
- }\r
- graphics2.Dispose();\r
- try\r
- {\r
- this.txComment = new CTexture(CDTXMania.Instance.Device, bitmap4, CDTXMania.Instance.TextureFormat);\r
- this.txComment.vc拡大縮小倍率 = new Vector3(0.5f, 0.5f, 1f);\r
- }\r
- catch (CTextureCreateFailedException)\r
- {\r
- Trace.TraceError("COMMENTテクスチャの生成に失敗しました。");\r
- this.txComment = null;\r
- }\r
- bitmap4.Dispose();\r
- bitmap3.Dispose();\r
- }\r
- image.Dispose();\r
- if (this.txComment != null)\r
- {\r
- this.ctComment = new CCounter(\r
- -nComment表示幅,\r
- (int)((((this.nComment行数 - 1) * this.nテクスチャの最大幅) + this.nComment最終行の幅) * this.txComment.vc拡大縮小倍率.X),\r
- unchecked((int)(10 * 2 / Scale.X)),\r
- CDTXMania.Instance.Timer\r
- );\r
- }\r
- }\r
- }\r
-\r
-\r
- // CActivity 実装\r
-\r
- public override void On活性化()\r
- {\r
- this.ft描画用フォント = new Font("MS PGothic", 26f * Scale.Y, GraphicsUnit.Pixel);\r
- this.txArtist = null;\r
- this.txComment = null;\r
- this.strArtist = "";\r
- this.strComment = "";\r
- this.nComment最終行の幅 = 0;\r
- this.nComment行数 = 0;\r
- this.nテクスチャの最大幅 = 0;\r
- this.ctComment = new CCounter();\r
- base.On活性化();\r
- }\r
- public override void On非活性化()\r
- {\r
- TextureFactory.tテクスチャの解放(ref this.txArtist);\r
- TextureFactory.tテクスチャの解放(ref this.txComment);\r
- if (this.ft描画用フォント != null)\r
- {\r
- this.ft描画用フォント.Dispose();\r
- this.ft描画用フォント = null;\r
- }\r
- this.ctComment = null;\r
- base.On非活性化();\r
- }\r
- public override void OnManagedリソースの作成()\r
- {\r
- if (!base.b活性化してない)\r
- {\r
- this.t選択曲が変更された();\r
- base.OnManagedリソースの作成();\r
- }\r
- }\r
- public override void OnManagedリソースの解放()\r
- {\r
- if (!base.b活性化してない)\r
- {\r
- TextureFactory.tテクスチャの解放(ref this.txArtist);\r
- TextureFactory.tテクスチャの解放(ref this.txComment);\r
- base.OnManagedリソースの解放();\r
- }\r
- }\r
- public override int On進行描画()\r
- {\r
- if (!base.b活性化してない)\r
- {\r
- if (this.ctComment.b進行中)\r
- {\r
- this.ctComment.t進行Loop();\r
- }\r
- if (this.txArtist != null)\r
- {\r
- 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
- int y = (int)(231 * Scale.Y);\r
- this.txArtist.t2D描画(CDTXMania.Instance.Device, x, y);\r
- }\r
- if ((this.txComment != null) && ((this.ctComment.n現在の値 + nComment表示幅) >= 0))\r
- {\r
- int num3 = (int)(0xf8 * Scale.X);\r
- int num4 = (int)(0xf5 * Scale.Y);\r
- Rectangle rectangle = new Rectangle(this.ctComment.n現在の値, 0, nComment表示幅, (int)this.ft描画用フォント.Size);\r
- if (rectangle.X < 0)\r
- {\r
- num3 += -rectangle.X;\r
- rectangle.Width -= -rectangle.X;\r
- rectangle.X = 0;\r
- }\r
- int num5 = ((int)(((float)rectangle.X) / this.txComment.vc拡大縮小倍率.X)) / this.nテクスチャの最大幅;\r
- Rectangle rectangle2 = new Rectangle();\r
- while (rectangle.Width > 0)\r
- {\r
- rectangle2.X = ((int)(((float)rectangle.X) / this.txComment.vc拡大縮小倍率.X)) % this.nテクスチャの最大幅;\r
- rectangle2.Y = num5 * ((int)this.ft描画用フォント.Size);\r
- int num6 = ((num5 + 1) == this.nComment行数) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;\r
- int num7 = num6 - rectangle2.X;\r
- rectangle2.Width = num7;\r
- rectangle2.Height = (int)this.ft描画用フォント.Size;\r
- this.txComment.t2D描画(CDTXMania.Instance.Device, num3, num4, rectangle2);\r
- if (++num5 == this.nComment行数)\r
- {\r
- break;\r
- }\r
- int num8 = (int)(rectangle2.Width * this.txComment.vc拡大縮小倍率.X);\r
- rectangle.X += num8;\r
- rectangle.Width -= num8;\r
- num3 += num8;\r
- }\r
- }\r
- }\r
- return 0;\r
- }\r
-\r
-\r
- // その他\r
-\r
- #region [ private ]\r
- //-----------------\r
- private CCounter ctComment;\r
- private Font ft描画用フォント;\r
- private int nComment行数;\r
- private int nComment最終行の幅;\r
- private const int nComment表示幅 = (int)(0x182 * Scale.X);\r
- private int nテクスチャの最大幅;\r
- private string strArtist;\r
- private string strComment;\r
- private CTexture txArtist;\r
- private CTexture txComment;\r
- //-----------------\r
- #endregion\r
- }\r
-}\r