Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/DTXManiaプロジェクト/コード/ステージ/02.タイトル/CStageタイトル.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 568 - (show annotations) (download)
Sat Aug 20 09:31:46 2016 UTC (7 years, 7 months ago) by kairera0467
File size: 12869 byte(s)
Ver3.61
#36544 「JudgePosition」を使用しても座標が変わらなくなっていたので修正。
#xxxxx バージョン番号の変更
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Runtime.InteropServices;
5 using System.Diagnostics;
6 using System.Drawing;
7 using SlimDX.DirectInput;
8 using FDK;
9
10 namespace DTXMania
11 {
12 internal class CStageタイトル : CStage
13 {
14 // コンストラクタ
15
16 public CStageタイトル()
17 {
18 base.eステID = CStage.Eステ.タイトル;
19 base.b活性化してない = true;
20 base.listActivities.Add( this.actFIfromSetup = new CActFIFOWhite() );
21 base.listActivities.Add( this.actFI = new CActFIFOWhite() );
22 base.listActivities.Add( this.actFO = new CActFIFOWhite() );
23 }
24
25
26 // CStage 実装
27
28 public override void On活性化()
29 {
30 Trace.TraceInformation( "タイトルステージを活性化します。" );
31 Trace.Indent();
32 try
33 {
34 for( int i = 0; i < 4; i++ )
35 {
36 this.ct反復用[ i ] = new CCounter( 0, 0, 0, CDTXMania.Timer );
37 }
38 this.ct上移動用 = new CCounter();
39 this.ct下移動用 = new CCounter();
40 this.ctソルフラッシュ用 = new CCounter();
41 base.On活性化();
42 }
43 finally
44 {
45 Trace.TraceInformation( "タイトルステージの活性化を完了しました。" );
46 Trace.Unindent();
47 }
48 }
49 public override void On非活性化()
50 {
51 Trace.TraceInformation( "タイトルステージを非活性化します。" );
52 Trace.Indent();
53 try
54 {
55 for( int i = 0; i < 4; i++ )
56 {
57 this.ct反復用[ i ] = null;
58 }
59 this.ct上移動用 = null;
60 this.ct下移動用 = null;
61 this.ctソルフラッシュ用 = null;
62 }
63 finally
64 {
65 Trace.TraceInformation( "タイトルステージの非活性化を完了しました。" );
66 Trace.Unindent();
67 }
68 base.On非活性化();
69 }
70 public override void OnManagedリソスの作成()
71 {
72 if( !base.b活性化してない )
73 {
74 this.tx背景 = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\2_background.jpg" ), false );
75 this.txメニュ = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\2_menu.png" ), false );
76 base.OnManagedリソスの作成();
77 }
78 }
79 public override void OnManagedリソスの解放()
80 {
81 if( !base.b活性化してない )
82 {
83 CDTXMania.tテクスチャの解放( ref this.tx背景 );
84 CDTXMania.tテクスチャの解放( ref this.txメニュ );
85 base.OnManagedリソスの解放();
86 }
87 }
88 public override int On進行描画()
89 {
90 if( !base.b活性化してない )
91 {
92 #region [ 初めての進行描画 ]
93 //---------------------
94 if( base.b初めての進行描画 )
95 {
96 if( CDTXMania.r直前のステ == CDTXMania.stage起動 )
97 {
98 this.actFIfromSetup.tフェドイン開始();
99 base.eフェID = CStage.Eフェ.タイトル_起動画面からのフェドイン;
100 }
101 else
102 {
103 this.actFI.tフェドイン開始();
104 base.eフェID = CStage.Eフェ.共通_フェドイン;
105 }
106 this.ctソルフラッシュ用.t開始( 0, 700, 5, CDTXMania.Timer );
107 this.ctソルフラッシュ用.n現在の値 = 100;
108 base.b初めての進行描画 = false;
109 }
110 //---------------------
111 #endregion
112
113 // 進行
114
115 #region [ カーソル上移動 ]
116 //---------------------
117 if( this.ct上移動用.b進行中 )
118 {
119 this.ct上移動用.t進行();
120 if( this.ct上移動用.b終了値に達した )
121 {
122 this.ct上移動用.t停止();
123 }
124 }
125 //---------------------
126 #endregion
127 #region [ カーソル下移動 ]
128 //---------------------
129 if( this.ct下移動用.b進行中 )
130 {
131 this.ct下移動用.t進行();
132 if( this.ct下移動用.b終了値に達した )
133 {
134 this.ct下移動用.t停止();
135 }
136 }
137 //---------------------
138 #endregion
139 #region [ カーソルフラッシュ ]
140 //---------------------
141 this.ctソルフラッシュ用.t進行Loop();
142 //---------------------
143 #endregion
144
145 // キー入力
146
147 if( base.eフェID == CStage.Eフェ.共通_通常状態 // 通常状態、かつ
148 && CDTXMania.act現在入力を占有中のプラグイン == null ) // プラグインの入力占有がない
149 {
150 if( CDTXMania.Input管理.Keyboard.bが押された( (int) Key.Escape ) )
151 return (int) E戻り値.EXIT;
152
153 this.ct反復用.Up.t反復( CDTXMania.Input管理.Keyboard.bが押されている( (int)SlimDX.DirectInput.Key.UpArrow ), new CCounter.DG処理( this.tソルを上へ移動する ) );
154 this.ct反復用.R.t反復( CDTXMania.Pad.b押されているGB( Eパッド.HH ), new CCounter.DG処理( this.tソルを上へ移動する ) );
155 if( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.SD ) )
156 this.tソルを上へ移動する();
157
158 this.ct反復用.Down.t反復( CDTXMania.Input管理.Keyboard.bが押されている( (int)SlimDX.DirectInput.Key.DownArrow ), new CCounter.DG処理( this.tソルを下へ移動する ) );
159 this.ct反復用.B.t反復( CDTXMania.Pad.b押されているGB( Eパッド.SD ), new CCounter.DG処理( this.tソルを下へ移動する ) );
160 if( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.FT ) )
161 this.tソルを下へ移動する();
162
163 if( ( CDTXMania.Pad.b押されたDGB( Eパッド.CY ) || CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.RD ) ) || ( CDTXMania.ConfigIni.bEnterがキ割り当てのどこにも使用されていない && CDTXMania.Input管理.Keyboard.bが押された( (int)SlimDX.DirectInput.Key.Return ) ) )
164 {
165 if ( ( this.n現在のカソル行 == (int) E戻り値.GAMESTART - 1 ) && CDTXMania.Skin.soundム開始音.b読み込み成功 )
166 {
167 CDTXMania.Skin.soundム開始音.t再生する();
168 }
169 else
170 {
171 CDTXMania.Skin.sound決定音.t再生する();
172 }
173 if( this.n現在のカソル行 == (int)E戻り値.EXIT - 1 )
174 {
175 return (int)E戻り値.EXIT;
176 }
177 this.actFO.tフェドアウト開始();
178 base.eフェID = CStage.Eフェ.共通_フェドアウト;
179 }
180 }
181
182 // 描画
183
184 if( this.tx背景 != null )
185 this.tx背景.t2D描画( CDTXMania.app.Device, 0, 0 );
186
187 CDTXMania.act文字コンソ.tPrint( 2, 2, C文字コンソ.Eフォント種別., "DTX:J:A:A:2016082000" );
188
189 if( this.txメニュ != null )
190 {
191 int x = MENU_X;
192 int y = MENU_Y + ( this.n現在のカソル行 * MENU_H );
193 if( this.ct上移動用.b進行中 )
194 {
195 y += (int) ( (double)MENU_H / 2 * ( Math.Cos( Math.PI * ( ( (double) this.ct上移動用.n現在の値 ) / 100.0 ) ) + 1.0 ) );
196 }
197 else if( this.ct下移動用.b進行中 )
198 {
199 y -= (int) ( (double)MENU_H / 2 * ( Math.Cos( Math.PI * ( ( (double) this.ct下移動用.n現在の値 ) / 100.0 ) ) + 1.0 ) );
200 }
201 if( this.ctソルフラッシュ用.n現在の値 <= 100 )
202 {
203 float nMag = (float) ( 1.0 + ( ( ( (double) this.ctソルフラッシュ用.n現在の値 ) / 100.0 ) * 0.5 ) );
204 this.txメニュ.vc拡大縮小倍率.X = nMag;
205 this.txメニュ.vc拡大縮小倍率.Y = nMag;
206 this.txメニュ.n透明度 = (int) ( 255.0 * ( 1.0 - ( ( (double) this.ctソルフラッシュ用.n現在の値 ) / 100.0 ) ) );
207 int x_magnified = x + ( (int) ( ( MENU_W * ( 1.0 - nMag ) ) / 2.0 ) );
208 int y_magnified = y + ( (int) ( ( MENU_H * ( 1.0 - nMag ) ) / 2.0 ) );
209 this.txメニュ.t2D描画( CDTXMania.app.Device, x_magnified, y_magnified, new Rectangle( 0, MENU_H * 5, MENU_W, MENU_H ) );
210 }
211 this.txメニュ.vc拡大縮小倍率.X = 1f;
212 this.txメニュ.vc拡大縮小倍率.Y = 1f;
213 this.txメニュ.n透明度 = 0xff;
214 this.txメニュ.t2D描画( CDTXMania.app.Device, x, y, new Rectangle( 0, MENU_H * 4, MENU_W, MENU_H ) );
215 }
216 if( this.txメニュ != null )
217 {
218 //this.txメニュー.t2D描画( CDTXMania.app.Device, 0xce, 0xcb, new Rectangle( 0, 0, MENU_W, MENU_H ) );
219 // #24525 2011.3.16 yyagi: "OPTION"を省いて描画。従来スキンとの互換性確保のため。
220 this.txメニュ.t2D描画( CDTXMania.app.Device, MENU_X, MENU_Y, new Rectangle( 0, 0, MENU_W, MENU_H ) );
221 this.txメニュ.t2D描画( CDTXMania.app.Device, MENU_X, MENU_Y + MENU_H, new Rectangle( 0, MENU_H * 2, MENU_W, MENU_H * 2 ) );
222 }
223 CStage.Eフェ eフェid = base.eフェID;
224 switch( eフェid )
225 {
226 case CStage.Eフェ.共通_フェドイン:
227 if( this.actFI.On進行描画() != 0 )
228 {
229 CDTXMania.Skin.soundタイトル音.t再生する();
230 base.eフェID = CStage.Eフェ.共通_通常状態;
231 }
232 break;
233
234 case CStage.Eフェ.共通_フェドアウト:
235 if( this.actFO.On進行描画() == 0 )
236 {
237 break;
238 }
239 base.eフェID = CStage.Eフェ.共通_終了状態;
240 switch ( this.n現在のカソル行 )
241 {
242 case (int)E戻り値.GAMESTART - 1:
243 return (int)E戻り値.GAMESTART;
244
245 case (int) E戻り値.CONFIG - 1:
246 return (int) E戻り値.CONFIG;
247
248 case (int)E戻り値.EXIT - 1:
249 return (int) E戻り値.EXIT;
250 //return ( this.n現在のカーソル行 + 1 );
251 }
252 break;
253
254 case CStage.Eフェ.タイトル_起動画面からのフェドイン:
255 if( this.actFIfromSetup.On進行描画() != 0 )
256 {
257 CDTXMania.Skin.soundタイトル音.t再生する();
258 base.eフェID = CStage.Eフェ.共通_通常状態;
259 }
260 break;
261 }
262 }
263 return 0;
264 }
265 public enum E戻り値
266 {
267 継続 = 0,
268 GAMESTART,
269 // OPTION,
270 CONFIG,
271 EXIT
272 }
273
274
275 // その他
276
277 #region [ private ]
278 //-----------------
279 [StructLayout( LayoutKind.Sequential )]
280 private struct ST反復用カウンタ
281 {
282 public CCounter Up;
283 public CCounter Down;
284 public CCounter R;
285 public CCounter B;
286 public CCounter this[ int index ]
287 {
288 get
289 {
290 switch( index )
291 {
292 case 0:
293 return this.Up;
294
295 case 1:
296 return this.Down;
297
298 case 2:
299 return this.R;
300
301 case 3:
302 return this.B;
303 }
304 throw new IndexOutOfRangeException();
305 }
306 set
307 {
308 switch( index )
309 {
310 case 0:
311 this.Up = value;
312 return;
313
314 case 1:
315 this.Down = value;
316 return;
317
318 case 2:
319 this.R = value;
320 return;
321
322 case 3:
323 this.B = value;
324 return;
325 }
326 throw new IndexOutOfRangeException();
327 }
328 }
329 }
330
331 private CActFIFOWhite actFI;
332 private CActFIFOWhite actFIfromSetup;
333 private CActFIFOWhite actFO;
334 private CCounter ctソルフラッシュ用;
335 private ST反復用カウンタ ct反復用;
336 private CCounter ct下移動用;
337 private CCounter ct上移動用;
338 private const int MENU_H = 0x27;
339 private const int MENU_W = 0xe3;
340 private const int MENU_X = 0x1fa;
341 private const int MENU_Y = 0x201;
342 private int n現在のカソル行;
343 private CTexture txメニュ;
344 private CTexture tx背景;
345
346 private void tソルを下へ移動する()
347 {
348 if ( this.n現在のカソル行 != (int) E戻り値.EXIT - 1 )
349 {
350 CDTXMania.Skin.soundソル移動音.t再生する();
351 this.n現在のカソル行++;
352 this.ct下移動用.t開始( 0, 100, 1, CDTXMania.Timer );
353 if( this.ct上移動用.b進行中 )
354 {
355 this.ct下移動用.n現在の値 = 100 - this.ct上移動用.n現在の値;
356 this.ct上移動用.t停止();
357 }
358 }
359 }
360 private void tソルを上へ移動する()
361 {
362 if ( this.n現在のカソル行 != (int) E戻り値.GAMESTART - 1 )
363 {
364 CDTXMania.Skin.soundソル移動音.t再生する();
365 this.n現在のカソル行--;
366 this.ct上移動用.t開始( 0, 100, 1, CDTXMania.Timer );
367 if( this.ct下移動用.b進行中 )
368 {
369 this.ct上移動用.n現在の値 = 100 - this.ct下移動用.n現在の値;
370 this.ct下移動用.t停止();
371 }
372 }
373 }
374 //-----------------
375 #endregion
376 }
377 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26