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 base.Window.MaximizeBox = false;
\r
1154 base.Window.FormBorderStyle = FormBorderStyle.Sizable; // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize
\r
1155 base.Window.ShowIcon = true;
\r
1156 base.Window.Icon = Properties.Resources.dtx;
\r
1157 base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );
\r
1158 base.Window.ApplicationActivated += new EventHandler( this.Window_ApplicationActivated );
\r
1159 base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
\r
1160 // base.Window.Resize += new EventHandler(Window_Resize);
\r
1161 //---------------------
\r
1163 #region [ Direct3D9 デバイスの生成 ]
\r
1164 //---------------------
\r
1165 DeviceSettings settings = new DeviceSettings();
\r
1166 settings.Windowed = ConfigIni.bウィンドウモード;
\r
1167 settings.BackBufferWidth = 640;
\r
1168 settings.BackBufferHeight = 480;
\r
1169 settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1170 base.GraphicsDeviceManager.ChangeDevice( settings );
\r
1171 base.IsFixedTimeStep = false;
\r
1172 base.Window.ClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight); // #23510 2010.10.31 yyagi
\r
1173 //---------------------
\r
1178 #region [ Skin の初期化 ]
\r
1179 //---------------------
\r
1180 Trace.TraceInformation( "スキンの初期化を行います。" );
\r
1184 Skin = new CSkin();
\r
1185 Trace.TraceInformation( "スキンの初期化を完了しました。" );
\r
1189 Trace.TraceInformation( "スキンの初期化に失敗しました。" );
\r
1196 //---------------------
\r
1198 #region [ Timer の初期化 ]
\r
1199 //---------------------
\r
1200 Trace.TraceInformation( "タイマの初期化を行います。" );
\r
1204 Timer = new CTimer( CTimer.E種別.MultiMedia );
\r
1205 Trace.TraceInformation( "タイマの初期化を完了しました。" );
\r
1211 //---------------------
\r
1213 #region [ FPS カウンタの初期化 ]
\r
1214 //---------------------
\r
1215 Trace.TraceInformation( "FPSカウンタの初期化を行います。" );
\r
1220 Trace.TraceInformation( "FPSカウンタを生成しました。" );
\r
1226 //---------------------
\r
1228 #region [ act文字コンソールの初期化 ]
\r
1229 //---------------------
\r
1230 Trace.TraceInformation( "文字コンソールの初期化を行います。" );
\r
1234 act文字コンソール = new C文字コンソール();
\r
1235 Trace.TraceInformation( "文字コンソールを生成しました。" );
\r
1236 act文字コンソール.On活性化();
\r
1237 Trace.TraceInformation( "文字コンソールを活性化しました。" );
\r
1238 Trace.TraceInformation( "文字コンソールの初期化を完了しました。" );
\r
1240 catch( Exception exception )
\r
1242 Trace.TraceError( exception.Message );
\r
1243 Trace.TraceError( "文字コンソールの初期化に失敗しました。" );
\r
1249 //---------------------
\r
1251 #region [ Input管理 の初期化 ]
\r
1252 //---------------------
\r
1253 Trace.TraceInformation( "DirectInput, MIDI入力の初期化を行います。" );
\r
1257 Input管理 = new CInput管理( base.Window.Handle );
\r
1258 foreach( IInputDevice device in Input管理.list入力デバイス )
\r
1260 if( ( device.e入力デバイス種別 == E入力デバイス種別.Joystick ) && !ConfigIni.dicJoystick.ContainsValue( device.GUID ) )
\r
1263 while( ConfigIni.dicJoystick.ContainsKey( key ) )
\r
1267 ConfigIni.dicJoystick.Add( key, device.GUID );
\r
1270 foreach( IInputDevice device2 in Input管理.list入力デバイス )
\r
1272 if( device2.e入力デバイス種別 == E入力デバイス種別.Joystick )
\r
1274 foreach( KeyValuePair<int, string> pair in ConfigIni.dicJoystick )
\r
1276 if( device2.GUID.Equals( pair.Value ) )
\r
1278 ( (CInputJoystick) device2 ).SetID( pair.Key );
\r
1285 Trace.TraceInformation( "DirectInput の初期化を完了しました。" );
\r
1287 catch( Exception exception2 )
\r
1289 Trace.TraceError( exception2.Message );
\r
1290 Trace.TraceError( "DirectInput, MIDI入力の初期化に失敗しました。" );
\r
1297 //---------------------
\r
1299 #region [ Pad の初期化 ]
\r
1300 //---------------------
\r
1301 Trace.TraceInformation( "パッドの初期化を行います。" );
\r
1305 Pad = new CPad( ConfigIni, Input管理 );
\r
1306 Trace.TraceInformation( "パッドの初期化を完了しました。" );
\r
1308 catch( Exception exception3 )
\r
1310 Trace.TraceError( exception3.Message );
\r
1311 Trace.TraceError( "パッドの初期化に失敗しました。" );
\r
1317 //---------------------
\r
1319 #region [ Sound管理 の初期化 ]
\r
1320 //---------------------
\r
1321 Trace.TraceInformation( "DirectSound の初期化を行います。" );
\r
1325 Sound管理 = new CSound管理( base.Window.Handle );
\r
1326 Trace.TraceInformation( "DirectSound の初期化を完了しました。" );
\r
1330 Trace.TraceError( "DirectSound の初期化に失敗しました。" );
\r
1337 //---------------------
\r
1339 #region [ Songs管理 の初期化 ]
\r
1340 //---------------------
\r
1341 Trace.TraceInformation( "曲リストの初期化を行います。" );
\r
1345 Songs管理 = new CSongs管理();
\r
1346 Trace.TraceInformation( "曲リストの初期化を完了しました。" );
\r
1348 catch( Exception exception4 )
\r
1350 Trace.TraceError( exception4.Message );
\r
1351 Trace.TraceError( "曲リストの初期化に失敗しました。" );
\r
1357 //---------------------
\r
1359 #region [ CAvi の初期化 ]
\r
1360 //---------------------
\r
1362 //---------------------
\r
1364 #region [ Random の初期化 ]
\r
1365 //---------------------
\r
1366 Random = new Random( (int) Timer.nシステム時刻 );
\r
1367 //---------------------
\r
1369 #region [ ステージの初期化 ]
\r
1370 //---------------------
\r
1373 stage起動 = new CStage起動();
\r
1374 stageタイトル = new CStageタイトル();
\r
1375 stageオプション = new CStageオプション();
\r
1376 stageコンフィグ = new CStageコンフィグ();
\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 this.listトップレベルActivities = new List<CActivity>();
\r
1384 this.listトップレベルActivities.Add( act文字コンソール );
\r
1385 this.listトップレベルActivities.Add( stage起動 );
\r
1386 this.listトップレベルActivities.Add( stageタイトル );
\r
1387 this.listトップレベルActivities.Add( stageオプション );
\r
1388 this.listトップレベルActivities.Add( stageコンフィグ );
\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 //---------------------
\r
1397 #region [ プラグインの検索と生成 ]
\r
1398 //---------------------
\r
1399 PluginHost = new CPluginHost();
\r
1401 Trace.TraceInformation( "プラグインの検索と生成を行います。" );
\r
1405 this.tプラグイン検索と生成();
\r
1406 Trace.TraceInformation( "プラグインの検索と生成を完了しました。" );
\r
1412 //---------------------
\r
1414 #region [ プラグインの初期化 ]
\r
1415 //---------------------
\r
1416 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
\r
1418 Trace.TraceInformation( "プラグインの初期化を行います。" );
\r
1422 foreach( STPlugin st in this.listプラグイン )
\r
1424 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1425 st.plugin.On初期化( this.PluginHost );
\r
1426 st.plugin.OnManagedリソースの作成();
\r
1427 st.plugin.OnUnmanagedリソースの作成();
\r
1428 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1430 Trace.TraceInformation( "すべてのプラグインの初期化を完了しました。" );
\r
1434 Trace.TraceError( "プラグインのどれかの初期化に失敗しました。" );
\r
1443 //---------------------
\r
1446 Trace.TraceInformation( "アプリケーションの初期化を完了しました。" );
\r
1448 #region [ 最初のステージの起動 ]
\r
1449 //---------------------
\r
1450 Trace.TraceInformation( "----------------------" );
\r
1451 Trace.TraceInformation( "■ 起動" );
\r
1453 r現在のステージ = stage起動;
\r
1455 //---------------------
\r
1458 private void t終了処理()
\r
1460 if( !this.b終了処理完了済み )
\r
1462 Trace.TraceInformation( "----------------------" );
\r
1463 Trace.TraceInformation( "■ アプリケーションの終了" );
\r
1464 if( r現在のステージ != null )
\r
1466 Trace.TraceInformation( "現在のステージを終了します。" );
\r
1470 r現在のステージ.On非活性化();
\r
1471 Trace.TraceInformation( "現在のステージの終了処理を完了しました。" );
\r
1479 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
\r
1481 Trace.TraceInformation( "すべてのプラグインを終了します。" );
\r
1485 foreach( STPlugin st in this.listプラグイン )
\r
1487 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
1488 st.plugin.OnUnmanagedリソースの解放();
\r
1489 st.plugin.OnManagedリソースの解放();
\r
1491 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1493 PluginHost = null;
\r
1494 Trace.TraceInformation( "すべてのプラグインの終了処理を完了しました。" );
\r
1502 if( Songs管理 != null )
\r
1504 Trace.TraceInformation( "曲リストの終了処理を行います。" );
\r
1509 Trace.TraceInformation( "曲リストの終了処理を完了しました。" );
\r
1511 catch( Exception exception )
\r
1513 Trace.TraceError( exception.Message );
\r
1514 Trace.TraceError( "曲リストの終了処理に失敗しました。" );
\r
1522 if( Skin != null )
\r
1524 Trace.TraceInformation( "スキンの終了処理を行います。" );
\r
1530 Trace.TraceInformation( "スキンの終了処理を完了しました。" );
\r
1532 catch( Exception exception2 )
\r
1534 Trace.TraceError( exception2.Message );
\r
1535 Trace.TraceError( "スキンの終了処理に失敗しました。" );
\r
1542 if( Sound管理 != null )
\r
1544 Trace.TraceInformation( "DirectSound の終了処理を行います。" );
\r
1548 Sound管理.Dispose();
\r
1550 Trace.TraceInformation( "DirectSound の終了処理を完了しました。" );
\r
1552 catch( Exception exception3 )
\r
1554 Trace.TraceError( exception3.Message );
\r
1555 Trace.TraceError( "DirectSound の終了処理に失敗しました。" );
\r
1564 Trace.TraceInformation( "パッドの終了処理を行います。" );
\r
1569 Trace.TraceInformation( "パッドの終了処理を完了しました。" );
\r
1571 catch( Exception exception4 )
\r
1573 Trace.TraceError( exception4.Message );
\r
1574 Trace.TraceError( "パッドの終了処理に失敗しました。" );
\r
1581 if( Input管理 != null )
\r
1583 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を行います。" );
\r
1587 Input管理.Dispose();
\r
1589 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を完了しました。" );
\r
1591 catch( Exception exception5 )
\r
1593 Trace.TraceError( exception5.Message );
\r
1594 Trace.TraceError( "DirectInput, MIDI入力の終了処理に失敗しました。" );
\r
1601 if( act文字コンソール != null )
\r
1603 Trace.TraceInformation( "文字コンソールの終了処理を行います。" );
\r
1607 act文字コンソール.On非活性化();
\r
1608 act文字コンソール = null;
\r
1609 Trace.TraceInformation( "文字コンソールの終了処理を完了しました。" );
\r
1611 catch( Exception exception6 )
\r
1613 Trace.TraceError( exception6.Message );
\r
1614 Trace.TraceError( "文字コンソールの終了処理に失敗しました。" );
\r
1621 Trace.TraceInformation( "FPSカウンタの終了処理を行います。" );
\r
1629 Trace.TraceInformation( "FPSカウンタの終了処理を完了しました。" );
\r
1635 Trace.TraceInformation( "タイマの終了処理を行います。" );
\r
1639 if( Timer != null )
\r
1643 Trace.TraceInformation( "タイマの終了処理を完了しました。" );
\r
1647 Trace.TraceInformation( "タイマは使用されていません。" );
\r
1654 Trace.TraceInformation( "Config.ini を出力します。" );
\r
1655 // #23510 2010.10.31 yyagi
\r
1656 // とりあえずここでConfigへの変数書き戻しを行っているが、
\r
1657 // 一段落したらリサイズイベントの処理中に入れ込んでしまう予定。
\r
1658 ConfigIni.nウインドウwidth = (base.Window.ClientSize.Width > 0) ? base.Window.ClientSize.Width : currentClientSize.Width; // #23510 2010.10.31 yyagi add
\r
1659 ConfigIni.nウインドウheight = (base.Window.ClientSize.Height > 0) ? base.Window.ClientSize.Height : currentClientSize.Height;
\r
1660 Debug.WriteLine("width,height=" + base.Window.ClientSize.Width + " " + base.Window.ClientSize.Height);
\r
1661 string str = strEXEのあるフォルダ + "Config.ini";
\r
1665 ConfigIni.t書き出し( str );
\r
1666 Trace.TraceInformation( "保存しました。({0})", new object[] { str } );
\r
1668 catch( Exception exception7 )
\r
1670 Trace.TraceError( exception7.Message );
\r
1671 Trace.TraceError( "Config.ini の出力に失敗しました。({0})", new object[] { str } );
\r
1677 Trace.TraceInformation( "アプリケーションの終了処理を完了しました。" );
\r
1680 this.b終了処理完了済み = true;
\r
1683 private void Window_ApplicationActivated( object sender, EventArgs e )
\r
1685 this.bApplicationActive = true;
\r
1687 private void Window_ApplicationDeactivated( object sender, EventArgs e )
\r
1689 this.bApplicationActive = false;
\r
1691 private void Window_KeyDown( object sender, KeyEventArgs e )
\r
1693 if( e.KeyCode == Keys.Menu )
\r
1695 e.SuppressKeyPress = true;
\r
1697 else if( ( e.KeyCode == Keys.Return ) && e.Alt )
\r
1699 if( ConfigIni != null )
\r
1701 ConfigIni.bウィンドウモード = !ConfigIni.bウィンドウモード;
\r
1702 this.t全画面・ウィンドウモード切り替え();
\r
1704 e.SuppressKeyPress = true;
\r
1707 private CScoreIni tScoreIniへBGMAdjustとHistoryとPlayCountを更新( string str新ヒストリ行 )
\r
1712 string str = DTX.strファイル名の絶対パス + ".score.ini";
\r
1713 CScoreIni ini = new CScoreIni( str );
\r
1714 if( !File.Exists( str ) )
\r
1716 ini.stファイル.Title = DTX.TITLE;
\r
1717 ini.stファイル.Name = DTX.strファイル名;
\r
1718 ini.stファイル.Hash = CScoreIni.tファイルのMD5を求めて返す( DTX.strファイル名の絶対パス );
\r
1719 for( int i = 0; i < 6; i++ )
\r
1721 ini.stセクション[ i ].nPerfectになる範囲ms = nPerfect範囲ms;
\r
1722 ini.stセクション[ i ].nGreatになる範囲ms = nGreat範囲ms;
\r
1723 ini.stセクション[ i ].nGoodになる範囲ms = nGood範囲ms;
\r
1724 ini.stセクション[ i ].nPoorになる範囲ms = nPoor範囲ms;
\r
1727 ini.stファイル.BGMAdjust = DTX.nBGMAdjust;
\r
1728 CScoreIni.t更新条件を取得する( out flag, out flag2, out flag3 );
\r
1729 if( ( flag || flag2 ) || flag3 )
\r
1733 ini.stファイル.PlayCountDrums++;
\r
1737 ini.stファイル.PlayCountGuitar++;
\r
1741 ini.stファイル.PlayCountBass++;
\r
1743 ini.tヒストリを追加する( str新ヒストリ行 );
\r
1746 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Drums = ini.stファイル.PlayCountDrums;
\r
1747 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
\r
1748 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Bass = ini.stファイル.PlayCountBass;
\r
1749 for( int j = 0; j < ini.stファイル.History.Length; j++ )
\r
1751 stage選曲.r現在選択中のスコア.譜面情報.演奏履歴[ j ] = ini.stファイル.History[ j ];
\r
1755 if( ConfigIni.bScoreIniを出力する )
\r
1762 private void tガベージコレクションを実行する()
\r
1765 GC.WaitForPendingFinalizers();
\r
1767 GC.WaitForPendingFinalizers();
\r
1769 private void tプラグイン検索と生成()
\r
1771 this.listプラグイン = new List<STPlugin>();
\r
1773 string strIPluginActivityの名前 = typeof( IPluginActivity ).FullName;
\r
1774 string strプラグインフォルダパス = strEXEのあるフォルダ + "Plugins\\";
\r
1776 this.t指定フォルダ内でのプラグイン検索と生成( strプラグインフォルダパス, strIPluginActivityの名前 );
\r
1778 if( this.listプラグイン.Count > 0 )
\r
1779 Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" );
\r
1781 private void t指定フォルダ内でのプラグイン検索と生成( string strプラグインフォルダパス, string strプラグイン型名 )
\r
1783 // 指定されたパスが存在しないとエラー
\r
1784 if( !Directory.Exists( strプラグインフォルダパス ) )
\r
1786 Trace.TraceWarning( "プラグインフォルダが存在しません。(" + strプラグインフォルダパス + ")" );
\r
1790 // (1) すべての *.dll について…
\r
1791 string[] strDLLs = System.IO.Directory.GetFiles( strプラグインフォルダパス, "*.dll" );
\r
1792 foreach( string dllName in strDLLs )
\r
1796 // (1-1) dll をアセンブリとして読み込む。
\r
1797 System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( dllName );
\r
1799 // (1-2) アセンブリ内のすべての型について、プラグインとして有効か調べる
\r
1800 foreach( Type t in asm.GetTypes() )
\r
1802 // (1-3) ↓クラスであり↓Publicであり↓抽象クラスでなく↓IPlugin型のインスタンスが作れる 型を持っていれば有効
\r
1803 if( t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface( strプラグイン型名 ) != null )
\r
1805 // (1-4) クラス名からインスタンスを作成する
\r
1806 var st = new STPlugin() {
\r
1807 plugin = (IPluginActivity) asm.CreateInstance( t.FullName ),
\r
1808 strプラグインフォルダ = Path.GetDirectoryName( dllName ),
\r
1809 strアセンブリ簡易名 = asm.GetName().Name,
\r
1810 Version = asm.GetName().Version,
\r
1813 // (1-5) プラグインリストへ登録
\r
1814 this.listプラグイン.Add( st );
\r
1815 Trace.TraceInformation( "プラグイン {0} ({1}, {2}, {3}) を読み込みました。", t.FullName, Path.GetFileName( dllName ), st.strアセンブリ簡易名, st.Version.ToString() );
\r
1821 Trace.TraceInformation( dllName + " からプラグインを生成することに失敗しました。スキップします。" );
\r
1825 // (2) サブフォルダがあれば再帰する
\r
1826 string[] strDirs = Directory.GetDirectories( strプラグインフォルダパス, "*" );
\r
1827 foreach( string dir in strDirs )
\r
1828 this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );
\r
1830 //-----------------
\r