2 using System.Collections.Generic;
\r
4 using System.Windows.Forms;
\r
5 using System.Drawing;
\r
6 using System.Diagnostics;
\r
7 using System.Runtime.InteropServices;
\r
9 using System.Threading;
\r
11 using SlimDX.Direct3D9;
\r
13 using SampleFramework;
\r
17 internal class CDTXMania : Game
\r
21 public static readonly string VERSION = "087(110115)";
\r
22 // public static readonly string VERSION = "086(101120)";
\r
23 public static readonly string SLIMDXDLL = "c_net20x86_Jun2010";
\r
24 public static readonly string D3DXDLL = "d3dx9_43.dll"; // June 2010
\r
25 //public static readonly string D3DXDLL = "d3dx9_42.dll"; // February 2010
\r
26 //public static readonly string D3DXDLL = "d3dx9_41.dll"; // March 2009
\r
28 public static CDTXMania app
\r
33 public static C文字コンソール act文字コンソール
\r
38 public static bool bコンパクトモード
\r
43 public static CConfigIni ConfigIni
\r
48 public static CDTX DTX
\r
56 if( ( dtx != null ) && ( app != null ) )
\r
59 app.listトップレベルActivities.Remove( dtx );
\r
62 if( ( dtx != null ) && ( app != null ) )
\r
64 app.listトップレベルActivities.Add( dtx );
\r
68 public static CFPS FPS
\r
73 public static CInput管理 Input管理
\r
78 public static int nPerfect範囲ms
\r
82 if( stage選曲.r確定された曲 != null )
\r
84 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
85 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nPerfect範囲ms >= 0 ) )
\r
87 return c曲リストノード.nPerfect範囲ms;
\r
90 return ConfigIni.nヒット範囲ms.Perfect;
\r
93 public static int nGreat範囲ms
\r
97 if( stage選曲.r確定された曲 != null )
\r
99 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
100 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nGreat範囲ms >= 0 ) )
\r
102 return c曲リストノード.nGreat範囲ms;
\r
105 return ConfigIni.nヒット範囲ms.Great;
\r
108 public static int nGood範囲ms
\r
112 if( stage選曲.r確定された曲 != null )
\r
114 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
115 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nGood範囲ms >= 0 ) )
\r
117 return c曲リストノード.nGood範囲ms;
\r
120 return ConfigIni.nヒット範囲ms.Good;
\r
123 public static int nPoor範囲ms
\r
127 if( stage選曲.r確定された曲 != null )
\r
129 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
130 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nPoor範囲ms >= 0 ) )
\r
132 return c曲リストノード.nPoor範囲ms;
\r
135 return ConfigIni.nヒット範囲ms.Poor;
\r
138 public static CPad Pad
\r
143 public static Random Random
\r
148 public static CSkin Skin
\r
153 public static CSongs管理 Songs管理
\r
158 public static CSound管理 Sound管理
\r
163 public static CStage起動 stage起動
\r
168 public static CStageタイトル stageタイトル
\r
173 public static CStageオプション stageオプション
\r
178 public static CStageコンフィグ stageコンフィグ
\r
183 public static CStage選曲 stage選曲
\r
188 public static CStage曲読み込み stage曲読み込み
\r
193 public static CStage演奏ギター画面 stage演奏ギター画面
\r
198 public static CStage演奏ドラム画面 stage演奏ドラム画面
\r
203 public static CStage結果 stage結果
\r
208 public static CStage終了 stage終了
\r
213 public static CStage r現在のステージ = null;
\r
214 public static CStage r直前のステージ = null;
\r
215 public static string strEXEのあるフォルダ
\r
220 public static string strコンパクトモードファイル
\r
225 public static CTimer Timer
\r
230 public static Format TextureFormat = Format.A8R8G8B8;
\r
231 internal static IPluginActivity act現在入力を占有中のプラグイン = null;
\r
232 public bool bApplicationActive
\r
237 public bool b次のタイミングで垂直帰線同期切り替えを行う
\r
242 public bool b次のタイミングで全画面・ウィンドウ切り替えを行う
\r
247 public Device Device
\r
249 get { return base.GraphicsDeviceManager.Direct3D9.Device; }
\r
251 public CPluginHost PluginHost
\r
256 public List<STPlugin> listプラグイン = new List<STPlugin>();
\r
257 public struct STPlugin
\r
259 public IPluginActivity plugin;
\r
260 public string strプラグインフォルダ;
\r
261 public string strアセンブリ簡易名;
\r
262 public Version Version;
\r
264 private static Size currentClientSize // #23510 2010.10.27 add yyagi to keep current window size
\r
274 CDTXMania.app = this;
\r
281 public void t全画面・ウィンドウモード切り替え()
\r
283 DeviceSettings settings = base.GraphicsDeviceManager.CurrentSettings.Clone();
\r
284 if( ( ConfigIni != null ) && ( ConfigIni.bウィンドウモード != settings.Windowed ) )
\r
286 settings.Windowed = ConfigIni.bウィンドウモード;
\r
287 if (ConfigIni.bウィンドウモード == false) // #23510 2010.10.27 yyagi: backup current window size before going fullscreen mode
\r
289 currentClientSize = this.Window.ClientSize;
\r
290 ConfigIni.nウインドウwidth = this.Window.ClientSize.Width;
\r
291 ConfigIni.nウインドウheight = this.Window.ClientSize.Height;
\r
293 base.GraphicsDeviceManager.ChangeDevice( settings );
\r
294 if (ConfigIni.bウィンドウモード == true) // #23510 2010.10.27 yyagi: to resume window size from backuped value
\r
296 base.Window.ClientSize =
\r
297 new Size(currentClientSize.Width, currentClientSize.Height);
\r
305 protected override void Initialize()
\r
307 if( this.listトップレベルActivities != null )
\r
309 foreach( CActivity activity in this.listトップレベルActivities )
\r
310 activity.OnManagedリソースの作成();
\r
313 foreach( STPlugin st in this.listプラグイン )
\r
315 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
316 st.plugin.OnManagedリソースの作成();
\r
317 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
320 protected override void LoadContent()
\r
322 if ( ConfigIni.bウィンドウモード )
\r
324 if( !this.bマウスカーソル表示中 )
\r
327 this.bマウスカーソル表示中 = true;
\r
330 else if( this.bマウスカーソル表示中 )
\r
333 this.bマウスカーソル表示中 = false;
\r
335 this.Device.SetTransform( TransformState.View, Matrix.LookAtLH( new Vector3( 0f, 0f, (float) ( -240.0 * Math.Sqrt( 3.0 ) ) ), new Vector3( 0f, 0f, 0f ), new Vector3( 0f, 1f, 0f ) ) );
\r
336 this.Device.SetTransform( TransformState.Projection, Matrix.PerspectiveFovLH( C変換.DegreeToRadian( (float) 60f ), ( (float) this.Device.Viewport.Width ) / ( (float) this.Device.Viewport.Height ), -100f, 100f ) );
\r
337 this.Device.SetRenderState( RenderState.Lighting, false );
\r
338 this.Device.SetRenderState( RenderState.ZEnable, false );
\r
339 this.Device.SetRenderState( RenderState.AntialiasedLineEnable, false );
\r
340 this.Device.SetRenderState( RenderState.AlphaTestEnable, true );
\r
341 this.Device.SetRenderState( RenderState.AlphaRef, 10 );
\r
342 this.Device.SetRenderState<Compare>( RenderState.AlphaFunc, Compare.Greater );
\r
343 this.Device.SetRenderState( RenderState.AlphaBlendEnable, true );
\r
344 this.Device.SetRenderState<Blend>( RenderState.SourceBlend, Blend.SourceAlpha );
\r
345 this.Device.SetRenderState<Blend>( RenderState.DestinationBlend, Blend.InverseSourceAlpha );
\r
346 this.Device.SetTextureStageState( 0, TextureStage.AlphaOperation, TextureOperation.Modulate );
\r
347 this.Device.SetTextureStageState( 0, TextureStage.AlphaArg1, 2 );
\r
348 this.Device.SetTextureStageState( 0, TextureStage.AlphaArg2, 1 );
\r
350 if( this.listトップレベルActivities != null )
\r
352 foreach( CActivity activity in this.listトップレベルActivities )
\r
353 activity.OnUnmanagedリソースの作成();
\r
356 foreach( STPlugin st in this.listプラグイン )
\r
358 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
359 st.plugin.OnUnmanagedリソースの作成();
\r
360 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
363 protected override void UnloadContent()
\r
365 if( this.listトップレベルActivities != null )
\r
367 foreach( CActivity activity in this.listトップレベルActivities )
\r
368 activity.OnUnmanagedリソースの解放();
\r
371 foreach( STPlugin st in this.listプラグイン )
\r
373 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
374 st.plugin.OnUnmanagedリソースの解放();
\r
375 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
378 protected override void OnExiting( EventArgs e )
\r
381 base.OnExiting( e );
\r
383 protected override void Update( GameTime gameTime )
\r
386 protected override void Draw( GameTime gameTime )
\r
388 CScoreIni.C演奏記録 c演奏記録;
\r
389 CScoreIni.C演奏記録 c演奏記録2;
\r
390 CScoreIni.C演奏記録 c演奏記録3;
\r
391 CDTX.CChip[] chipArray;
\r
394 Sound管理.t再生中の処理をする();
\r
396 if( Timer != null )
\r
399 if( Input管理 != null )
\r
400 Input管理.tポーリング( this.bApplicationActive, CDTXMania.ConfigIni.bバッファ入力を行う );
\r
405 //if( Pad != null ) ポーリング時にクリアしたらダメ!曲の開始時に1回だけクリアする。(2010.9.11)
\r
406 // Pad.st検知したデバイス.Clear();
\r
408 if( this.Device == null )
\r
411 this.Device.BeginScene();
\r
412 this.Device.Clear( ClearFlags.ZBuffer | ClearFlags.Target, Color.Black, 1f, 0 );
\r
414 if( r現在のステージ != null )
\r
416 this.n進行描画の戻り値 = ( r現在のステージ != null ) ? r現在のステージ.On進行描画() : 0;
\r
418 #region [ プラグインの進行描画 ]
\r
419 //---------------------
\r
420 foreach( STPlugin sp in this.listプラグイン )
\r
422 Directory.SetCurrentDirectory( sp.strプラグインフォルダ );
\r
424 if( CDTXMania.act現在入力を占有中のプラグイン == null || CDTXMania.act現在入力を占有中のプラグイン == sp.plugin )
\r
425 sp.plugin.On進行描画( CDTXMania.Pad, CDTXMania.Input管理.Keyboard );
\r
427 sp.plugin.On進行描画( null, null );
\r
429 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
431 //---------------------
\r
434 CScoreIni scoreIni = null;
\r
436 switch( r現在のステージ.eステージID )
\r
438 case CStage.Eステージ.何もしない:
\r
441 case CStage.Eステージ.起動:
\r
443 //-----------------------------
\r
444 if( this.n進行描画の戻り値 != 0 )
\r
449 Trace.TraceInformation( "----------------------" );
\r
450 Trace.TraceInformation( "■ タイトル" );
\r
452 r直前のステージ = r現在のステージ;
\r
453 r現在のステージ = stageタイトル;
\r
458 Trace.TraceInformation( "----------------------" );
\r
459 Trace.TraceInformation( "■ 曲読み込み" );
\r
460 stage曲読み込み.On活性化();
\r
461 r直前のステージ = r現在のステージ;
\r
462 r現在のステージ = stage曲読み込み;
\r
465 foreach( STPlugin pg in this.listプラグイン )
\r
467 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
468 pg.plugin.Onステージ変更();
\r
469 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
472 this.tガベージコレクションを実行する();
\r
474 //-----------------------------
\r
478 case CStage.Eステージ.タイトル:
\r
480 //-----------------------------
\r
481 switch( this.n進行描画の戻り値 )
\r
485 //-----------------------------
\r
487 Trace.TraceInformation( "----------------------" );
\r
488 Trace.TraceInformation( "■ 選曲" );
\r
490 r直前のステージ = r現在のステージ;
\r
491 r現在のステージ = stage選曲;
\r
492 //-----------------------------
\r
498 //-----------------------------
\r
500 Trace.TraceInformation( "----------------------" );
\r
501 Trace.TraceInformation( "■ オプション" );
\r
502 stageオプション.On活性化();
\r
503 r直前のステージ = r現在のステージ;
\r
504 r現在のステージ = stageオプション;
\r
505 //-----------------------------
\r
511 //-----------------------------
\r
513 Trace.TraceInformation( "----------------------" );
\r
514 Trace.TraceInformation( "■ コンフィグ" );
\r
515 stageコンフィグ.On活性化();
\r
516 r直前のステージ = r現在のステージ;
\r
517 r現在のステージ = stageコンフィグ;
\r
518 //-----------------------------
\r
524 //-----------------------------
\r
526 Trace.TraceInformation( "----------------------" );
\r
527 Trace.TraceInformation( "■ 終了" );
\r
529 r直前のステージ = r現在のステージ;
\r
530 r現在のステージ = stage終了;
\r
531 //-----------------------------
\r
536 foreach( STPlugin pg in this.listプラグイン )
\r
538 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
539 pg.plugin.Onステージ変更();
\r
540 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
543 this.tガベージコレクションを実行する();
\r
544 //-----------------------------
\r
548 case CStage.Eステージ.オプション:
\r
550 //-----------------------------
\r
551 if( this.n進行描画の戻り値 != 0 )
\r
553 switch( r直前のステージ.eステージID )
\r
555 case CStage.Eステージ.タイトル:
\r
557 //-----------------------------
\r
559 Trace.TraceInformation( "----------------------" );
\r
560 Trace.TraceInformation( "■ タイトル" );
\r
562 r直前のステージ = r現在のステージ;
\r
563 r現在のステージ = stageタイトル;
\r
565 foreach( STPlugin pg in this.listプラグイン )
\r
567 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
568 pg.plugin.Onステージ変更();
\r
569 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
572 this.tガベージコレクションを実行する();
\r
574 //-----------------------------
\r
577 case CStage.Eステージ.選曲:
\r
579 //-----------------------------
\r
581 Trace.TraceInformation( "----------------------" );
\r
582 Trace.TraceInformation( "■ 選曲" );
\r
584 r直前のステージ = r現在のステージ;
\r
585 r現在のステージ = stage選曲;
\r
587 foreach( STPlugin pg in this.listプラグイン )
\r
589 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
590 pg.plugin.Onステージ変更();
\r
591 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
594 this.tガベージコレクションを実行する();
\r
596 //-----------------------------
\r
600 //-----------------------------
\r
604 case CStage.Eステージ.コンフィグ:
\r
606 //-----------------------------
\r
607 if( this.n進行描画の戻り値 != 0 )
\r
609 switch( r直前のステージ.eステージID )
\r
611 case CStage.Eステージ.タイトル:
\r
613 //-----------------------------
\r
615 Trace.TraceInformation( "----------------------" );
\r
616 Trace.TraceInformation( "■ タイトル" );
\r
618 r直前のステージ = r現在のステージ;
\r
619 r現在のステージ = stageタイトル;
\r
621 foreach( STPlugin pg in this.listプラグイン )
\r
623 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
624 pg.plugin.Onステージ変更();
\r
625 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
628 this.tガベージコレクションを実行する();
\r
630 //-----------------------------
\r
633 case CStage.Eステージ.選曲:
\r
635 //-----------------------------
\r
637 Trace.TraceInformation( "----------------------" );
\r
638 Trace.TraceInformation( "■ 選曲" );
\r
640 r直前のステージ = r現在のステージ;
\r
641 r現在のステージ = stage選曲;
\r
643 foreach( STPlugin pg in this.listプラグイン )
\r
645 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
646 pg.plugin.Onステージ変更();
\r
647 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
650 this.tガベージコレクションを実行する();
\r
652 //-----------------------------
\r
656 //-----------------------------
\r
660 case CStage.Eステージ.選曲:
\r
662 //-----------------------------
\r
663 switch( this.n進行描画の戻り値 )
\r
667 //-----------------------------
\r
669 Trace.TraceInformation( "----------------------" );
\r
670 Trace.TraceInformation( "■ タイトル" );
\r
672 r直前のステージ = r現在のステージ;
\r
673 r現在のステージ = stageタイトル;
\r
675 foreach( STPlugin pg in this.listプラグイン )
\r
677 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
678 pg.plugin.Onステージ変更();
\r
679 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
682 this.tガベージコレクションを実行する();
\r
684 //-----------------------------
\r
689 //-----------------------------
\r
691 Trace.TraceInformation( "----------------------" );
\r
692 Trace.TraceInformation( "■ 曲読み込み" );
\r
693 stage曲読み込み.On活性化();
\r
694 r直前のステージ = r現在のステージ;
\r
695 r現在のステージ = stage曲読み込み;
\r
697 foreach( STPlugin pg in this.listプラグイン )
\r
699 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
700 pg.plugin.Onステージ変更();
\r
701 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
704 this.tガベージコレクションを実行する();
\r
706 //-----------------------------
\r
711 //-----------------------------
\r
713 Trace.TraceInformation( "----------------------" );
\r
714 Trace.TraceInformation( "■ オプション" );
\r
715 stageオプション.On活性化();
\r
716 r直前のステージ = r現在のステージ;
\r
717 r現在のステージ = stageオプション;
\r
719 foreach( STPlugin pg in this.listプラグイン )
\r
721 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
722 pg.plugin.Onステージ変更();
\r
723 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
726 this.tガベージコレクションを実行する();
\r
728 //-----------------------------
\r
733 //-----------------------------
\r
735 Trace.TraceInformation( "----------------------" );
\r
736 Trace.TraceInformation( "■ コンフィグ" );
\r
737 stageコンフィグ.On活性化();
\r
738 r直前のステージ = r現在のステージ;
\r
739 r現在のステージ = stageコンフィグ;
\r
741 foreach( STPlugin pg in this.listプラグイン )
\r
743 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
744 pg.plugin.Onステージ変更();
\r
745 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
748 this.tガベージコレクションを実行する();
\r
750 //-----------------------------
\r
753 //-----------------------------
\r
757 case CStage.Eステージ.曲読み込み:
\r
759 //-----------------------------
\r
760 if( this.n進行描画の戻り値 != 0 )
\r
762 CDTXMania.Pad.st検知したデバイス.Clear(); // 入力デバイスフラグクリア(2010.9.11)
\r
765 if( !ConfigIni.bギタレボモード )
\r
767 Trace.TraceInformation( "----------------------" );
\r
768 Trace.TraceInformation( "■ 演奏(ドラム画面)" );
\r
769 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
\r
770 for (int i = 0; i < 5; i++)
\r
772 for (int j = 0; j < 2; j++)
\r
774 stage演奏ドラム画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
\r
777 for (int i = 0; i < 3; i++) {
\r
778 stage演奏ドラム画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
\r
781 r直前のステージ = r現在のステージ;
\r
782 r現在のステージ = stage演奏ドラム画面;
\r
786 Trace.TraceInformation( "----------------------" );
\r
787 Trace.TraceInformation( "■ 演奏(ギター画面)" );
\r
788 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
\r
789 for (int i = 0; i < 5; i++)
\r
791 for (int j = 0; j < 2; j++)
\r
793 stage演奏ギター画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
\r
796 for (int i = 0; i < 3; i++) {
\r
797 stage演奏ギター画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
\r
800 r直前のステージ = r現在のステージ;
\r
801 r現在のステージ = stage演奏ギター画面;
\r
804 foreach( STPlugin pg in this.listプラグイン )
\r
806 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
807 pg.plugin.Onステージ変更();
\r
808 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
811 this.tガベージコレクションを実行する();
\r
813 //-----------------------------
\r
817 case CStage.Eステージ.演奏:
\r
819 //-----------------------------
\r
820 switch( this.n進行描画の戻り値 )
\r
826 #region [ 演奏キャンセル ]
\r
827 //-----------------------------
\r
828 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Play canceled" );
\r
830 #region [ プラグイン On演奏キャンセル() の呼び出し ]
\r
831 //---------------------
\r
832 foreach( STPlugin pg in this.listプラグイン )
\r
834 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
835 pg.plugin.On演奏キャンセル( scoreIni );
\r
836 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
838 //---------------------
\r
846 base.Window.Close();
\r
850 Trace.TraceInformation( "----------------------" );
\r
851 Trace.TraceInformation( "■ 選曲" );
\r
853 r直前のステージ = r現在のステージ;
\r
854 r現在のステージ = stage選曲;
\r
856 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
857 //---------------------
\r
858 foreach( STPlugin pg in this.listプラグイン )
\r
860 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
861 pg.plugin.Onステージ変更();
\r
862 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
864 //---------------------
\r
867 this.tガベージコレクションを実行する();
\r
870 //-----------------------------
\r
874 #region [ 演奏失敗(StageFailed) ]
\r
875 //-----------------------------
\r
876 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Stage failed" );
\r
878 #region [ プラグイン On演奏失敗() の呼び出し ]
\r
879 //---------------------
\r
880 foreach( STPlugin pg in this.listプラグイン )
\r
882 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
883 pg.plugin.On演奏失敗( scoreIni );
\r
884 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
886 //---------------------
\r
894 base.Window.Close();
\r
898 Trace.TraceInformation( "----------------------" );
\r
899 Trace.TraceInformation( "■ 選曲" );
\r
901 r直前のステージ = r現在のステージ;
\r
902 r現在のステージ = stage選曲;
\r
904 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
905 //---------------------
\r
906 foreach( STPlugin pg in this.listプラグイン )
\r
908 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
909 pg.plugin.Onステージ変更();
\r
910 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
912 //---------------------
\r
915 this.tガベージコレクションを実行する();
\r
918 //-----------------------------
\r
923 //-----------------------------
\r
924 chipArray = new CDTX.CChip[ 10 ];
\r
925 if( ConfigIni.bギタレボモード )
\r
927 stage演奏ギター画面.t演奏結果を格納する( out c演奏記録, out c演奏記録2, out c演奏記録3 );
\r
931 stage演奏ドラム画面.t演奏結果を格納する( out c演奏記録, out c演奏記録2, out c演奏記録3, out chipArray );
\r
934 switch( CScoreIni.t総合ランク値を計算して返す( c演奏記録, c演奏記録2, c演奏記録3 ) )
\r
937 str = "Cleared (Rank:SS)";
\r
941 str = "Cleared (Rank:S)";
\r
945 str = "Cleared (Rank:A)";
\r
949 str = "Cleared (Rank:B)";
\r
953 str = "Cleared (Rank:C)";
\r
957 str = "Cleared (Rank:D)";
\r
961 str = "Cleared (Rank:E)";
\r
964 case 99: // #23534 2010.10.28 yyagi add: 演奏チップが0個のとき
\r
965 str = "Cleared (No chips)";
\r
969 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( str );
\r
971 #region [ プラグイン On演奏クリア() の呼び出し ]
\r
972 //---------------------
\r
973 foreach( STPlugin pg in this.listプラグイン )
\r
975 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
976 pg.plugin.On演奏クリア( scoreIni );
\r
977 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
979 //---------------------
\r
983 Trace.TraceInformation( "----------------------" );
\r
984 Trace.TraceInformation( "■ 結果" );
\r
985 stage結果.st演奏記録.Drums = c演奏記録;
\r
986 stage結果.st演奏記録.Guitar = c演奏記録2;
\r
987 stage結果.st演奏記録.Bass = c演奏記録3;
\r
988 stage結果.r空うちドラムチップ = chipArray;
\r
990 r直前のステージ = r現在のステージ;
\r
991 r現在のステージ = stage結果;
\r
993 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
994 //---------------------
\r
995 foreach( STPlugin pg in this.listプラグイン )
\r
997 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
998 pg.plugin.Onステージ変更();
\r
999 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1001 //---------------------
\r
1005 //-----------------------------
\r
1008 //-----------------------------
\r
1012 case CStage.Eステージ.結果:
\r
1014 //-----------------------------
\r
1015 if( this.n進行描画の戻り値 != 0 )
\r
1017 DTX.t全チップの再生一時停止();
\r
1019 r現在のステージ.On非活性化();
\r
1022 Trace.TraceInformation( "----------------------" );
\r
1023 Trace.TraceInformation( "■ 選曲" );
\r
1025 r直前のステージ = r現在のステージ;
\r
1026 r現在のステージ = stage選曲;
\r
1028 foreach( STPlugin pg in this.listプラグイン )
\r
1030 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1031 pg.plugin.Onステージ変更();
\r
1032 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1035 this.tガベージコレクションを実行する();
\r
1039 base.Window.Close();
\r
1042 //-----------------------------
\r
1046 case CStage.Eステージ.終了:
\r
1048 //-----------------------------
\r
1049 if( this.n進行描画の戻り値 != 0 )
\r
1053 //-----------------------------
\r
1059 this.Device.EndScene();
\r
1060 if( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )
\r
1062 ConfigIni.b全画面モード = !ConfigIni.b全画面モード;
\r
1063 app.t全画面・ウィンドウモード切り替え();
\r
1064 this.b次のタイミングで全画面・ウィンドウ切り替えを行う = false;
\r
1066 if( this.b次のタイミングで垂直帰線同期切り替えを行う )
\r
1068 bool bIsMaximized = this.Window.IsMaximized; // #23510 2010.11.3 yyagi: to backup current window mode before changing VSyncWait
\r
1069 currentClientSize = this.Window.ClientSize; // #23510 2010.11.3 yyagi: to backup current window size before changing VSyncWait
\r
1070 DeviceSettings currentSettings = app.GraphicsDeviceManager.CurrentSettings;
\r
1071 currentSettings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1072 app.GraphicsDeviceManager.ChangeDevice( currentSettings );
\r
1073 this.b次のタイミングで垂直帰線同期切り替えを行う = false;
\r
1074 base.Window.ClientSize = new Size(currentClientSize.Width, currentClientSize.Height); // #23510 2010.11.3 yyagi: to resume window size after changing VSyncWait
\r
1077 this.Window.WindowState = FormWindowState.Maximized; // #23510 2010.11.3 yyagi: to resume window mode after changing VSyncWait
\r
1085 #region [ テクスチャの生成・解放のためのヘルパー ]
\r
1086 //-----------------
\r
1087 public static CTexture tテクスチャの生成( string fileName )
\r
1089 return tテクスチャの生成( fileName, false );
\r
1091 public static CTexture tテクスチャの生成( string fileName, bool b黒を透過する )
\r
1099 return new CTexture( app.Device, fileName, TextureFormat, b黒を透過する );
\r
1101 catch( CTextureCreateFailedException )
\r
1103 Trace.TraceError( "テクスチャの生成に失敗しました。({0})", new object[] { fileName } );
\r
1107 public static void tテクスチャの解放( ref CTexture tx )
\r
1115 //-----------------
\r
1118 #region [ private ]
\r
1119 //-----------------
\r
1120 private bool bマウスカーソル表示中 = true;
\r
1121 private bool b終了処理完了済み;
\r
1122 private static CDTX dtx;
\r
1123 private List<CActivity> listトップレベルActivities;
\r
1124 private int n進行描画の戻り値;
\r
1126 private void t起動処理()
\r
1128 #region [ strEXEのあるフォルダを決定する ]
\r
1129 //-----------------
\r
1130 // BEGIN #23629 2010.11.13 from: デバッグ時は Application.ExecutablePath が ($SolutionDir)/bin/x86/Debug/ などになり System/ の読み込みに失敗するので、カレントディレクトリを採用する。(プロジェクトのプロパティ→デバッグ→作業ディレクトリが有効になる)
\r
1132 strEXEのあるフォルダ = Environment.CurrentDirectory + @"\";
\r
1134 strEXEのあるフォルダ = Path.GetDirectoryName( Application.ExecutablePath ) + @"\"; // #23629 2010.11.9 yyagi: set correct pathname where DTXManiaGR.exe is.
\r
1136 // END #23629 2010.11.13 from
\r
1137 //-----------------
\r
1140 #region [ Config.ini の読込み ]
\r
1141 //---------------------
\r
1142 ConfigIni = new CConfigIni();
\r
1143 string path = strEXEのあるフォルダ + "Config.ini";
\r
1144 if( File.Exists( path ) )
\r
1148 ConfigIni.t読み込み( path );
\r
1152 //ConfigIni = new CConfigIni(); // 存在してなければ新規生成
\r
1155 //---------------------
\r
1157 #region [ ログ出力開始 ]
\r
1158 //---------------------
\r
1159 Trace.AutoFlush = true;
\r
1160 if( ConfigIni.bログ出力 )
\r
1162 Trace.Listeners.Add( new CTraceLogListener( new StreamWriter( "DTXManiaLog.txt", false, Encoding.GetEncoding( "shift-jis" ) ) ) );
\r
1164 Trace.WriteLine("");
\r
1165 Trace.WriteLine( "DTXMania powered by YAMAHA Silent Session Drums" );
\r
1166 Trace.WriteLine( string.Format( "Release: {0}", VERSION ) );
\r
1167 Trace.WriteLine( "" );
\r
1168 Trace.TraceInformation( "----------------------" );
\r
1169 Trace.TraceInformation( "■ アプリケーションの初期化" );
\r
1170 Trace.TraceInformation( "OS Version: " + Environment.OSVersion );
\r
1171 Trace.TraceInformation( "ProcessorCount: " + Environment.ProcessorCount.ToString() );
\r
1172 Trace.TraceInformation( "CLR Version: " + Environment.Version.ToString() );
\r
1173 //---------------------
\r
1175 #region [ コンパクトモードスイッチの有無 ]
\r
1176 //---------------------
\r
1177 bコンパクトモード = false;
\r
1178 strコンパクトモードファイル = "";
\r
1179 string[] commandLineArgs = Environment.GetCommandLineArgs();
\r
1180 if( ( commandLineArgs != null ) && ( commandLineArgs.Length > 1 ) )
\r
1183 strコンパクトモードファイル = commandLineArgs[ 1 ];
\r
1184 Trace.TraceInformation( "コンパクトモードで起動します。[{0}]", new object[] { strコンパクトモードファイル } );
\r
1186 //---------------------
\r
1189 #region [ ウィンドウ初期化 ]
\r
1190 //---------------------
\r
1191 base.Window.Text = "DTXMania .NET style release " + VERSION;
\r
1192 base.Window.ClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight); // #34510 yyagi 2010.10.31 to change window size got from Config.ini
\r
1193 if (!ConfigIni.bウィンドウモード) // #23510 2010.11.02 yyagi: add; to recover window size in case bootup with fullscreen mode
\r
1195 currentClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight);
\r
1197 base.Window.MaximizeBox = true; // #23510 2010.11.04 yyagi: to support maximizing window
\r
1198 base.Window.FormBorderStyle = FormBorderStyle.Sizable; // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize
\r
1199 base.Window.ShowIcon = true;
\r
1200 base.Window.Icon = Properties.Resources.dtx;
\r
1201 base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );
\r
1202 base.Window.MouseDoubleClick += new MouseEventHandler(this.Window_MouseDoubleClick); // #23510 2010.11.13 yyagi: to go fullscreen mode
\r
1203 base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd); // #23510 2010.11.20 yyagi: to set resized window size in Config.ini
\r
1204 base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);
\r
1205 base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
\r
1206 //---------------------
\r
1208 #region [ Direct3D9 デバイスの生成 ]
\r
1209 //---------------------
\r
1210 DeviceSettings settings = new DeviceSettings();
\r
1211 settings.Windowed = ConfigIni.bウィンドウモード;
\r
1212 settings.BackBufferWidth = 640;
\r
1213 settings.BackBufferHeight = 480;
\r
1214 settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1217 base.GraphicsDeviceManager.ChangeDevice(settings);
\r
1219 catch (DeviceCreationException e)
\r
1221 Trace.TraceError(e.ToString());
\r
1222 MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
1223 Environment.Exit(-1);
\r
1226 base.IsFixedTimeStep = false;
\r
1227 base.Window.ClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight); // #23510 2010.10.31 yyagi: to recover window size. width and height are able to get from Config.ini.
\r
1228 base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォーカス時スリープms)); // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive
\r
1229 // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )
\r
1230 //---------------------
\r
1235 #region [ Skin の初期化 ]
\r
1236 //---------------------
\r
1237 Trace.TraceInformation( "スキンの初期化を行います。" );
\r
1241 Skin = new CSkin();
\r
1242 Trace.TraceInformation( "スキンの初期化を完了しました。" );
\r
1246 Trace.TraceInformation( "スキンの初期化に失敗しました。" );
\r
1253 //---------------------
\r
1255 #region [ Timer の初期化 ]
\r
1256 //---------------------
\r
1257 Trace.TraceInformation( "タイマの初期化を行います。" );
\r
1261 Timer = new CTimer( CTimer.E種別.MultiMedia );
\r
1262 Trace.TraceInformation( "タイマの初期化を完了しました。" );
\r
1268 //---------------------
\r
1270 #region [ FPS カウンタの初期化 ]
\r
1271 //---------------------
\r
1272 Trace.TraceInformation( "FPSカウンタの初期化を行います。" );
\r
1277 Trace.TraceInformation( "FPSカウンタを生成しました。" );
\r
1283 //---------------------
\r
1285 #region [ act文字コンソールの初期化 ]
\r
1286 //---------------------
\r
1287 Trace.TraceInformation( "文字コンソールの初期化を行います。" );
\r
1291 act文字コンソール = new C文字コンソール();
\r
1292 Trace.TraceInformation( "文字コンソールを生成しました。" );
\r
1293 act文字コンソール.On活性化();
\r
1294 Trace.TraceInformation( "文字コンソールを活性化しました。" );
\r
1295 Trace.TraceInformation( "文字コンソールの初期化を完了しました。" );
\r
1297 catch( Exception exception )
\r
1299 Trace.TraceError( exception.Message );
\r
1300 Trace.TraceError( "文字コンソールの初期化に失敗しました。" );
\r
1306 //---------------------
\r
1308 #region [ Input管理 の初期化 ]
\r
1309 //---------------------
\r
1310 Trace.TraceInformation( "DirectInput, MIDI入力の初期化を行います。" );
\r
1314 Input管理 = new CInput管理( base.Window.Handle );
\r
1315 foreach( IInputDevice device in Input管理.list入力デバイス )
\r
1317 if( ( device.e入力デバイス種別 == E入力デバイス種別.Joystick ) && !ConfigIni.dicJoystick.ContainsValue( device.GUID ) )
\r
1320 while( ConfigIni.dicJoystick.ContainsKey( key ) )
\r
1324 ConfigIni.dicJoystick.Add( key, device.GUID );
\r
1327 foreach( IInputDevice device2 in Input管理.list入力デバイス )
\r
1329 if( device2.e入力デバイス種別 == E入力デバイス種別.Joystick )
\r
1331 foreach( KeyValuePair<int, string> pair in ConfigIni.dicJoystick )
\r
1333 if( device2.GUID.Equals( pair.Value ) )
\r
1335 ( (CInputJoystick) device2 ).SetID( pair.Key );
\r
1342 Trace.TraceInformation( "DirectInput の初期化を完了しました。" );
\r
1344 catch( Exception exception2 )
\r
1346 Trace.TraceError( exception2.Message );
\r
1347 Trace.TraceError( "DirectInput, MIDI入力の初期化に失敗しました。" );
\r
1354 //---------------------
\r
1356 #region [ Pad の初期化 ]
\r
1357 //---------------------
\r
1358 Trace.TraceInformation( "パッドの初期化を行います。" );
\r
1362 Pad = new CPad( ConfigIni, Input管理 );
\r
1363 Trace.TraceInformation( "パッドの初期化を完了しました。" );
\r
1365 catch( Exception exception3 )
\r
1367 Trace.TraceError( exception3.Message );
\r
1368 Trace.TraceError( "パッドの初期化に失敗しました。" );
\r
1374 //---------------------
\r
1376 #region [ Sound管理 の初期化 ]
\r
1377 //---------------------
\r
1378 Trace.TraceInformation( "DirectSound の初期化を行います。" );
\r
1382 Sound管理 = new CSound管理( base.Window.Handle );
\r
1383 Trace.TraceInformation( "DirectSound の初期化を完了しました。" );
\r
1387 Trace.TraceError( "DirectSound の初期化に失敗しました。" );
\r
1394 //---------------------
\r
1396 #region [ Songs管理 の初期化 ]
\r
1397 //---------------------
\r
1398 Trace.TraceInformation( "曲リストの初期化を行います。" );
\r
1402 Songs管理 = new CSongs管理();
\r
1403 Trace.TraceInformation( "曲リストの初期化を完了しました。" );
\r
1405 catch( Exception exception4 )
\r
1407 Trace.TraceError( exception4.Message );
\r
1408 Trace.TraceError( "曲リストの初期化に失敗しました。" );
\r
1414 //---------------------
\r
1416 #region [ CAvi の初期化 ]
\r
1417 //---------------------
\r
1419 //---------------------
\r
1421 #region [ Random の初期化 ]
\r
1422 //---------------------
\r
1423 Random = new Random( (int) Timer.nシステム時刻 );
\r
1424 //---------------------
\r
1426 #region [ ステージの初期化 ]
\r
1427 //---------------------
\r
1430 stage起動 = new CStage起動();
\r
1431 stageタイトル = new CStageタイトル();
\r
1432 stageオプション = new CStageオプション();
\r
1433 stageコンフィグ = new CStageコンフィグ();
\r
1434 stage選曲 = new CStage選曲();
\r
1435 stage曲読み込み = new CStage曲読み込み();
\r
1436 stage演奏ドラム画面 = new CStage演奏ドラム画面();
\r
1437 stage演奏ギター画面 = new CStage演奏ギター画面();
\r
1438 stage結果 = new CStage結果();
\r
1439 stage終了 = new CStage終了();
\r
1440 this.listトップレベルActivities = new List<CActivity>();
\r
1441 this.listトップレベルActivities.Add( act文字コンソール );
\r
1442 this.listトップレベルActivities.Add( stage起動 );
\r
1443 this.listトップレベルActivities.Add( stageタイトル );
\r
1444 this.listトップレベルActivities.Add( stageオプション );
\r
1445 this.listトップレベルActivities.Add( stageコンフィグ );
\r
1446 this.listトップレベルActivities.Add( stage選曲 );
\r
1447 this.listトップレベルActivities.Add( stage曲読み込み );
\r
1448 this.listトップレベルActivities.Add( stage演奏ドラム画面 );
\r
1449 this.listトップレベルActivities.Add( stage演奏ギター画面 );
\r
1450 this.listトップレベルActivities.Add( stage結果 );
\r
1451 this.listトップレベルActivities.Add( stage終了 );
\r
1452 //---------------------
\r
1454 #region [ プラグインの検索と生成 ]
\r
1455 //---------------------
\r
1456 PluginHost = new CPluginHost();
\r
1458 Trace.TraceInformation( "プラグインの検索と生成を行います。" );
\r
1462 this.tプラグイン検索と生成();
\r
1463 Trace.TraceInformation( "プラグインの検索と生成を完了しました。" );
\r
1469 //---------------------
\r
1471 #region [ プラグインの初期化 ]
\r
1472 //---------------------
\r
1473 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
\r
1475 Trace.TraceInformation( "プラグインの初期化を行います。" );
\r
1479 foreach( STPlugin st in this.listプラグイン )
\r
1481 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1482 st.plugin.On初期化( this.PluginHost );
\r
1483 st.plugin.OnManagedリソースの作成();
\r
1484 st.plugin.OnUnmanagedリソースの作成();
\r
1485 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1487 Trace.TraceInformation( "すべてのプラグインの初期化を完了しました。" );
\r
1491 Trace.TraceError( "プラグインのどれかの初期化に失敗しました。" );
\r
1500 //---------------------
\r
1503 Trace.TraceInformation( "アプリケーションの初期化を完了しました。" );
\r
1505 #region [ 最初のステージの起動 ]
\r
1506 //---------------------
\r
1507 Trace.TraceInformation( "----------------------" );
\r
1508 Trace.TraceInformation( "■ 起動" );
\r
1510 r現在のステージ = stage起動;
\r
1512 //---------------------
\r
1515 private void t終了処理()
\r
1517 if( !this.b終了処理完了済み )
\r
1519 Trace.TraceInformation( "----------------------" );
\r
1520 Trace.TraceInformation( "■ アプリケーションの終了" );
\r
1521 #region [ 現在のステージの終了処理 ]
\r
1522 //---------------------
\r
1523 if (r現在のステージ != null)
\r
1525 Trace.TraceInformation( "現在のステージを終了します。" );
\r
1529 r現在のステージ.On非活性化();
\r
1530 Trace.TraceInformation( "現在のステージの終了処理を完了しました。" );
\r
1537 //---------------------
\r
1539 #region [ プラグインの終了処理 ]
\r
1540 //---------------------
\r
1541 if (this.listプラグイン != null && this.listプラグイン.Count > 0)
\r
1543 Trace.TraceInformation( "すべてのプラグインを終了します。" );
\r
1547 foreach( STPlugin st in this.listプラグイン )
\r
1549 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1550 st.plugin.OnUnmanagedリソースの解放();
\r
1551 st.plugin.OnManagedリソースの解放();
\r
1553 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1555 PluginHost = null;
\r
1556 Trace.TraceInformation( "すべてのプラグインの終了処理を完了しました。" );
\r
1563 //---------------------
\r
1565 #region [ 曲リストの終了処理 ]
\r
1566 //---------------------
\r
1567 if (Songs管理 != null)
\r
1569 Trace.TraceInformation( "曲リストの終了処理を行います。" );
\r
1574 Trace.TraceInformation( "曲リストの終了処理を完了しました。" );
\r
1576 catch( Exception exception )
\r
1578 Trace.TraceError( exception.Message );
\r
1579 Trace.TraceError( "曲リストの終了処理に失敗しました。" );
\r
1587 //---------------------
\r
1589 #region [ スキンの終了処理 ]
\r
1590 //---------------------
\r
1593 Trace.TraceInformation( "スキンの終了処理を行います。" );
\r
1599 Trace.TraceInformation( "スキンの終了処理を完了しました。" );
\r
1601 catch( Exception exception2 )
\r
1603 Trace.TraceError( exception2.Message );
\r
1604 Trace.TraceError( "スキンの終了処理に失敗しました。" );
\r
1611 //---------------------
\r
1613 #region [ DirectSoundの終了処理 ]
\r
1614 //---------------------
\r
1615 if (Sound管理 != null)
\r
1617 Trace.TraceInformation( "DirectSound の終了処理を行います。" );
\r
1621 Sound管理.Dispose();
\r
1623 Trace.TraceInformation( "DirectSound の終了処理を完了しました。" );
\r
1625 catch( Exception exception3 )
\r
1627 Trace.TraceError( exception3.Message );
\r
1628 Trace.TraceError( "DirectSound の終了処理に失敗しました。" );
\r
1635 //---------------------
\r
1637 #region [ パッドの終了処理 ]
\r
1638 //---------------------
\r
1641 Trace.TraceInformation( "パッドの終了処理を行います。" );
\r
1646 Trace.TraceInformation( "パッドの終了処理を完了しました。" );
\r
1648 catch( Exception exception4 )
\r
1650 Trace.TraceError( exception4.Message );
\r
1651 Trace.TraceError( "パッドの終了処理に失敗しました。" );
\r
1658 //---------------------
\r
1660 #region [ DirectInput, MIDI入力の終了処理 ]
\r
1661 //---------------------
\r
1662 if (Input管理 != null)
\r
1664 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を行います。" );
\r
1668 Input管理.Dispose();
\r
1670 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を完了しました。" );
\r
1672 catch( Exception exception5 )
\r
1674 Trace.TraceError( exception5.Message );
\r
1675 Trace.TraceError( "DirectInput, MIDI入力の終了処理に失敗しました。" );
\r
1682 //---------------------
\r
1684 #region [ 文字コンソールの終了処理 ]
\r
1685 //---------------------
\r
1686 if (act文字コンソール != null)
\r
1688 Trace.TraceInformation( "文字コンソールの終了処理を行います。" );
\r
1692 act文字コンソール.On非活性化();
\r
1693 act文字コンソール = null;
\r
1694 Trace.TraceInformation( "文字コンソールの終了処理を完了しました。" );
\r
1696 catch( Exception exception6 )
\r
1698 Trace.TraceError( exception6.Message );
\r
1699 Trace.TraceError( "文字コンソールの終了処理に失敗しました。" );
\r
1706 //---------------------
\r
1708 #region [ FPSカウンタの終了処理 ]
\r
1709 //---------------------
\r
1710 Trace.TraceInformation("FPSカウンタの終了処理を行います。");
\r
1718 Trace.TraceInformation( "FPSカウンタの終了処理を完了しました。" );
\r
1724 //---------------------
\r
1726 #region [ タイマの終了処理 ]
\r
1727 //---------------------
\r
1728 Trace.TraceInformation("タイマの終了処理を行います。");
\r
1732 if( Timer != null )
\r
1736 Trace.TraceInformation( "タイマの終了処理を完了しました。" );
\r
1740 Trace.TraceInformation( "タイマは使用されていません。" );
\r
1747 //---------------------
\r
1749 #region [ Config.iniの出力 ]
\r
1750 //---------------------
\r
1751 Trace.TraceInformation("Config.ini を出力します。");
\r
1752 if ( ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.16 yyagi ギターベースがスワップしているときは元に戻す
\r
1754 // ConfigIni.SwapGuitarBassKeyAssign();
\r
1756 string str = strEXEのあるフォルダ + "Config.ini";
\r
1760 ConfigIni.t書き出し( str );
\r
1761 Trace.TraceInformation( "保存しました。({0})", new object[] { str } );
\r
1763 catch( Exception e )
\r
1765 Trace.TraceError( e.Message );
\r
1766 Trace.TraceError( "Config.ini の出力に失敗しました。({0})", new object[] { str } );
\r
1772 //---------------------
\r
1774 Trace.TraceInformation("アプリケーションの終了処理を完了しました。");
\r
1777 this.b終了処理完了済み = true;
\r
1780 private void Window_ApplicationActivated( object sender, EventArgs e )
\r
1782 this.bApplicationActive = true;
\r
1784 private void Window_ApplicationDeactivated( object sender, EventArgs e )
\r
1786 this.bApplicationActive = false;
\r
1788 private void Window_KeyDown( object sender, KeyEventArgs e )
\r
1790 if (e.KeyCode == Keys.Menu)
\r
1793 e.SuppressKeyPress = true;
\r
1795 else if ((e.KeyCode == Keys.Return) && e.Alt)
\r
1797 if (ConfigIni != null)
\r
1799 ConfigIni.bウィンドウモード = !ConfigIni.bウィンドウモード;
\r
1800 this.t全画面・ウィンドウモード切り替え();
\r
1803 e.SuppressKeyPress = true;
\r
1806 private CScoreIni tScoreIniへBGMAdjustとHistoryとPlayCountを更新(string str新ヒストリ行)
\r
1811 string str = DTX.strファイル名の絶対パス + ".score.ini";
\r
1812 CScoreIni ini = new CScoreIni( str );
\r
1813 if( !File.Exists( str ) )
\r
1815 ini.stファイル.Title = DTX.TITLE;
\r
1816 ini.stファイル.Name = DTX.strファイル名;
\r
1817 ini.stファイル.Hash = CScoreIni.tファイルのMD5を求めて返す( DTX.strファイル名の絶対パス );
\r
1818 for( int i = 0; i < 6; i++ )
\r
1820 ini.stセクション[ i ].nPerfectになる範囲ms = nPerfect範囲ms;
\r
1821 ini.stセクション[ i ].nGreatになる範囲ms = nGreat範囲ms;
\r
1822 ini.stセクション[ i ].nGoodになる範囲ms = nGood範囲ms;
\r
1823 ini.stセクション[ i ].nPoorになる範囲ms = nPoor範囲ms;
\r
1826 ini.stファイル.BGMAdjust = DTX.nBGMAdjust;
\r
1827 CScoreIni.t更新条件を取得する( out flag, out flag2, out flag3 );
\r
1828 if( ( flag || flag2 ) || flag3 )
\r
1832 ini.stファイル.PlayCountDrums++;
\r
1836 ini.stファイル.PlayCountGuitar++;
\r
1840 ini.stファイル.PlayCountBass++;
\r
1842 ini.tヒストリを追加する( str新ヒストリ行 );
\r
1845 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Drums = ini.stファイル.PlayCountDrums;
\r
1846 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
\r
1847 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Bass = ini.stファイル.PlayCountBass;
\r
1848 for( int j = 0; j < ini.stファイル.History.Length; j++ )
\r
1850 stage選曲.r現在選択中のスコア.譜面情報.演奏履歴[ j ] = ini.stファイル.History[ j ];
\r
1854 if( ConfigIni.bScoreIniを出力する )
\r
1861 private void tガベージコレクションを実行する()
\r
1864 GC.WaitForPendingFinalizers();
\r
1866 GC.WaitForPendingFinalizers();
\r
1868 private void tプラグイン検索と生成()
\r
1870 this.listプラグイン = new List<STPlugin>();
\r
1872 string strIPluginActivityの名前 = typeof( IPluginActivity ).FullName;
\r
1873 string strプラグインフォルダパス = strEXEのあるフォルダ + "Plugins\\";
\r
1875 this.t指定フォルダ内でのプラグイン検索と生成( strプラグインフォルダパス, strIPluginActivityの名前 );
\r
1877 if( this.listプラグイン.Count > 0 )
\r
1878 Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" );
\r
1880 private void t指定フォルダ内でのプラグイン検索と生成( string strプラグインフォルダパス, string strプラグイン型名 )
\r
1882 // 指定されたパスが存在しないとエラー
\r
1883 if( !Directory.Exists( strプラグインフォルダパス ) )
\r
1885 Trace.TraceWarning( "プラグインフォルダが存在しません。(" + strプラグインフォルダパス + ")" );
\r
1889 // (1) すべての *.dll について…
\r
1890 string[] strDLLs = System.IO.Directory.GetFiles( strプラグインフォルダパス, "*.dll" );
\r
1891 foreach( string dllName in strDLLs )
\r
1895 // (1-1) dll をアセンブリとして読み込む。
\r
1896 System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( dllName );
\r
1898 // (1-2) アセンブリ内のすべての型について、プラグインとして有効か調べる
\r
1899 foreach( Type t in asm.GetTypes() )
\r
1901 // (1-3) ↓クラスであり↓Publicであり↓抽象クラスでなく↓IPlugin型のインスタンスが作れる 型を持っていれば有効
\r
1902 if( t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface( strプラグイン型名 ) != null )
\r
1904 // (1-4) クラス名からインスタンスを作成する
\r
1905 var st = new STPlugin() {
\r
1906 plugin = (IPluginActivity) asm.CreateInstance( t.FullName ),
\r
1907 strプラグインフォルダ = Path.GetDirectoryName( dllName ),
\r
1908 strアセンブリ簡易名 = asm.GetName().Name,
\r
1909 Version = asm.GetName().Version,
\r
1912 // (1-5) プラグインリストへ登録
\r
1913 this.listプラグイン.Add( st );
\r
1914 Trace.TraceInformation( "プラグイン {0} ({1}, {2}, {3}) を読み込みました。", t.FullName, Path.GetFileName( dllName ), st.strアセンブリ簡易名, st.Version.ToString() );
\r
1920 Trace.TraceInformation( dllName + " からプラグインを生成することに失敗しました。スキップします。" );
\r
1924 // (2) サブフォルダがあれば再帰する
\r
1925 string[] strDirs = Directory.GetDirectories( strプラグインフォルダパス, "*" );
\r
1926 foreach( string dir in strDirs )
\r
1927 this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );
\r
1929 //-----------------
\r
1930 private void Window_MouseDoubleClick( object sender, MouseEventArgs e) // #23510 2010.11.13 yyagi: to go full screen mode
\r
1932 ConfigIni.bウィンドウモード = false;
\r
1933 this.t全画面・ウィンドウモード切り替え();
\r
1935 private void Window_ResizeEnd(object sender, EventArgs e) // #23510 2010.11.20 yyagi: to get resized window size
\r
1937 ConfigIni.nウインドウwidth = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Width : currentClientSize.Width; // #23510 2010.10.31 yyagi add
\r
1938 ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Height : currentClientSize.Height;
\r