2 using System.Collections.Generic;
4 using System.Runtime.InteropServices;
6 using System.Diagnostics;
12 public class CActLVLNFont : CActivity
16 const int numWidth = 15;
17 const int numHeight = 19;
21 string numChars = "0123456789?-";
22 st数字 = new ST数字[12, 4];
24 for (int j = 0; j < 4; j++)
26 for (int i = 0; i < 12; i++)
28 this.st数字[i, j].ch = numChars[i];
29 this.st数字[i, j].rc = new Rectangle(
30 (i % 4) * numWidth + (j % 2) * 64,
31 (i / 4) * numHeight + (j / 2) * 64,
41 public void t文字列描画(int x, int y, string str)
43 this.t文字列描画(x, y, str, EFontColor.White, EFontAlign.Right);
45 public void t文字列描画(int x, int y, string str, EFontColor efc, EFontAlign efa)
47 //if (!base.b活性化してない && !string.IsNullOrEmpty(str))
48 if ( !string.IsNullOrEmpty(str))
50 if (this.tx数値 != null)
52 bool bRightAlign = (efa == EFontAlign.Right);
53 bool bCenterAlign = (efa == EFontAlign.Center);
55 if (bRightAlign) // 右詰なら文字列反転して右から描画
57 char[] chars = str.ToCharArray();
59 str = new string(chars);
61 else if( bCenterAlign )
63 //Centerの場合は左から。ただし開始時のX座標をマイナス方向にずらしておく。
65 x -= (15 * str.Length) / 2;
68 foreach (char ch in str)
70 int p = (ch == '-' ? 11 : ch - '0');
71 ST数字 s = st数字[p, (int)efc];
73 int delta = bRightAlign ? 0 : -sw;
74 this.tx数値.t2D描画(CDTXMania.app.Device, x + delta, y, s.rc);
75 x += bRightAlign ? -sw : sw;
84 public override void OnManagedリソースの作成()
88 this.tx数値 = CDTXMania.tテクスチャの生成(CSkin.Path(@"Graphics\ScreenSelect level numbers.png"));
89 base.OnManagedリソースの作成();
92 public override void OnManagedリソースの解放()
96 if ( this.tx数値 != null )
101 base.OnManagedリソースの解放();
110 [StructLayout(LayoutKind.Sequential)]
117 public enum EFontColor
124 public enum EFontAlign
128 Center //2017.05.20 kairera0467
130 private ST数字[,] st数字;
131 private CTexture tx数値;