OSDN Git Service

DTXManiaソリューション、DTXManiaプロジェクト、DTXCreatorプロジェクト、FDKプロジェクトについて英語化。
[dtxmania/dtxmania.git] / DTXMania / コード / ステージ / 07.演奏 / ドラム画面 / CAct演奏Drumsパッド.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Runtime.InteropServices;
5 using System.Drawing;
6 using FDK;
7
8 namespace DTXMania
9 {
10         internal class CAct演奏Drumsパッド : CActivity
11         {
12                 private readonly EPad[] n描画順 = new EPad[] {
13                                                 EPad.BD,
14                                                 EPad.FT,
15                                                 EPad.LT,
16                                                 EPad.HT,
17                                                 EPad.SD,
18                                                 EPad.CY,
19                                                 EPad.HH,
20                                                 EPad.RD,
21                                                 EPad.LC
22                                 };
23                 private long nY座標制御タイマ;
24                 private long nフラッシュ制御タイマ;
25                 private STPadValue<STパッド状態> stパッド状態 = new STPadValue<STパッド状態>();
26                 private CTexture txパッド;
27                 private CTexture tx光るパッド;
28
29                 private class STパッド状態
30                 {
31                         public int n明るさ;
32                         public int nY座標オフセットdot;
33                         public int nY座標加速度dot;
34                         public STパッド状態(int n明るさ_, int nY座標オフセットdot_, int nY座標加速度dot_)
35                         {
36                                 n明るさ = n明るさ_;
37                                 nY座標オフセットdot = nY座標オフセットdot_;
38                                 nY座標加速度dot = nY座標加速度dot_;
39                         }
40                 }
41
42                 public void Hit(EPad ePad)
43                 {
44                         this.stパッド状態[ePad].n明るさ = 6;
45                         this.stパッド状態[ePad].nY座標加速度dot = 2;
46                 }
47
48                 public override void On活性化()
49                 {
50                         if (base.b活性化してない)
51                         {
52                                 this.nフラッシュ制御タイマ = -1;
53                                 this.nY座標制御タイマ = -1;
54                                 for (EPad i = EPad.DrumsPadMin; i < EPad.DrumsPadMax; ++i)
55                                 {
56                                         this.stパッド状態[i] = new STパッド状態(0, 0, 0);
57                                 }
58                                 base.On活性化();
59                         }
60                 }
61
62                 public override void OnManagedリソースの作成()
63                 {
64                         if (base.b活性化してる)
65                         {
66                                 this.txパッド = TextureFactory.tテクスチャの生成(CSkin.Path(@"Graphics\ScreenPlayDrums pads.png"));
67                                 this.tx光るパッド = TextureFactory.tテクスチャの生成(CSkin.Path(@"Graphics\ScreenPlayDrums pads flush.png"));
68                                 base.OnManagedリソースの作成();
69                         }
70                 }
71
72                 public override void OnManagedリソースの解放()
73                 {
74                         if (base.b活性化してる)
75                         {
76                                 TextureFactory.tテクスチャの解放(ref this.txパッド);
77                                 TextureFactory.tテクスチャの解放(ref this.tx光るパッド);
78                                 base.OnManagedリソースの解放();
79                         }
80                 }
81
82                 public override int On進行描画()
83                 {
84                         if (b活性化してる &&
85                                 CDTXMania.Instance.ConfigIni.bDrums有効 &&
86                                 CDTXMania.Instance.DTX.bチップがある.Drums &&
87                                 CDTXMania.Instance.ConfigIni.eDark != EDark.Full)
88                         {
89                                 if (b初めての進行描画)
90                                 {
91                                         nフラッシュ制御タイマ = FDK.CSound管理.rc演奏用タイマ.n現在時刻;
92                                         nY座標制御タイマ = FDK.CSound管理.rc演奏用タイマ.n現在時刻;
93                                         b初めての進行描画 = false;
94                                 }
95                                 long n現在時刻 = FDK.CSound管理.rc演奏用タイマ.n現在時刻;
96                                 if (n現在時刻 < this.nフラッシュ制御タイマ)
97                                 {
98                                         this.nフラッシュ制御タイマ = n現在時刻;
99                                 }
100                                 while ((n現在時刻 - this.nフラッシュ制御タイマ) >= 15)
101                                 {
102                                         for (EPad i = EPad.DrumsPadMin; i < EPad.DrumsPadMax; i++)
103                                         {
104                                                 if (this.stパッド状態[i].n明るさ > 0)
105                                                 {
106                                                         this.stパッド状態[i].n明るさ--;
107                                                 }
108                                         }
109                                         this.nフラッシュ制御タイマ += 15;
110                                 }
111                                 n現在時刻 = FDK.CSound管理.rc演奏用タイマ.n現在時刻;
112                                 if (n現在時刻 < this.nY座標制御タイマ)
113                                 {
114                                         this.nY座標制御タイマ = n現在時刻;
115                                 }
116                                 while ((n現在時刻 - this.nY座標制御タイマ) >= 5)
117                                 {
118                                         for (EPad i = EPad.DrumsPadMin; i < EPad.DrumsPadMax; i++)
119                                         {
120                                                 this.stパッド状態[i].nY座標オフセットdot += this.stパッド状態[i].nY座標加速度dot;
121                                                 if (this.stパッド状態[i].nY座標オフセットdot > 15)
122                                                 {
123                                                         this.stパッド状態[i].nY座標オフセットdot = 15;
124                                                         this.stパッド状態[i].nY座標加速度dot = -1;
125                                                 }
126                                                 else if (this.stパッド状態[i].nY座標オフセットdot < 0)
127                                                 {
128                                                         this.stパッド状態[i].nY座標オフセットdot = 0;
129                                                         this.stパッド状態[i].nY座標加速度dot = 0;
130                                                 }
131                                         }
132                                         this.nY座標制御タイマ += 5;
133                                 }
134                                 #region [ 表示 ]
135                                 for (int idx = 0; idx < n描画順.Length; idx++)
136                                 {
137                                         EPad i = n描画順[idx];
138                                         Rectangle rc = CDTXMania.Instance.Coordinates.ImgDrPad[i];
139                                         int x = CDTXMania.Instance.ConfigIni.GetLaneX(EnumConverter.LaneFromPad(i)) +
140                                                         (CDTXMania.Instance.ConfigIni.GetLaneW(EnumConverter.LaneFromPad(i)) / 2 -
141                                                         CDTXMania.Instance.Coordinates.ImgDrPad[i].W / 2);
142                                         int yoffset = CDTXMania.Instance.Coordinates.DrPadOffset[i].Y;
143                                         int y = (CDTXMania.Instance.ConfigIni.bReverse.Drums ?
144                                                  SampleFramework.GameWindowSize.Height - CDTXMania.Instance.Coordinates.DrPad.Y - yoffset - rc.Height :
145                                                  CDTXMania.Instance.Coordinates.DrPad.Y + yoffset) + 2 * this.stパッド状態[i].nY座標オフセットdot;
146
147                                         if (this.txパッド != null)
148                                         {
149                                                 this.txパッド.t2D描画(CDTXMania.Instance.Device, x, y, rc);
150                                         }
151                                         if (this.tx光るパッド != null)
152                                         {
153                                                 this.tx光るパッド.n透明度 = (this.stパッド状態[i].n明るさ * 40) + 15;
154                                                 this.tx光るパッド.t2D描画(CDTXMania.Instance.Device, x, y, rc);
155                                         }
156                                 }
157                                 #endregion
158                         }
159
160                         return 0;
161                 }
162         }
163 }