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
10 using SlimDX.Direct3D9;
\r
12 using SampleFramework;
\r
16 internal class CDTXMania : Game
\r
20 public static readonly string VERSION = "085(101102)";
\r
21 public static readonly string SLIMDXDLL = "c_net20x86_Jun2010";
\r
22 public static readonly string D3DXDLL = "d3dx9_43.dll"; // June 2010
\r
23 //public static readonly string D3DXDLL = "d3dx9_42.dll"; // February 2010
\r
24 //public static readonly string D3DXDLL = "d3dx9_41.dll"; // March 2009
\r
26 public static CDTXMania app
\r
31 public static C文字コンソール act文字コンソール
\r
36 public static bool bコンパクトモード
\r
41 public static CConfigIni ConfigIni
\r
46 public static CDTX DTX
\r
54 if( ( dtx != null ) && ( app != null ) )
\r
57 app.listトップレベルActivities.Remove( dtx );
\r
60 if( ( dtx != null ) && ( app != null ) )
\r
62 app.listトップレベルActivities.Add( dtx );
\r
66 public static CFPS FPS
\r
71 public static CInput管理 Input管理
\r
76 public static int nPerfect範囲ms
\r
80 if( stage選曲.r確定された曲 != null )
\r
82 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
83 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nPerfect範囲ms >= 0 ) )
\r
85 return c曲リストノード.nPerfect範囲ms;
\r
88 return ConfigIni.nヒット範囲ms.Perfect;
\r
91 public static int nGreat範囲ms
\r
95 if( stage選曲.r確定された曲 != null )
\r
97 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
98 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nGreat範囲ms >= 0 ) )
\r
100 return c曲リストノード.nGreat範囲ms;
\r
103 return ConfigIni.nヒット範囲ms.Great;
\r
106 public static int nGood範囲ms
\r
110 if( stage選曲.r確定された曲 != null )
\r
112 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
113 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nGood範囲ms >= 0 ) )
\r
115 return c曲リストノード.nGood範囲ms;
\r
118 return ConfigIni.nヒット範囲ms.Good;
\r
121 public static int nPoor範囲ms
\r
125 if( stage選曲.r確定された曲 != null )
\r
127 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
128 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nPoor範囲ms >= 0 ) )
\r
130 return c曲リストノード.nPoor範囲ms;
\r
133 return ConfigIni.nヒット範囲ms.Poor;
\r
136 public static CPad Pad
\r
141 public static Random Random
\r
146 public static CSkin Skin
\r
151 public static CSongs管理 Songs管理
\r
156 public static CSound管理 Sound管理
\r
161 public static CStage起動 stage起動
\r
166 public static CStageタイトル stageタイトル
\r
171 public static CStageオプション stageオプション
\r
176 public static CStageコンフィグ stageコンフィグ
\r
181 public static CStage選曲 stage選曲
\r
186 public static CStage曲読み込み stage曲読み込み
\r
191 public static CStage演奏ギター画面 stage演奏ギター画面
\r
196 public static CStage演奏ドラム画面 stage演奏ドラム画面
\r
201 public static CStage結果 stage結果
\r
206 public static CStage終了 stage終了
\r
211 public static CStage r現在のステージ = null;
\r
212 public static CStage r直前のステージ = null;
\r
213 public static string strEXEのあるフォルダ
\r
218 public static string strコンパクトモードファイル
\r
223 public static CTimer Timer
\r
228 public static Format TextureFormat = Format.A8R8G8B8;
\r
229 internal static IPluginActivity act現在入力を占有中のプラグイン = null;
\r
230 public bool bApplicationActive
\r
235 public bool b次のタイミングで垂直帰線同期切り替えを行う
\r
240 public bool b次のタイミングで全画面・ウィンドウ切り替えを行う
\r
245 public Device Device
\r
247 get { return base.GraphicsDeviceManager.Direct3D9.Device; }
\r
249 public CPluginHost PluginHost
\r
254 public List<STPlugin> listプラグイン = new List<STPlugin>();
\r
255 public struct STPlugin
\r
257 public IPluginActivity plugin;
\r
258 public string strプラグインフォルダ;
\r
259 public string strアセンブリ簡易名;
\r
260 public Version Version;
\r
262 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.ToggleFullScreen();
\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 r直前のステージ = r現在のステージ;
\r
770 r現在のステージ = stage演奏ドラム画面;
\r
774 Trace.TraceInformation( "----------------------" );
\r
775 Trace.TraceInformation( "■ 演奏(ギター画面)" );
\r
776 r直前のステージ = r現在のステージ;
\r
777 r現在のステージ = stage演奏ギター画面;
\r
780 foreach( STPlugin pg in this.listプラグイン )
\r
782 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
783 pg.plugin.Onステージ変更();
\r
784 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
787 this.tガベージコレクションを実行する();
\r
789 //-----------------------------
\r
793 case CStage.Eステージ.演奏:
\r
795 //-----------------------------
\r
796 switch( this.n進行描画の戻り値 )
\r
802 #region [ 演奏キャンセル ]
\r
803 //-----------------------------
\r
804 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Play canceled" );
\r
806 #region [ プラグイン On演奏キャンセル() の呼び出し ]
\r
807 //---------------------
\r
808 foreach( STPlugin pg in this.listプラグイン )
\r
810 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
811 pg.plugin.On演奏キャンセル( scoreIni );
\r
812 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
814 //---------------------
\r
822 base.Window.Close();
\r
826 Trace.TraceInformation( "----------------------" );
\r
827 Trace.TraceInformation( "■ 選曲" );
\r
829 r直前のステージ = r現在のステージ;
\r
830 r現在のステージ = stage選曲;
\r
832 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
833 //---------------------
\r
834 foreach( STPlugin pg in this.listプラグイン )
\r
836 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
837 pg.plugin.Onステージ変更();
\r
838 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
840 //---------------------
\r
843 this.tガベージコレクションを実行する();
\r
846 //-----------------------------
\r
850 #region [ 演奏失敗(StageFailed) ]
\r
851 //-----------------------------
\r
852 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Stage failed" );
\r
854 #region [ プラグイン On演奏失敗() の呼び出し ]
\r
855 //---------------------
\r
856 foreach( STPlugin pg in this.listプラグイン )
\r
858 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
859 pg.plugin.On演奏失敗( scoreIni );
\r
860 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
862 //---------------------
\r
870 base.Window.Close();
\r
874 Trace.TraceInformation( "----------------------" );
\r
875 Trace.TraceInformation( "■ 選曲" );
\r
877 r直前のステージ = r現在のステージ;
\r
878 r現在のステージ = stage選曲;
\r
880 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
881 //---------------------
\r
882 foreach( STPlugin pg in this.listプラグイン )
\r
884 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
885 pg.plugin.Onステージ変更();
\r
886 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
888 //---------------------
\r
891 this.tガベージコレクションを実行する();
\r
894 //-----------------------------
\r
899 //-----------------------------
\r
900 chipArray = new CDTX.CChip[ 10 ];
\r
901 if( ConfigIni.bギタレボモード )
\r
903 stage演奏ギター画面.t演奏結果を格納する( out c演奏記録, out c演奏記録2, out c演奏記録3 );
\r
907 stage演奏ドラム画面.t演奏結果を格納する( out c演奏記録, out c演奏記録2, out c演奏記録3, out chipArray );
\r
910 switch( CScoreIni.t総合ランク値を計算して返す( c演奏記録, c演奏記録2, c演奏記録3 ) )
\r
913 str = "Cleared (Rank:SS)";
\r
917 str = "Cleared (Rank:S)";
\r
921 str = "Cleared (Rank:A)";
\r
925 str = "Cleared (Rank:B)";
\r
929 str = "Cleared (Rank:C)";
\r
933 str = "Cleared (Rank:D)";
\r
937 str = "Cleared (Rank:E)";
\r
940 case 99: // #23534 2010.10.28 yyagi add: 演奏チップが0個のとき
\r
941 str = "Cleared (No chips)";
\r
945 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( str );
\r
947 #region [ プラグイン On演奏クリア() の呼び出し ]
\r
948 //---------------------
\r
949 foreach( STPlugin pg in this.listプラグイン )
\r
951 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
952 pg.plugin.On演奏クリア( scoreIni );
\r
953 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
955 //---------------------
\r
959 Trace.TraceInformation( "----------------------" );
\r
960 Trace.TraceInformation( "■ 結果" );
\r
961 stage結果.st演奏記録.Drums = c演奏記録;
\r
962 stage結果.st演奏記録.Guitar = c演奏記録2;
\r
963 stage結果.st演奏記録.Bass = c演奏記録3;
\r
964 stage結果.r空うちドラムチップ = chipArray;
\r
966 r直前のステージ = r現在のステージ;
\r
967 r現在のステージ = stage結果;
\r
969 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
970 //---------------------
\r
971 foreach( STPlugin pg in this.listプラグイン )
\r
973 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
974 pg.plugin.Onステージ変更();
\r
975 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
977 //---------------------
\r
981 //-----------------------------
\r
984 //-----------------------------
\r
988 case CStage.Eステージ.結果:
\r
990 //-----------------------------
\r
991 if( this.n進行描画の戻り値 != 0 )
\r
993 DTX.t全チップの再生一時停止();
\r
998 Trace.TraceInformation( "----------------------" );
\r
999 Trace.TraceInformation( "■ 選曲" );
\r
1001 r直前のステージ = r現在のステージ;
\r
1002 r現在のステージ = stage選曲;
\r
1004 foreach( STPlugin pg in this.listプラグイン )
\r
1006 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1007 pg.plugin.Onステージ変更();
\r
1008 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1011 this.tガベージコレクションを実行する();
\r
1015 base.Window.Close();
\r
1018 //-----------------------------
\r
1022 case CStage.Eステージ.終了:
\r
1024 //-----------------------------
\r
1025 if( this.n進行描画の戻り値 != 0 )
\r
1029 //-----------------------------
\r
1035 this.Device.EndScene();
\r
1036 if( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )
\r
1038 ConfigIni.b全画面モード = !ConfigIni.b全画面モード;
\r
1039 app.t全画面・ウィンドウモード切り替え();
\r
1040 this.b次のタイミングで全画面・ウィンドウ切り替えを行う = false;
\r
1042 if( this.b次のタイミングで垂直帰線同期切り替えを行う )
\r
1044 DeviceSettings currentSettings = app.GraphicsDeviceManager.CurrentSettings;
\r
1045 currentSettings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1046 app.GraphicsDeviceManager.ChangeDevice( currentSettings );
\r
1047 this.b次のタイミングで垂直帰線同期切り替えを行う = false;
\r
1054 #region [ テクスチャの生成・解放のためのヘルパー ]
\r
1055 //-----------------
\r
1056 public static CTexture tテクスチャの生成( string fileName )
\r
1058 return tテクスチャの生成( fileName, false );
\r
1060 public static CTexture tテクスチャの生成( string fileName, bool b黒を透過する )
\r
1068 return new CTexture( app.Device, fileName, TextureFormat, b黒を透過する );
\r
1070 catch( CTextureCreateFailedException )
\r
1072 Trace.TraceError( "テクスチャの生成に失敗しました。({0})", new object[] { fileName } );
\r
1076 public static void tテクスチャの解放( ref CTexture tx )
\r
1084 //-----------------
\r
1087 #region [ private ]
\r
1088 //-----------------
\r
1089 private bool bマウスカーソル表示中 = true;
\r
1090 private bool b終了処理完了済み;
\r
1091 private static CDTX dtx;
\r
1092 private List<CActivity> listトップレベルActivities;
\r
1093 private int n進行描画の戻り値;
\r
1095 private void t起動処理()
\r
1097 strEXEのあるフォルダ = Environment.CurrentDirectory + @"\";
\r
1099 #region [ Config.ini の読込み ]
\r
1100 //---------------------
\r
1101 ConfigIni = new CConfigIni();
\r
1102 string path = strEXEのあるフォルダ + "Config.ini";
\r
1103 if( File.Exists( path ) )
\r
1107 ConfigIni.t読み込み( path );
\r
1111 ConfigIni = new CConfigIni(); // 存在してなければ新規生成
\r
1114 //---------------------
\r
1116 #region [ ログ出力開始 ]
\r
1117 //---------------------
\r
1118 Trace.AutoFlush = true;
\r
1119 if( ConfigIni.bログ出力 )
\r
1121 Trace.Listeners.Add( new CTraceLogListener( new StreamWriter( "DTXManiaLog.txt", false, Encoding.GetEncoding( "shift-jis" ) ) ) );
\r
1123 Trace.WriteLine( "" );
\r
1124 Trace.WriteLine( "DTXMania powered by YAMAHA Silent Session Drums" );
\r
1125 Trace.WriteLine( string.Format( "Release: {0}", VERSION ) );
\r
1126 Trace.WriteLine( "" );
\r
1127 Trace.TraceInformation( "----------------------" );
\r
1128 Trace.TraceInformation( "■ アプリケーションの初期化" );
\r
1129 Trace.TraceInformation( "OS Version: " + Environment.OSVersion );
\r
1130 Trace.TraceInformation( "ProcessorCount: " + Environment.ProcessorCount.ToString() );
\r
1131 Trace.TraceInformation( "CLR Version: " + Environment.Version.ToString() );
\r
1132 //---------------------
\r
1134 #region [ コンパクトモードスイッチの有無 ]
\r
1135 //---------------------
\r
1136 bコンパクトモード = false;
\r
1137 strコンパクトモードファイル = "";
\r
1138 string[] commandLineArgs = Environment.GetCommandLineArgs();
\r
1140 if( ( commandLineArgs != null ) && ( commandLineArgs.Length > 1 ) )
\r
1143 strコンパクトモードファイル = commandLineArgs[ 1 ];
\r
1144 Trace.TraceInformation( "コンパクトモードで起動します。[{0}]", new object[] { strコンパクトモードファイル } );
\r
1146 //---------------------
\r
1149 #region [ ウィンドウ初期化 ]
\r
1150 //---------------------
\r
1151 base.Window.Text = "DTXMania .NET style release " + VERSION;
\r
1152 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
1153 if (!ConfigIni.bウィンドウモード) // #23510 2010.11.02 yyagi: add; to recover window size in case bootup with fullscreen mode
\r
1155 currentClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight);
\r
1157 base.Window.MaximizeBox = false;
\r
1158 base.Window.FormBorderStyle = FormBorderStyle.Sizable; // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize
\r
1159 base.Window.ShowIcon = true;
\r
1160 base.Window.Icon = Properties.Resources.dtx;
\r
1161 base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );
\r
1162 base.Window.ApplicationActivated += new EventHandler( this.Window_ApplicationActivated );
\r
1163 base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
\r
1164 // base.Window.Resize += new EventHandler(Window_Resize);
\r
1165 //---------------------
\r
1167 #region [ Direct3D9 デバイスの生成 ]
\r
1168 //---------------------
\r
1169 DeviceSettings settings = new DeviceSettings();
\r
1170 settings.Windowed = ConfigIni.bウィンドウモード;
\r
1171 settings.BackBufferWidth = 640;
\r
1172 settings.BackBufferHeight = 480;
\r
1173 settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1174 base.GraphicsDeviceManager.ChangeDevice( settings );
\r
1175 base.IsFixedTimeStep = false;
\r
1176 base.Window.ClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight); // #23510 2010.10.31 yyagi
\r
1177 //---------------------
\r
1182 #region [ Skin の初期化 ]
\r
1183 //---------------------
\r
1184 Trace.TraceInformation( "スキンの初期化を行います。" );
\r
1188 Skin = new CSkin();
\r
1189 Trace.TraceInformation( "スキンの初期化を完了しました。" );
\r
1193 Trace.TraceInformation( "スキンの初期化に失敗しました。" );
\r
1200 //---------------------
\r
1202 #region [ Timer の初期化 ]
\r
1203 //---------------------
\r
1204 Trace.TraceInformation( "タイマの初期化を行います。" );
\r
1208 Timer = new CTimer( CTimer.E種別.MultiMedia );
\r
1209 Trace.TraceInformation( "タイマの初期化を完了しました。" );
\r
1215 //---------------------
\r
1217 #region [ FPS カウンタの初期化 ]
\r
1218 //---------------------
\r
1219 Trace.TraceInformation( "FPSカウンタの初期化を行います。" );
\r
1224 Trace.TraceInformation( "FPSカウンタを生成しました。" );
\r
1230 //---------------------
\r
1232 #region [ act文字コンソールの初期化 ]
\r
1233 //---------------------
\r
1234 Trace.TraceInformation( "文字コンソールの初期化を行います。" );
\r
1238 act文字コンソール = new C文字コンソール();
\r
1239 Trace.TraceInformation( "文字コンソールを生成しました。" );
\r
1240 act文字コンソール.On活性化();
\r
1241 Trace.TraceInformation( "文字コンソールを活性化しました。" );
\r
1242 Trace.TraceInformation( "文字コンソールの初期化を完了しました。" );
\r
1244 catch( Exception exception )
\r
1246 Trace.TraceError( exception.Message );
\r
1247 Trace.TraceError( "文字コンソールの初期化に失敗しました。" );
\r
1253 //---------------------
\r
1255 #region [ Input管理 の初期化 ]
\r
1256 //---------------------
\r
1257 Trace.TraceInformation( "DirectInput, MIDI入力の初期化を行います。" );
\r
1261 Input管理 = new CInput管理( base.Window.Handle );
\r
1262 foreach( IInputDevice device in Input管理.list入力デバイス )
\r
1264 if( ( device.e入力デバイス種別 == E入力デバイス種別.Joystick ) && !ConfigIni.dicJoystick.ContainsValue( device.GUID ) )
\r
1267 while( ConfigIni.dicJoystick.ContainsKey( key ) )
\r
1271 ConfigIni.dicJoystick.Add( key, device.GUID );
\r
1274 foreach( IInputDevice device2 in Input管理.list入力デバイス )
\r
1276 if( device2.e入力デバイス種別 == E入力デバイス種別.Joystick )
\r
1278 foreach( KeyValuePair<int, string> pair in ConfigIni.dicJoystick )
\r
1280 if( device2.GUID.Equals( pair.Value ) )
\r
1282 ( (CInputJoystick) device2 ).SetID( pair.Key );
\r
1289 Trace.TraceInformation( "DirectInput の初期化を完了しました。" );
\r
1291 catch( Exception exception2 )
\r
1293 Trace.TraceError( exception2.Message );
\r
1294 Trace.TraceError( "DirectInput, MIDI入力の初期化に失敗しました。" );
\r
1301 //---------------------
\r
1303 #region [ Pad の初期化 ]
\r
1304 //---------------------
\r
1305 Trace.TraceInformation( "パッドの初期化を行います。" );
\r
1309 Pad = new CPad( ConfigIni, Input管理 );
\r
1310 Trace.TraceInformation( "パッドの初期化を完了しました。" );
\r
1312 catch( Exception exception3 )
\r
1314 Trace.TraceError( exception3.Message );
\r
1315 Trace.TraceError( "パッドの初期化に失敗しました。" );
\r
1321 //---------------------
\r
1323 #region [ Sound管理 の初期化 ]
\r
1324 //---------------------
\r
1325 Trace.TraceInformation( "DirectSound の初期化を行います。" );
\r
1329 Sound管理 = new CSound管理( base.Window.Handle );
\r
1330 Trace.TraceInformation( "DirectSound の初期化を完了しました。" );
\r
1334 Trace.TraceError( "DirectSound の初期化に失敗しました。" );
\r
1341 //---------------------
\r
1343 #region [ Songs管理 の初期化 ]
\r
1344 //---------------------
\r
1345 Trace.TraceInformation( "曲リストの初期化を行います。" );
\r
1349 Songs管理 = new CSongs管理();
\r
1350 Trace.TraceInformation( "曲リストの初期化を完了しました。" );
\r
1352 catch( Exception exception4 )
\r
1354 Trace.TraceError( exception4.Message );
\r
1355 Trace.TraceError( "曲リストの初期化に失敗しました。" );
\r
1361 //---------------------
\r
1363 #region [ CAvi の初期化 ]
\r
1364 //---------------------
\r
1366 //---------------------
\r
1368 #region [ Random の初期化 ]
\r
1369 //---------------------
\r
1370 Random = new Random( (int) Timer.nシステム時刻 );
\r
1371 //---------------------
\r
1373 #region [ ステージの初期化 ]
\r
1374 //---------------------
\r
1377 stage起動 = new CStage起動();
\r
1378 stageタイトル = new CStageタイトル();
\r
1379 stageオプション = new CStageオプション();
\r
1380 stageコンフィグ = new CStageコンフィグ();
\r
1381 stage選曲 = new CStage選曲();
\r
1382 stage曲読み込み = new CStage曲読み込み();
\r
1383 stage演奏ドラム画面 = new CStage演奏ドラム画面();
\r
1384 stage演奏ギター画面 = new CStage演奏ギター画面();
\r
1385 stage結果 = new CStage結果();
\r
1386 stage終了 = new CStage終了();
\r
1387 this.listトップレベルActivities = new List<CActivity>();
\r
1388 this.listトップレベルActivities.Add( act文字コンソール );
\r
1389 this.listトップレベルActivities.Add( stage起動 );
\r
1390 this.listトップレベルActivities.Add( stageタイトル );
\r
1391 this.listトップレベルActivities.Add( stageオプション );
\r
1392 this.listトップレベルActivities.Add( stageコンフィグ );
\r
1393 this.listトップレベルActivities.Add( stage選曲 );
\r
1394 this.listトップレベルActivities.Add( stage曲読み込み );
\r
1395 this.listトップレベルActivities.Add( stage演奏ドラム画面 );
\r
1396 this.listトップレベルActivities.Add( stage演奏ギター画面 );
\r
1397 this.listトップレベルActivities.Add( stage結果 );
\r
1398 this.listトップレベルActivities.Add( stage終了 );
\r
1399 //---------------------
\r
1401 #region [ プラグインの検索と生成 ]
\r
1402 //---------------------
\r
1403 PluginHost = new CPluginHost();
\r
1405 Trace.TraceInformation( "プラグインの検索と生成を行います。" );
\r
1409 this.tプラグイン検索と生成();
\r
1410 Trace.TraceInformation( "プラグインの検索と生成を完了しました。" );
\r
1416 //---------------------
\r
1418 #region [ プラグインの初期化 ]
\r
1419 //---------------------
\r
1420 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
\r
1422 Trace.TraceInformation( "プラグインの初期化を行います。" );
\r
1426 foreach( STPlugin st in this.listプラグイン )
\r
1428 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1429 st.plugin.On初期化( this.PluginHost );
\r
1430 st.plugin.OnManagedリソースの作成();
\r
1431 st.plugin.OnUnmanagedリソースの作成();
\r
1432 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1434 Trace.TraceInformation( "すべてのプラグインの初期化を完了しました。" );
\r
1438 Trace.TraceError( "プラグインのどれかの初期化に失敗しました。" );
\r
1447 //---------------------
\r
1450 Trace.TraceInformation( "アプリケーションの初期化を完了しました。" );
\r
1452 #region [ 最初のステージの起動 ]
\r
1453 //---------------------
\r
1454 Trace.TraceInformation( "----------------------" );
\r
1455 Trace.TraceInformation( "■ 起動" );
\r
1457 r現在のステージ = stage起動;
\r
1459 //---------------------
\r
1462 private void t終了処理()
\r
1464 if( !this.b終了処理完了済み )
\r
1466 Trace.TraceInformation( "----------------------" );
\r
1467 Trace.TraceInformation( "■ アプリケーションの終了" );
\r
1468 if( r現在のステージ != null )
\r
1470 Trace.TraceInformation( "現在のステージを終了します。" );
\r
1474 r現在のステージ.On非活性化();
\r
1475 Trace.TraceInformation( "現在のステージの終了処理を完了しました。" );
\r
1483 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
\r
1485 Trace.TraceInformation( "すべてのプラグインを終了します。" );
\r
1489 foreach( STPlugin st in this.listプラグイン )
\r
1491 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1492 st.plugin.OnUnmanagedリソースの解放();
\r
1493 st.plugin.OnManagedリソースの解放();
\r
1495 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1497 PluginHost = null;
\r
1498 Trace.TraceInformation( "すべてのプラグインの終了処理を完了しました。" );
\r
1506 if( Songs管理 != null )
\r
1508 Trace.TraceInformation( "曲リストの終了処理を行います。" );
\r
1513 Trace.TraceInformation( "曲リストの終了処理を完了しました。" );
\r
1515 catch( Exception exception )
\r
1517 Trace.TraceError( exception.Message );
\r
1518 Trace.TraceError( "曲リストの終了処理に失敗しました。" );
\r
1526 if( Skin != null )
\r
1528 Trace.TraceInformation( "スキンの終了処理を行います。" );
\r
1534 Trace.TraceInformation( "スキンの終了処理を完了しました。" );
\r
1536 catch( Exception exception2 )
\r
1538 Trace.TraceError( exception2.Message );
\r
1539 Trace.TraceError( "スキンの終了処理に失敗しました。" );
\r
1546 if( Sound管理 != null )
\r
1548 Trace.TraceInformation( "DirectSound の終了処理を行います。" );
\r
1552 Sound管理.Dispose();
\r
1554 Trace.TraceInformation( "DirectSound の終了処理を完了しました。" );
\r
1556 catch( Exception exception3 )
\r
1558 Trace.TraceError( exception3.Message );
\r
1559 Trace.TraceError( "DirectSound の終了処理に失敗しました。" );
\r
1568 Trace.TraceInformation( "パッドの終了処理を行います。" );
\r
1573 Trace.TraceInformation( "パッドの終了処理を完了しました。" );
\r
1575 catch( Exception exception4 )
\r
1577 Trace.TraceError( exception4.Message );
\r
1578 Trace.TraceError( "パッドの終了処理に失敗しました。" );
\r
1585 if( Input管理 != null )
\r
1587 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を行います。" );
\r
1591 Input管理.Dispose();
\r
1593 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を完了しました。" );
\r
1595 catch( Exception exception5 )
\r
1597 Trace.TraceError( exception5.Message );
\r
1598 Trace.TraceError( "DirectInput, MIDI入力の終了処理に失敗しました。" );
\r
1605 if( act文字コンソール != null )
\r
1607 Trace.TraceInformation( "文字コンソールの終了処理を行います。" );
\r
1611 act文字コンソール.On非活性化();
\r
1612 act文字コンソール = null;
\r
1613 Trace.TraceInformation( "文字コンソールの終了処理を完了しました。" );
\r
1615 catch( Exception exception6 )
\r
1617 Trace.TraceError( exception6.Message );
\r
1618 Trace.TraceError( "文字コンソールの終了処理に失敗しました。" );
\r
1625 Trace.TraceInformation( "FPSカウンタの終了処理を行います。" );
\r
1633 Trace.TraceInformation( "FPSカウンタの終了処理を完了しました。" );
\r
1639 Trace.TraceInformation( "タイマの終了処理を行います。" );
\r
1643 if( Timer != null )
\r
1647 Trace.TraceInformation( "タイマの終了処理を完了しました。" );
\r
1651 Trace.TraceInformation( "タイマは使用されていません。" );
\r
1658 Trace.TraceInformation( "Config.ini を出力します。" );
\r
1659 // #23510 2010.10.31 yyagi
\r
1660 // #23510 2010.11.02 yyagi change conditions from (base.windows.clientsize.width > 0) to (ConfigIni.bウインドウモード) to detect whether fullscreenmode or not correctly
\r
1661 // とりあえずここでConfigへの変数書き戻しを行っているが、
\r
1662 // 一段落したらリサイズイベントの処理中に入れ込んでしまう予定。
\r
1663 ConfigIni.nウインドウwidth = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Width : currentClientSize.Width; // #23510 2010.10.31 yyagi add
\r
1664 ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Height : currentClientSize.Height;
\r
1665 string str = strEXEのあるフォルダ + "Config.ini";
\r
1669 ConfigIni.t書き出し( str );
\r
1670 Trace.TraceInformation( "保存しました。({0})", new object[] { str } );
\r
1672 catch( Exception exception7 )
\r
1674 Trace.TraceError( exception7.Message );
\r
1675 Trace.TraceError( "Config.ini の出力に失敗しました。({0})", new object[] { str } );
\r
1681 Trace.TraceInformation( "アプリケーションの終了処理を完了しました。" );
\r
1684 this.b終了処理完了済み = true;
\r
1687 private void Window_ApplicationActivated( object sender, EventArgs e )
\r
1689 this.bApplicationActive = true;
\r
1691 private void Window_ApplicationDeactivated( object sender, EventArgs e )
\r
1693 this.bApplicationActive = false;
\r
1695 private void Window_KeyDown( object sender, KeyEventArgs e )
\r
1697 if( e.KeyCode == Keys.Menu )
\r
1699 e.SuppressKeyPress = true;
\r
1701 else if( ( e.KeyCode == Keys.Return ) && e.Alt )
\r
1703 if( ConfigIni != null )
\r
1705 ConfigIni.bウィンドウモード = !ConfigIni.bウィンドウモード;
\r
1706 this.t全画面・ウィンドウモード切り替え();
\r
1708 e.SuppressKeyPress = true;
\r
1711 private CScoreIni tScoreIniへBGMAdjustとHistoryとPlayCountを更新( string str新ヒストリ行 )
\r
1716 string str = DTX.strファイル名の絶対パス + ".score.ini";
\r
1717 CScoreIni ini = new CScoreIni( str );
\r
1718 if( !File.Exists( str ) )
\r
1720 ini.stファイル.Title = DTX.TITLE;
\r
1721 ini.stファイル.Name = DTX.strファイル名;
\r
1722 ini.stファイル.Hash = CScoreIni.tファイルのMD5を求めて返す( DTX.strファイル名の絶対パス );
\r
1723 for( int i = 0; i < 6; i++ )
\r
1725 ini.stセクション[ i ].nPerfectになる範囲ms = nPerfect範囲ms;
\r
1726 ini.stセクション[ i ].nGreatになる範囲ms = nGreat範囲ms;
\r
1727 ini.stセクション[ i ].nGoodになる範囲ms = nGood範囲ms;
\r
1728 ini.stセクション[ i ].nPoorになる範囲ms = nPoor範囲ms;
\r
1731 ini.stファイル.BGMAdjust = DTX.nBGMAdjust;
\r
1732 CScoreIni.t更新条件を取得する( out flag, out flag2, out flag3 );
\r
1733 if( ( flag || flag2 ) || flag3 )
\r
1737 ini.stファイル.PlayCountDrums++;
\r
1741 ini.stファイル.PlayCountGuitar++;
\r
1745 ini.stファイル.PlayCountBass++;
\r
1747 ini.tヒストリを追加する( str新ヒストリ行 );
\r
1750 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Drums = ini.stファイル.PlayCountDrums;
\r
1751 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
\r
1752 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Bass = ini.stファイル.PlayCountBass;
\r
1753 for( int j = 0; j < ini.stファイル.History.Length; j++ )
\r
1755 stage選曲.r現在選択中のスコア.譜面情報.演奏履歴[ j ] = ini.stファイル.History[ j ];
\r
1759 if( ConfigIni.bScoreIniを出力する )
\r
1766 private void tガベージコレクションを実行する()
\r
1769 GC.WaitForPendingFinalizers();
\r
1771 GC.WaitForPendingFinalizers();
\r
1773 private void tプラグイン検索と生成()
\r
1775 this.listプラグイン = new List<STPlugin>();
\r
1777 string strIPluginActivityの名前 = typeof( IPluginActivity ).FullName;
\r
1778 string strプラグインフォルダパス = strEXEのあるフォルダ + "Plugins\\";
\r
1780 this.t指定フォルダ内でのプラグイン検索と生成( strプラグインフォルダパス, strIPluginActivityの名前 );
\r
1782 if( this.listプラグイン.Count > 0 )
\r
1783 Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" );
\r
1785 private void t指定フォルダ内でのプラグイン検索と生成( string strプラグインフォルダパス, string strプラグイン型名 )
\r
1787 // 指定されたパスが存在しないとエラー
\r
1788 if( !Directory.Exists( strプラグインフォルダパス ) )
\r
1790 Trace.TraceWarning( "プラグインフォルダが存在しません。(" + strプラグインフォルダパス + ")" );
\r
1794 // (1) すべての *.dll について…
\r
1795 string[] strDLLs = System.IO.Directory.GetFiles( strプラグインフォルダパス, "*.dll" );
\r
1796 foreach( string dllName in strDLLs )
\r
1800 // (1-1) dll をアセンブリとして読み込む。
\r
1801 System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( dllName );
\r
1803 // (1-2) アセンブリ内のすべての型について、プラグインとして有効か調べる
\r
1804 foreach( Type t in asm.GetTypes() )
\r
1806 // (1-3) ↓クラスであり↓Publicであり↓抽象クラスでなく↓IPlugin型のインスタンスが作れる 型を持っていれば有効
\r
1807 if( t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface( strプラグイン型名 ) != null )
\r
1809 // (1-4) クラス名からインスタンスを作成する
\r
1810 var st = new STPlugin() {
\r
1811 plugin = (IPluginActivity) asm.CreateInstance( t.FullName ),
\r
1812 strプラグインフォルダ = Path.GetDirectoryName( dllName ),
\r
1813 strアセンブリ簡易名 = asm.GetName().Name,
\r
1814 Version = asm.GetName().Version,
\r
1817 // (1-5) プラグインリストへ登録
\r
1818 this.listプラグイン.Add( st );
\r
1819 Trace.TraceInformation( "プラグイン {0} ({1}, {2}, {3}) を読み込みました。", t.FullName, Path.GetFileName( dllName ), st.strアセンブリ簡易名, st.Version.ToString() );
\r
1825 Trace.TraceInformation( dllName + " からプラグインを生成することに失敗しました。スキップします。" );
\r
1829 // (2) サブフォルダがあれば再帰する
\r
1830 string[] strDirs = Directory.GetDirectories( strプラグインフォルダパス, "*" );
\r
1831 foreach( string dir in strDirs )
\r
1832 this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );
\r
1834 //-----------------
\r