2 using System.Collections.Generic;
\r
4 using System.Runtime.InteropServices;
\r
5 using System.Drawing;
\r
6 using System.Diagnostics;
\r
12 public class CActLVLNFont : CActivity
\r
16 const int numWidth = 15;
\r
17 const int numHeight = 19;
\r
19 public CActLVLNFont()
\r
21 string numChars = "0123456789?-";
\r
22 st数字 = new ST数字[12, 4];
\r
24 for (int j = 0; j < 4; j++)
\r
26 for (int i = 0; i < 12; i++)
\r
28 this.st数字[i, j].ch = numChars[i];
\r
29 this.st数字[i, j].rc = new Rectangle(
\r
30 (i % 4) * numWidth + (j % 2) * 64,
\r
31 (i / 4) * numHeight + (j / 2) * 64,
\r
41 public void t文字列描画(int x, int y, string str)
\r
43 this.t文字列描画(x, y, str, EFontColor.White, EFontAlign.Right);
\r
45 public void t文字列描画(int x, int y, string str, EFontColor efc, EFontAlign efa)
\r
47 if (!base.b活性化してない && !string.IsNullOrEmpty(str))
\r
49 if (this.tx数値 != null)
\r
51 bool bRightAlign = (efa == EFontAlign.Right);
\r
53 if (bRightAlign) // 右詰なら文字列反転して右から描画
\r
55 char[] chars = str.ToCharArray();
\r
56 Array.Reverse(chars);
\r
57 str = new string(chars);
\r
60 foreach (char ch in str)
\r
62 int p = (ch == '-' ? 11 : ch - '0');
\r
63 ST数字 s = st数字[p, (int)efc];
\r
64 int sw = s.rc.Width;
\r
65 int delta = bRightAlign ? 0 : -sw;
\r
66 this.tx数値.t2D描画(CDTXMania.Instance.Device, x + delta, y, s.rc);
\r
67 x += bRightAlign ? -sw : sw;
\r
76 public override void OnManagedリソースの作成()
\r
80 this.tx数値 = TextureFactory.tテクスチャの生成(CSkin.Path(@"Graphics\ScreenSelect level numbers.png"));
\r
81 base.OnManagedリソースの作成();
\r
84 public override void OnManagedリソースの解放()
\r
88 if ( this.tx数値 != null )
\r
90 this.tx数値.Dispose();
\r
93 base.OnManagedリソースの解放();
\r
100 #region [ private ]
\r
101 //-----------------
\r
102 [StructLayout(LayoutKind.Sequential)]
\r
103 private struct ST数字
\r
106 public Rectangle rc;
\r
109 public enum EFontColor
\r
116 public enum EFontAlign
\r
121 private ST数字[,] st数字;
\r
122 private CTexture tx数値;
\r
123 //-----------------
\r