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 = "088(110211)";
\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 #region [ 全画面・ウインドウ切り替え ]
\r
1061 if ( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )
\r
1063 ConfigIni.b全画面モード = !ConfigIni.b全画面モード;
\r
1064 app.t全画面・ウィンドウモード切り替え();
\r
1065 this.b次のタイミングで全画面・ウィンドウ切り替えを行う = false;
\r
1068 #region [ 垂直基線同期切り替え ]
\r
1069 if ( this.b次のタイミングで垂直帰線同期切り替えを行う )
\r
1071 bool bIsMaximized = this.Window.IsMaximized; // #23510 2010.11.3 yyagi: to backup current window mode before changing VSyncWait
\r
1072 currentClientSize = this.Window.ClientSize; // #23510 2010.11.3 yyagi: to backup current window size before changing VSyncWait
\r
1073 DeviceSettings currentSettings = app.GraphicsDeviceManager.CurrentSettings;
\r
1074 currentSettings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1075 app.GraphicsDeviceManager.ChangeDevice( currentSettings );
\r
1076 this.b次のタイミングで垂直帰線同期切り替えを行う = false;
\r
1077 base.Window.ClientSize = new Size(currentClientSize.Width, currentClientSize.Height); // #23510 2010.11.3 yyagi: to resume window size after changing VSyncWait
\r
1080 this.Window.WindowState = FormWindowState.Maximized; // #23510 2010.11.3 yyagi: to resume window mode after changing VSyncWait
\r
1089 #region [ テクスチャの生成・解放のためのヘルパー ]
\r
1090 //-----------------
\r
1091 public static CTexture tテクスチャの生成( string fileName )
\r
1093 return tテクスチャの生成( fileName, false );
\r
1095 public static CTexture tテクスチャの生成( string fileName, bool b黒を透過する )
\r
1103 return new CTexture( app.Device, fileName, TextureFormat, b黒を透過する );
\r
1105 catch( CTextureCreateFailedException )
\r
1107 Trace.TraceError( "テクスチャの生成に失敗しました。({0})", new object[] { fileName } );
\r
1111 public static void tテクスチャの解放( ref CTexture tx )
\r
1119 //-----------------
\r
1122 #region [ private ]
\r
1123 //-----------------
\r
1124 private bool bマウスカーソル表示中 = true;
\r
1125 private bool b終了処理完了済み;
\r
1126 private static CDTX dtx;
\r
1127 private List<CActivity> listトップレベルActivities;
\r
1128 private int n進行描画の戻り値;
\r
1130 private void t起動処理()
\r
1132 #region [ strEXEのあるフォルダを決定する ]
\r
1133 //-----------------
\r
1134 // BEGIN #23629 2010.11.13 from: デバッグ時は Application.ExecutablePath が ($SolutionDir)/bin/x86/Debug/ などになり System/ の読み込みに失敗するので、カレントディレクトリを採用する。(プロジェクトのプロパティ→デバッグ→作業ディレクトリが有効になる)
\r
1136 strEXEのあるフォルダ = Environment.CurrentDirectory + @"\";
\r
1138 strEXEのあるフォルダ = Path.GetDirectoryName( Application.ExecutablePath ) + @"\"; // #23629 2010.11.9 yyagi: set correct pathname where DTXManiaGR.exe is.
\r
1140 // END #23629 2010.11.13 from
\r
1141 //-----------------
\r
1144 #region [ Config.ini の読込み ]
\r
1145 //---------------------
\r
1146 ConfigIni = new CConfigIni();
\r
1147 string path = strEXEのあるフォルダ + "Config.ini";
\r
1148 if( File.Exists( path ) )
\r
1152 ConfigIni.t読み込み( path );
\r
1156 //ConfigIni = new CConfigIni(); // 存在してなければ新規生成
\r
1159 //---------------------
\r
1161 #region [ ログ出力開始 ]
\r
1162 //---------------------
\r
1163 Trace.AutoFlush = true;
\r
1164 if( ConfigIni.bログ出力 )
\r
1166 Trace.Listeners.Add( new CTraceLogListener( new StreamWriter( "DTXManiaLog.txt", false, Encoding.GetEncoding( "shift-jis" ) ) ) );
\r
1168 Trace.WriteLine("");
\r
1169 Trace.WriteLine( "DTXMania powered by YAMAHA Silent Session Drums" );
\r
1170 Trace.WriteLine( string.Format( "Release: {0}", VERSION ) );
\r
1171 Trace.WriteLine( "" );
\r
1172 Trace.TraceInformation( "----------------------" );
\r
1173 Trace.TraceInformation( "■ アプリケーションの初期化" );
\r
1174 Trace.TraceInformation( "OS Version: " + Environment.OSVersion );
\r
1175 Trace.TraceInformation( "ProcessorCount: " + Environment.ProcessorCount.ToString() );
\r
1176 Trace.TraceInformation( "CLR Version: " + Environment.Version.ToString() );
\r
1177 //---------------------
\r
1179 #region [ コンパクトモードスイッチの有無 ]
\r
1180 //---------------------
\r
1181 bコンパクトモード = false;
\r
1182 strコンパクトモードファイル = "";
\r
1183 string[] commandLineArgs = Environment.GetCommandLineArgs();
\r
1184 if( ( commandLineArgs != null ) && ( commandLineArgs.Length > 1 ) )
\r
1187 strコンパクトモードファイル = commandLineArgs[ 1 ];
\r
1188 Trace.TraceInformation( "コンパクトモードで起動します。[{0}]", new object[] { strコンパクトモードファイル } );
\r
1190 //---------------------
\r
1193 #region [ ウィンドウ初期化 ]
\r
1194 //---------------------
\r
1195 base.Window.Text = "DTXMania .NET style release " + VERSION;
\r
1196 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
1197 if (!ConfigIni.bウィンドウモード) // #23510 2010.11.02 yyagi: add; to recover window size in case bootup with fullscreen mode
\r
1199 currentClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight);
\r
1201 base.Window.MaximizeBox = true; // #23510 2010.11.04 yyagi: to support maximizing window
\r
1202 base.Window.FormBorderStyle = FormBorderStyle.Sizable; // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize
\r
1203 base.Window.ShowIcon = true;
\r
1204 base.Window.Icon = Properties.Resources.dtx;
\r
1205 base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );
\r
1206 base.Window.MouseDoubleClick += new MouseEventHandler(this.Window_MouseDoubleClick); // #23510 2010.11.13 yyagi: to go fullscreen mode
\r
1207 base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd); // #23510 2010.11.20 yyagi: to set resized window size in Config.ini
\r
1208 base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);
\r
1209 base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
\r
1210 //---------------------
\r
1212 #region [ Direct3D9 デバイスの生成 ]
\r
1213 //---------------------
\r
1214 DeviceSettings settings = new DeviceSettings();
\r
1215 settings.Windowed = ConfigIni.bウィンドウモード;
\r
1216 settings.BackBufferWidth = 640;
\r
1217 settings.BackBufferHeight = 480;
\r
1218 settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1221 base.GraphicsDeviceManager.ChangeDevice(settings);
\r
1223 catch (DeviceCreationException e)
\r
1225 Trace.TraceError(e.ToString());
\r
1226 MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
1227 Environment.Exit(-1);
\r
1230 base.IsFixedTimeStep = false;
\r
1231 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
1232 base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォーカス時スリープms)); // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive
\r
1233 // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )
\r
1234 //---------------------
\r
1239 #region [ Skin の初期化 ]
\r
1240 //---------------------
\r
1241 Trace.TraceInformation( "スキンの初期化を行います。" );
\r
1245 Skin = new CSkin();
\r
1246 Trace.TraceInformation( "スキンの初期化を完了しました。" );
\r
1250 Trace.TraceInformation( "スキンの初期化に失敗しました。" );
\r
1257 //---------------------
\r
1259 #region [ Timer の初期化 ]
\r
1260 //---------------------
\r
1261 Trace.TraceInformation( "タイマの初期化を行います。" );
\r
1265 Timer = new CTimer( CTimer.E種別.MultiMedia );
\r
1266 Trace.TraceInformation( "タイマの初期化を完了しました。" );
\r
1272 //---------------------
\r
1274 #region [ FPS カウンタの初期化 ]
\r
1275 //---------------------
\r
1276 Trace.TraceInformation( "FPSカウンタの初期化を行います。" );
\r
1281 Trace.TraceInformation( "FPSカウンタを生成しました。" );
\r
1287 //---------------------
\r
1289 #region [ act文字コンソールの初期化 ]
\r
1290 //---------------------
\r
1291 Trace.TraceInformation( "文字コンソールの初期化を行います。" );
\r
1295 act文字コンソール = new C文字コンソール();
\r
1296 Trace.TraceInformation( "文字コンソールを生成しました。" );
\r
1297 act文字コンソール.On活性化();
\r
1298 Trace.TraceInformation( "文字コンソールを活性化しました。" );
\r
1299 Trace.TraceInformation( "文字コンソールの初期化を完了しました。" );
\r
1301 catch( Exception exception )
\r
1303 Trace.TraceError( exception.Message );
\r
1304 Trace.TraceError( "文字コンソールの初期化に失敗しました。" );
\r
1310 //---------------------
\r
1312 #region [ Input管理 の初期化 ]
\r
1313 //---------------------
\r
1314 Trace.TraceInformation( "DirectInput, MIDI入力の初期化を行います。" );
\r
1318 Input管理 = new CInput管理( base.Window.Handle );
\r
1319 foreach( IInputDevice device in Input管理.list入力デバイス )
\r
1321 if( ( device.e入力デバイス種別 == E入力デバイス種別.Joystick ) && !ConfigIni.dicJoystick.ContainsValue( device.GUID ) )
\r
1324 while( ConfigIni.dicJoystick.ContainsKey( key ) )
\r
1328 ConfigIni.dicJoystick.Add( key, device.GUID );
\r
1331 foreach( IInputDevice device2 in Input管理.list入力デバイス )
\r
1333 if( device2.e入力デバイス種別 == E入力デバイス種別.Joystick )
\r
1335 foreach( KeyValuePair<int, string> pair in ConfigIni.dicJoystick )
\r
1337 if( device2.GUID.Equals( pair.Value ) )
\r
1339 ( (CInputJoystick) device2 ).SetID( pair.Key );
\r
1346 Trace.TraceInformation( "DirectInput の初期化を完了しました。" );
\r
1348 catch( Exception exception2 )
\r
1350 Trace.TraceError( exception2.Message );
\r
1351 Trace.TraceError( "DirectInput, MIDI入力の初期化に失敗しました。" );
\r
1358 //---------------------
\r
1360 #region [ Pad の初期化 ]
\r
1361 //---------------------
\r
1362 Trace.TraceInformation( "パッドの初期化を行います。" );
\r
1366 Pad = new CPad( ConfigIni, Input管理 );
\r
1367 Trace.TraceInformation( "パッドの初期化を完了しました。" );
\r
1369 catch( Exception exception3 )
\r
1371 Trace.TraceError( exception3.Message );
\r
1372 Trace.TraceError( "パッドの初期化に失敗しました。" );
\r
1378 //---------------------
\r
1380 #region [ Sound管理 の初期化 ]
\r
1381 //---------------------
\r
1382 Trace.TraceInformation( "DirectSound の初期化を行います。" );
\r
1386 Sound管理 = new CSound管理( base.Window.Handle );
\r
1387 Trace.TraceInformation( "DirectSound の初期化を完了しました。" );
\r
1391 Trace.TraceError( "DirectSound の初期化に失敗しました。" );
\r
1398 //---------------------
\r
1400 #region [ Songs管理 の初期化 ]
\r
1401 //---------------------
\r
1402 Trace.TraceInformation( "曲リストの初期化を行います。" );
\r
1406 Songs管理 = new CSongs管理();
\r
1407 Trace.TraceInformation( "曲リストの初期化を完了しました。" );
\r
1409 catch( Exception exception4 )
\r
1411 Trace.TraceError( exception4.Message );
\r
1412 Trace.TraceError( "曲リストの初期化に失敗しました。" );
\r
1418 //---------------------
\r
1420 #region [ CAvi の初期化 ]
\r
1421 //---------------------
\r
1423 //---------------------
\r
1425 #region [ Random の初期化 ]
\r
1426 //---------------------
\r
1427 Random = new Random( (int) Timer.nシステム時刻 );
\r
1428 //---------------------
\r
1430 #region [ ステージの初期化 ]
\r
1431 //---------------------
\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 stage演奏ドラム画面 = new CStage演奏ドラム画面();
\r
1441 stage演奏ギター画面 = new CStage演奏ギター画面();
\r
1442 stage結果 = new CStage結果();
\r
1443 stage終了 = new CStage終了();
\r
1444 this.listトップレベルActivities = new List<CActivity>();
\r
1445 this.listトップレベルActivities.Add( act文字コンソール );
\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 this.listトップレベルActivities.Add( stage演奏ドラム画面 );
\r
1453 this.listトップレベルActivities.Add( stage演奏ギター画面 );
\r
1454 this.listトップレベルActivities.Add( stage結果 );
\r
1455 this.listトップレベルActivities.Add( stage終了 );
\r
1456 //---------------------
\r
1458 #region [ プラグインの検索と生成 ]
\r
1459 //---------------------
\r
1460 PluginHost = new CPluginHost();
\r
1462 Trace.TraceInformation( "プラグインの検索と生成を行います。" );
\r
1466 this.tプラグイン検索と生成();
\r
1467 Trace.TraceInformation( "プラグインの検索と生成を完了しました。" );
\r
1473 //---------------------
\r
1475 #region [ プラグインの初期化 ]
\r
1476 //---------------------
\r
1477 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
\r
1479 Trace.TraceInformation( "プラグインの初期化を行います。" );
\r
1483 foreach( STPlugin st in this.listプラグイン )
\r
1485 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1486 st.plugin.On初期化( this.PluginHost );
\r
1487 st.plugin.OnManagedリソースの作成();
\r
1488 st.plugin.OnUnmanagedリソースの作成();
\r
1489 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1491 Trace.TraceInformation( "すべてのプラグインの初期化を完了しました。" );
\r
1495 Trace.TraceError( "プラグインのどれかの初期化に失敗しました。" );
\r
1504 //---------------------
\r
1507 Trace.TraceInformation( "アプリケーションの初期化を完了しました。" );
\r
1509 #region [ 最初のステージの起動 ]
\r
1510 //---------------------
\r
1511 Trace.TraceInformation( "----------------------" );
\r
1512 Trace.TraceInformation( "■ 起動" );
\r
1514 r現在のステージ = stage起動;
\r
1516 //---------------------
\r
1519 private void t終了処理()
\r
1521 if( !this.b終了処理完了済み )
\r
1523 Trace.TraceInformation( "----------------------" );
\r
1524 Trace.TraceInformation( "■ アプリケーションの終了" );
\r
1525 #region [ 現在のステージの終了処理 ]
\r
1526 //---------------------
\r
1527 if (r現在のステージ != null)
\r
1529 Trace.TraceInformation( "現在のステージを終了します。" );
\r
1533 r現在のステージ.On非活性化();
\r
1534 Trace.TraceInformation( "現在のステージの終了処理を完了しました。" );
\r
1541 //---------------------
\r
1543 #region [ プラグインの終了処理 ]
\r
1544 //---------------------
\r
1545 if (this.listプラグイン != null && this.listプラグイン.Count > 0)
\r
1547 Trace.TraceInformation( "すべてのプラグインを終了します。" );
\r
1551 foreach( STPlugin st in this.listプラグイン )
\r
1553 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1554 st.plugin.OnUnmanagedリソースの解放();
\r
1555 st.plugin.OnManagedリソースの解放();
\r
1557 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1559 PluginHost = null;
\r
1560 Trace.TraceInformation( "すべてのプラグインの終了処理を完了しました。" );
\r
1567 //---------------------
\r
1569 #region [ 曲リストの終了処理 ]
\r
1570 //---------------------
\r
1571 if (Songs管理 != null)
\r
1573 Trace.TraceInformation( "曲リストの終了処理を行います。" );
\r
1578 Trace.TraceInformation( "曲リストの終了処理を完了しました。" );
\r
1580 catch( Exception exception )
\r
1582 Trace.TraceError( exception.Message );
\r
1583 Trace.TraceError( "曲リストの終了処理に失敗しました。" );
\r
1591 //---------------------
\r
1593 #region [ スキンの終了処理 ]
\r
1594 //---------------------
\r
1597 Trace.TraceInformation( "スキンの終了処理を行います。" );
\r
1603 Trace.TraceInformation( "スキンの終了処理を完了しました。" );
\r
1605 catch( Exception exception2 )
\r
1607 Trace.TraceError( exception2.Message );
\r
1608 Trace.TraceError( "スキンの終了処理に失敗しました。" );
\r
1615 //---------------------
\r
1617 #region [ DirectSoundの終了処理 ]
\r
1618 //---------------------
\r
1619 if (Sound管理 != null)
\r
1621 Trace.TraceInformation( "DirectSound の終了処理を行います。" );
\r
1625 Sound管理.Dispose();
\r
1627 Trace.TraceInformation( "DirectSound の終了処理を完了しました。" );
\r
1629 catch( Exception exception3 )
\r
1631 Trace.TraceError( exception3.Message );
\r
1632 Trace.TraceError( "DirectSound の終了処理に失敗しました。" );
\r
1639 //---------------------
\r
1641 #region [ パッドの終了処理 ]
\r
1642 //---------------------
\r
1645 Trace.TraceInformation( "パッドの終了処理を行います。" );
\r
1650 Trace.TraceInformation( "パッドの終了処理を完了しました。" );
\r
1652 catch( Exception exception4 )
\r
1654 Trace.TraceError( exception4.Message );
\r
1655 Trace.TraceError( "パッドの終了処理に失敗しました。" );
\r
1662 //---------------------
\r
1664 #region [ DirectInput, MIDI入力の終了処理 ]
\r
1665 //---------------------
\r
1666 if (Input管理 != null)
\r
1668 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を行います。" );
\r
1672 Input管理.Dispose();
\r
1674 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を完了しました。" );
\r
1676 catch( Exception exception5 )
\r
1678 Trace.TraceError( exception5.Message );
\r
1679 Trace.TraceError( "DirectInput, MIDI入力の終了処理に失敗しました。" );
\r
1686 //---------------------
\r
1688 #region [ 文字コンソールの終了処理 ]
\r
1689 //---------------------
\r
1690 if (act文字コンソール != null)
\r
1692 Trace.TraceInformation( "文字コンソールの終了処理を行います。" );
\r
1696 act文字コンソール.On非活性化();
\r
1697 act文字コンソール = null;
\r
1698 Trace.TraceInformation( "文字コンソールの終了処理を完了しました。" );
\r
1700 catch( Exception exception6 )
\r
1702 Trace.TraceError( exception6.Message );
\r
1703 Trace.TraceError( "文字コンソールの終了処理に失敗しました。" );
\r
1710 //---------------------
\r
1712 #region [ FPSカウンタの終了処理 ]
\r
1713 //---------------------
\r
1714 Trace.TraceInformation("FPSカウンタの終了処理を行います。");
\r
1722 Trace.TraceInformation( "FPSカウンタの終了処理を完了しました。" );
\r
1728 //---------------------
\r
1730 #region [ タイマの終了処理 ]
\r
1731 //---------------------
\r
1732 Trace.TraceInformation("タイマの終了処理を行います。");
\r
1736 if( Timer != null )
\r
1740 Trace.TraceInformation( "タイマの終了処理を完了しました。" );
\r
1744 Trace.TraceInformation( "タイマは使用されていません。" );
\r
1751 //---------------------
\r
1753 #region [ Config.iniの出力 ]
\r
1754 //---------------------
\r
1755 Trace.TraceInformation("Config.ini を出力します。");
\r
1756 if ( ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.16 yyagi ギターベースがスワップしているときは元に戻す
\r
1758 // ConfigIni.SwapGuitarBassKeyAssign();
\r
1760 string str = strEXEのあるフォルダ + "Config.ini";
\r
1764 ConfigIni.t書き出し( str );
\r
1765 Trace.TraceInformation( "保存しました。({0})", new object[] { str } );
\r
1767 catch( Exception e )
\r
1769 Trace.TraceError( e.Message );
\r
1770 Trace.TraceError( "Config.ini の出力に失敗しました。({0})", new object[] { str } );
\r
1776 //---------------------
\r
1778 Trace.TraceInformation("アプリケーションの終了処理を完了しました。");
\r
1781 this.b終了処理完了済み = true;
\r
1784 private void Window_ApplicationActivated( object sender, EventArgs e )
\r
1786 this.bApplicationActive = true;
\r
1788 private void Window_ApplicationDeactivated( object sender, EventArgs e )
\r
1790 this.bApplicationActive = false;
\r
1792 private void Window_KeyDown( object sender, KeyEventArgs e )
\r
1794 if (e.KeyCode == Keys.Menu)
\r
1797 e.SuppressKeyPress = true;
\r
1799 else if ((e.KeyCode == Keys.Return) && e.Alt)
\r
1801 if (ConfigIni != null)
\r
1803 ConfigIni.bウィンドウモード = !ConfigIni.bウィンドウモード;
\r
1804 this.t全画面・ウィンドウモード切り替え();
\r
1807 e.SuppressKeyPress = true;
\r
1810 private CScoreIni tScoreIniへBGMAdjustとHistoryとPlayCountを更新(string str新ヒストリ行)
\r
1812 bool bIsUpdatedDrums, bIsUpdatedGuitar, bIsUpdatedBass;
\r
1813 string strFilename = DTX.strファイル名の絶対パス + ".score.ini";
\r
1814 CScoreIni ini = new CScoreIni( strFilename );
\r
1815 if( !File.Exists( strFilename ) )
\r
1817 ini.stファイル.Title = DTX.TITLE;
\r
1818 ini.stファイル.Name = DTX.strファイル名;
\r
1819 ini.stファイル.Hash = CScoreIni.tファイルのMD5を求めて返す( DTX.strファイル名の絶対パス );
\r
1820 for( int i = 0; i < 6; i++ )
\r
1822 ini.stセクション[ i ].nPerfectになる範囲ms = nPerfect範囲ms;
\r
1823 ini.stセクション[ i ].nGreatになる範囲ms = nGreat範囲ms;
\r
1824 ini.stセクション[ i ].nGoodになる範囲ms = nGood範囲ms;
\r
1825 ini.stセクション[ i ].nPoorになる範囲ms = nPoor範囲ms;
\r
1828 ini.stファイル.BGMAdjust = DTX.nBGMAdjust;
\r
1829 CScoreIni.t更新条件を取得する( out bIsUpdatedDrums, out bIsUpdatedGuitar, out bIsUpdatedBass );
\r
1830 if( bIsUpdatedDrums || bIsUpdatedGuitar || bIsUpdatedBass )
\r
1832 if( bIsUpdatedDrums )
\r
1834 ini.stファイル.PlayCountDrums++;
\r
1836 if( bIsUpdatedGuitar )
\r
1838 ini.stファイル.PlayCountGuitar++;
\r
1840 if( bIsUpdatedBass )
\r
1842 ini.stファイル.PlayCountBass++;
\r
1844 ini.tヒストリを追加する( str新ヒストリ行 );
\r
1847 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Drums = ini.stファイル.PlayCountDrums;
\r
1848 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
\r
1849 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Bass = ini.stファイル.PlayCountBass;
\r
1850 for( int j = 0; j < ini.stファイル.History.Length; j++ )
\r
1852 stage選曲.r現在選択中のスコア.譜面情報.演奏履歴[ j ] = ini.stファイル.History[ j ];
\r
1856 if( ConfigIni.bScoreIniを出力する )
\r
1858 ini.t書き出し( strFilename );
\r
1863 private void tガベージコレクションを実行する()
\r
1866 GC.WaitForPendingFinalizers();
\r
1868 GC.WaitForPendingFinalizers();
\r
1870 private void tプラグイン検索と生成()
\r
1872 this.listプラグイン = new List<STPlugin>();
\r
1874 string strIPluginActivityの名前 = typeof( IPluginActivity ).FullName;
\r
1875 string strプラグインフォルダパス = strEXEのあるフォルダ + "Plugins\\";
\r
1877 this.t指定フォルダ内でのプラグイン検索と生成( strプラグインフォルダパス, strIPluginActivityの名前 );
\r
1879 if( this.listプラグイン.Count > 0 )
\r
1880 Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" );
\r
1882 private void t指定フォルダ内でのプラグイン検索と生成( string strプラグインフォルダパス, string strプラグイン型名 )
\r
1884 // 指定されたパスが存在しないとエラー
\r
1885 if( !Directory.Exists( strプラグインフォルダパス ) )
\r
1887 Trace.TraceWarning( "プラグインフォルダが存在しません。(" + strプラグインフォルダパス + ")" );
\r
1891 // (1) すべての *.dll について…
\r
1892 string[] strDLLs = System.IO.Directory.GetFiles( strプラグインフォルダパス, "*.dll" );
\r
1893 foreach( string dllName in strDLLs )
\r
1897 // (1-1) dll をアセンブリとして読み込む。
\r
1898 System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( dllName );
\r
1900 // (1-2) アセンブリ内のすべての型について、プラグインとして有効か調べる
\r
1901 foreach( Type t in asm.GetTypes() )
\r
1903 // (1-3) ↓クラスであり↓Publicであり↓抽象クラスでなく↓IPlugin型のインスタンスが作れる 型を持っていれば有効
\r
1904 if( t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface( strプラグイン型名 ) != null )
\r
1906 // (1-4) クラス名からインスタンスを作成する
\r
1907 var st = new STPlugin() {
\r
1908 plugin = (IPluginActivity) asm.CreateInstance( t.FullName ),
\r
1909 strプラグインフォルダ = Path.GetDirectoryName( dllName ),
\r
1910 strアセンブリ簡易名 = asm.GetName().Name,
\r
1911 Version = asm.GetName().Version,
\r
1914 // (1-5) プラグインリストへ登録
\r
1915 this.listプラグイン.Add( st );
\r
1916 Trace.TraceInformation( "プラグイン {0} ({1}, {2}, {3}) を読み込みました。", t.FullName, Path.GetFileName( dllName ), st.strアセンブリ簡易名, st.Version.ToString() );
\r
1922 Trace.TraceInformation( dllName + " からプラグインを生成することに失敗しました。スキップします。" );
\r
1926 // (2) サブフォルダがあれば再帰する
\r
1927 string[] strDirs = Directory.GetDirectories( strプラグインフォルダパス, "*" );
\r
1928 foreach( string dir in strDirs )
\r
1929 this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );
\r
1931 //-----------------
\r
1932 private void Window_MouseDoubleClick( object sender, MouseEventArgs e) // #23510 2010.11.13 yyagi: to go full screen mode
\r
1934 ConfigIni.bウィンドウモード = false;
\r
1935 this.t全画面・ウィンドウモード切り替え();
\r
1937 private void Window_ResizeEnd(object sender, EventArgs e) // #23510 2010.11.20 yyagi: to get resized window size
\r
1939 ConfigIni.nウインドウwidth = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Width : currentClientSize.Width; // #23510 2010.10.31 yyagi add
\r
1940 ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Height : currentClientSize.Height;
\r