OSDN Git Service

#32713 初コミット。SVNrev567時点での、ファイルはbranch/140707(ReBuild XGVersion)から移行したもの。
[dtxmaniaxg-verk/dtxmaniaxg-verk-git.git] / DTXManiaプロジェクト / コード / ステージ / 07.演奏 / ドラム画面 / CAct演奏Drumsレーン.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Drawing;
5 using FDK;
6 using SlimDX.Direct3D9;
7
8 namespace DTXMania
9 {
10     internal class CAct演奏Drumsレーン : CActivity
11     {
12         /// <summary>
13         /// レーンを描画するクラス。
14         /// レーンの他にもクリップのウィンドウ表示も兼ねる。要はクラス作成が面倒だっただけ。
15         /// 
16         /// 課題
17         /// ・レーンの透明度対応
18         /// </summary>
19         public CAct演奏Drumsレーン()
20         {
21             base.b活性化してない = true;
22         }
23
24         public override void On活性化()
25         {
26             this.n振動X座標 = 0;
27             for( int i = 0; i < 10; i++ )
28             {
29                 this.ct進行[ i ] = new CCounter();
30             }
31             this.ct振動進行 = new CCounter();
32             base.On活性化();
33         }
34
35         public override void On非活性化()
36         {
37             for( int i = 0; i < 10; i++ )
38             { 
39                 this.ct進行[ i ] = null;
40             }
41             this.ct振動進行 = null;
42             base.On非活性化();
43         }
44
45         public override void OnManagedリソースの作成()
46         {
47             for( int i = 0; i < 10; i++ )
48             {
49                 if( CDTXMania.ConfigIni.nLaneDispType.Drums == 0 || CDTXMania.ConfigIni.nLaneDispType.Drums == 2 )
50                     this.txLane[ i ] = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\7_Paret.png" ) );
51                 else
52                     this.txLane[ i ] = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\Tile black 64x64.png" ) );
53             }
54             this.txLaneShadow = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\7_Drums_Shadow.png" ) );
55             base.OnManagedリソースの作成();
56         }
57
58         public override void OnManagedリソースの解放()
59         {
60             for( int i = 0; i < 10; i++ )
61             { 
62                 CDTXMania.tテクスチャの解放( ref this.txLane[ i ] );
63             }
64             CDTXMania.tテクスチャの解放( ref this.txLaneShadow );
65             base.OnManagedリソースの解放();
66         }
67
68         public override int On進行描画()
69         {
70             if( CDTXMania.bXGRelease && !( CDTXMania.ConfigIni.nLaneDispType.Drums == 1 || CDTXMania.ConfigIni.nLaneDispType.Drums == 3 ) )
71             {
72                             for( int i = 0; i < 10; i++ )
73                         {
74                                 if( !this.ct進行[ i ].b停止中 )
75                                 {
76                                         this.ct進行[ i ].t進行();
77                                         if ( this.ct進行[ i ].b終了値に達した )
78                                             {
79                                                     this.ct進行[ i ].t停止();
80                                         }
81                                 }
82                     }
83                 if( !this.ct振動進行.b停止中 )
84                 {
85                     this.ct振動進行.t進行();
86                     if( this.ct振動進行.b終了値に達した )
87                     {
88                         this.ct振動進行.t停止();
89                     }
90                 }
91
92                 //CDTXMania.act文字コンソール.tPrint( 0, 0, C文字コンソール.Eフォント種別.灰, this.n振動X座標.ToString() );
93                 //CDTXMania.act文字コンソール.tPrint( 0, 16, C文字コンソール.Eフォント種別.灰, this.ct振動進行.n現在の値.ToString() );
94                 if( this.ct振動進行.b進行中 )
95                     this.n振動X座標 = CDTXMania.Random.Next( 12 ) - 6;
96                 else
97                     this.n振動X座標 = 0;
98             }
99
100             if( this.txLaneShadow != null )
101             {
102                 this.txLaneShadow.t2D描画( CDTXMania.app.Device, 0, 0 );
103             }
104
105             if( this.txLane[ 0 ] != null ) //LC
106             {
107                 float[] f拡大率 = new float[] { 1.0f, 0.97f, 0.93f, 0.90f, 0.86f, 0.90f, 0.93f, 0.97f, 1.0f }; //BD
108                 this.txLane[ 0 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 0 ].n現在の値 ];
109                 this.txLane[ 0 ].t2D描画( CDTXMania.app.Device, 367 - (int)( 72 * f拡大率[ this.ct進行[ 0 ].n現在の値 ] ) + this.n振動X座標, 0, new Rectangle( 0, 0, 72, 720 ) );
110             }
111             if( this.txLane[ 1 ] != null ) //HH
112             {
113                 float[] f拡大率 = new float[] { 1.0f, 0.97f, 0.93f, 0.90f, 0.86f, 0.90f, 0.93f, 0.97f, 1.0f }; //BD
114                 this.txLane[ 1 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 1 ].n現在の値 ];
115                 this.txLane[ 1 ].t2D描画( CDTXMania.app.Device, 416 - (int)( 49 * f拡大率[ this.ct進行[ 1 ].n現在の値 ] ) + this.n振動X座標, 0, new Rectangle( 72, 0, 49, 720 ) );
116
117                 this.txLane[ 1 ].vc拡大縮小倍率.X = 1.0f;
118                 this.txLane[ 1 ].t2D描画( CDTXMania.app.Device, 416 + this.n振動X座標, 0, new Rectangle( 121, 0, 3, 720 ) );
119             }
120             if( this.txLane[ 2 ] != null ) //SD
121             {
122                 float[] f拡大率 = new float[] { 1.0f, 0.94f, 0.89f, 0.87f, 0.81f, 0.87f, 0.89f, 0.94f, 1.0f }; //BDのものを使いまわし
123                 int[] nX座標補正 = new int[] { 0, 1, 1, 2, 2, 1, 1, 0, 0 };
124
125                 switch( CDTXMania.ConfigIni.eLaneType )
126                 {
127                     case Eタイプ.A:
128                     case Eタイプ.C:
129                         this.txLane[ 2 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 2 ].n現在の値 ];
130                         this.txLane[ 2 ].t2D描画( CDTXMania.app.Device, 497 - (int)( ( 60 / 2 ) * f拡大率[ this.ct進行[ 2 ].n現在の値 ] ) + nX座標補正[ this.ct進行[ 2 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 172, 0, 60, 720 ) );
131                         break;
132                     case Eタイプ.B:
133                     case Eタイプ.D:
134                         this.txLane[ 2 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 2 ].n現在の値 ];
135                         this.txLane[ 2 ].t2D描画( CDTXMania.app.Device, 446 - (int)( ( 60 / 2 ) * f拡大率[ this.ct進行[ 2 ].n現在の値 ] ) + nX座標補正[ this.ct進行[ 2 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 172, 0, 60, 720 ) );
136                         break;
137                 }
138             }
139             if( this.txLane[ 3 ] != null ) //BD
140             {
141                 float[] f拡大率 = new float[] { 1.0f, 0.94f, 0.89f, 0.87f, 0.81f, 0.87f, 0.89f, 0.94f, 1.0f }; //BD
142                 int[] nX座標補正 = new int[] { 0, 1, 1, 2, 4, 2, 1, 1, 0 };
143                 switch( CDTXMania.ConfigIni.eLaneType )
144                 {
145                     case Eタイプ.A:
146                     case Eタイプ.D:
147                         this.txLane[ 3 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 3 ].n現在の値 ];
148                         this.txLane[ 3 ].t2D描画( CDTXMania.app.Device, 612 - (int)( ( 66 / 2 ) * f拡大率[ this.ct進行[ 3 ].n現在の値 ] ) - nX座標補正[ this.ct進行[ 3 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 284, 0, 66, 720 ) );
149                         break;
150                     case Eタイプ.B:
151                     case Eタイプ.C:
152                         this.txLane[ 3 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 3 ].n現在の値 ];
153                         this.txLane[ 3 ].t2D描画( CDTXMania.app.Device, 563 - (int)( ( 66 / 2 ) * f拡大率[ this.ct進行[ 3 ].n現在の値 ] ) - nX座標補正[ this.ct進行[ 3 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 284, 0, 66, 720 ) );
154                         break;
155                 }
156             }
157             if( this.txLane[ 4 ] != null ) //HT
158             {
159                 float[] f拡大率 = new float[] { 1.0f, 0.98f, 0.91f, 0.87f, 0.78f, 0.87f, 0.91f, 0.98f, 1.0f }; //HT
160                 int[] nX座標補正 = new int[] { 0, 1, 1, 1, 2, 1, 1, 1, 0 };
161
162                 switch( CDTXMania.ConfigIni.eLaneType )
163                 {
164                     case Eタイプ.A:
165                         this.txLane[ 4 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 4 ].n現在の値 ];
166                         this.txLane[ 4 ].t2D描画( CDTXMania.app.Device, 550 - (int)( ( 52 / 2 ) * f拡大率[ this.ct進行[ 4 ].n現在の値 ] ) + nX座標補正[ this.ct進行[ 4 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 229, 0, 52, 720 ) );
167                         this.txLane[ 4 ].vc拡大縮小倍率.X = 1.0f;
168                         this.txLane[ 4 ].t2D描画( CDTXMania.app.Device, 576 + this.n振動X座標, 0, new Rectangle( 281, 0, 3, 720 ) );
169                         break;
170                     case Eタイプ.B:
171                     case Eタイプ.C:
172                         nX座標補正 = new int[] { 0, 1, 1, 1, 2, 1, 1, 1, 0 };
173                         f拡大率 = new float[] { 1.0f, 0.96f, 0.94f, 0.92f, 0.88f, 0.92f, 0.94f, 0.96f, 1.0f };
174                         this.txLane[ 4 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 4 ].n現在の値 ];
175                         this.txLane[ 4 ].t2D描画( CDTXMania.app.Device, 593 - nX座標補正[ this.ct進行[ 4 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 229, 0, 52, 720 ) );
176                         this.txLane[ 4 ].vc拡大縮小倍率.X = 1.0f;
177                         this.txLane[ 4 ].t2D描画( CDTXMania.app.Device, 527 + this.n振動X座標, 0, new Rectangle( 281, 0, 3, 720 ) );
178                         break;
179                     case Eタイプ.D:
180                         this.txLane[ 4 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 4 ].n現在の値 ];
181                         this.txLane[ 4 ].t2D描画( CDTXMania.app.Device, 501 - (int)( ( 52 / 2 ) * f拡大率[ this.ct進行[ 4 ].n現在の値 ] ) + nX座標補正[ this.ct進行[ 4 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 229, 0, 52, 720 ) );
182                         break;
183                 }
184
185             }
186             if( this.txLane[ 5 ] != null ) //LT
187             {
188                 float[] f拡大率 = new float[] { 1.0f, 0.96f, 0.94f, 0.92f, 0.88f, 0.92f, 0.94f, 0.96f, 1.0f }; //LT
189                 int[] nX座標補正 = new int[] { 0, 1, 1, 1, 2, 1, 1, 1, 0 };
190                 this.txLane[ 5 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 5 ].n現在の値 ];
191                 this.txLane[ 5 ].t2D描画( CDTXMania.app.Device, 642 - nX座標補正[ this.ct進行[ 5 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 347, 0, 52, 720 ) );
192             }
193             if( this.txLane[ 6 ] != null ) //FT
194             {
195                 float[] f拡大率 = new float[] { 1.0f, 0.96f, 0.94f, 0.92f, 0.88f, 0.92f, 0.94f, 0.96f, 1.0f }; //LTの使い回し
196                 int[] nX座標補正 = new int[] { 0, 1, 1, 1, 2, 1, 1, 1, 0 };
197                 this.txLane[ 6 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 6 ].n現在の値 ];
198                 this.txLane[ 6 ].t2D描画( CDTXMania.app.Device, 691 - nX座標補正[ this.ct進行[ 6 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 396, 0, 52, 720 ) );
199
200                 this.txLane[ 6 ].vc拡大縮小倍率.X = 1.0f;
201                 this.txLane[ 6 ].t2D描画( CDTXMania.app.Device, 743 + this.n振動X座標, 0, new Rectangle( 448, 0, 2, 720 ) );
202             }
203             if( this.txLane[ 9 ] != null ) //RD
204             {
205                 float[] f拡大率 = new float[] { 1.0f, 0.96f, 0.94f, 0.92f, 0.88f, 0.92f, 0.94f, 0.96f, 1.0f }; //HTの使い回し
206                 int[] nX座標補正 = new int[] { 0, 1, 1, 1, 1, 1, 1, 1, 0 };
207                 this.txLane[ 9 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 9 ].n現在の値 ];
208
209                 switch( CDTXMania.ConfigIni.eRDPosition )
210                 {
211                     case ERDPosition.RCRD:
212                         this.txLane[ 9 ].t2D描画( CDTXMania.app.Device, 815 - nX座標補正[ this.ct進行[ 9 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 520, 0, 38, 720 ) );
213                         this.txLane[ 9 ].vc拡大縮小倍率.X = 1.0f;
214                         this.txLane[ 9 ].t2D描画( CDTXMania.app.Device, 812 + this.n振動X座標, 0, new Rectangle( 517, 0, 3, 720 ) );
215                         break;
216                     case ERDPosition.RDRC:
217                         this.txLane[ 9 ].t2D描画( CDTXMania.app.Device, 744 - nX座標補正[ this.ct進行[ 9 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 520, 0, 38, 720 ) );
218                         this.txLane[ 9 ].vc拡大縮小倍率.X = 1.0f;
219                         this.txLane[ 9 ].t2D描画( CDTXMania.app.Device, 783 + this.n振動X座標, 0, new Rectangle( 517, 0, 3, 720 ) );
220                         break;
221                 }
222
223             }
224             if( this.txLane[ 7 ] != null ) //CY
225             {
226                 float[] f拡大率 = new float[] { 1.0f, 0.96f, 0.94f, 0.92f, 0.88f, 0.92f, 0.94f, 0.96f, 1.0f }; //LCの使い回し
227                 int[] nX座標補正 = new int[] { 0, 2, 3, 4, 6, 4, 3, 2, 0 };
228                 this.txLane[ 7 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 7 ].n現在の値 ];
229                 this.txLane[ 7 ].t2D描画( CDTXMania.app.Device, 745 - nX座標補正[ this.ct進行[ 7 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 450, 0, 70, 720 ) );
230                 switch( CDTXMania.ConfigIni.eRDPosition )
231                 {
232                     case ERDPosition.RCRD:
233                         this.txLane[ 7 ].t2D描画( CDTXMania.app.Device, 745 - nX座標補正[ this.ct進行[ 7 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 450, 0, 70, 720 ) );
234                         break;
235                     case ERDPosition.RDRC:
236                         this.txLane[ 7 ].t2D描画( CDTXMania.app.Device, 783 - nX座標補正[ this.ct進行[ 7 ].n現在の値 ] + this.n振動X座標, 0, new Rectangle( 450, 0, 70, 720 ) );
237                         break;
238                 }
239             }
240             if( this.txLane[ 8 ] != null ) //LP LBD
241             {
242                 float[] f拡大率 = new float[] { 1.0f, 0.96f, 0.92f, 0.90f, 0.86f, 0.90f, 0.92f, 0.96f, 1.0f }; //LP LBD
243                 this.txLane[ 8 ].vc拡大縮小倍率.X = f拡大率[ this.ct進行[ 8 ].n現在の値 ];
244
245                 switch( CDTXMania.ConfigIni.eLaneType )
246                 {
247                     case Eタイプ.A:
248                         this.txLane[ 8 ].t2D描画( CDTXMania.app.Device, 467 - (int)( 51 * f拡大率[ this.ct進行[ 8 ].n現在の値 ] ) + this.n振動X座標, 0, new Rectangle( 121, 0, 51, 720 ) );
249                         break;
250                     case Eタイプ.C:
251                         this.txLane[ 8 ].t2D描画( CDTXMania.app.Device, 467 - (int)( 51 * f拡大率[ this.ct進行[ 8 ].n現在の値 ] ) + this.n振動X座標, 0, new Rectangle( 121, 0, 51, 720 ) );
252                         this.txLane[ 8 ].vc拡大縮小倍率.X = 1.0f;
253                         this.txLane[ 8 ].t2D描画( CDTXMania.app.Device, 524 + this.n振動X座標, 0, new Rectangle( 281, 0, 3, 720 ) );
254                         break;
255                     case Eタイプ.B:
256                         this.txLane[ 8 ].t2D描画( CDTXMania.app.Device, 524 - (int)( 51 * f拡大率[ this.ct進行[ 8 ].n現在の値 ] ) + this.n振動X座標, 0, new Rectangle( 121, 0, 51, 720 ) );
257                         this.txLane[ 8 ].vc拡大縮小倍率.X = 1.0f;
258                         this.txLane[ 8 ].t2D描画( CDTXMania.app.Device, 524 + this.n振動X座標, 0, new Rectangle( 281, 0, 3, 720 ) );
259                         break;
260                     case Eタイプ.D:
261                         this.txLane[ 8 ].t2D描画( CDTXMania.app.Device, 575 - (int)( 51 * f拡大率[ this.ct進行[ 8 ].n現在の値 ] ) + this.n振動X座標, 0, new Rectangle( 121, 0, 51, 720 ) );
262                         break;
263                 }
264             }
265
266             return base.On進行描画();
267         }
268
269                 public void Start( Eレーン lane )
270                 {
271                         this.ct進行[ (int) lane ] = new CCounter( 0, 8, 12, CDTXMania.Timer );
272                 }
273
274         public void tVibration()
275         {
276                         this.ct振動進行 = new CCounter( 0, 30, 20, CDTXMania.Timer );
277         }
278
279         #region[ private ]
280         //-----------------
281         private CTexture[] txLane = new CTexture[ 10 ];
282         private CCounter[] ct進行 = new CCounter[ 10 ];
283         private CCounter ct振動進行;
284         private CTexture txLaneShadow;
285         private int n振動X座標;
286         //-----------------
287         #endregion
288     }
289 }