OSDN Git Service

#36057 コンフィグまわりのリファクタ(リソース不完全なので注意)
[dtxmania/dtxmania.git] / DTXManiaプロジェクト / コード / ステージ / 05.選曲 / CActSelectInformation.cs
1 using System;\r
2 using System.Collections.Generic;\r
3 using System.Diagnostics;\r
4 using System.Globalization;\r
5 using System.Text;\r
6 using System.Runtime.InteropServices;\r
7 using System.Drawing;\r
8 using FDK;\r
9 \r
10 namespace DTXMania\r
11 {\r
12         internal class CActSelectInformation : CActivity\r
13         {\r
14                 // コンストラクタ\r
15 \r
16                 public CActSelectInformation()\r
17                 {\r
18                         base.b活性化してない = true;\r
19                 }\r
20 \r
21 \r
22                 // CActivity 実装\r
23 \r
24                 public override void On活性化()\r
25                 {\r
26                         this.n画像Index上 = -1;\r
27                         this.n画像Index下 = 0;\r
28                         base.On活性化();\r
29                 }\r
30                 public override void On非活性化()\r
31                 {\r
32                         this.ctスクロール用 = null;\r
33                         base.On非活性化();\r
34                 }\r
35                 public override void OnManagedリソースの作成()\r
36                 {\r
37                         if (!base.b活性化してない)\r
38                         {\r
39                                 string[,] infofiles = {         // #25381 2011.6.4 yyagi\r
40                                    { @"Graphics\ScreenSelect information 1.png", @"Graphics\ScreenSelect information 2.png" },\r
41                                          { @"Graphics\ScreenSelect information 1e.png", @"Graphics\ScreenSelect information 2e.png" }\r
42                                 };\r
43                                 int c = (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ja") ? 0 : 1;\r
44                                 this.txInfo[0] = TextureFactory.tテクスチャの生成(CSkin.Path(infofiles[c, 0]), false);\r
45                                 this.txInfo[1] = TextureFactory.tテクスチャの生成(CSkin.Path(infofiles[c, 1]), false);\r
46                                 base.OnManagedリソースの作成();\r
47                         }\r
48                 }\r
49                 public override void OnManagedリソースの解放()\r
50                 {\r
51                         if (!base.b活性化してない)\r
52                         {\r
53                                 TextureFactory.tテクスチャの解放(ref this.txInfo[0]);\r
54                                 TextureFactory.tテクスチャの解放(ref this.txInfo[1]);\r
55                                 base.OnManagedリソースの解放();\r
56                         }\r
57                 }\r
58                 public override int On進行描画()\r
59                 {\r
60                         if (!base.b活性化してない)\r
61                         {\r
62                                 if (base.b初めての進行描画)\r
63                                 {\r
64                                         this.ctスクロール用 = new CCounter(0, 6000, 1, CDTXMania.Instance.Timer);\r
65                                         base.b初めての進行描画 = false;\r
66                                 }\r
67                                 this.ctスクロール用.t進行();\r
68                                 if (this.ctスクロール用.b終了値に達した)\r
69                                 {\r
70                                         this.n画像Index上 = this.n画像Index下;\r
71                                         this.n画像Index下 = (this.n画像Index下 + 1) % stInfo.GetLength(0);    //8;\r
72                                         this.ctスクロール用.n現在の値 = 0;\r
73                                 }\r
74                                 int n現在の値 = this.ctスクロール用.n現在の値;\r
75                                 if (n現在の値 <= 250)\r
76                                 {\r
77                                         double n現在の割合 = ((double)n現在の値) / 250.0;\r
78                                         if (this.n画像Index上 >= 0)\r
79                                         {\r
80                                                 STINFO stinfo = this.stInfo[this.n画像Index上];\r
81                                                 Rectangle rectangle = new Rectangle(\r
82                                                         stinfo.pt左上座標.X,\r
83                                                         stinfo.pt左上座標.Y + ((int)((int)(45.0 * Scale.Y) * n現在の割合)),\r
84                                                         (int)(221 * Scale.X),\r
85                                                         Convert.ToInt32((int)(45.0 * Scale.Y) * (1.0 - n現在の割合))\r
86                                                 );\r
87                                                 if (this.txInfo[stinfo.nTexture番号] != null)\r
88                                                 {\r
89                                                         this.txInfo[stinfo.nTexture番号].t2D描画(\r
90                                                                 CDTXMania.Instance.Device,\r
91                                                                 115 * Scale.X,\r
92                                                                 6 * Scale.Y,\r
93                                                                 rectangle\r
94                                                         );\r
95                                                 }\r
96                                         }\r
97                                         if (this.n画像Index下 >= 0)\r
98                                         {\r
99                                                 STINFO stinfo = this.stInfo[this.n画像Index下];\r
100                                                 Rectangle rectangle = new Rectangle(\r
101                                                         stinfo.pt左上座標.X,\r
102                                                         stinfo.pt左上座標.Y,\r
103                                                         (int)(221 * Scale.X),\r
104                                                         (int)(45.0 * Scale.Y * n現在の割合)\r
105                                                 );\r
106                                                 if (this.txInfo[stinfo.nTexture番号] != null)\r
107                                                 {\r
108                                                         this.txInfo[stinfo.nTexture番号].t2D描画(\r
109                                                                 CDTXMania.Instance.Device,\r
110                                                                 115 * Scale.X,\r
111                                                                 6 * Scale.Y + ((int)(45.0 * Scale.Y * (1.0 - n現在の割合))),\r
112                                                                 rectangle\r
113                                                         );\r
114                                                 }\r
115                                         }\r
116                                 }\r
117                                 else\r
118                                 {\r
119                                         STINFO stinfo = this.stInfo[this.n画像Index下];\r
120                                         Rectangle rectangle = new Rectangle(\r
121                                                 stinfo.pt左上座標.X,\r
122                                                 stinfo.pt左上座標.Y,\r
123                                                 (int)(221 * Scale.X),\r
124                                                 (int)(45 * Scale.Y)\r
125                                         );\r
126                                         if (this.txInfo[stinfo.nTexture番号] != null)\r
127                                         {\r
128                                                 this.txInfo[stinfo.nTexture番号].t2D描画(\r
129                                                         CDTXMania.Instance.Device,\r
130                                                         115 * Scale.X,\r
131                                                         6 * Scale.Y,\r
132                                                         rectangle\r
133                                                 );\r
134                                         }\r
135                                 }\r
136                         }\r
137                         return 0;\r
138                 }\r
139 \r
140 \r
141                 // その他\r
142 \r
143                 #region [ private ]\r
144                 //-----------------\r
145                 [StructLayout(LayoutKind.Sequential)]\r
146                 private struct STINFO\r
147                 {\r
148                         public int nTexture番号;\r
149                         public Point pt左上座標;\r
150                         public STINFO(int nTexture番号, int x, int y)\r
151                         {\r
152                                 this.nTexture番号 = nTexture番号;\r
153                                 this.pt左上座標 = new Point(x, y);\r
154                         }\r
155                 }\r
156 \r
157                 private CCounter ctスクロール用;\r
158                 private int n画像Index下;\r
159                 private int n画像Index上;\r
160                 private readonly STINFO[] stInfo = new STINFO[] {\r
161                         new STINFO( 0, 0, 0 ),\r
162                         new STINFO( 0, 0, (int)(49 * Scale.Y) ),\r
163                         new STINFO( 0, 0, (int)(97 * Scale.Y) ),\r
164                         new STINFO( 0, 0, (int)(147 * Scale.Y) ),\r
165                         new STINFO( 0, 0, (int)(196 * Scale.Y) ),\r
166                         new STINFO( 1, 0, (int)(0 * Scale.Y) ),\r
167                         new STINFO( 1, 0, (int)(49 * Scale.Y) ),\r
168                         new STINFO( 1, 0, (int)(97 * Scale.Y) ),\r
169                         new STINFO( 1, 0, (int)(147 * Scale.Y) )\r
170                 };\r
171                 private CTexture[] txInfo = new CTexture[2];\r
172                 //-----------------\r
173                 #endregion\r
174         }\r
175 }\r