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 = "086(101120)";
\r
22 public static readonly string SLIMDXDLL = "c_net20x86_Jun2010";
\r
23 public static readonly string D3DXDLL = "d3dx9_43.dll"; // June 2010
\r
24 //public static readonly string D3DXDLL = "d3dx9_42.dll"; // February 2010
\r
25 //public static readonly string D3DXDLL = "d3dx9_41.dll"; // March 2009
\r
27 public static CDTXMania app
\r
32 public static C文字コンソール act文字コンソール
\r
37 public static bool bコンパクトモード
\r
42 public static CConfigIni ConfigIni
\r
47 public static CDTX DTX
\r
55 if( ( dtx != null ) && ( app != null ) )
\r
58 app.listトップレベルActivities.Remove( dtx );
\r
61 if( ( dtx != null ) && ( app != null ) )
\r
63 app.listトップレベルActivities.Add( dtx );
\r
67 public static CFPS FPS
\r
72 public static CInput管理 Input管理
\r
77 public static int nPerfect範囲ms
\r
81 if( stage選曲.r確定された曲 != null )
\r
83 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
84 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nPerfect範囲ms >= 0 ) )
\r
86 return c曲リストノード.nPerfect範囲ms;
\r
89 return ConfigIni.nヒット範囲ms.Perfect;
\r
92 public static int nGreat範囲ms
\r
96 if( stage選曲.r確定された曲 != null )
\r
98 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
99 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nGreat範囲ms >= 0 ) )
\r
101 return c曲リストノード.nGreat範囲ms;
\r
104 return ConfigIni.nヒット範囲ms.Great;
\r
107 public static int nGood範囲ms
\r
111 if( stage選曲.r確定された曲 != null )
\r
113 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
114 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nGood範囲ms >= 0 ) )
\r
116 return c曲リストノード.nGood範囲ms;
\r
119 return ConfigIni.nヒット範囲ms.Good;
\r
122 public static int nPoor範囲ms
\r
126 if( stage選曲.r確定された曲 != null )
\r
128 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
129 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nPoor範囲ms >= 0 ) )
\r
131 return c曲リストノード.nPoor範囲ms;
\r
134 return ConfigIni.nヒット範囲ms.Poor;
\r
137 public static CPad Pad
\r
142 public static Random Random
\r
147 public static CSkin Skin
\r
152 public static CSongs管理 Songs管理
\r
157 public static CSound管理 Sound管理
\r
162 public static CStage起動 stage起動
\r
167 public static CStageタイトル stageタイトル
\r
172 public static CStageオプション stageオプション
\r
177 public static CStageコンフィグ stageコンフィグ
\r
182 public static CStage選曲 stage選曲
\r
187 public static CStage曲読み込み stage曲読み込み
\r
192 public static CStage演奏ギター画面 stage演奏ギター画面
\r
197 public static CStage演奏ドラム画面 stage演奏ドラム画面
\r
202 public static CStage結果 stage結果
\r
207 public static CStage終了 stage終了
\r
212 public static CStage r現在のステージ = null;
\r
213 public static CStage r直前のステージ = null;
\r
214 public static string strEXEのあるフォルダ
\r
219 public static string strコンパクトモードファイル
\r
224 public static CTimer Timer
\r
229 public static Format TextureFormat = Format.A8R8G8B8;
\r
230 internal static IPluginActivity act現在入力を占有中のプラグイン = null;
\r
231 public bool bApplicationActive
\r
236 public bool b次のタイミングで垂直帰線同期切り替えを行う
\r
241 public bool b次のタイミングで全画面・ウィンドウ切り替えを行う
\r
246 public Device Device
\r
248 get { return base.GraphicsDeviceManager.Direct3D9.Device; }
\r
250 public CPluginHost PluginHost
\r
255 public List<STPlugin> listプラグイン = new List<STPlugin>();
\r
256 public struct STPlugin
\r
258 public IPluginActivity plugin;
\r
259 public string strプラグインフォルダ;
\r
260 public string strアセンブリ簡易名;
\r
261 public Version Version;
\r
263 private static Size currentClientSize // #23510 2010.10.27 add yyagi to keep current window size
\r
273 CDTXMania.app = this;
\r
280 public void t全画面・ウィンドウモード切り替え()
\r
282 DeviceSettings settings = base.GraphicsDeviceManager.CurrentSettings.Clone();
\r
283 if( ( ConfigIni != null ) && ( ConfigIni.bウィンドウモード != settings.Windowed ) )
\r
285 settings.Windowed = ConfigIni.bウィンドウモード;
\r
286 if (ConfigIni.bウィンドウモード == false) // #23510 2010.10.27 yyagi: backup current window size before going fullscreen mode
\r
288 currentClientSize = this.Window.ClientSize;
\r
289 ConfigIni.nウインドウwidth = this.Window.ClientSize.Width;
\r
290 ConfigIni.nウインドウheight = this.Window.ClientSize.Height;
\r
292 base.GraphicsDeviceManager.ChangeDevice( settings );
\r
293 if (ConfigIni.bウィンドウモード == true) // #23510 2010.10.27 yyagi: to resume window size from backuped value
\r
295 base.Window.ClientSize =
\r
296 new Size(currentClientSize.Width, currentClientSize.Height);
\r
304 protected override void Initialize()
\r
306 if( this.listトップレベルActivities != null )
\r
308 foreach( CActivity activity in this.listトップレベルActivities )
\r
309 activity.OnManagedリソースの作成();
\r
312 foreach( STPlugin st in this.listプラグイン )
\r
314 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
315 st.plugin.OnManagedリソースの作成();
\r
316 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
319 protected override void LoadContent()
\r
321 if ( ConfigIni.bウィンドウモード )
\r
323 if( !this.bマウスカーソル表示中 )
\r
326 this.bマウスカーソル表示中 = true;
\r
329 else if( this.bマウスカーソル表示中 )
\r
332 this.bマウスカーソル表示中 = false;
\r
334 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
335 this.Device.SetTransform( TransformState.Projection, Matrix.PerspectiveFovLH( C変換.DegreeToRadian( (float) 60f ), ( (float) this.Device.Viewport.Width ) / ( (float) this.Device.Viewport.Height ), -100f, 100f ) );
\r
336 this.Device.SetRenderState( RenderState.Lighting, false );
\r
337 this.Device.SetRenderState( RenderState.ZEnable, false );
\r
338 this.Device.SetRenderState( RenderState.AntialiasedLineEnable, false );
\r
339 this.Device.SetRenderState( RenderState.AlphaTestEnable, true );
\r
340 this.Device.SetRenderState( RenderState.AlphaRef, 10 );
\r
341 this.Device.SetRenderState<Compare>( RenderState.AlphaFunc, Compare.Greater );
\r
342 this.Device.SetRenderState( RenderState.AlphaBlendEnable, true );
\r
343 this.Device.SetRenderState<Blend>( RenderState.SourceBlend, Blend.SourceAlpha );
\r
344 this.Device.SetRenderState<Blend>( RenderState.DestinationBlend, Blend.InverseSourceAlpha );
\r
345 this.Device.SetTextureStageState( 0, TextureStage.AlphaOperation, TextureOperation.Modulate );
\r
346 this.Device.SetTextureStageState( 0, TextureStage.AlphaArg1, 2 );
\r
347 this.Device.SetTextureStageState( 0, TextureStage.AlphaArg2, 1 );
\r
349 if( this.listトップレベルActivities != null )
\r
351 foreach( CActivity activity in this.listトップレベルActivities )
\r
352 activity.OnUnmanagedリソースの作成();
\r
355 foreach( STPlugin st in this.listプラグイン )
\r
357 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
358 st.plugin.OnUnmanagedリソースの作成();
\r
359 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
362 protected override void UnloadContent()
\r
364 if( this.listトップレベルActivities != null )
\r
366 foreach( CActivity activity in this.listトップレベルActivities )
\r
367 activity.OnUnmanagedリソースの解放();
\r
370 foreach( STPlugin st in this.listプラグイン )
\r
372 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
373 st.plugin.OnUnmanagedリソースの解放();
\r
374 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
377 protected override void OnExiting( EventArgs e )
\r
380 base.OnExiting( e );
\r
382 protected override void Update( GameTime gameTime )
\r
385 protected override void Draw( GameTime gameTime )
\r
387 CScoreIni.C演奏記録 c演奏記録;
\r
388 CScoreIni.C演奏記録 c演奏記録2;
\r
389 CScoreIni.C演奏記録 c演奏記録3;
\r
390 CDTX.CChip[] chipArray;
\r
393 Sound管理.t再生中の処理をする();
\r
395 if( Timer != null )
\r
398 if( Input管理 != null )
\r
399 Input管理.tポーリング( this.bApplicationActive, CDTXMania.ConfigIni.bバッファ入力を行う );
\r
404 //if( Pad != null ) ポーリング時にクリアしたらダメ!曲の開始時に1回だけクリアする。(2010.9.11)
\r
405 // Pad.st検知したデバイス.Clear();
\r
407 if( this.Device == null )
\r
410 this.Device.BeginScene();
\r
411 this.Device.Clear( ClearFlags.ZBuffer | ClearFlags.Target, Color.Black, 1f, 0 );
\r
413 if( r現在のステージ != null )
\r
415 this.n進行描画の戻り値 = ( r現在のステージ != null ) ? r現在のステージ.On進行描画() : 0;
\r
417 #region [ プラグインの進行描画 ]
\r
418 //---------------------
\r
419 foreach( STPlugin sp in this.listプラグイン )
\r
421 Directory.SetCurrentDirectory( sp.strプラグインフォルダ );
\r
423 if( CDTXMania.act現在入力を占有中のプラグイン == null || CDTXMania.act現在入力を占有中のプラグイン == sp.plugin )
\r
424 sp.plugin.On進行描画( CDTXMania.Pad, CDTXMania.Input管理.Keyboard );
\r
426 sp.plugin.On進行描画( null, null );
\r
428 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
430 //---------------------
\r
433 CScoreIni scoreIni = null;
\r
435 switch( r現在のステージ.eステージID )
\r
437 case CStage.Eステージ.何もしない:
\r
440 case CStage.Eステージ.起動:
\r
442 //-----------------------------
\r
443 if( this.n進行描画の戻り値 != 0 )
\r
448 Trace.TraceInformation( "----------------------" );
\r
449 Trace.TraceInformation( "■ タイトル" );
\r
451 r直前のステージ = r現在のステージ;
\r
452 r現在のステージ = stageタイトル;
\r
457 Trace.TraceInformation( "----------------------" );
\r
458 Trace.TraceInformation( "■ 曲読み込み" );
\r
459 stage曲読み込み.On活性化();
\r
460 r直前のステージ = r現在のステージ;
\r
461 r現在のステージ = stage曲読み込み;
\r
464 foreach( STPlugin pg in this.listプラグイン )
\r
466 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
467 pg.plugin.Onステージ変更();
\r
468 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
471 this.tガベージコレクションを実行する();
\r
473 //-----------------------------
\r
477 case CStage.Eステージ.タイトル:
\r
479 //-----------------------------
\r
480 switch( this.n進行描画の戻り値 )
\r
484 //-----------------------------
\r
486 Trace.TraceInformation( "----------------------" );
\r
487 Trace.TraceInformation( "■ 選曲" );
\r
489 r直前のステージ = r現在のステージ;
\r
490 r現在のステージ = stage選曲;
\r
491 //-----------------------------
\r
497 //-----------------------------
\r
499 Trace.TraceInformation( "----------------------" );
\r
500 Trace.TraceInformation( "■ オプション" );
\r
501 stageオプション.On活性化();
\r
502 r直前のステージ = r現在のステージ;
\r
503 r現在のステージ = stageオプション;
\r
504 //-----------------------------
\r
510 //-----------------------------
\r
512 Trace.TraceInformation( "----------------------" );
\r
513 Trace.TraceInformation( "■ コンフィグ" );
\r
514 stageコンフィグ.On活性化();
\r
515 r直前のステージ = r現在のステージ;
\r
516 r現在のステージ = stageコンフィグ;
\r
517 //-----------------------------
\r
523 //-----------------------------
\r
525 Trace.TraceInformation( "----------------------" );
\r
526 Trace.TraceInformation( "■ 終了" );
\r
528 r直前のステージ = r現在のステージ;
\r
529 r現在のステージ = stage終了;
\r
530 //-----------------------------
\r
535 foreach( STPlugin pg in this.listプラグイン )
\r
537 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
538 pg.plugin.Onステージ変更();
\r
539 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
542 this.tガベージコレクションを実行する();
\r
543 //-----------------------------
\r
547 case CStage.Eステージ.オプション:
\r
549 //-----------------------------
\r
550 if( this.n進行描画の戻り値 != 0 )
\r
552 switch( r直前のステージ.eステージID )
\r
554 case CStage.Eステージ.タイトル:
\r
556 //-----------------------------
\r
558 Trace.TraceInformation( "----------------------" );
\r
559 Trace.TraceInformation( "■ タイトル" );
\r
561 r直前のステージ = r現在のステージ;
\r
562 r現在のステージ = stageタイトル;
\r
564 foreach( STPlugin pg in this.listプラグイン )
\r
566 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
567 pg.plugin.Onステージ変更();
\r
568 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
571 this.tガベージコレクションを実行する();
\r
573 //-----------------------------
\r
576 case CStage.Eステージ.選曲:
\r
578 //-----------------------------
\r
580 Trace.TraceInformation( "----------------------" );
\r
581 Trace.TraceInformation( "■ 選曲" );
\r
583 r直前のステージ = r現在のステージ;
\r
584 r現在のステージ = stage選曲;
\r
586 foreach( STPlugin pg in this.listプラグイン )
\r
588 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
589 pg.plugin.Onステージ変更();
\r
590 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
593 this.tガベージコレクションを実行する();
\r
595 //-----------------------------
\r
599 //-----------------------------
\r
603 case CStage.Eステージ.コンフィグ:
\r
605 //-----------------------------
\r
606 if( this.n進行描画の戻り値 != 0 )
\r
608 switch( r直前のステージ.eステージID )
\r
610 case CStage.Eステージ.タイトル:
\r
612 //-----------------------------
\r
614 Trace.TraceInformation( "----------------------" );
\r
615 Trace.TraceInformation( "■ タイトル" );
\r
617 r直前のステージ = r現在のステージ;
\r
618 r現在のステージ = stageタイトル;
\r
620 foreach( STPlugin pg in this.listプラグイン )
\r
622 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
623 pg.plugin.Onステージ変更();
\r
624 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
627 this.tガベージコレクションを実行する();
\r
629 //-----------------------------
\r
632 case CStage.Eステージ.選曲:
\r
634 //-----------------------------
\r
636 Trace.TraceInformation( "----------------------" );
\r
637 Trace.TraceInformation( "■ 選曲" );
\r
639 r直前のステージ = r現在のステージ;
\r
640 r現在のステージ = stage選曲;
\r
642 foreach( STPlugin pg in this.listプラグイン )
\r
644 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
645 pg.plugin.Onステージ変更();
\r
646 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
649 this.tガベージコレクションを実行する();
\r
651 //-----------------------------
\r
655 //-----------------------------
\r
659 case CStage.Eステージ.選曲:
\r
661 //-----------------------------
\r
662 switch( this.n進行描画の戻り値 )
\r
666 //-----------------------------
\r
668 Trace.TraceInformation( "----------------------" );
\r
669 Trace.TraceInformation( "■ タイトル" );
\r
671 r直前のステージ = r現在のステージ;
\r
672 r現在のステージ = stageタイトル;
\r
674 foreach( STPlugin pg in this.listプラグイン )
\r
676 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
677 pg.plugin.Onステージ変更();
\r
678 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
681 this.tガベージコレクションを実行する();
\r
683 //-----------------------------
\r
688 //-----------------------------
\r
690 Trace.TraceInformation( "----------------------" );
\r
691 Trace.TraceInformation( "■ 曲読み込み" );
\r
692 stage曲読み込み.On活性化();
\r
693 r直前のステージ = r現在のステージ;
\r
694 r現在のステージ = stage曲読み込み;
\r
696 foreach( STPlugin pg in this.listプラグイン )
\r
698 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
699 pg.plugin.Onステージ変更();
\r
700 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
703 this.tガベージコレクションを実行する();
\r
705 //-----------------------------
\r
710 //-----------------------------
\r
712 Trace.TraceInformation( "----------------------" );
\r
713 Trace.TraceInformation( "■ オプション" );
\r
714 stageオプション.On活性化();
\r
715 r直前のステージ = r現在のステージ;
\r
716 r現在のステージ = stageオプション;
\r
718 foreach( STPlugin pg in this.listプラグイン )
\r
720 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
721 pg.plugin.Onステージ変更();
\r
722 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
725 this.tガベージコレクションを実行する();
\r
727 //-----------------------------
\r
732 //-----------------------------
\r
734 Trace.TraceInformation( "----------------------" );
\r
735 Trace.TraceInformation( "■ コンフィグ" );
\r
736 stageコンフィグ.On活性化();
\r
737 r直前のステージ = r現在のステージ;
\r
738 r現在のステージ = stageコンフィグ;
\r
740 foreach( STPlugin pg in this.listプラグイン )
\r
742 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
743 pg.plugin.Onステージ変更();
\r
744 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
747 this.tガベージコレクションを実行する();
\r
749 //-----------------------------
\r
752 //-----------------------------
\r
756 case CStage.Eステージ.曲読み込み:
\r
758 //-----------------------------
\r
759 if( this.n進行描画の戻り値 != 0 )
\r
761 CDTXMania.Pad.st検知したデバイス.Clear(); // 入力デバイスフラグクリア(2010.9.11)
\r
764 if( !ConfigIni.bギタレボモード )
\r
766 Trace.TraceInformation( "----------------------" );
\r
767 Trace.TraceInformation( "■ 演奏(ドラム画面)" );
\r
768 #if DAMAGELEVELTUNING
\r
769 for (int i = 0; i < 5; i++)
\r
771 for (int j = 0; j < 2; j++)
\r
773 stage演奏ドラム画面.gaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
\r
776 for (int i = 0; i < 3; i++) {
\r
777 stage演奏ドラム画面.damageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
\r
780 r直前のステージ = r現在のステージ;
\r
781 r現在のステージ = stage演奏ドラム画面;
\r
785 Trace.TraceInformation( "----------------------" );
\r
786 Trace.TraceInformation( "■ 演奏(ギター画面)" );
\r
787 r直前のステージ = r現在のステージ;
\r
788 r現在のステージ = stage演奏ギター画面;
\r
791 foreach( STPlugin pg in this.listプラグイン )
\r
793 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
794 pg.plugin.Onステージ変更();
\r
795 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
798 this.tガベージコレクションを実行する();
\r
800 //-----------------------------
\r
804 case CStage.Eステージ.演奏:
\r
806 //-----------------------------
\r
807 switch( this.n進行描画の戻り値 )
\r
813 #region [ 演奏キャンセル ]
\r
814 //-----------------------------
\r
815 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Play canceled" );
\r
817 #region [ プラグイン On演奏キャンセル() の呼び出し ]
\r
818 //---------------------
\r
819 foreach( STPlugin pg in this.listプラグイン )
\r
821 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
822 pg.plugin.On演奏キャンセル( scoreIni );
\r
823 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
825 //---------------------
\r
833 base.Window.Close();
\r
837 Trace.TraceInformation( "----------------------" );
\r
838 Trace.TraceInformation( "■ 選曲" );
\r
840 r直前のステージ = r現在のステージ;
\r
841 r現在のステージ = stage選曲;
\r
843 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
844 //---------------------
\r
845 foreach( STPlugin pg in this.listプラグイン )
\r
847 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
848 pg.plugin.Onステージ変更();
\r
849 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
851 //---------------------
\r
854 this.tガベージコレクションを実行する();
\r
857 //-----------------------------
\r
861 #region [ 演奏失敗(StageFailed) ]
\r
862 //-----------------------------
\r
863 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Stage failed" );
\r
865 #region [ プラグイン On演奏失敗() の呼び出し ]
\r
866 //---------------------
\r
867 foreach( STPlugin pg in this.listプラグイン )
\r
869 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
870 pg.plugin.On演奏失敗( scoreIni );
\r
871 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
873 //---------------------
\r
881 base.Window.Close();
\r
885 Trace.TraceInformation( "----------------------" );
\r
886 Trace.TraceInformation( "■ 選曲" );
\r
888 r直前のステージ = r現在のステージ;
\r
889 r現在のステージ = stage選曲;
\r
891 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
892 //---------------------
\r
893 foreach( STPlugin pg in this.listプラグイン )
\r
895 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
896 pg.plugin.Onステージ変更();
\r
897 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
899 //---------------------
\r
902 this.tガベージコレクションを実行する();
\r
905 //-----------------------------
\r
910 //-----------------------------
\r
911 chipArray = new CDTX.CChip[ 10 ];
\r
912 if( ConfigIni.bギタレボモード )
\r
914 stage演奏ギター画面.t演奏結果を格納する( out c演奏記録, out c演奏記録2, out c演奏記録3 );
\r
918 stage演奏ドラム画面.t演奏結果を格納する( out c演奏記録, out c演奏記録2, out c演奏記録3, out chipArray );
\r
921 switch( CScoreIni.t総合ランク値を計算して返す( c演奏記録, c演奏記録2, c演奏記録3 ) )
\r
924 str = "Cleared (Rank:SS)";
\r
928 str = "Cleared (Rank:S)";
\r
932 str = "Cleared (Rank:A)";
\r
936 str = "Cleared (Rank:B)";
\r
940 str = "Cleared (Rank:C)";
\r
944 str = "Cleared (Rank:D)";
\r
948 str = "Cleared (Rank:E)";
\r
951 case 99: // #23534 2010.10.28 yyagi add: 演奏チップが0個のとき
\r
952 str = "Cleared (No chips)";
\r
956 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( str );
\r
958 #region [ プラグイン On演奏クリア() の呼び出し ]
\r
959 //---------------------
\r
960 foreach( STPlugin pg in this.listプラグイン )
\r
962 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
963 pg.plugin.On演奏クリア( scoreIni );
\r
964 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
966 //---------------------
\r
970 Trace.TraceInformation( "----------------------" );
\r
971 Trace.TraceInformation( "■ 結果" );
\r
972 stage結果.st演奏記録.Drums = c演奏記録;
\r
973 stage結果.st演奏記録.Guitar = c演奏記録2;
\r
974 stage結果.st演奏記録.Bass = c演奏記録3;
\r
975 stage結果.r空うちドラムチップ = chipArray;
\r
977 r直前のステージ = r現在のステージ;
\r
978 r現在のステージ = stage結果;
\r
980 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
981 //---------------------
\r
982 foreach( STPlugin pg in this.listプラグイン )
\r
984 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
985 pg.plugin.Onステージ変更();
\r
986 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
988 //---------------------
\r
992 //-----------------------------
\r
995 //-----------------------------
\r
999 case CStage.Eステージ.結果:
\r
1001 //-----------------------------
\r
1002 if( this.n進行描画の戻り値 != 0 )
\r
1004 DTX.t全チップの再生一時停止();
\r
1006 r現在のステージ.On非活性化();
\r
1009 Trace.TraceInformation( "----------------------" );
\r
1010 Trace.TraceInformation( "■ 選曲" );
\r
1012 r直前のステージ = r現在のステージ;
\r
1013 r現在のステージ = stage選曲;
\r
1015 foreach( STPlugin pg in this.listプラグイン )
\r
1017 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1018 pg.plugin.Onステージ変更();
\r
1019 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1022 this.tガベージコレクションを実行する();
\r
1026 base.Window.Close();
\r
1029 //-----------------------------
\r
1033 case CStage.Eステージ.終了:
\r
1035 //-----------------------------
\r
1036 if( this.n進行描画の戻り値 != 0 )
\r
1040 //-----------------------------
\r
1046 this.Device.EndScene();
\r
1047 if( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )
\r
1049 ConfigIni.b全画面モード = !ConfigIni.b全画面モード;
\r
1050 app.t全画面・ウィンドウモード切り替え();
\r
1051 this.b次のタイミングで全画面・ウィンドウ切り替えを行う = false;
\r
1053 if( this.b次のタイミングで垂直帰線同期切り替えを行う )
\r
1055 bool bIsMaximized = this.Window.IsMaximized; // #23510 2010.11.3 yyagi: to backup current window mode before changing VSyncWait
\r
1056 currentClientSize = this.Window.ClientSize; // #23510 2010.11.3 yyagi: to backup current window size before changing VSyncWait
\r
1057 DeviceSettings currentSettings = app.GraphicsDeviceManager.CurrentSettings;
\r
1058 currentSettings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1059 app.GraphicsDeviceManager.ChangeDevice( currentSettings );
\r
1060 this.b次のタイミングで垂直帰線同期切り替えを行う = false;
\r
1061 base.Window.ClientSize = new Size(currentClientSize.Width, currentClientSize.Height); // #23510 2010.11.3 yyagi: to resume window size after changing VSyncWait
\r
1064 this.Window.WindowState = FormWindowState.Maximized; // #23510 2010.11.3 yyagi: to resume window mode after changing VSyncWait
\r
1072 #region [ テクスチャの生成・解放のためのヘルパー ]
\r
1073 //-----------------
\r
1074 public static CTexture tテクスチャの生成( string fileName )
\r
1076 return tテクスチャの生成( fileName, false );
\r
1078 public static CTexture tテクスチャの生成( string fileName, bool b黒を透過する )
\r
1086 return new CTexture( app.Device, fileName, TextureFormat, b黒を透過する );
\r
1088 catch( CTextureCreateFailedException )
\r
1090 Trace.TraceError( "テクスチャの生成に失敗しました。({0})", new object[] { fileName } );
\r
1094 public static void tテクスチャの解放( ref CTexture tx )
\r
1102 //-----------------
\r
1105 #region [ private ]
\r
1106 //-----------------
\r
1107 private bool bマウスカーソル表示中 = true;
\r
1108 private bool b終了処理完了済み;
\r
1109 private static CDTX dtx;
\r
1110 private List<CActivity> listトップレベルActivities;
\r
1111 private int n進行描画の戻り値;
\r
1113 private void t起動処理()
\r
1115 #region [ strEXEのあるフォルダを決定する ]
\r
1116 //-----------------
\r
1117 // BEGIN #23629 2010.11.13 from: デバッグ時は Application.ExecutablePath が ($SolutionDir)/bin/x86/Debug/ などになり System/ の読み込みに失敗するので、カレントディレクトリを採用する。(プロジェクトのプロパティ→デバッグ→作業ディレクトリが有効になる)
\r
1119 strEXEのあるフォルダ = Environment.CurrentDirectory + @"\";
\r
1121 strEXEのあるフォルダ = Path.GetDirectoryName( Application.ExecutablePath ) + @"\"; // #23629 2010.11.9 yyagi: set correct pathname where DTXManiaGR.exe is.
\r
1123 // END #23629 2010.11.13 from
\r
1124 //-----------------
\r
1127 #region [ Config.ini の読込み ]
\r
1128 //---------------------
\r
1129 ConfigIni = new CConfigIni();
\r
1130 string path = strEXEのあるフォルダ + "Config.ini";
\r
1131 if( File.Exists( path ) )
\r
1135 ConfigIni.t読み込み( path );
\r
1139 //ConfigIni = new CConfigIni(); // 存在してなければ新規生成
\r
1142 //---------------------
\r
1144 #region [ ログ出力開始 ]
\r
1145 //---------------------
\r
1146 Trace.AutoFlush = true;
\r
1147 if( ConfigIni.bログ出力 )
\r
1149 Trace.Listeners.Add( new CTraceLogListener( new StreamWriter( "DTXManiaLog.txt", false, Encoding.GetEncoding( "shift-jis" ) ) ) );
\r
1151 Trace.WriteLine("");
\r
1152 Trace.WriteLine( "DTXMania powered by YAMAHA Silent Session Drums" );
\r
1153 Trace.WriteLine( string.Format( "Release: {0}", VERSION ) );
\r
1154 Trace.WriteLine( "" );
\r
1155 Trace.TraceInformation( "----------------------" );
\r
1156 Trace.TraceInformation( "■ アプリケーションの初期化" );
\r
1157 Trace.TraceInformation( "OS Version: " + Environment.OSVersion );
\r
1158 Trace.TraceInformation( "ProcessorCount: " + Environment.ProcessorCount.ToString() );
\r
1159 Trace.TraceInformation( "CLR Version: " + Environment.Version.ToString() );
\r
1160 //---------------------
\r
1162 #region [ コンパクトモードスイッチの有無 ]
\r
1163 //---------------------
\r
1164 bコンパクトモード = false;
\r
1165 strコンパクトモードファイル = "";
\r
1166 string[] commandLineArgs = Environment.GetCommandLineArgs();
\r
1167 if( ( commandLineArgs != null ) && ( commandLineArgs.Length > 1 ) )
\r
1170 strコンパクトモードファイル = commandLineArgs[ 1 ];
\r
1171 Trace.TraceInformation( "コンパクトモードで起動します。[{0}]", new object[] { strコンパクトモードファイル } );
\r
1173 //---------------------
\r
1176 #region [ ウィンドウ初期化 ]
\r
1177 //---------------------
\r
1178 base.Window.Text = "DTXMania .NET style release " + VERSION;
\r
1179 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
1180 if (!ConfigIni.bウィンドウモード) // #23510 2010.11.02 yyagi: add; to recover window size in case bootup with fullscreen mode
\r
1182 currentClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight);
\r
1184 base.Window.MaximizeBox = true; // #23510 2010.11.04 yyagi: to support maximizing window
\r
1185 base.Window.FormBorderStyle = FormBorderStyle.Sizable; // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize
\r
1186 base.Window.ShowIcon = true;
\r
1187 base.Window.Icon = Properties.Resources.dtx;
\r
1188 base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );
\r
1189 base.Window.MouseDoubleClick += new MouseEventHandler(this.Window_MouseDoubleClick); // #23510 2010.11.13 yyagi: to go fullscreen mode
\r
1190 base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd); // #23510 2010.11.20 yyagi: to set resized window size in Config.ini
\r
1191 base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);
\r
1192 base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
\r
1193 //---------------------
\r
1195 #region [ Direct3D9 デバイスの生成 ]
\r
1196 //---------------------
\r
1197 DeviceSettings settings = new DeviceSettings();
\r
1198 settings.Windowed = ConfigIni.bウィンドウモード;
\r
1199 settings.BackBufferWidth = 640;
\r
1200 settings.BackBufferHeight = 480;
\r
1201 settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1204 base.GraphicsDeviceManager.ChangeDevice(settings);
\r
1206 catch (DeviceCreationException e)
\r
1208 Trace.TraceError(e.ToString());
\r
1209 MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
1210 Environment.Exit(-1);
\r
1213 base.IsFixedTimeStep = false;
\r
1214 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
1215 base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォーカス時スリープms)); // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive
\r
1216 // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )
\r
1217 //---------------------
\r
1222 #region [ Skin の初期化 ]
\r
1223 //---------------------
\r
1224 Trace.TraceInformation( "スキンの初期化を行います。" );
\r
1228 Skin = new CSkin();
\r
1229 Trace.TraceInformation( "スキンの初期化を完了しました。" );
\r
1233 Trace.TraceInformation( "スキンの初期化に失敗しました。" );
\r
1240 //---------------------
\r
1242 #region [ Timer の初期化 ]
\r
1243 //---------------------
\r
1244 Trace.TraceInformation( "タイマの初期化を行います。" );
\r
1248 Timer = new CTimer( CTimer.E種別.MultiMedia );
\r
1249 Trace.TraceInformation( "タイマの初期化を完了しました。" );
\r
1255 //---------------------
\r
1257 #region [ FPS カウンタの初期化 ]
\r
1258 //---------------------
\r
1259 Trace.TraceInformation( "FPSカウンタの初期化を行います。" );
\r
1264 Trace.TraceInformation( "FPSカウンタを生成しました。" );
\r
1270 //---------------------
\r
1272 #region [ act文字コンソールの初期化 ]
\r
1273 //---------------------
\r
1274 Trace.TraceInformation( "文字コンソールの初期化を行います。" );
\r
1278 act文字コンソール = new C文字コンソール();
\r
1279 Trace.TraceInformation( "文字コンソールを生成しました。" );
\r
1280 act文字コンソール.On活性化();
\r
1281 Trace.TraceInformation( "文字コンソールを活性化しました。" );
\r
1282 Trace.TraceInformation( "文字コンソールの初期化を完了しました。" );
\r
1284 catch( Exception exception )
\r
1286 Trace.TraceError( exception.Message );
\r
1287 Trace.TraceError( "文字コンソールの初期化に失敗しました。" );
\r
1293 //---------------------
\r
1295 #region [ Input管理 の初期化 ]
\r
1296 //---------------------
\r
1297 Trace.TraceInformation( "DirectInput, MIDI入力の初期化を行います。" );
\r
1301 Input管理 = new CInput管理( base.Window.Handle );
\r
1302 foreach( IInputDevice device in Input管理.list入力デバイス )
\r
1304 if( ( device.e入力デバイス種別 == E入力デバイス種別.Joystick ) && !ConfigIni.dicJoystick.ContainsValue( device.GUID ) )
\r
1307 while( ConfigIni.dicJoystick.ContainsKey( key ) )
\r
1311 ConfigIni.dicJoystick.Add( key, device.GUID );
\r
1314 foreach( IInputDevice device2 in Input管理.list入力デバイス )
\r
1316 if( device2.e入力デバイス種別 == E入力デバイス種別.Joystick )
\r
1318 foreach( KeyValuePair<int, string> pair in ConfigIni.dicJoystick )
\r
1320 if( device2.GUID.Equals( pair.Value ) )
\r
1322 ( (CInputJoystick) device2 ).SetID( pair.Key );
\r
1329 Trace.TraceInformation( "DirectInput の初期化を完了しました。" );
\r
1331 catch( Exception exception2 )
\r
1333 Trace.TraceError( exception2.Message );
\r
1334 Trace.TraceError( "DirectInput, MIDI入力の初期化に失敗しました。" );
\r
1341 //---------------------
\r
1343 #region [ Pad の初期化 ]
\r
1344 //---------------------
\r
1345 Trace.TraceInformation( "パッドの初期化を行います。" );
\r
1349 Pad = new CPad( ConfigIni, Input管理 );
\r
1350 Trace.TraceInformation( "パッドの初期化を完了しました。" );
\r
1352 catch( Exception exception3 )
\r
1354 Trace.TraceError( exception3.Message );
\r
1355 Trace.TraceError( "パッドの初期化に失敗しました。" );
\r
1361 //---------------------
\r
1363 #region [ Sound管理 の初期化 ]
\r
1364 //---------------------
\r
1365 Trace.TraceInformation( "DirectSound の初期化を行います。" );
\r
1369 Sound管理 = new CSound管理( base.Window.Handle );
\r
1370 Trace.TraceInformation( "DirectSound の初期化を完了しました。" );
\r
1374 Trace.TraceError( "DirectSound の初期化に失敗しました。" );
\r
1381 //---------------------
\r
1383 #region [ Songs管理 の初期化 ]
\r
1384 //---------------------
\r
1385 Trace.TraceInformation( "曲リストの初期化を行います。" );
\r
1389 Songs管理 = new CSongs管理();
\r
1390 Trace.TraceInformation( "曲リストの初期化を完了しました。" );
\r
1392 catch( Exception exception4 )
\r
1394 Trace.TraceError( exception4.Message );
\r
1395 Trace.TraceError( "曲リストの初期化に失敗しました。" );
\r
1401 //---------------------
\r
1403 #region [ CAvi の初期化 ]
\r
1404 //---------------------
\r
1406 //---------------------
\r
1408 #region [ Random の初期化 ]
\r
1409 //---------------------
\r
1410 Random = new Random( (int) Timer.nシステム時刻 );
\r
1411 //---------------------
\r
1413 #region [ ステージの初期化 ]
\r
1414 //---------------------
\r
1417 stage起動 = new CStage起動();
\r
1418 stageタイトル = new CStageタイトル();
\r
1419 stageオプション = new CStageオプション();
\r
1420 stageコンフィグ = new CStageコンフィグ();
\r
1421 stage選曲 = new CStage選曲();
\r
1422 stage曲読み込み = new CStage曲読み込み();
\r
1423 stage演奏ドラム画面 = new CStage演奏ドラム画面();
\r
1424 stage演奏ギター画面 = new CStage演奏ギター画面();
\r
1425 stage結果 = new CStage結果();
\r
1426 stage終了 = new CStage終了();
\r
1427 this.listトップレベルActivities = new List<CActivity>();
\r
1428 this.listトップレベルActivities.Add( act文字コンソール );
\r
1429 this.listトップレベルActivities.Add( stage起動 );
\r
1430 this.listトップレベルActivities.Add( stageタイトル );
\r
1431 this.listトップレベルActivities.Add( stageオプション );
\r
1432 this.listトップレベルActivities.Add( stageコンフィグ );
\r
1433 this.listトップレベルActivities.Add( stage選曲 );
\r
1434 this.listトップレベルActivities.Add( stage曲読み込み );
\r
1435 this.listトップレベルActivities.Add( stage演奏ドラム画面 );
\r
1436 this.listトップレベルActivities.Add( stage演奏ギター画面 );
\r
1437 this.listトップレベルActivities.Add( stage結果 );
\r
1438 this.listトップレベルActivities.Add( stage終了 );
\r
1439 //---------------------
\r
1441 #region [ プラグインの検索と生成 ]
\r
1442 //---------------------
\r
1443 PluginHost = new CPluginHost();
\r
1445 Trace.TraceInformation( "プラグインの検索と生成を行います。" );
\r
1449 this.tプラグイン検索と生成();
\r
1450 Trace.TraceInformation( "プラグインの検索と生成を完了しました。" );
\r
1456 //---------------------
\r
1458 #region [ プラグインの初期化 ]
\r
1459 //---------------------
\r
1460 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
\r
1462 Trace.TraceInformation( "プラグインの初期化を行います。" );
\r
1466 foreach( STPlugin st in this.listプラグイン )
\r
1468 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1469 st.plugin.On初期化( this.PluginHost );
\r
1470 st.plugin.OnManagedリソースの作成();
\r
1471 st.plugin.OnUnmanagedリソースの作成();
\r
1472 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1474 Trace.TraceInformation( "すべてのプラグインの初期化を完了しました。" );
\r
1478 Trace.TraceError( "プラグインのどれかの初期化に失敗しました。" );
\r
1487 //---------------------
\r
1490 Trace.TraceInformation( "アプリケーションの初期化を完了しました。" );
\r
1492 #region [ 最初のステージの起動 ]
\r
1493 //---------------------
\r
1494 Trace.TraceInformation( "----------------------" );
\r
1495 Trace.TraceInformation( "■ 起動" );
\r
1497 r現在のステージ = stage起動;
\r
1499 //---------------------
\r
1502 private void t終了処理()
\r
1504 if( !this.b終了処理完了済み )
\r
1506 Trace.TraceInformation( "----------------------" );
\r
1507 Trace.TraceInformation( "■ アプリケーションの終了" );
\r
1508 #region [ 現在のステージの終了処理 ]
\r
1509 //---------------------
\r
1510 if (r現在のステージ != null)
\r
1512 Trace.TraceInformation( "現在のステージを終了します。" );
\r
1516 r現在のステージ.On非活性化();
\r
1517 Trace.TraceInformation( "現在のステージの終了処理を完了しました。" );
\r
1524 //---------------------
\r
1526 #region [ プラグインの終了処理 ]
\r
1527 //---------------------
\r
1528 if (this.listプラグイン != null && this.listプラグイン.Count > 0)
\r
1530 Trace.TraceInformation( "すべてのプラグインを終了します。" );
\r
1534 foreach( STPlugin st in this.listプラグイン )
\r
1536 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1537 st.plugin.OnUnmanagedリソースの解放();
\r
1538 st.plugin.OnManagedリソースの解放();
\r
1540 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1542 PluginHost = null;
\r
1543 Trace.TraceInformation( "すべてのプラグインの終了処理を完了しました。" );
\r
1550 //---------------------
\r
1552 #region [ 曲リストの終了処理 ]
\r
1553 //---------------------
\r
1554 if (Songs管理 != null)
\r
1556 Trace.TraceInformation( "曲リストの終了処理を行います。" );
\r
1561 Trace.TraceInformation( "曲リストの終了処理を完了しました。" );
\r
1563 catch( Exception exception )
\r
1565 Trace.TraceError( exception.Message );
\r
1566 Trace.TraceError( "曲リストの終了処理に失敗しました。" );
\r
1574 //---------------------
\r
1576 #region [ スキンの終了処理 ]
\r
1577 //---------------------
\r
1580 Trace.TraceInformation( "スキンの終了処理を行います。" );
\r
1586 Trace.TraceInformation( "スキンの終了処理を完了しました。" );
\r
1588 catch( Exception exception2 )
\r
1590 Trace.TraceError( exception2.Message );
\r
1591 Trace.TraceError( "スキンの終了処理に失敗しました。" );
\r
1598 //---------------------
\r
1600 #region [ DirectSoundの終了処理 ]
\r
1601 //---------------------
\r
1602 if (Sound管理 != null)
\r
1604 Trace.TraceInformation( "DirectSound の終了処理を行います。" );
\r
1608 Sound管理.Dispose();
\r
1610 Trace.TraceInformation( "DirectSound の終了処理を完了しました。" );
\r
1612 catch( Exception exception3 )
\r
1614 Trace.TraceError( exception3.Message );
\r
1615 Trace.TraceError( "DirectSound の終了処理に失敗しました。" );
\r
1622 //---------------------
\r
1624 #region [ パッドの終了処理 ]
\r
1625 //---------------------
\r
1628 Trace.TraceInformation( "パッドの終了処理を行います。" );
\r
1633 Trace.TraceInformation( "パッドの終了処理を完了しました。" );
\r
1635 catch( Exception exception4 )
\r
1637 Trace.TraceError( exception4.Message );
\r
1638 Trace.TraceError( "パッドの終了処理に失敗しました。" );
\r
1645 //---------------------
\r
1647 #region [ DirectInput, MIDI入力の終了処理 ]
\r
1648 //---------------------
\r
1649 if (Input管理 != null)
\r
1651 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を行います。" );
\r
1655 Input管理.Dispose();
\r
1657 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を完了しました。" );
\r
1659 catch( Exception exception5 )
\r
1661 Trace.TraceError( exception5.Message );
\r
1662 Trace.TraceError( "DirectInput, MIDI入力の終了処理に失敗しました。" );
\r
1669 //---------------------
\r
1671 #region [ 文字コンソールの終了処理 ]
\r
1672 //---------------------
\r
1673 if (act文字コンソール != null)
\r
1675 Trace.TraceInformation( "文字コンソールの終了処理を行います。" );
\r
1679 act文字コンソール.On非活性化();
\r
1680 act文字コンソール = null;
\r
1681 Trace.TraceInformation( "文字コンソールの終了処理を完了しました。" );
\r
1683 catch( Exception exception6 )
\r
1685 Trace.TraceError( exception6.Message );
\r
1686 Trace.TraceError( "文字コンソールの終了処理に失敗しました。" );
\r
1693 //---------------------
\r
1695 #region [ FPSカウンタの終了処理 ]
\r
1696 //---------------------
\r
1697 Trace.TraceInformation("FPSカウンタの終了処理を行います。");
\r
1705 Trace.TraceInformation( "FPSカウンタの終了処理を完了しました。" );
\r
1711 //---------------------
\r
1713 #region [ タイマの終了処理 ]
\r
1714 //---------------------
\r
1715 Trace.TraceInformation("タイマの終了処理を行います。");
\r
1719 if( Timer != null )
\r
1723 Trace.TraceInformation( "タイマの終了処理を完了しました。" );
\r
1727 Trace.TraceInformation( "タイマは使用されていません。" );
\r
1734 //---------------------
\r
1736 #region [ Config.iniの出力 ]
\r
1737 //---------------------
\r
1738 Trace.TraceInformation("Config.ini を出力します。");
\r
1739 string str = strEXEのあるフォルダ + "Config.ini";
\r
1743 ConfigIni.t書き出し( str );
\r
1744 Trace.TraceInformation( "保存しました。({0})", new object[] { str } );
\r
1746 catch( Exception e )
\r
1748 Trace.TraceError( e.Message );
\r
1749 Trace.TraceError( "Config.ini の出力に失敗しました。({0})", new object[] { str } );
\r
1755 //---------------------
\r
1757 Trace.TraceInformation("アプリケーションの終了処理を完了しました。");
\r
1760 this.b終了処理完了済み = true;
\r
1763 private void Window_ApplicationActivated( object sender, EventArgs e )
\r
1765 this.bApplicationActive = true;
\r
1767 private void Window_ApplicationDeactivated( object sender, EventArgs e )
\r
1769 this.bApplicationActive = false;
\r
1771 private void Window_KeyDown( object sender, KeyEventArgs e )
\r
1773 if (e.KeyCode == Keys.Menu)
\r
1776 e.SuppressKeyPress = true;
\r
1778 else if ((e.KeyCode == Keys.Return) && e.Alt)
\r
1780 if (ConfigIni != null)
\r
1782 ConfigIni.bウィンドウモード = !ConfigIni.bウィンドウモード;
\r
1783 this.t全画面・ウィンドウモード切り替え();
\r
1786 e.SuppressKeyPress = true;
\r
1788 * while (Input管理.Keyboard.bキーが押されている(0x75))
\r
1790 Trace.TraceInformation("Enterが押されている");
\r
1791 Thread.Sleep(100);
\r
1792 if (Input管理.Keyboard.bキーが離された(0x75))
\r
1794 Trace.TraceInformation("Enterが離された");
\r
1801 private CScoreIni tScoreIniへBGMAdjustとHistoryとPlayCountを更新(string str新ヒストリ行)
\r
1806 string str = DTX.strファイル名の絶対パス + ".score.ini";
\r
1807 CScoreIni ini = new CScoreIni( str );
\r
1808 if( !File.Exists( str ) )
\r
1810 ini.stファイル.Title = DTX.TITLE;
\r
1811 ini.stファイル.Name = DTX.strファイル名;
\r
1812 ini.stファイル.Hash = CScoreIni.tファイルのMD5を求めて返す( DTX.strファイル名の絶対パス );
\r
1813 for( int i = 0; i < 6; i++ )
\r
1815 ini.stセクション[ i ].nPerfectになる範囲ms = nPerfect範囲ms;
\r
1816 ini.stセクション[ i ].nGreatになる範囲ms = nGreat範囲ms;
\r
1817 ini.stセクション[ i ].nGoodになる範囲ms = nGood範囲ms;
\r
1818 ini.stセクション[ i ].nPoorになる範囲ms = nPoor範囲ms;
\r
1821 ini.stファイル.BGMAdjust = DTX.nBGMAdjust;
\r
1822 CScoreIni.t更新条件を取得する( out flag, out flag2, out flag3 );
\r
1823 if( ( flag || flag2 ) || flag3 )
\r
1827 ini.stファイル.PlayCountDrums++;
\r
1831 ini.stファイル.PlayCountGuitar++;
\r
1835 ini.stファイル.PlayCountBass++;
\r
1837 ini.tヒストリを追加する( str新ヒストリ行 );
\r
1840 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Drums = ini.stファイル.PlayCountDrums;
\r
1841 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
\r
1842 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Bass = ini.stファイル.PlayCountBass;
\r
1843 for( int j = 0; j < ini.stファイル.History.Length; j++ )
\r
1845 stage選曲.r現在選択中のスコア.譜面情報.演奏履歴[ j ] = ini.stファイル.History[ j ];
\r
1849 if( ConfigIni.bScoreIniを出力する )
\r
1856 private void tガベージコレクションを実行する()
\r
1859 GC.WaitForPendingFinalizers();
\r
1861 GC.WaitForPendingFinalizers();
\r
1863 private void tプラグイン検索と生成()
\r
1865 this.listプラグイン = new List<STPlugin>();
\r
1867 string strIPluginActivityの名前 = typeof( IPluginActivity ).FullName;
\r
1868 string strプラグインフォルダパス = strEXEのあるフォルダ + "Plugins\\";
\r
1870 this.t指定フォルダ内でのプラグイン検索と生成( strプラグインフォルダパス, strIPluginActivityの名前 );
\r
1872 if( this.listプラグイン.Count > 0 )
\r
1873 Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" );
\r
1875 private void t指定フォルダ内でのプラグイン検索と生成( string strプラグインフォルダパス, string strプラグイン型名 )
\r
1877 // 指定されたパスが存在しないとエラー
\r
1878 if( !Directory.Exists( strプラグインフォルダパス ) )
\r
1880 Trace.TraceWarning( "プラグインフォルダが存在しません。(" + strプラグインフォルダパス + ")" );
\r
1884 // (1) すべての *.dll について…
\r
1885 string[] strDLLs = System.IO.Directory.GetFiles( strプラグインフォルダパス, "*.dll" );
\r
1886 foreach( string dllName in strDLLs )
\r
1890 // (1-1) dll をアセンブリとして読み込む。
\r
1891 System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( dllName );
\r
1893 // (1-2) アセンブリ内のすべての型について、プラグインとして有効か調べる
\r
1894 foreach( Type t in asm.GetTypes() )
\r
1896 // (1-3) ↓クラスであり↓Publicであり↓抽象クラスでなく↓IPlugin型のインスタンスが作れる 型を持っていれば有効
\r
1897 if( t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface( strプラグイン型名 ) != null )
\r
1899 // (1-4) クラス名からインスタンスを作成する
\r
1900 var st = new STPlugin() {
\r
1901 plugin = (IPluginActivity) asm.CreateInstance( t.FullName ),
\r
1902 strプラグインフォルダ = Path.GetDirectoryName( dllName ),
\r
1903 strアセンブリ簡易名 = asm.GetName().Name,
\r
1904 Version = asm.GetName().Version,
\r
1907 // (1-5) プラグインリストへ登録
\r
1908 this.listプラグイン.Add( st );
\r
1909 Trace.TraceInformation( "プラグイン {0} ({1}, {2}, {3}) を読み込みました。", t.FullName, Path.GetFileName( dllName ), st.strアセンブリ簡易名, st.Version.ToString() );
\r
1915 Trace.TraceInformation( dllName + " からプラグインを生成することに失敗しました。スキップします。" );
\r
1919 // (2) サブフォルダがあれば再帰する
\r
1920 string[] strDirs = Directory.GetDirectories( strプラグインフォルダパス, "*" );
\r
1921 foreach( string dir in strDirs )
\r
1922 this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );
\r
1924 //-----------------
\r
1925 private void Window_MouseDoubleClick( object sender, MouseEventArgs e) // #23510 2010.11.13 yyagi: to go full screen mode
\r
1927 ConfigIni.bウィンドウモード = false;
\r
1928 this.t全画面・ウィンドウモード切り替え();
\r
1930 private void Window_ResizeEnd(object sender, EventArgs e) // #23510 2010.11.20 yyagi: to get resized window size
\r
1932 ConfigIni.nウインドウwidth = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Width : currentClientSize.Width; // #23510 2010.10.31 yyagi add
\r
1933 ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Height : currentClientSize.Height;
\r