Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13 - (hide annotations) (download)
Sun Feb 17 05:00:51 2013 UTC (11 years, 1 month ago) by kairera0467
File size: 12727 byte(s)


1 kairera0467 2 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パッド.BD ), new CCounter.DG処理( this.tソルを下へ移動する ) );
160     if( CDTXMania.Pad.b押された( E楽器パ.DRUMS, Eパッド.LT ) )
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     if( this.txメニュ != null )
188     {
189     int x = MENU_X;
190     int y = MENU_Y + ( this.n現在のカソル行 * MENU_H );
191     if( this.ct上移動用.b進行中 )
192     {
193     y += (int) ( (double)MENU_H / 2 * ( Math.Cos( Math.PI * ( ( (double) this.ct上移動用.n現在の値 ) / 100.0 ) ) + 1.0 ) );
194     }
195     else if( this.ct下移動用.b進行中 )
196     {
197     y -= (int) ( (double)MENU_H / 2 * ( Math.Cos( Math.PI * ( ( (double) this.ct下移動用.n現在の値 ) / 100.0 ) ) + 1.0 ) );
198     }
199     if( this.ctソルフラッシュ用.n現在の値 <= 100 )
200     {
201     float nMag = (float) ( 1.0 + ( ( ( (double) this.ctソルフラッシュ用.n現在の値 ) / 100.0 ) * 0.5 ) );
202     this.txメニュ.vc拡大縮小倍率.X = nMag;
203     this.txメニュ.vc拡大縮小倍率.Y = nMag;
204     this.txメニュ.n透明度 = (int) ( 255.0 * ( 1.0 - ( ( (double) this.ctソルフラッシュ用.n現在の値 ) / 100.0 ) ) );
205     int x_magnified = x + ( (int) ( ( MENU_W * ( 1.0 - nMag ) ) / 2.0 ) );
206     int y_magnified = y + ( (int) ( ( MENU_H * ( 1.0 - nMag ) ) / 2.0 ) );
207     this.txメニュ.t2D描画( CDTXMania.app.Device, x_magnified, y_magnified, new Rectangle( 0, MENU_H * 5, MENU_W, MENU_H ) );
208     }
209     this.txメニュ.vc拡大縮小倍率.X = 1f;
210     this.txメニュ.vc拡大縮小倍率.Y = 1f;
211     this.txメニュ.n透明度 = 0xff;
212     this.txメニュ.t2D描画( CDTXMania.app.Device, x, y, new Rectangle( 0, MENU_H * 4, MENU_W, MENU_H ) );
213     }
214     if( this.txメニュ != null )
215     {
216     //this.txメニュー.t2D描画( CDTXMania.app.Device, 0xce, 0xcb, new Rectangle( 0, 0, MENU_W, MENU_H ) );
217     // #24525 2011.3.16 yyagi: "OPTION"を省いて描画。従来スキンとの互換性確保のため。
218     this.txメニュ.t2D描画( CDTXMania.app.Device, MENU_X, MENU_Y, new Rectangle( 0, 0, MENU_W, MENU_H ) );
219     this.txメニュ.t2D描画( CDTXMania.app.Device, MENU_X, MENU_Y + MENU_H, new Rectangle( 0, MENU_H * 2, MENU_W, MENU_H * 2 ) );
220     }
221     CStage.Eフェ eフェid = base.eフェID;
222     switch( eフェid )
223     {
224     case CStage.Eフェ.共通_フェドイン:
225     if( this.actFI.On進行描画() != 0 )
226     {
227     CDTXMania.Skin.soundタイトル音.t再生する();
228     base.eフェID = CStage.Eフェ.共通_通常状態;
229     }
230     break;
231    
232     case CStage.Eフェ.共通_フェドアウト:
233     if( this.actFO.On進行描画() == 0 )
234     {
235     break;
236     }
237     base.eフェID = CStage.Eフェ.共通_終了状態;
238     switch ( this.n現在のカソル行 )
239     {
240     case (int)E戻り値.GAMESTART - 1:
241     return (int)E戻り値.GAMESTART;
242    
243     case (int) E戻り値.CONFIG - 1:
244     return (int) E戻り値.CONFIG;
245    
246     case (int)E戻り値.EXIT - 1:
247     return (int) E戻り値.EXIT;
248     //return ( this.n現在のカーソル行 + 1 );
249     }
250     break;
251    
252     case CStage.Eフェ.タイトル_起動画面からのフェドイン:
253     if( this.actFIfromSetup.On進行描画() != 0 )
254     {
255     CDTXMania.Skin.soundタイトル音.t再生する();
256     base.eフェID = CStage.Eフェ.共通_通常状態;
257     }
258     break;
259     }
260     }
261     return 0;
262     }
263     public enum E戻り値
264     {
265     継続 = 0,
266     GAMESTART,
267     // OPTION,
268     CONFIG,
269     EXIT
270     }
271    
272    
273     // その他
274    
275     #region [ private ]
276     //-----------------
277     [StructLayout( LayoutKind.Sequential )]
278     private struct ST反復用カウンタ
279     {
280     public CCounter Up;
281     public CCounter Down;
282     public CCounter R;
283     public CCounter B;
284     public CCounter this[ int index ]
285     {
286     get
287     {
288     switch( index )
289     {
290     case 0:
291     return this.Up;
292    
293     case 1:
294     return this.Down;
295    
296     case 2:
297     return this.R;
298    
299     case 3:
300     return this.B;
301     }
302     throw new IndexOutOfRangeException();
303     }
304     set
305     {
306     switch( index )
307     {
308     case 0:
309     this.Up = value;
310     return;
311    
312     case 1:
313     this.Down = value;
314     return;
315    
316     case 2:
317     this.R = value;
318     return;
319    
320     case 3:
321     this.B = value;
322     return;
323     }
324     throw new IndexOutOfRangeException();
325     }
326     }
327     }
328    
329     private CActFIFOWhite actFI;
330     private CActFIFOWhite actFIfromSetup;
331     private CActFIFOWhite actFO;
332     private CCounter ctソルフラッシュ用;
333     private ST反復用カウンタ ct反復用;
334     private CCounter ct下移動用;
335     private CCounter ct上移動用;
336     private const int MENU_H = 0x27;
337     private const int MENU_W = 0xe3;
338     private const int MENU_X = 0x1fa;
339     private const int MENU_Y = 0x201;
340     private int n現在のカソル行;
341     private CTexture txメニュ;
342     private CTexture tx背景;
343    
344     private void tソルを下へ移動する()
345     {
346     if ( this.n現在のカソル行 != (int) E戻り値.EXIT - 1 )
347     {
348     CDTXMania.Skin.soundソル移動音.t再生する();
349     this.n現在のカソル行++;
350     this.ct下移動用.t開始( 0, 100, 1, CDTXMania.Timer );
351     if( this.ct上移動用.b進行中 )
352     {
353     this.ct下移動用.n現在の値 = 100 - this.ct上移動用.n現在の値;
354     this.ct上移動用.t停止();
355     }
356     }
357     }
358     private void tソルを上へ移動する()
359     {
360     if ( this.n現在のカソル行 != (int) E戻り値.GAMESTART - 1 )
361     {
362     CDTXMania.Skin.soundソル移動音.t再生する();
363     this.n現在のカソル行--;
364     this.ct上移動用.t開始( 0, 100, 1, CDTXMania.Timer );
365     if( this.ct下移動用.b進行中 )
366     {
367     this.ct上移動用.n現在の値 = 100 - this.ct下移動用.n現在の値;
368     this.ct下移動用.t停止();
369     }
370     }
371     }
372     //-----------------
373     #endregion
374     }
375     }

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