Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/DTXManiaプロジェクト/コード/全体/CDTXMania.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 39 - (show annotations) (download)
Sat Mar 9 14:34:14 2013 UTC (11 years ago) by kairera0467
File size: 99295 byte(s)
#xxxxx アンチエイリアスが適用されていなかったのを修正。
#30783 少々修正。ただしまだ再生できない。
1 using System;
2 using System.Collections.Generic;
3 using System.Globalization;
4 using System.Text;
5 using System.Windows.Forms;
6 using System.Drawing;
7 using System.Diagnostics;
8 using System.Runtime.InteropServices;
9 using System.IO;
10 using System.Threading;
11 using System.Runtime.Serialization.Formatters.Binary;
12 using SlimDX;
13 using SlimDX.Direct3D9;
14 using SlimDX.Windows;
15 using FDK;
16 using SampleFramework;
17 using DTXMania.Properties;
18 using System.Reflection;
19 using DirectShowLib;
20
21 namespace DTXMania
22 {
23 internal class CDTXMania : Game
24 {
25 // プロパティ
26
27 public static readonly string VERSION = "Ver2.30(130302)";
28 public static readonly string SLIMDXDLL = "c_net20x86_Jun2010";
29 public static readonly string D3DXDLL = "d3dx9_43.dll"; // June 2010
30 //public static readonly string D3DXDLL = "d3dx9_42.dll"; // February 2010
31 //public static readonly string D3DXDLL = "d3dx9_41.dll"; // March 2009
32
33 public static CDTXMania app
34 {
35 get;
36 private set;
37 }
38 public static Folder Folder
39 {
40 get;
41 protected set;
42 }
43 public static CApp App
44 {
45 get;
46 private set;
47 }
48 public static C文字コンソ act文字コンソ
49 {
50 get;
51 private set;
52 }
53 public static bool bコンパクトモ
54 {
55 get;
56 private set;
57 }
58 public static CConfigIni ConfigIni
59 {
60 get;
61 private set;
62 }
63 public static CDTX DTX
64 {
65 get
66 {
67 return dtx;
68 }
69 set
70 {
71 if( ( dtx != null ) && ( app != null ) )
72 {
73 dtx.On非活性化();
74 app.listトップレベルActivities.Remove( dtx );
75 }
76 dtx = value;
77 if( ( dtx != null ) && ( app != null ) )
78 {
79 app.listトップレベルActivities.Add( dtx );
80 }
81 }
82 }
83 public static CFPS FPS
84 {
85 get;
86 private set;
87 }
88 public static CInput管理 Input管理
89 {
90 get;
91 private set;
92 }
93 public static int nSongDifficulty
94 {
95 get;
96 set;
97 }
98
99 public static string strSongDifficulyName
100 {
101 get;
102 set;
103 }
104 public static int nPerfect範囲ms
105 {
106 get
107 {
108 if( stage選曲.r確定された曲 != null )
109 {
110 C曲リストノ c曲リストノ = stage選曲.r確定された曲.r親ノ;
111 if( ( ( c曲リストノ != null ) && ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.BOX ) ) && ( c曲リストノ.nPerfect範囲ms >= 0 ) )
112 {
113 return c曲リストノ.nPerfect範囲ms;
114 }
115 }
116 return ConfigIni.nヒット範囲ms.Perfect;
117 }
118 }
119 public static int nGreat範囲ms
120 {
121 get
122 {
123 if( stage選曲.r確定された曲 != null )
124 {
125 C曲リストノ c曲リストノ = stage選曲.r確定された曲.r親ノ;
126 if( ( ( c曲リストノ != null ) && ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.BOX ) ) && ( c曲リストノ.nGreat範囲ms >= 0 ) )
127 {
128 return c曲リストノ.nGreat範囲ms;
129 }
130 }
131 return ConfigIni.nヒット範囲ms.Great;
132 }
133 }
134 public static int nGood範囲ms
135 {
136 get
137 {
138 if( stage選曲.r確定された曲 != null )
139 {
140 C曲リストノ c曲リストノ = stage選曲.r確定された曲.r親ノ;
141 if( ( ( c曲リストノ != null ) && ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.BOX ) ) && ( c曲リストノ.nGood範囲ms >= 0 ) )
142 {
143 return c曲リストノ.nGood範囲ms;
144 }
145 }
146 return ConfigIni.nヒット範囲ms.Good;
147 }
148 }
149 public static int nPoor範囲ms
150 {
151 get
152 {
153 if( stage選曲.r確定された曲 != null )
154 {
155 C曲リストノ c曲リストノ = stage選曲.r確定された曲.r親ノ;
156 if( ( ( c曲リストノ != null ) && ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.BOX ) ) && ( c曲リストノ.nPoor範囲ms >= 0 ) )
157 {
158 return c曲リストノ.nPoor範囲ms;
159 }
160 }
161 return ConfigIni.nヒット範囲ms.Poor;
162 }
163 }
164 public static CPad Pad
165 {
166 get;
167 private set;
168 }
169 public static Random Random
170 {
171 get;
172 private set;
173 }
174 public static CSkin Skin
175 {
176 get;
177 private set;
178 }
179 public static CSongs管理 Songs管理
180 {
181 get;
182 set; // 2012.1.26 yyagi private解除 CStage起動でのdesirialize読み込みのため
183 }
184 public static CEnumSongs EnumSongs
185 {
186 get;
187 private set;
188 }
189 public static CActEnumSongs actEnumSongs
190 {
191 get;
192 private set;
193 }
194 public static CActFlushGPU actFlushGPU
195 {
196 get;
197 private set;
198 }
199 public static CSound管理 Sound管理
200 {
201 get;
202 private set;
203 }
204 public static CStage起動 stage起動
205 {
206 get;
207 private set;
208 }
209 public static CStageタイトル stageタイトル
210 {
211 get;
212 private set;
213 }
214 public static CStageオプション stageオプション
215 {
216 get;
217 private set;
218 }
219 public static CStageコンフィグ stageコンフィグ
220 {
221 get;
222 private set;
223 }
224 public static CStage選曲 stage選曲
225 {
226 get;
227 private set;
228 }
229 public static CStage曲読み込み stage曲読み込み
230 {
231 get;
232 private set;
233 }
234 public static CStage演奏ギタ画面 stage演奏ギタ画面
235 {
236 get;
237 private set;
238 }
239 public static CStage演奏ドラム画面 stage演奏ドラム画面
240 {
241 get;
242 private set;
243 }
244 public static CStage演奏画面共通 stage演奏画面共通
245 {
246 get;
247 private set;
248 }
249 public static CStage結果 stage結果
250 {
251 get;
252 private set;
253 }
254 public static CStageChangeSkin stageChangeSkin
255 {
256 get;
257 private set;
258 }
259 public static CStage終了 stage終了
260 {
261 get;
262 private set;
263 }
264 public static CStage r現在のステ = null;
265 public static CStage r直前のステ = null;
266 public static string strEXEのあるフォルダ
267 {
268 get;
269 private set;
270 }
271 public static string strコンパクトモドファイル
272 {
273 get;
274 private set;
275 }
276 public static CTimer Timer
277 {
278 get;
279 private set;
280 }
281 public static Format TextureFormat = Format.A8R8G8B8;
282 internal static IPluginActivity act現在入力を占有中のプラグイン = null;
283 public bool bApplicationActive
284 {
285 get;
286 private set;
287 }
288 public bool b次のタイミングで垂直帰線同期切り替えを行う
289 {
290 get;
291 set;
292 }
293 public bool b次のタイミングで全画面・ウィンドウ切り替えを行う
294 {
295 get;
296 set;
297 }
298
299 public Device Device
300 {
301 get { return base.GraphicsDeviceManager.Direct3D9.Device; }
302 }
303 public CPluginHost PluginHost
304 {
305 get;
306 private set;
307 }
308 public List<STPlugin> listプラグイン = new List<STPlugin>();
309 public struct STPlugin
310 {
311 public IPluginActivity plugin;
312 public string strプラグインフォルダ;
313 public string strアセンブリ簡易名;
314 public Version Version;
315 }
316 private static Size currentClientSize // #23510 2010.10.27 add yyagi to keep current window size
317 {
318 get;
319 set;
320 }
321 public Device D3D9Device
322 {
323 get { return this._D3D9Device; }
324 protected set { this._D3D9Device = value; }
325 }
326
327 public static void t初期化(CApp app)
328 {
329 //CDTXMania.App = app;
330 //CDTXMania.SoundDevice = null; // ユーザ依存
331 //CDTXMania.rc演奏用タイマ = null; // Global.Bass 依存(つまりユーザ依存)
332 }
333
334 public IntPtr WindowHandle // 2012.10.24 yyagi; to add ASIO support
335 {
336 get { return base.Window.Handle; }
337 }
338
339 // コンストラクタ
340
341 public CDTXMania()
342 {
343 CDTXMania.app = this;
344 this.t起動処理();
345 }
346
347
348 // メソッド
349
350 public void t全画面・ウィンドウモド切り替え()
351 {
352 #if WindowedFullscreen
353 if ( ConfigIni != null )
354 #else
355 DeviceSettings settings = base.GraphicsDeviceManager.CurrentSettings.Clone();
356 if ((ConfigIni != null) && (ConfigIni.bウィンドウモ != settings.Windowed))
357 #endif
358 {
359 #if !WindowedFullscreen
360 settings.Windowed = ConfigIni.bウィンドウモ;
361 #endif
362 if (ConfigIni.bウィンドウモ == false) // #23510 2010.10.27 yyagi: backup current window size before going fullscreen mode
363 {
364 currentClientSize = this.Window.ClientSize;
365 ConfigIni.nウインドウwidth = this.Window.ClientSize.Width;
366 ConfigIni.nウインドウheight = this.Window.ClientSize.Height;
367 // FDK.CTaskBar.ShowTaskBar( false );
368 }
369 #if !WindowedFullscreen
370 base.GraphicsDeviceManager.ChangeDevice(settings);
371 #endif
372 if (ConfigIni.bウィンドウモ == true) // #23510 2010.10.27 yyagi: to resume window size from backuped value
373 {
374 #if WindowedFullscreen
375 base.Window.ClientSize =
376 new Size(currentClientSize.Width, currentClientSize.Height);
377 }
378 }
379 if ( ConfigIni.bウィンドウモ == true ) // #23510 2010.10.27 yyagi: to resume window size from backuped value
380 {
381 // #30666 2013.2.2 yyagi Don't use Fullscreen mode becasue NVIDIA GeForce is
382 // tend to delay drawing on Fullscreen mode. So DTXMania uses Maximized window
383 // in spite of using fullscreen mode.
384 app.Window.WindowState = FormWindowState.Normal;
385 app.Window.FormBorderStyle = FormBorderStyle.Sizable;
386 app.Window.WindowState = FormWindowState.Normal;
387 #endif
388 base.Window.ClientSize =
389 new Size(currentClientSize.Width, currentClientSize.Height);
390 // FDK.CTaskBar.ShowTaskBar( true );
391 }
392 #if WindowedFullscreen
393 else
394 {
395 app.Window.WindowState = FormWindowState.Normal;
396 app.Window.FormBorderStyle = FormBorderStyle.None;
397 app.Window.WindowState = FormWindowState.Maximized;
398 }
399 if ( ConfigIni.bウィンドウモ )
400 {
401 if ( !this.bマウスカソル表示中 )
402 {
403 Cursor.Show();
404 this.bマウスカソル表示中 = true;
405 }
406 }
407 else if ( this.bマウスカソル表示中 )
408 {
409 Cursor.Hide();
410 this.bマウスカソル表示中 = false;
411 }
412 #endif
413 }
414
415 }
416
417
418 #region [ #24609 リザルト画像をpngで保存する ] // #24609 2011.3.14 yyagi; to save result screen in case BestRank or HiSkill.
419 /// <summary>
420 /// リザルト画像のキャプチャと保存。
421 /// </summary>
422 /// <param name="strFilename">保存するファイル名(フルパス)</param>
423 public bool SaveResultScreen( string strFullPath )
424 {
425 string strSavePath = Path.GetDirectoryName( strFullPath );
426 if ( !Directory.Exists( strSavePath ) )
427 {
428 try
429 {
430 Directory.CreateDirectory( strSavePath );
431 }
432 catch
433 {
434 return false;
435 }
436 }
437
438 // http://www.gamedev.net/topic/594369-dx9slimdxati-incorrect-saving-surface-to-file/
439 using ( Surface pSurface = CDTXMania.app.Device.GetRenderTarget( 0 ) )
440 {
441 Surface.ToFile( pSurface, strFullPath, ImageFileFormat.Png );
442 }
443 return true;
444 }
445 #endregion
446
447 // Game 実装
448 protected override void Initialize()
449 {
450 // new GCBeep();
451 if( this.listトップレベルActivities != null )
452 {
453 foreach (CActivity activity in this.listトップレベルActivities)
454 {
455 activity.OnManagedリソスの作成();
456 }
457 }
458
459 foreach( STPlugin st in this.listプラグイン )
460 {
461 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
462 st.plugin.OnManagedリソスの作成();
463 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
464 }
465 }
466 protected override void LoadContent()
467 {
468 if ( ConfigIni.bウィンドウモ )
469 {
470 if( !this.bマウスカソル表示中 )
471 {
472 Cursor.Show();
473 this.bマウスカソル表示中 = true;
474 }
475 }
476 else if( this.bマウスカソル表示中 )
477 {
478 Cursor.Hide();
479 this.bマウスカソル表示中 = false;
480 }
481 this.Device.SetTransform(TransformState.View, Matrix.LookAtLH(new Vector3(0f, 0f, (float)(-SampleFramework.GameWindowSize.Height / 2 * Math.Sqrt(3.0))), new Vector3(0f, 0f, 0f), new Vector3(0f, 1f, 0f)));
482 this.Device.SetTransform(TransformState.Projection, Matrix.PerspectiveFovLH(C変換.DegreeToRadian((float)60f), ((float)this.Device.Viewport.Width) / ((float)this.Device.Viewport.Height), -100f, 100f));
483 this.Device.SetRenderState(RenderState.Lighting, false);
484 this.Device.SetRenderState(RenderState.ZEnable, false);
485 this.Device.SetRenderState(RenderState.AntialiasedLineEnable, false);
486 this.Device.SetRenderState(RenderState.AlphaTestEnable, true);
487 this.Device.SetRenderState(RenderState.AlphaRef, 10);
488
489 this.Device.SetRenderState(RenderState.MultisampleAntialias, true);
490 this.Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear);
491 this.Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
492
493 this.Device.SetRenderState<Compare>(RenderState.AlphaFunc, Compare.Greater);
494 this.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
495 this.Device.SetRenderState<Blend>(RenderState.SourceBlend, Blend.SourceAlpha);
496 this.Device.SetRenderState<Blend>(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
497 this.Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate);
498 this.Device.SetTextureStageState(0, TextureStage.AlphaArg1, 2);
499 this.Device.SetTextureStageState(0, TextureStage.AlphaArg2, 1);
500
501 if( this.listトップレベルActivities != null )
502 {
503 foreach( CActivity activity in this.listトップレベルActivities )
504 activity.OnUnmanagedリソスの作成();
505 }
506
507 foreach( STPlugin st in this.listプラグイン )
508 {
509 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
510 st.plugin.OnUnmanagedリソスの作成();
511 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
512 }
513
514 if (ConfigIni.クレジットを表示する == true)
515 {
516 this.ftDeclaration = new System.Drawing.Font("Arial", 13f, FontStyle.Regular, GraphicsUnit.Pixel);
517 Bitmap image = new Bitmap(1, 1);
518 Graphics graphics = Graphics.FromImage(image);
519 graphics.PageUnit = GraphicsUnit.Pixel;
520 int width = (int)graphics.MeasureString("DTXManiaXG(verK) ver 2.22 based on DTXMania", this.ftDeclaration).Width;
521 graphics.Dispose();
522 Bitmap bitmap2 = new Bitmap(width, this.ftDeclaration.Height);
523 graphics = Graphics.FromImage(bitmap2);
524 graphics.DrawString("DTXManiaXG(verK) ver 2.22 based on DTXMania", this.ftDeclaration, Brushes.White, (float)0f, (float)0f);
525 graphics.Dispose();
526 this.txCredit = new CTexture(app.Device, bitmap2, TextureFormat);
527 bitmap2.Dispose();
528 graphics = Graphics.FromImage(image);
529 graphics.PageUnit = GraphicsUnit.Pixel;
530 width = (int)graphics.MeasureString("CREDIT 0", this.ftDeclaration).Width;
531 graphics.Dispose();
532 bitmap2 = new Bitmap(width, this.ftDeclaration.Height);
533 graphics = Graphics.FromImage(bitmap2);
534 graphics.DrawString("CREDIT 0", this.ftDeclaration, Brushes.White, (float)0f, (float)0f);
535 graphics.Dispose();
536 this.txDeclaration = new CTexture(app.Device, bitmap2, TextureFormat);
537 bitmap2.Dispose();
538 }
539
540 }
541 protected override void UnloadContent()
542 {
543 if( this.listトップレベルActivities != null )
544 {
545 foreach( CActivity activity in this.listトップレベルActivities )
546 activity.OnUnmanagedリソスの解放();
547 }
548
549 foreach( STPlugin st in this.listプラグイン )
550 {
551 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
552 st.plugin.OnUnmanagedリソスの解放();
553 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
554 }
555 }
556 protected override void OnExiting( EventArgs e )
557 {
558 CPowerManagement.tEnableMonitorSuspend(); // スリープ抑止状態を解除
559 this.t終了処理();
560 base.OnExiting( e );
561 }
562 protected override void Update( GameTime gameTime )
563 {
564 }
565 protected override void Draw( GameTime gameTime )
566 {
567 Sound管理.t再生中の処理をする();
568
569 if( Timer != null )
570 Timer.t更新();
571
572 if (CSound管理.rc演奏用タイマ != null)
573 CSound管理.rc演奏用タイマ.t更新();
574
575 if( Input管理 != null )
576 Input管理.tリング( this.bApplicationActive, CDTXMania.ConfigIni.bバッファ入力を行う );
577
578 if( FPS != null )
579 FPS.tカウンタ更新();
580
581 //if( Pad != null ) ポーリング時にクリアしたらダメ!曲の開始時に1回だけクリアする。(2010.9.11)
582 // Pad.st検知したデバイス.Clear();
583
584 if( this.Device == null )
585 return;
586
587 if (this.bApplicationActive) // DTXMania本体起動中の本体/モニタの省電力モード移行を抑止
588 CPowerManagement.tDisableMonitorSuspend();
589
590 this.Device.BeginScene();
591 this.Device.Clear(ClearFlags.ZBuffer | ClearFlags.Target, Color.Black, 1f, 0);
592
593 if( r現在のステ != null )
594 {
595 this.n進行描画の戻り値 = ( r現在のステ != null ) ? r現在のステ.On進行描画() : 0;
596
597 #region [ プラグインの進行描画 ]
598 //---------------------
599 foreach( STPlugin sp in this.listプラグイン )
600 {
601 Directory.SetCurrentDirectory( sp.strプラグインフォルダ );
602
603 if( CDTXMania.act現在入力を占有中のプラグイン == null || CDTXMania.act現在入力を占有中のプラグイン == sp.plugin )
604 sp.plugin.On進行描画( CDTXMania.Pad, CDTXMania.Input管理.Keyboard );
605 else
606 sp.plugin.On進行描画( null, null );
607
608 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
609 }
610 //---------------------
611 #endregion
612
613
614 CScoreIni scoreIni = null;
615
616 #region [ 曲検索スレッドの起動/終了 ] // ここに"Enumerating Songs..."表示を集約
617 if (!CDTXMania.bコンパクトモ)
618 {
619 actEnumSongs.On進行描画(); // "Enumerating Songs..."アイコンの描画
620 } // "Enumerating Songs..."アイコンの描画
621 switch ( r現在のステ.eステID )
622 {
623 case CStage.Eステ.タイトル:
624 case CStage.Eステ.コンフィグ:
625 case CStage.Eステ.オプション:
626 case CStage.Eステ.選曲:
627 case CStage.Eステ.曲読み込み:
628 if ( EnumSongs != null )
629 {
630 #region [ (特定条件時) 曲検索スレッドの起動・開始 ]
631 if ( r現在のステ.eステID == CStage.Eステ.タイトル &&
632 r直前のステ.eステID == CStage.Eステ.起動 &&
633 this.n進行描画の戻り値 == (int) CStageタイトル.E戻り値.継続 &&
634 !EnumSongs.IsSongListEnumStarted )
635 {
636 actEnumSongs.On活性化();
637 CDTXMania.stage選曲.bIsEnumeratingSongs = true;
638 EnumSongs.Init( CDTXMania.Songs管理.listSongsDB, CDTXMania.Songs管理.nSongsDBから取得できたスコア数 ); // songs.db情報と、取得した曲数を、新インスタンスにも与える
639 EnumSongs.StartEnumFromDisk(); // 曲検索スレッドの起動・開始
640 if ( CDTXMania.Songs管理.nSongsDBから取得できたスコア数 == 0 ) // もし初回起動なら、検索スレッドのプライオリティをLowestでなくNormalにする
641 {
642 EnumSongs.ChangeEnumeratePriority( ThreadPriority.Normal );
643 }
644 }
645 #endregion
646
647 #region [ 曲検索の中断と再開 ]
648 if ( r現在のステ.eステID == CStage.Eステ.選曲 && !EnumSongs.IsSongListEnumCompletelyDone )
649 {
650 switch ( this.n進行描画の戻り値 )
651 {
652 case 0: // 何もない
653 //if ( CDTXMania.stage選曲.bIsEnumeratingSongs )
654 if ( !CDTXMania.stage選曲.bIsPlayingPremovie )
655 {
656 EnumSongs.Resume(); // #27060 2012.2.6 yyagi 中止していたバックグランド曲検索を再開
657 EnumSongs.IsSlowdown = false;
658 }
659 else
660 {
661 // EnumSongs.Suspend(); // #27060 2012.3.2 yyagi #PREMOVIE再生中は曲検索を低速化
662 EnumSongs.IsSlowdown = true;
663 }
664 actEnumSongs.On活性化();
665 break;
666
667 case 2: // 曲決定
668 EnumSongs.Suspend(); // #27060 バックグラウンドの曲検索を一時停止
669 actEnumSongs.On非活性化();
670 break;
671 }
672 }
673 #endregion
674
675 #region [ 曲探索中断待ち待機 ]
676 if ( r現在のステ.eステID == CStage.Eステ.曲読み込み && !EnumSongs.IsSongListEnumCompletelyDone &&
677 EnumSongs.thDTXFileEnumerate != null ) // #28700 2012.6.12 yyagi; at Compact mode, enumerating thread does not exist.
678 {
679 EnumSongs.WaitUntilSuspended(); // 念のため、曲検索が一時中断されるまで待機
680 }
681 #endregion
682
683 #region [ 曲検索が完了したら、実際の曲リストに反映する ]
684 // CStage選曲.On活性化() に回した方がいいかな?
685 if ( EnumSongs.IsSongListEnumerated )
686 {
687 actEnumSongs.On非活性化();
688 CDTXMania.stage選曲.bIsEnumeratingSongs = false;
689
690 bool bRemakeSongTitleBar = ( r現在のステ.eステID == CStage.Eステ.選曲 ) ? true : false;
691 CDTXMania.stage選曲.Refresh( EnumSongs.Songs管理, bRemakeSongTitleBar );
692 EnumSongs.SongListEnumCompletelyDone();
693 }
694 #endregion
695 }
696 break;
697 }
698 #endregion
699
700 switch ( r現在のステ.eステID )
701 {
702 case CStage.Eステ.何もしない:
703 break;
704
705 case CStage.Eステ.起動:
706 #region [ *** ]
707 //-----------------------------
708 if( this.n進行描画の戻り値 != 0 )
709 {
710 if( !bコンパクトモ )
711 {
712 r現在のステ.On非活性化();
713 Trace.TraceInformation( "----------------------" );
714 Trace.TraceInformation( "■ タイトル" );
715 stageタイトル.On活性化();
716 r直前のステ = r現在のステ;
717 r現在のステ = stageタイトル;
718 }
719 else
720 {
721 r現在のステ.On非活性化();
722 Trace.TraceInformation( "----------------------" );
723 Trace.TraceInformation( "■ 曲読み込み" );
724 stage曲読み込み.On活性化();
725 r直前のステ = r現在のステ;
726 r現在のステ = stage曲読み込み;
727
728 }
729 foreach( STPlugin pg in this.listプラグイン )
730 {
731 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
732 pg.plugin.Onステジ変更();
733 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
734 }
735
736 this.tガベジコレクションを実行する();
737 }
738 //-----------------------------
739 #endregion
740 break;
741
742 case CStage.Eステ.タイトル:
743 #region [ *** ]
744 //-----------------------------
745 switch( this.n進行描画の戻り値 )
746 {
747 case (int)CStageタイトル.E戻り値.GAMESTART:
748 #region [ 選曲処理へ ]
749 //-----------------------------
750 r現在のステ.On非活性化();
751 Trace.TraceInformation( "----------------------" );
752 Trace.TraceInformation( "■ 選曲" );
753 stage選曲.On活性化();
754 r直前のステ = r現在のステ;
755 r現在のステ = stage選曲;
756 //-----------------------------
757 #endregion
758 break;
759
760 #region [ OPTION: 廃止済 ]
761 /*
762 case 2: // #24525 OPTIONとCONFIGの統合に伴い、OPTIONは廃止
763 #region [ *** ]
764 //-----------------------------
765 r現在のステージ.On非活性化();
766 Trace.TraceInformation( "----------------------" );
767 Trace.TraceInformation( "■ オプション" );
768 stageオプション.On活性化();
769 r直前のステージ = r現在のステージ;
770 r現在のステージ = stageオプション;
771 //-----------------------------
772 #endregion
773 break;
774 */
775 #endregion
776
777 case (int)CStageタイトル.E戻り値.CONFIG:
778 #region [ *** ]
779 //-----------------------------
780 r現在のステ.On非活性化();
781 Trace.TraceInformation( "----------------------" );
782 Trace.TraceInformation( "■ コンフィグ" );
783 stageコンフィグ.On活性化();
784 r直前のステ = r現在のステ;
785 r現在のステ = stageコンフィグ;
786 //-----------------------------
787 #endregion
788 break;
789
790 case (int)CStageタイトル.E戻り値.EXIT:
791 #region [ *** ]
792 //-----------------------------
793 r現在のステ.On非活性化();
794 Trace.TraceInformation( "----------------------" );
795 Trace.TraceInformation( "■ 終了" );
796 stage終了.On活性化();
797 r直前のステ = r現在のステ;
798 r現在のステ = stage終了;
799 //-----------------------------
800 #endregion
801 break;
802 }
803
804 foreach( STPlugin pg in this.listプラグイン )
805 {
806 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
807 pg.plugin.Onステジ変更();
808 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
809 }
810
811 this.tガベジコレクションを実行する();
812 //-----------------------------
813 #endregion
814 break;
815
816
817 case CStage.Eステ.オプション:
818 #region [ *** ]
819 //-----------------------------
820 if( this.n進行描画の戻り値 != 0 )
821 {
822 switch( r直前のステ.eステID )
823 {
824 case CStage.Eステ.タイトル:
825 #region [ *** ]
826 //-----------------------------
827 r現在のステ.On非活性化();
828 Trace.TraceInformation( "----------------------" );
829 Trace.TraceInformation( "■ タイトル" );
830 stageタイトル.On活性化();
831 r直前のステ = r現在のステ;
832 r現在のステ = stageタイトル;
833
834 foreach( STPlugin pg in this.listプラグイン )
835 {
836 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
837 pg.plugin.Onステジ変更();
838 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
839 }
840
841 this.tガベジコレクションを実行する();
842 break;
843 //-----------------------------
844 #endregion
845
846 case CStage.Eステ.選曲:
847 #region [ *** ]
848 //-----------------------------
849 r現在のステ.On非活性化();
850 Trace.TraceInformation( "----------------------" );
851 Trace.TraceInformation( "■ 選曲" );
852 stage選曲.On活性化();
853 r直前のステ = r現在のステ;
854 r現在のステ = stage選曲;
855
856 foreach( STPlugin pg in this.listプラグイン )
857 {
858 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
859 pg.plugin.Onステジ変更();
860 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
861 }
862
863 this.tガベジコレクションを実行する();
864 break;
865 //-----------------------------
866 #endregion
867 }
868 }
869 //-----------------------------
870 #endregion
871 break;
872
873
874 case CStage.Eステ.コンフィグ:
875 #region [ *** ]
876 //-----------------------------
877 if( this.n進行描画の戻り値 != 0 )
878 {
879 switch( r直前のステ.eステID )
880 {
881 case CStage.Eステ.タイトル:
882 #region [ *** ]
883 //-----------------------------
884 r現在のステ.On非活性化();
885 Trace.TraceInformation( "----------------------" );
886 Trace.TraceInformation( "■ タイトル" );
887 stageタイトル.On活性化();
888 r直前のステ = r現在のステ;
889 r現在のステ = stageタイトル;
890
891 foreach( STPlugin pg in this.listプラグイン )
892 {
893 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
894 pg.plugin.Onステジ変更();
895 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
896 }
897
898 this.tガベジコレクションを実行する();
899 break;
900 //-----------------------------
901 #endregion
902
903 case CStage.Eステ.選曲:
904 #region [ *** ]
905 //-----------------------------
906 r現在のステ.On非活性化();
907 Trace.TraceInformation( "----------------------" );
908 Trace.TraceInformation( "■ 選曲" );
909 stage選曲.On活性化();
910 r直前のステ = r現在のステ;
911 r現在のステ = stage選曲;
912
913 foreach( STPlugin pg in this.listプラグイン )
914 {
915 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
916 pg.plugin.Onステジ変更();
917 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
918 }
919
920 this.tガベジコレクションを実行する();
921 break;
922 //-----------------------------
923 #endregion
924 }
925 }
926 //-----------------------------
927 #endregion
928 break;
929
930 case CStage.Eステ.選曲:
931 #region [ *** ]
932 //-----------------------------
933 switch( this.n進行描画の戻り値 )
934 {
935 case (int) CStage選曲.E戻り値.タイトルに戻る:
936 #region [ *** ]
937 //-----------------------------
938 r現在のステ.On非活性化();
939 Trace.TraceInformation( "----------------------" );
940 Trace.TraceInformation( "■ タイトル" );
941 stageタイトル.On活性化();
942 r直前のステ = r現在のステ;
943 r現在のステ = stageタイトル;
944
945 foreach( STPlugin pg in this.listプラグイン )
946 {
947 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
948 pg.plugin.Onステジ変更();
949 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
950 }
951
952 this.tガベジコレクションを実行する();
953 break;
954 //-----------------------------
955 #endregion
956
957 case (int) CStage選曲.E戻り値.選曲した:
958 #region [ *** ]
959 //-----------------------------
960 r現在のステ.On非活性化();
961 Trace.TraceInformation( "----------------------" );
962 Trace.TraceInformation( "■ 曲読み込み" );
963 stage曲読み込み.On活性化();
964 r直前のステ = r現在のステ;
965 r現在のステ = stage曲読み込み;
966
967 foreach( STPlugin pg in this.listプラグイン )
968 {
969 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
970 pg.plugin.Onステジ変更();
971 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
972 }
973
974 this.tガベジコレクションを実行する();
975 break;
976 //-----------------------------
977 #endregion
978
979
980 case (int) CStage選曲.E戻り値.オプション呼び出し:
981 #region [ *** ]
982 //-----------------------------
983
984 r現在のステ.On非活性化();
985 Trace.TraceInformation( "----------------------" );
986 Trace.TraceInformation( "■ オプション" );
987 stageオプション.On活性化();
988 r直前のステ = r現在のステ;
989 r現在のステ = stageオプション;
990
991 foreach( STPlugin pg in this.listプラグイン )
992 {
993 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
994 pg.plugin.Onステジ変更();
995 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
996 }
997
998 this.tガベジコレクションを実行する();
999 break;
1000 //-----------------------------
1001 #endregion
1002
1003 case (int) CStage選曲.E戻り値.コンフィグ呼び出し:
1004 #region [ *** ]
1005 //-----------------------------
1006 r現在のステ.On非活性化();
1007 Trace.TraceInformation( "----------------------" );
1008 Trace.TraceInformation( "■ コンフィグ" );
1009 stageコンフィグ.On活性化();
1010 r直前のステ = r現在のステ;
1011 r現在のステ = stageコンフィグ;
1012
1013 foreach( STPlugin pg in this.listプラグイン )
1014 {
1015 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1016 pg.plugin.Onステジ変更();
1017 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1018 }
1019
1020 this.tガベジコレクションを実行する();
1021 break;
1022 //-----------------------------
1023 #endregion
1024
1025 case (int) CStage選曲.E戻り値.スキン変更:
1026
1027 #region [ *** ]
1028 //-----------------------------
1029 r現在のステ.On非活性化();
1030 Trace.TraceInformation( "----------------------" );
1031 Trace.TraceInformation( "■ スキン切り替え" );
1032 stageChangeSkin.On活性化();
1033 r直前のステ = r現在のステ;
1034 r現在のステ = stageChangeSkin;
1035 break;
1036 //-----------------------------
1037 #endregion
1038 }
1039 //-----------------------------
1040 #endregion
1041 break;
1042
1043 case CStage.Eステ.曲読み込み:
1044 #region [ *** ]
1045 //-----------------------------
1046 if( this.n進行描画の戻り値 != 0 )
1047 {
1048 CDTXMania.Pad.st検知したデバイス.Clear(); // 入力デバイスフラグクリア(2010.9.11)
1049
1050 r現在のステ.On非活性化();
1051 //#if dshow
1052 stage演奏ドラム画面.actFOStageClear.On活性化(CDTXMania.app.Device);
1053 //#endif
1054 if( !ConfigIni.bギタレボモ )
1055 {
1056 Trace.TraceInformation( "----------------------" );
1057 Trace.TraceInformation( "■ 演奏(ドラム画面)" );
1058 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
1059 for (int i = 0; i < 5; i++)
1060 {
1061 for (int j = 0; j < 2; j++)
1062 {
1063 stage演奏ドラム画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
1064 }
1065 }
1066 for (int i = 0; i < 3; i++) {
1067 stage演奏ドラム画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
1068 }
1069 #endif
1070 r直前のステ = r現在のステ;
1071 r現在のステ = stage演奏ドラム画面;
1072 }
1073 else
1074 {
1075 Trace.TraceInformation( "----------------------" );
1076 Trace.TraceInformation( "■ 演奏(ギター画面)" );
1077 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
1078 for (int i = 0; i < 5; i++)
1079 {
1080 for (int j = 0; j < 2; j++)
1081 {
1082 stage演奏ギタ画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
1083 }
1084 }
1085 for (int i = 0; i < 3; i++) {
1086 stage演奏ギタ画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
1087 }
1088 #endif
1089 r直前のステ = r現在のステ;
1090 r現在のステ = stage演奏ギタ画面;
1091 }
1092
1093 foreach( STPlugin pg in this.listプラグイン )
1094 {
1095 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1096 pg.plugin.Onステジ変更();
1097 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1098 }
1099
1100 this.tガベジコレクションを実行する();
1101 }
1102 //-----------------------------
1103 #endregion
1104 break;
1105
1106 case CStage.Eステ.演奏:
1107 #region [ *** ]
1108 //-----------------------------
1109 switch( this.n進行描画の戻り値 )
1110 {
1111 case (int) E演奏画面の戻り値.継続:
1112 break;
1113
1114 case (int) E演奏画面の戻り値.演奏中断:
1115 #region [ 演奏キャンセル ]
1116 //-----------------------------
1117 scoreIni = this.tScoreIniBGMAdjustHistoryPlayCountを更新( "Play canceled" );
1118
1119 #region [ プラグイン On演奏キャンセル() の呼び出し ]
1120 //---------------------
1121 foreach( STPlugin pg in this.listプラグイン )
1122 {
1123 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1124 pg.plugin.On演奏キャンセル( scoreIni );
1125 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1126 }
1127 //---------------------
1128 #endregion
1129
1130 DTX.t全チップの再生停止();
1131 DTX.On非活性化();
1132 r現在のステ.On非活性化();
1133 if( bコンパクトモ )
1134 {
1135 base.Window.Close();
1136 }
1137 else
1138 {
1139 Trace.TraceInformation( "----------------------" );
1140 Trace.TraceInformation( "■ 選曲" );
1141 stage選曲.On活性化();
1142 r直前のステ = r現在のステ;
1143 r現在のステ = stage選曲;
1144
1145 #region [ プラグイン Onステージ変更() の呼び出し ]
1146 //---------------------
1147 foreach( STPlugin pg in this.listプラグイン )
1148 {
1149 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1150 pg.plugin.Onステジ変更();
1151 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1152 }
1153 //---------------------
1154 #endregion
1155
1156 this.tガベジコレクションを実行する();
1157 }
1158 break;
1159 //-----------------------------
1160 #endregion
1161
1162 case (int) E演奏画面の戻り値.ステジ失敗:
1163 #region [ 演奏失敗(StageFailed) ]
1164 //-----------------------------
1165 scoreIni = this.tScoreIniBGMAdjustHistoryPlayCountを更新( "Stage failed" );
1166
1167 #region [ プラグイン On演奏失敗() の呼び出し ]
1168 //---------------------
1169 foreach( STPlugin pg in this.listプラグイン )
1170 {
1171 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1172 pg.plugin.On演奏失敗( scoreIni );
1173 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1174 }
1175 //---------------------
1176 #endregion
1177
1178 DTX.t全チップの再生停止();
1179 DTX.On非活性化();
1180 r現在のステ.On非活性化();
1181 if( bコンパクトモ )
1182 {
1183 base.Window.Close();
1184 }
1185 else
1186 {
1187 Trace.TraceInformation( "----------------------" );
1188 Trace.TraceInformation( "■ 選曲" );
1189 stage選曲.On活性化();
1190 r直前のステ = r現在のステ;
1191 r現在のステ = stage選曲;
1192
1193 #region [ プラグイン Onステージ変更() の呼び出し ]
1194 //---------------------
1195 foreach( STPlugin pg in this.listプラグイン )
1196 {
1197 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1198 pg.plugin.Onステジ変更();
1199 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1200 }
1201 //---------------------
1202 #endregion
1203
1204 this.tガベジコレクションを実行する();
1205 }
1206 break;
1207 //-----------------------------
1208 #endregion
1209
1210 case (int) E演奏画面の戻り値.ステジクリア:
1211 #region [ 演奏クリア ]
1212 //-----------------------------
1213 CScoreIni.C演奏記録 c演奏記録_Drums, c演奏記録_Guitar, c演奏記録_Bass;
1214 CDTX.CChip[] chipArray = new CDTX.CChip[10];
1215 if( ConfigIni.bギタレボモ )
1216 {
1217 stage演奏ギタ画面.t演奏結果を格納する( out c演奏記録_Drums, out c演奏記録_Guitar, out c演奏記録_Bass );
1218 }
1219 else
1220 {
1221 stage演奏ドラム画面.t演奏結果を格納する( out c演奏記録_Drums, out c演奏記録_Guitar, out c演奏記録_Bass, out chipArray );
1222 }
1223
1224 if ( CDTXMania.ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.24 yyagi Gt/Bsを入れ替えていたなら、演奏結果も入れ替える
1225 {
1226 CScoreIni.C演奏記録 t;
1227 t = c演奏記録_Guitar;
1228 c演奏記録_Guitar = c演奏記録_Bass;
1229 c演奏記録_Bass = t;
1230
1231 CDTXMania.DTX.SwapGuitarBassInfos(); // 譜面情報も元に戻す
1232 CDTXMania.ConfigIni.SwapGuitarBassInfos_AutoFlags(); // #24415 2011.2.27 yyagi
1233 // リザルト集計時のみ、Auto系のフラグも元に戻す。
1234 // これを戻すのは、リザルト集計後。
1235 } // "case CStage.Eステージ.結果:"のところ。
1236
1237 double ps = 0.0, gs = 0.0;
1238 if ( !c演奏記録_Drums.bAUTOである && c演奏記録_Drums.n全チップ数 > 0) {
1239 ps = c演奏記録_Drums.db演奏型スキル値;
1240 gs = c演奏記録_Drums.dbム型スキル値;
1241 }
1242 else if ( !c演奏記録_Guitar.bAUTOである && c演奏記録_Guitar.n全チップ数 > 0) {
1243 ps = c演奏記録_Guitar.db演奏型スキル値;
1244 gs = c演奏記録_Guitar.dbム型スキル値;
1245 }
1246 else
1247 {
1248 ps = c演奏記録_Bass.db演奏型スキル値;
1249 gs = c演奏記録_Bass.dbム型スキル値;
1250 }
1251 string str = "Cleared";
1252 switch( CScoreIni.t総合ランク値を計算して返す( c演奏記録_Drums, c演奏記録_Guitar, c演奏記録_Bass ) )
1253 {
1254 case (int)CScoreIni.ERANK.SS:
1255 str = string.Format( "Cleared (SS: {0:F2})", ps );
1256 break;
1257
1258 case (int) CScoreIni.ERANK.S:
1259 str = string.Format( "Cleared (S: {0:F2})", ps );
1260 break;
1261
1262 case (int) CScoreIni.ERANK.A:
1263 str = string.Format( "Cleared (A: {0:F2})", ps );
1264 break;
1265
1266 case (int) CScoreIni.ERANK.B:
1267 str = string.Format( "Cleared (B: {0:F2})", ps );
1268 break;
1269
1270 case (int) CScoreIni.ERANK.C:
1271 str = string.Format( "Cleared (C: {0:F2})", ps );
1272 break;
1273
1274 case (int) CScoreIni.ERANK.D:
1275 str = string.Format( "Cleared (D: {0:F2})", ps );
1276 break;
1277
1278 case (int) CScoreIni.ERANK.E:
1279 str = string.Format( "Cleared (E: {0:F2})", ps );
1280 break;
1281
1282 case (int)CScoreIni.ERANK.UNKNOWN: // #23534 2010.10.28 yyagi add: 演奏チップが0個のとき
1283 str = "Cleared (No chips)";
1284 break;
1285 }
1286
1287 scoreIni = this.tScoreIniBGMAdjustHistoryPlayCountを更新( str );
1288
1289 #region [ プラグイン On演奏クリア() の呼び出し ]
1290 //---------------------
1291 foreach( STPlugin pg in this.listプラグイン )
1292 {
1293 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1294 pg.plugin.On演奏クリア( scoreIni );
1295 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1296 }
1297 //---------------------
1298 #endregion
1299
1300 r現在のステ.On非活性化();
1301 Trace.TraceInformation( "----------------------" );
1302 Trace.TraceInformation( "■ 結果" );
1303 stage結果.st演奏記録.Drums = c演奏記録_Drums;
1304 stage結果.st演奏記録.Guitar = c演奏記録_Guitar;
1305 stage結果.st演奏記録.Bass = c演奏記録_Bass;
1306 stage結果.r空うちドラムチップ = chipArray;
1307 stage結果.On活性化();
1308 r直前のステ = r現在のステ;
1309 r現在のステ = stage結果;
1310
1311 #region [ プラグイン Onステージ変更() の呼び出し ]
1312 //---------------------
1313 foreach( STPlugin pg in this.listプラグイン )
1314 {
1315 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1316 pg.plugin.Onステジ変更();
1317 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1318 }
1319 //---------------------
1320 #endregion
1321
1322 break;
1323 //-----------------------------
1324 #endregion
1325 }
1326 //-----------------------------
1327 #endregion
1328 break;
1329
1330 case CStage.Eステ.結果:
1331 #region [ *** ]
1332 //-----------------------------
1333 if( this.n進行描画の戻り値 != 0 )
1334 {
1335 if ( CDTXMania.ConfigIni.bIsSwappedGuitarBass ) // #24415 2011.2.27 yyagi Gt/Bsを入れ替えていたなら、Auto状態をリザルト画面終了後に元に戻す
1336 {
1337 CDTXMania.ConfigIni.SwapGuitarBassInfos_AutoFlags(); // Auto入れ替え
1338 }
1339
1340 DTX.t全チップの再生一時停止();
1341 DTX.On非活性化();
1342 r現在のステ.On非活性化();
1343 if( !bコンパクトモ )
1344 {
1345 Trace.TraceInformation( "----------------------" );
1346 Trace.TraceInformation( "■ 選曲" );
1347 stage選曲.On活性化();
1348 r直前のステ = r現在のステ;
1349 r現在のステ = stage選曲;
1350
1351 foreach( STPlugin pg in this.listプラグイン )
1352 {
1353 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1354 pg.plugin.Onステジ変更();
1355 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1356 }
1357
1358 this.tガベジコレクションを実行する();
1359 }
1360 else
1361 {
1362 base.Window.Close();
1363 }
1364 }
1365 //-----------------------------
1366 #endregion
1367 break;
1368
1369 case CStage.Eステ.ChangeSkin:
1370 #region [ *** ]
1371 //-----------------------------
1372 if ( this.n進行描画の戻り値 != 0 )
1373 {
1374 r現在のステ.On非活性化();
1375 Trace.TraceInformation( "----------------------" );
1376 Trace.TraceInformation( "■ 選曲" );
1377 stage選曲.On活性化();
1378 r直前のステ = r現在のステ;
1379 r現在のステ = stage選曲;
1380 this.tガベジコレクションを実行する();
1381 }
1382 //-----------------------------
1383 #endregion
1384 break;
1385
1386 case CStage.Eステ.終了:
1387 #region [ *** ]
1388 //-----------------------------
1389 if( this.n進行描画の戻り値 != 0 )
1390 {
1391 base.Exit();
1392 }
1393 //-----------------------------
1394 #endregion
1395 break;
1396 }
1397 }
1398 if (ConfigIni.クレジットを表示する == true)
1399 {
1400 this.txDeclaration.t2D描画(this.Device, 472, 694);
1401 if ((r現在のステ.eステID == CStage.Eステ.タイトル) || (r現在のステ.eステID == CStage.Eステ.終了))
1402 {
1403 this.txCredit.t2D描画(this.Device, (1280 - this.txCredit.sz画像サイズ.Width) - 20, 700);
1404 }
1405 }
1406 this.Device.EndScene();
1407 //actFlushGPU.On進行描画(); // Flush GPU
1408
1409 #region [ 全画面・ウインドウ切り替え ]
1410 if ( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )
1411 {
1412 ConfigIni.b全画面モ = !ConfigIni.b全画面モ;
1413 app.t全画面・ウィンドウモド切り替え();
1414 this.b次のタイミングで全画面・ウィンドウ切り替えを行う = false;
1415 }
1416 #endregion
1417 #region [ 垂直基線同期切り替え ]
1418 if ( this.b次のタイミングで垂直帰線同期切り替えを行う )
1419 {
1420 bool bIsMaximized = this.Window.IsMaximized; // #23510 2010.11.3 yyagi: to backup current window mode before changing VSyncWait
1421 currentClientSize = this.Window.ClientSize; // #23510 2010.11.3 yyagi: to backup current window size before changing VSyncWait
1422 DeviceSettings currentSettings = app.GraphicsDeviceManager.CurrentSettings;
1423 currentSettings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
1424 app.GraphicsDeviceManager.ChangeDevice( currentSettings );
1425 this.b次のタイミングで垂直帰線同期切り替えを行う = false;
1426 base.Window.ClientSize = new Size(currentClientSize.Width, currentClientSize.Height); // #23510 2010.11.3 yyagi: to resume window size after changing VSyncWait
1427 if (bIsMaximized)
1428 {
1429 this.Window.WindowState = FormWindowState.Maximized; // #23510 2010.11.3 yyagi: to resume window mode after changing VSyncWait
1430 }
1431 }
1432 #endregion
1433 #region [ スリープ ]
1434 if ( ConfigIni.nフレム毎スリms >= 0 ) // #xxxxx 2011.11.27 yyagi
1435 {
1436 Thread.Sleep( ConfigIni.nフレム毎スリms );
1437 }
1438 #endregion
1439 }
1440 /// <summary>
1441 /// <para>ここには、対応するイベントハンドラのないイベントをハンドルするコードを書く。</para>
1442 /// </summary>
1443 protected void WndProc( ref Message m )
1444 {
1445 #region [ WM_COPYDATA: 二重起動された StrokeStyleT.exe からコマンドライン行が送られてきたら、それを取得してアクション実行予約を行う。]
1446 //-----------------
1447 if( m.Msg == CWin32.WM_COPYDATA )
1448 {
1449 // コマンドライン行を取得。
1450 var copyData = (CWin32.COPYDATA) m.GetLParam( (new CWin32.COPYDATA()).GetType() );
1451
1452 // コマンドライン登録(アクション実行予約)
1453 //Global.PlayerMode.arrayコマンドライン = null;
1454 //if( copyData.cbData > 0 )
1455 // Global.PlayerMode.arrayコマンドライン = copyData.lpData.Split( new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries );
1456 }
1457 //-----------------
1458 #endregion
1459 #region [ WM_DSGRAPHNOTIFY: DirectShow グラフからのイベントを受信し、処理を行う。]
1460 //-----------------
1461 else if( m.Msg == CDirectShow.WM_DSGRAPHNOTIFY )
1462 {
1463 int nインスタンスID = m.LParam.ToInt32();
1464 CDirectShow dsイベント発信者 = null;
1465 bool b発信者が背景動画である = false;
1466
1467 #region [ イベント発信者(CDirectShow) を特定する。]
1468 //-----------------
1469 // このインスタンスID は、今のところ以下のいずれかである。
1470 // ・背景動画
1471 // ・仮想ドラムキット
1472 // なので、これらを順に見ていって、イベント発信者を特定する。
1473 dsイベント発信者 = CDirectShow.tインスタンスを返す( nインスタンスID );
1474 b発信者が背景動画である = false;
1475 //-----------------
1476 #endregion
1477
1478 if( dsイベント発信者 == null )
1479 return; // 特定に失敗したら無視。
1480
1481 #region [ イベント発信者からすべてのイベントを受け取り、処理する。]
1482 //-----------------
1483 IMediaEventEx mediaEventEx = dsイベント発信者.MediaEventEx;
1484
1485 if( mediaEventEx == null )
1486 return; // 既に DirectShow の終了処理が始まっている場合は何もしない。
1487
1488 // この辺りの処理の参考URL:
1489 // http://msdn.microsoft.com/ja-jp/library/cc370589.aspx
1490
1491 EventCode eventCode;
1492 IntPtr param1, param2;
1493 while( mediaEventEx.GetEvent( out eventCode, out param1, out param2, 0 ) == CWin32.S_OK ) // イベントがなくなるまで
1494 {
1495 // イベント処理。
1496
1497 if( eventCode == EventCode.Complete )
1498 {
1499 #region [ 再生完了 ]
1500 //-----------------
1501 if( dsイベント発信者.bプ再生 )
1502 {
1503 if( dsイベント発信者.bプ再生 ) // ループ指定ありなら
1504 dsイベント発信者.t再生位置を変更( 0.0 ); // すぐ再生開始。
1505 }
1506 else
1507 {
1508 if( b発信者が背景動画である )
1509 {
1510 dsイベント発信者.b再生中 = false;
1511 dsイベント発信者.t再生停止(); // 背景動画は終了しても巻き戻さない。
1512 }
1513 else
1514 {
1515 dsイベント発信者.b再生中 = false;
1516 dsイベント発信者.t再生停止();
1517 dsイベント発信者.t再生位置を変更( 0.0 ); // 再生完了しても再生は続くので、先頭に戻して
1518 dsイベント発信者.t再生準備開始(); // 次の再生に備えて準備しておく。
1519 }
1520 }
1521 //-----------------
1522 #endregion
1523 }
1524
1525 // イベントを解放。
1526
1527 mediaEventEx.FreeEventParams( eventCode, param1, param2 );
1528 }
1529 //-----------------
1530 #endregion
1531 }
1532 //-----------------
1533 #endregion
1534 #region [ WM_CLOSE: 終了指示フラグを立てる。立てるだけ。]
1535 //-----------------
1536 if( m.Msg == CWin32.WM_CLOSE )
1537 {
1538 CDTXMania.App.bWM_CLOSEを受け取った = true;
1539 return;
1540 }
1541 //-----------------
1542 #endregion
1543
1544 WndProc( ref m );
1545 }
1546
1547
1548 // その他
1549
1550 #region [ 汎用ヘルパー ]
1551 //-----------------
1552 public static CTexture tテクスチャの生成( string fileName )
1553 {
1554 return tテクスチャの生成( fileName, false );
1555 }
1556 public static CTexture tテクスチャの生成( string fileName, bool b黒を透過する )
1557 {
1558 if ( app == null )
1559 {
1560 return null;
1561 }
1562 try
1563 {
1564 return new CTexture( app.Device, fileName, TextureFormat, b黒を透過する );
1565 }
1566 catch ( CTextureCreateFailedException )
1567 {
1568 Trace.TraceError( "テクスチャの生成に失敗しました。({0})", fileName );
1569 return null;
1570 }
1571 catch ( FileNotFoundException )
1572 {
1573 Trace.TraceError( "テクスチャファイルが見つかりませんでした。({0})", fileName );
1574 return null;
1575 }
1576 }
1577 public static void tテクスチャの解放( ref CTexture tx )
1578 {
1579 CDTXMania.t安全にDisposeする( ref tx );
1580 }
1581
1582 public static CTexture tテクスチャの生成( byte[] txData )
1583 {
1584 return tテクスチャの生成( txData, false );
1585 }
1586 public static CTexture tテクスチャの生成( byte[] txData, bool b黒を透過する )
1587 {
1588 if ( app == null )
1589 {
1590 return null;
1591 }
1592 try
1593 {
1594 return new CTexture( app.Device, txData, TextureFormat, b黒を透過する );
1595 }
1596 catch ( CTextureCreateFailedException )
1597 {
1598 Trace.TraceError( "テクスチャの生成に失敗しました。(txData)" );
1599 return null;
1600 }
1601 }
1602
1603 public static CTexture tテクスチャの生成( Bitmap bitmap )
1604 {
1605 return tテクスチャの生成( bitmap, false );
1606 }
1607 public static CTexture tテクスチャの生成( Bitmap bitmap, bool b黒を透過する )
1608 {
1609 if ( app == null )
1610 {
1611 return null;
1612 }
1613 try
1614 {
1615 return new CTexture( app.Device, bitmap, TextureFormat, b黒を透過する );
1616 }
1617 catch ( CTextureCreateFailedException )
1618 {
1619 Trace.TraceError( "テクスチャの生成に失敗しました。(txData)" );
1620 return null;
1621 }
1622 }
1623
1624 public static CTexture tテクスチャを生成する(int width, int height)
1625 {
1626 try
1627 {
1628 return new CTexture(CDTXMania.App.D3D9Device, width, height, CDTXMania.TextureFormat);
1629 }
1630 catch
1631 {
1632 Trace.TraceError("空のテクスチャ({0}x{1})の生成に失敗しました。", width, height);
1633 return null;
1634 }
1635 }
1636
1637
1638 public static CDirectShow t失敗してもスキップ可能なDirectShowを生成する(string fileName, IntPtr hWnd, bool bディオレンダラなし)
1639 {
1640 CDirectShow ds = null;
1641 try
1642 {
1643 ds = new CDirectShow(fileName, hWnd, bディオレンダラなし);
1644 }
1645 catch (FileNotFoundException)
1646 {
1647 Trace.TraceError("動画ファイルが見つかりませんでした。({0})", fileName);
1648 ds = null; // Dispose はコンストラクタ内で実施済み
1649 }
1650 catch
1651 {
1652 Trace.TraceError("DirectShow の生成に失敗しました。[{0}]", fileName);
1653 ds = null; // Dispose はコンストラクタ内で実施済み
1654 }
1655
1656 return ds;
1657 }
1658
1659 /// <summary>プロパティ、インデクサには ref は使用できないので注意。</summary>
1660 public static void t安全にDisposeする<T>( ref T obj )
1661 {
1662 if ( obj == null )
1663 return;
1664
1665 var d = obj as IDisposable;
1666
1667 if ( d != null )
1668 d.Dispose();
1669
1670 obj = default( T );
1671 }
1672 //-----------------
1673 #endregion
1674 #region [ private ]
1675 //-----------------
1676 private bool bマウスカソル表示中 = true;
1677 public bool bウィンドウがアクティブである = true;
1678 private bool b終了処理完了済み;
1679 private static CDTX dtx;
1680 private List<CActivity> listトップレベルActivities;
1681 public int n進行描画の戻り値;
1682 private CTexture txCredit;
1683 private CTexture txDeclaration;
1684 private System.Drawing.Font ftDeclaration;
1685 private MouseButtons mb = System.Windows.Forms.MouseButtons.Left;
1686 private string strWindowTitle = "";
1687 private volatile Device _D3D9Device = null;
1688
1689 private void t起動処理()
1690 {
1691 #region [ strEXEのあるフォルダを決定する ]
1692 //-----------------
1693 // BEGIN #23629 2010.11.13 from: デバッグ時は Application.ExecutablePath が ($SolutionDir)/bin/x86/Debug/ などになり System/ の読み込みに失敗するので、カレントディレクトリを採用する。(プロジェクトのプロパティ→デバッグ→作業ディレクトリが有効になる)
1694 #if DEBUG
1695 strEXEのあるフォルダ = Environment.CurrentDirectory + @"\";
1696 #else
1697 strEXEのあるフォルダ = Path.GetDirectoryName( Application.ExecutablePath ) + @"\"; // #23629 2010.11.9 yyagi: set correct pathname where DTXManiaGR.exe is.
1698 #endif
1699 // END #23629 2010.11.13 from
1700 //-----------------
1701 #endregion
1702
1703 #region [ Config.ini の読込み ]
1704 //---------------------
1705 ConfigIni = new CConfigIni();
1706 string path = strEXEのあるフォルダ + "Config.ini";
1707 if( File.Exists( path ) )
1708 {
1709 try
1710 {
1711 ConfigIni.tファイルから読み込み( path );
1712 }
1713 catch
1714 {
1715 //ConfigIni = new CConfigIni(); // 存在してなければ新規生成
1716 }
1717 }
1718 this.Window.EnableSystemMenu = CDTXMania.ConfigIni.bIsEnabledSystemMenu; // #28200 2011.5.1 yyagi
1719 // 2012.8.22 Config.iniが無いときに初期値が適用されるよう、この設定行をifブロック外に移動
1720
1721 //---------------------
1722 #endregion
1723 #region [ ログ出力開始 ]
1724 //---------------------
1725 Trace.AutoFlush = true;
1726 if( ConfigIni.bログ出力 )
1727 {
1728 try
1729 {
1730 Trace.Listeners.Add( new CTraceLogListener( new StreamWriter( "DTXManiaLog.txt", false, Encoding.GetEncoding( "shift-jis" ) ) ) );
1731 }
1732 catch ( System.UnauthorizedAccessException ) // #24481 2011.2.20 yyagi
1733 {
1734 int c = (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ja")? 0 : 1;
1735 string[] mes_writeErr = {
1736 "DTXManiaLog.txtへの書き込みができませんでした。書き込みできるようにしてから、再度起動してください。",
1737 "Failed to write DTXManiaLog.txt. Please set it writable and try again."
1738 };
1739 MessageBox.Show( mes_writeErr[c], "DTXMania boot error", MessageBoxButtons.OK, MessageBoxIcon.Error );
1740 Environment.Exit(1);
1741 }
1742 }
1743 Trace.WriteLine("");
1744 Trace.WriteLine( "DTXMania powered by YAMAHA Silent Session Drums" );
1745 Trace.WriteLine( string.Format( "Release: {0}", VERSION ) );
1746 Trace.WriteLine( "" );
1747 Trace.TraceInformation( "----------------------" );
1748 Trace.TraceInformation( "■ アプリケーションの初期化" );
1749 Trace.TraceInformation( "OS Version: " + Environment.OSVersion );
1750 Trace.TraceInformation( "ProcessorCount: " + Environment.ProcessorCount.ToString() );
1751 Trace.TraceInformation( "CLR Version: " + Environment.Version.ToString() );
1752 //---------------------
1753 #endregion
1754 #region [ コンパクトモードスイッチの有無 ]
1755 //---------------------
1756 bコンパクトモ = false;
1757 strコンパクトモドファイル = "";
1758 string[] commandLineArgs = Environment.GetCommandLineArgs();
1759 if( ( commandLineArgs != null ) && ( commandLineArgs.Length > 1 ) )
1760 {
1761 bコンパクトモ = true;
1762 strコンパクトモドファイル = commandLineArgs[ 1 ];
1763 Trace.TraceInformation( "コンパクトモードで起動します。[{0}]", strコンパクトモドファイル );
1764 }
1765 //---------------------
1766 #endregion
1767
1768 #region [ ウィンドウ初期化 ]
1769 //---------------------
1770 this.strWindowTitle = "DTXMania .NET style release " + VERSION;
1771 base.Window.StartPosition = FormStartPosition.Manual; // #30675 2013.02.04 ikanick add
1772 base.Window.Location = new Point(ConfigIni.n初期ウィンドウ開始位置X, ConfigIni.n初期ウィンドウ開始位置Y); // #30675 2013.02.04 ikanick add
1773
1774 base.Window.Text = this.strWindowTitle;
1775 base.Window.ClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight); // #34510 yyagi 2010.10.31 to change window size got from Config.ini
1776 #if !WindowedFullscreen
1777 if (!ConfigIni.bウィンドウモ) // #23510 2010.11.02 yyagi: add; to recover window size in case bootup with fullscreen mode
1778 {
1779 #endif
1780 currentClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight);
1781 #if !WindowedFullscreen
1782 }
1783 #endif
1784 base.Window.MaximizeBox = true; // #23510 2010.11.04 yyagi: to support maximizing window
1785 base.Window.FormBorderStyle = FormBorderStyle.Sizable; // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize
1786 base.Window.ShowIcon = true;
1787 base.Window.Icon = Properties.Resources.dtx;
1788 base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );
1789 base.Window.MouseUp +=new MouseEventHandler( this.Window_MouseUp);
1790 base.Window.MouseDoubleClick += new MouseEventHandler(this.Window_MouseDoubleClick); // #23510 2010.11.13 yyagi: to go fullscreen mode
1791 base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd); // #23510 2010.11.20 yyagi: to set resized window size in Config.ini
1792 base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);
1793 base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
1794 //---------------------
1795 #endregion
1796 #region [ Direct3D9Exを使うかどうか判定 ]
1797 #endregion
1798 #region [ Direct3D9 デバイスの生成 ]
1799 //---------------------
1800 //2013.03.09.kairera0467
1801 //おそらくこれがSSTでいう「tDirect3Dデバイスを生成・変更・リセットする」へ渡す設定に相当しているのだと思われ。
1802 DeviceSettings settings = new DeviceSettings();
1803 CD3DSettings newD3DSettings = new CD3DSettings();
1804 #if WindowedFullscreen
1805 settings.Windowed = true; // #30666 2013.2.2 yyagi: Fullscreenmode is "Maximized window" mode
1806 #else
1807 settings.Windowed = ConfigIni.bウィンドウモ;
1808 #endif
1809 settings.BackBufferWidth = SampleFramework.GameWindowSize.Width;
1810 settings.BackBufferHeight = SampleFramework.GameWindowSize.Height;
1811 // settings.BackBufferCount = 3;
1812 settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
1813 // settings.BackBufferFormat = Format.A8R8G8B8;
1814 // settings.MultisampleType = MultisampleType.FourSamples;
1815 // settings.MultisampleQuality = 4;
1816 // settings.MultisampleType = MultisampleType.None;
1817 // settings.MultisampleQuality = 0;
1818
1819 try
1820 {
1821 base.GraphicsDeviceManager.ChangeDevice(settings);
1822 }
1823 catch (DeviceCreationException e)
1824 {
1825 Trace.TraceError(e.ToString());
1826 MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Initialize Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
1827 Environment.Exit(-1);
1828 }
1829
1830 base.IsFixedTimeStep = false;
1831 // base.TargetElapsedTime = TimeSpan.FromTicks( 10000000 / 75 );
1832 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.
1833 base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォカス時スリms)); // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive
1834 // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )
1835 //CWin32.WindowMessage msg;
1836 //while (CWin32.PeekMessage(out msg, IntPtr.Zero, 0, 0, CWin32.PM_REMOVE))
1837 //{
1838 //CWin32.TranslateMessage(ref msg);
1839 //CWin32.DispatchMessage(ref msg);
1840 //}
1841 //this.Direct3D = new Direct3D();
1842 this.D3D9Device = new Device( // 失敗したら異常系とみなし、そのまま例外をthrow。
1843 new Direct3D(),
1844 newD3DSettings.nAdaptor,
1845 newD3DSettings.DeviceType,
1846 newD3DSettings.PresentParameters.DeviceWindowHandle,
1847 newD3DSettings.CreateFlags,
1848 newD3DSettings.PresentParameters);
1849
1850 #if WindowedFullscreen
1851 this.t全画面・ウィンドウモド切り替え(); // #30666 2013.2.2 yyagi: finalize settings for "Maximized window mode"
1852 #endif
1853 actFlushGPU = new CActFlushGPU();
1854 //---------------------
1855 #endregion
1856
1857 DTX = null;
1858
1859 #region [ Skin の初期化 ]
1860 //---------------------
1861 Trace.TraceInformation( "スキンの初期化を行います。" );
1862 Trace.Indent();
1863 try
1864 {
1865 Skin = new CSkin( CDTXMania.ConfigIni.strSystemSkinSubfolderFullName, CDTXMania.ConfigIni.bUseBoxDefSkin );
1866 CDTXMania.ConfigIni.strSystemSkinSubfolderFullName = CDTXMania.Skin.GetCurrentSkinSubfolderFullName( true ); // 旧指定のSkinフォルダが消滅していた場合に備える
1867 Trace.TraceInformation( "スキンの初期化を完了しました。" );
1868 }
1869 catch
1870 {
1871 Trace.TraceInformation( "スキンの初期化に失敗しました。" );
1872 throw;
1873 }
1874 finally
1875 {
1876 Trace.Unindent();
1877 }
1878 //---------------------
1879 #endregion
1880 #region [ Timer の初期化 ]
1881 //---------------------
1882 Trace.TraceInformation( "タイマの初期化を行います。" );
1883 Trace.Indent();
1884 try
1885 {
1886 Timer = new CTimer( CTimer.E種別.MultiMedia );
1887 Trace.TraceInformation( "タイマの初期化を完了しました。" );
1888 }
1889 finally
1890 {
1891 Trace.Unindent();
1892 }
1893 //---------------------
1894 #endregion
1895 #region [ FPS カウンタの初期化 ]
1896 //---------------------
1897 Trace.TraceInformation( "FPSカウンタの初期化を行います。" );
1898 Trace.Indent();
1899 try
1900 {
1901 FPS = new CFPS();
1902 Trace.TraceInformation( "FPSカウンタを生成しました。" );
1903 }
1904 finally
1905 {
1906 Trace.Unindent();
1907 }
1908 //---------------------
1909 #endregion
1910 #region [ act文字コンソールの初期化 ]
1911 //---------------------
1912 Trace.TraceInformation( "文字コンソールの初期化を行います。" );
1913 Trace.Indent();
1914 try
1915 {
1916 act文字コンソ = new C文字コンソ();
1917 Trace.TraceInformation( "文字コンソールを生成しました。" );
1918 act文字コンソ.On活性化();
1919 Trace.TraceInformation( "文字コンソールを活性化しました。" );
1920 Trace.TraceInformation( "文字コンソールの初期化を完了しました。" );
1921 }
1922 catch( Exception exception )
1923 {
1924 Trace.TraceError( exception.Message );
1925 Trace.TraceError( "文字コンソールの初期化に失敗しました。" );
1926 }
1927 finally
1928 {
1929 Trace.Unindent();
1930 }
1931 //---------------------
1932 #endregion
1933 #region [ Input管理 の初期化 ]
1934 //---------------------
1935 Trace.TraceInformation( "DirectInput, MIDI入力の初期化を行います。" );
1936 Trace.Indent();
1937 try
1938 {
1939 Input管理 = new CInput管理( base.Window.Handle );
1940 foreach( IInputDevice device in Input管理.list入力デバイス )
1941 {
1942 if( ( device.e入力デバイス種別 == E入力デバイス種別.Joystick ) && !ConfigIni.dicJoystick.ContainsValue( device.GUID ) )
1943 {
1944 int key = 0;
1945 while( ConfigIni.dicJoystick.ContainsKey( key ) )
1946 {
1947 key++;
1948 }
1949 ConfigIni.dicJoystick.Add( key, device.GUID );
1950 }
1951 }
1952 foreach( IInputDevice device2 in Input管理.list入力デバイス )
1953 {
1954 if( device2.e入力デバイス種別 == E入力デバイス種別.Joystick )
1955 {
1956 foreach( KeyValuePair<int, string> pair in ConfigIni.dicJoystick )
1957 {
1958 if( device2.GUID.Equals( pair.Value ) )
1959 {
1960 ( (CInputJoystick) device2 ).SetID( pair.Key );
1961 break;
1962 }
1963 }
1964 continue;
1965 }
1966 }
1967 Trace.TraceInformation( "DirectInput の初期化を完了しました。" );
1968 }
1969 catch( Exception exception2 )
1970 {
1971 Trace.TraceError( exception2.Message );
1972 Trace.TraceError( "DirectInput, MIDI入力の初期化に失敗しました。" );
1973 throw;
1974 }
1975 finally
1976 {
1977 Trace.Unindent();
1978 }
1979 //---------------------
1980 #endregion
1981 #region [ Pad の初期化 ]
1982 //---------------------
1983 Trace.TraceInformation( "パッドの初期化を行います。" );
1984 Trace.Indent();
1985 try
1986 {
1987 Pad = new CPad( ConfigIni, Input管理 );
1988 Trace.TraceInformation( "パッドの初期化を完了しました。" );
1989 }
1990 catch( Exception exception3 )
1991 {
1992 Trace.TraceError( exception3.Message );
1993 Trace.TraceError( "パッドの初期化に失敗しました。" );
1994 }
1995 finally
1996 {
1997 Trace.Unindent();
1998 }
1999 //---------------------
2000 #endregion
2001 #region [ Sound管理 の初期化 ]
2002 //---------------------
2003 Trace.TraceInformation("サウンドデバイスの初期化を行います。");
2004 Trace.Indent();
2005 try
2006 {
2007 {
2008 ESoundDeviceType soundDeviceType;
2009 switch (CDTXMania.ConfigIni.nSoundDeviceType)
2010 {
2011 case 0:
2012 soundDeviceType = ESoundDeviceType.DirectSound;
2013 break;
2014 case 1:
2015 soundDeviceType = ESoundDeviceType.ASIO;
2016 break;
2017 case 2:
2018 soundDeviceType = ESoundDeviceType.ExclusiveWASAPI;
2019 break;
2020 default:
2021 soundDeviceType = ESoundDeviceType.Unknown;
2022 break;
2023 }
2024 Sound管理 = new CSound管理(base.Window.Handle,
2025 soundDeviceType,
2026 CDTXMania.ConfigIni.nWASAPIBufferSizeMs,
2027 CDTXMania.ConfigIni.nASIOBufferSizeMs,
2028 CDTXMania.ConfigIni.nASIODevice
2029 );
2030 AddSoundTypeToWindowTitle();
2031 FDK.CSound管理.bIsTimeStretch = CDTXMania.ConfigIni.bTimeStretch;
2032 Trace.TraceInformation("サウンドデバイスの初期化を完了しました。");
2033 }
2034 }
2035 catch (Exception e)
2036 {
2037 Trace.TraceError("DirectSound の初期化に失敗しました。(" + e.Message + ")");
2038 throw;
2039 }
2040 finally
2041 {
2042 Trace.Unindent();
2043 }
2044 //---------------------
2045 #endregion
2046 #region [ Songs管理 の初期化 ]
2047 //---------------------
2048 Trace.TraceInformation( "曲リストの初期化を行います。" );
2049 Trace.Indent();
2050 try
2051 {
2052 Songs管理 = new CSongs管理();
2053 // Songs管理_裏読 = new CSongs管理();
2054 EnumSongs = new CEnumSongs();
2055 actEnumSongs = new CActEnumSongs();
2056 Trace.TraceInformation( "曲リストの初期化を完了しました。" );
2057 }
2058 catch( Exception e )
2059 {
2060 Trace.TraceError( e.Message );
2061 Trace.TraceError( "曲リストの初期化に失敗しました。" );
2062 }
2063 finally
2064 {
2065 Trace.Unindent();
2066 }
2067 //---------------------
2068 #endregion
2069 #region [ CAvi の初期化 ]
2070 //---------------------
2071 CAvi.t初期化();
2072 //---------------------
2073 #endregion
2074 #region [ Random の初期化 ]
2075 //---------------------
2076 Random = new Random( (int) Timer.nシステム時刻 );
2077 //---------------------
2078 #endregion
2079 #region [ ステージの初期化 ]
2080 //---------------------
2081 r現在のステ = null;
2082 r直前のステ = null;
2083 stage起動 = new CStage起動();
2084 stageタイトル = new CStageタイトル();
2085 stageオプション = new CStageオプション();
2086 stageコンフィグ = new CStageコンフィグ();
2087 stage選曲 = new CStage選曲();
2088 stage曲読み込み = new CStage曲読み込み();
2089 stage演奏ドラム画面 = new CStage演奏ドラム画面();
2090 stage演奏ギタ画面 = new CStage演奏ギタ画面();
2091 stage結果 = new CStage結果();
2092 stageChangeSkin = new CStageChangeSkin();
2093 stage終了 = new CStage終了();
2094 this.listトップレベルActivities = new List<CActivity>();
2095 this.listトップレベルActivities.Add( actEnumSongs );
2096 this.listトップレベルActivities.Add( act文字コンソ );
2097 this.listトップレベルActivities.Add( stage起動 );
2098 this.listトップレベルActivities.Add( stageタイトル );
2099 this.listトップレベルActivities.Add( stageオプション );
2100 this.listトップレベルActivities.Add( stageコンフィグ );
2101 this.listトップレベルActivities.Add( stage選曲 );
2102 this.listトップレベルActivities.Add( stage曲読み込み );
2103 this.listトップレベルActivities.Add( stage演奏ドラム画面 );
2104 this.listトップレベルActivities.Add( stage演奏ギタ画面 );
2105 this.listトップレベルActivities.Add( stage結果 );
2106 this.listトップレベルActivities.Add( stageChangeSkin );
2107 this.listトップレベルActivities.Add( stage終了 );
2108 this.listトップレベルActivities.Add( actFlushGPU);
2109 //---------------------
2110 #endregion
2111 #region [ プラグインの検索と生成 ]
2112 //---------------------
2113 PluginHost = new CPluginHost();
2114
2115 Trace.TraceInformation( "プラグインの検索と生成を行います。" );
2116 Trace.Indent();
2117 try
2118 {
2119 this.tプラグイン検索と生成();
2120 Trace.TraceInformation( "プラグインの検索と生成を完了しました。" );
2121 }
2122 finally
2123 {
2124 Trace.Unindent();
2125 }
2126 //---------------------
2127 #endregion
2128 #region [ プラグインの初期化 ]
2129 //---------------------
2130 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
2131 {
2132 Trace.TraceInformation( "プラグインの初期化を行います。" );
2133 Trace.Indent();
2134 try
2135 {
2136 foreach( STPlugin st in this.listプラグイン )
2137 {
2138 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
2139 st.plugin.On初期化( this.PluginHost );
2140 st.plugin.OnManagedリソスの作成();
2141 st.plugin.OnUnmanagedリソスの作成();
2142 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
2143 }
2144 Trace.TraceInformation( "すべてのプラグインの初期化を完了しました。" );
2145 }
2146 catch
2147 {
2148 Trace.TraceError( "プラグインのどれかの初期化に失敗しました。" );
2149 throw;
2150 }
2151 finally
2152 {
2153 Trace.Unindent();
2154 }
2155 }
2156
2157 //---------------------
2158 #endregion
2159
2160
2161 Trace.TraceInformation( "アプリケーションの初期化を完了しました。" );
2162
2163 #region [ 最初のステージの起動 ]
2164 //---------------------
2165 Trace.TraceInformation("----------------------");
2166 Trace.TraceInformation("■ 起動");
2167
2168 if (CDTXMania.bコンパクトモ)
2169 {
2170 r現在のステ = stage曲読み込み;
2171 }
2172 else
2173 {
2174 r現在のステ = stage起動;
2175 }
2176 r現在のステ.On活性化();
2177 //---------------------
2178 #endregion
2179 }
2180 public void AddSoundTypeToWindowTitle()
2181 {
2182 string delay = "";
2183 if (Sound管理.GetCurrentSoundDeviceType() != "DirectSound")
2184 {
2185 delay = "(" + Sound管理.GetSoundDelay() + "ms)";
2186 }
2187 base.Window.Text = strWindowTitle + " (" + Sound管理.GetCurrentSoundDeviceType() + delay + ")";
2188 }
2189
2190 private void t終了処理()
2191 {
2192 if( !this.b終了処理完了済み )
2193 {
2194 Trace.TraceInformation( "----------------------" );
2195 Trace.TraceInformation( "■ アプリケーションの終了" );
2196 #region [ 曲検索の終了処理 ]
2197 //---------------------
2198 if ( actEnumSongs != null )
2199 {
2200 Trace.TraceInformation( "曲検索actの終了処理を行います。" );
2201 Trace.Indent();
2202 try
2203 {
2204 actEnumSongs.On非活性化();
2205 actEnumSongs= null;
2206 Trace.TraceInformation( "曲検索actの終了処理を完了しました。" );
2207 }
2208 catch ( Exception e )
2209 {
2210 Trace.TraceError( e.Message );
2211 Trace.TraceError( "曲検索actの終了処理に失敗しました。" );
2212 }
2213 finally
2214 {
2215 Trace.Unindent();
2216 }
2217 }
2218 //---------------------
2219 #endregion
2220 #region [ 現在のステージの終了処理 ]
2221 //---------------------
2222 if( CDTXMania.r現在のステ != null && CDTXMania.r現在のステ.b活性化してる ) // #25398 2011.06.07 MODIFY FROM
2223 {
2224 Trace.TraceInformation( "現在のステージを終了します。" );
2225 Trace.Indent();
2226 try
2227 {
2228 r現在のステ.On非活性化();
2229 Trace.TraceInformation( "現在のステージの終了処理を完了しました。" );
2230 }
2231 finally
2232 {
2233 Trace.Unindent();
2234 }
2235 }
2236 //---------------------
2237 #endregion
2238 #region [ プラグインの終了処理 ]
2239 //---------------------
2240 if (this.listプラグイン != null && this.listプラグイン.Count > 0)
2241 {
2242 Trace.TraceInformation( "すべてのプラグインを終了します。" );
2243 Trace.Indent();
2244 try
2245 {
2246 foreach( STPlugin st in this.listプラグイン )
2247 {
2248 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
2249 st.plugin.OnUnmanagedリソスの解放();
2250 st.plugin.OnManagedリソスの解放();
2251 st.plugin.On終了();
2252 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
2253 }
2254 PluginHost = null;
2255 Trace.TraceInformation( "すべてのプラグインの終了処理を完了しました。" );
2256 }
2257 finally
2258 {
2259 Trace.Unindent();
2260 }
2261 }
2262 //---------------------
2263 #endregion
2264 #region [ 曲リストの終了処理 ]
2265 //---------------------
2266 if (Songs管理 != null)
2267 {
2268 Trace.TraceInformation( "曲リストの終了処理を行います。" );
2269 Trace.Indent();
2270 try
2271 {
2272 Songs管理 = null;
2273 Trace.TraceInformation( "曲リストの終了処理を完了しました。" );
2274 }
2275 catch( Exception exception )
2276 {
2277 Trace.TraceError( exception.Message );
2278 Trace.TraceError( "曲リストの終了処理に失敗しました。" );
2279 }
2280 finally
2281 {
2282 Trace.Unindent();
2283 }
2284 }
2285 CAvi.t終了();
2286 //---------------------
2287 #endregion
2288 #region [ スキンの終了処理 ]
2289 //---------------------
2290 if (Skin != null)
2291 {
2292 Trace.TraceInformation( "スキンの終了処理を行います。" );
2293 Trace.Indent();
2294 try
2295 {
2296 Skin.Dispose();
2297 Skin = null;
2298 Trace.TraceInformation( "スキンの終了処理を完了しました。" );
2299 }
2300 catch( Exception exception2 )
2301 {
2302 Trace.TraceError( exception2.Message );
2303 Trace.TraceError( "スキンの終了処理に失敗しました。" );
2304 }
2305 finally
2306 {
2307 Trace.Unindent();
2308 }
2309 }
2310 //---------------------
2311 #endregion
2312 #region [ DirectSoundの終了処理 ]
2313 //---------------------
2314 if (Sound管理 != null)
2315 {
2316 Trace.TraceInformation( "DirectSound の終了処理を行います。" );
2317 Trace.Indent();
2318 try
2319 {
2320 Sound管理.Dispose();
2321 Sound管理 = null;
2322 Trace.TraceInformation( "DirectSound の終了処理を完了しました。" );
2323 }
2324 catch( Exception exception3 )
2325 {
2326 Trace.TraceError( exception3.Message );
2327 Trace.TraceError( "DirectSound の終了処理に失敗しました。" );
2328 }
2329 finally
2330 {
2331 Trace.Unindent();
2332 }
2333 }
2334 //---------------------
2335 #endregion
2336 #region [ パッドの終了処理 ]
2337 //---------------------
2338 if (Pad != null)
2339 {
2340 Trace.TraceInformation( "パッドの終了処理を行います。" );
2341 Trace.Indent();
2342 try
2343 {
2344 Pad = null;
2345 Trace.TraceInformation( "パッドの終了処理を完了しました。" );
2346 }
2347 catch( Exception exception4 )
2348 {
2349 Trace.TraceError( exception4.Message );
2350 Trace.TraceError( "パッドの終了処理に失敗しました。" );
2351 }
2352 finally
2353 {
2354 Trace.Unindent();
2355 }
2356 }
2357 //---------------------
2358 #endregion
2359 #region [ DirectInput, MIDI入力の終了処理 ]
2360 //---------------------
2361 if (Input管理 != null)
2362 {
2363 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を行います。" );
2364 Trace.Indent();
2365 try
2366 {
2367 Input管理.Dispose();
2368 Input管理 = null;
2369 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を完了しました。" );
2370 }
2371 catch( Exception exception5 )
2372 {
2373 Trace.TraceError( exception5.Message );
2374 Trace.TraceError( "DirectInput, MIDI入力の終了処理に失敗しました。" );
2375 }
2376 finally
2377 {
2378 Trace.Unindent();
2379 }
2380 }
2381 //---------------------
2382 #endregion
2383 #region [ 文字コンソールの終了処理 ]
2384 //---------------------
2385 if (act文字コンソ != null)
2386 {
2387 Trace.TraceInformation( "文字コンソールの終了処理を行います。" );
2388 Trace.Indent();
2389 try
2390 {
2391 act文字コンソ.On非活性化();
2392 act文字コンソ = null;
2393 Trace.TraceInformation( "文字コンソールの終了処理を完了しました。" );
2394 }
2395 catch( Exception exception6 )
2396 {
2397 Trace.TraceError( exception6.Message );
2398 Trace.TraceError( "文字コンソールの終了処理に失敗しました。" );
2399 }
2400 finally
2401 {
2402 Trace.Unindent();
2403 }
2404 }
2405 //---------------------
2406 #endregion
2407 #region [ FPSカウンタの終了処理 ]
2408 //---------------------
2409 Trace.TraceInformation("FPSカウンタの終了処理を行います。");
2410 Trace.Indent();
2411 try
2412 {
2413 if( FPS != null )
2414 {
2415 FPS = null;
2416 }
2417 Trace.TraceInformation( "FPSカウンタの終了処理を完了しました。" );
2418 }
2419 finally
2420 {
2421 Trace.Unindent();
2422 }
2423 //---------------------
2424 #endregion
2425
2426 // ct.Dispose();
2427
2428 #region [ タイマの終了処理 ]
2429 //---------------------
2430 Trace.TraceInformation("タイマの終了処理を行います。");
2431 Trace.Indent();
2432 try
2433 {
2434 if( Timer != null )
2435 {
2436 Timer.Dispose();
2437 Timer = null;
2438 Trace.TraceInformation( "タイマの終了処理を完了しました。" );
2439 }
2440 else
2441 {
2442 Trace.TraceInformation( "タイマは使用されていません。" );
2443 }
2444 }
2445 finally
2446 {
2447 Trace.Unindent();
2448 }
2449 //---------------------
2450 #endregion
2451 #region [ Config.iniの出力 ]
2452 //---------------------
2453 Trace.TraceInformation("Config.ini を出力します。");
2454 // if ( ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.16 yyagi ギターベースがスワップしているときは元に戻す
2455 if ( ConfigIni.bIsSwappedGuitarBass_AutoFlagsAreSwapped ) // #24415 2011.2.21 yyagi FLIP中かつ演奏中にalt-f4で終了したときは、AUTOのフラグをswapして戻す
2456 {
2457 ConfigIni.SwapGuitarBassInfos_AutoFlags();
2458 }
2459 string str = strEXEのあるフォルダ + "Config.ini";
2460 Trace.Indent();
2461 try
2462 {
2463 ConfigIni.t書き出し( str );
2464 Trace.TraceInformation( "保存しました。({0})", new object[] { str } );
2465 }
2466 catch( Exception e )
2467 {
2468 Trace.TraceError( e.Message );
2469 Trace.TraceError( "Config.ini の出力に失敗しました。({0})", new object[] { str } );
2470 }
2471 finally
2472 {
2473 Trace.Unindent();
2474 }
2475 //---------------------
2476 #endregion
2477 Trace.TraceInformation("アプリケーションの終了処理を完了しました。");
2478
2479
2480 this.b終了処理完了済み = true;
2481 }
2482 }
2483
2484 private CScoreIni tScoreIniBGMAdjustHistoryPlayCountを更新(string str新ヒストリ行)
2485 {
2486 bool bIsUpdatedDrums, bIsUpdatedGuitar, bIsUpdatedBass;
2487 string strFilename = DTX.strファイル名の絶対パス + ".score.ini";
2488 CScoreIni ini = new CScoreIni( strFilename );
2489 if( !File.Exists( strFilename ) )
2490 {
2491 ini.stファイル.Title = DTX.TITLE;
2492 ini.stファイル.Name = DTX.strファイル名;
2493 ini.stファイル.Hash = CScoreIni.tファイルのMD5を求めて返す( DTX.strファイル名の絶対パス );
2494 for( int i = 0; i < 6; i++ )
2495 {
2496 ini.stセクション[ i ].nPerfectになる範囲ms = nPerfect範囲ms;
2497 ini.stセクション[ i ].nGreatになる範囲ms = nGreat範囲ms;
2498 ini.stセクション[ i ].nGoodになる範囲ms = nGood範囲ms;
2499 ini.stセクション[ i ].nPoorになる範囲ms = nPoor範囲ms;
2500 }
2501 }
2502 ini.stファイル.BGMAdjust = DTX.nBGMAdjust;
2503 CScoreIni.t更新条件を取得する( out bIsUpdatedDrums, out bIsUpdatedGuitar, out bIsUpdatedBass );
2504 if( bIsUpdatedDrums || bIsUpdatedGuitar || bIsUpdatedBass )
2505 {
2506 if( bIsUpdatedDrums )
2507 {
2508 ini.stファイル.PlayCountDrums++;
2509 }
2510 if( bIsUpdatedGuitar )
2511 {
2512 ini.stファイル.PlayCountGuitar++;
2513 }
2514 if( bIsUpdatedBass )
2515 {
2516 ini.stファイル.PlayCountBass++;
2517 }
2518 ini.tヒストリを追加する( str新ヒストリ行 );
2519 if( !bコンパクトモ )
2520 {
2521 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Drums = ini.stファイル.PlayCountDrums;
2522 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
2523 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Bass = ini.stファイル.PlayCountBass;
2524 for( int j = 0; j < ini.stファイル.History.Length; j++ )
2525 {
2526 stage選曲.r現在選択中のスコア.譜面情報.演奏履歴[ j ] = ini.stファイル.History[ j ];
2527 }
2528 }
2529 }
2530 if( ConfigIni.bScoreIniを出力する )
2531 {
2532 ini.t書き出し( strFilename );
2533 }
2534
2535 return ini;
2536 }
2537 private void tガベジコレクションを実行する()
2538 {
2539 GC.Collect();
2540 GC.WaitForPendingFinalizers();
2541 GC.Collect();
2542 GC.WaitForPendingFinalizers();
2543 }
2544 private void tプラグイン検索と生成()
2545 {
2546 this.listプラグイン = new List<STPlugin>();
2547
2548 string strIPluginActivityの名前 = typeof( IPluginActivity ).FullName;
2549 string strプラグインフォルダパス = strEXEのあるフォルダ + "Plugins\\";
2550
2551 this.t指定フォルダ内でのプラグイン検索と生成( strプラグインフォルダパス, strIPluginActivityの名前 );
2552
2553 if( this.listプラグイン.Count > 0 )
2554 Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" );
2555 }
2556 #region [ Windowイベント処理 ]
2557 private void t指定フォルダ内でのプラグイン検索と生成( string strプラグインフォルダパス, string strプラグイン型名 )
2558 {
2559 // 指定されたパスが存在しないとエラー
2560 if( !Directory.Exists( strプラグインフォルダパス ) )
2561 {
2562 Trace.TraceWarning( "プラグインフォルダが存在しません。(" + strプラグインフォルダパス + ")" );
2563 return;
2564 }
2565
2566 // (1) すべての *.dll について…
2567 string[] strDLLs = System.IO.Directory.GetFiles( strプラグインフォルダパス, "*.dll" );
2568 foreach( string dllName in strDLLs )
2569 {
2570 try
2571 {
2572 // (1-1) dll をアセンブリとして読み込む。
2573 System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( dllName );
2574
2575 // (1-2) アセンブリ内のすべての型について、プラグインとして有効か調べる
2576 foreach( Type t in asm.GetTypes() )
2577 {
2578 // (1-3) ↓クラスであり↓Publicであり↓抽象クラスでなく↓IPlugin型のインスタンスが作れる 型を持っていれば有効
2579 if( t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface( strプラグイン型名 ) != null )
2580 {
2581 // (1-4) クラス名からインスタンスを作成する
2582 var st = new STPlugin() {
2583 plugin = (IPluginActivity) asm.CreateInstance( t.FullName ),
2584 strプラグインフォルダ = Path.GetDirectoryName( dllName ),
2585 strアセンブリ簡易名 = asm.GetName().Name,
2586 Version = asm.GetName().Version,
2587 };
2588
2589 // (1-5) プラグインリストへ登録
2590 this.listプラグイン.Add( st );
2591 Trace.TraceInformation( "プラグイン {0} ({1}, {2}, {3}) を読み込みました。", t.FullName, Path.GetFileName( dllName ), st.strアセンブリ簡易名, st.Version.ToString() );
2592 }
2593 }
2594 }
2595 catch
2596 {
2597 Trace.TraceInformation( dllName + " からプラグインを生成することに失敗しました。スキップします。" );
2598 }
2599 }
2600
2601 // (2) サブフォルダがあれば再帰する
2602 string[] strDirs = Directory.GetDirectories( strプラグインフォルダパス, "*" );
2603 foreach( string dir in strDirs )
2604 this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );
2605 }
2606 //-----------------
2607 private void Window_ApplicationActivated(object sender, EventArgs e)
2608 {
2609 this.bApplicationActive = true;
2610 }
2611 private void Window_ApplicationDeactivated(object sender, EventArgs e)
2612 {
2613 this.bApplicationActive = false;
2614 }
2615 private void Window_KeyDown(object sender, KeyEventArgs e)
2616 {
2617 if (e.KeyCode == Keys.Menu)
2618 {
2619 e.Handled = true;
2620 e.SuppressKeyPress = true;
2621 }
2622 else if ((e.KeyCode == Keys.Return) && e.Alt)
2623 {
2624 if (ConfigIni != null)
2625 {
2626 ConfigIni.bウィンドウモ = !ConfigIni.bウィンドウモ;
2627 this.t全画面・ウィンドウモド切り替え();
2628 }
2629 e.Handled = true;
2630 e.SuppressKeyPress = true;
2631 }
2632 else
2633 {
2634 for (int i = 0; i < 0x10; i++)
2635 {
2636 if (ConfigIni.KeyAssign.System.Capture[i]. > 0 &&
2637 e.KeyCode == DeviceConstantConverter.KeyToKeyCode((SlimDX.DirectInput.Key)ConfigIni.KeyAssign.System.Capture[i].))
2638 {
2639 // Debug.WriteLine( "capture: " + string.Format( "{0:2x}", (int) e.KeyCode ) + " " + (int) e.KeyCode );
2640 string strFullPath =
2641 Path.Combine(CDTXMania.strEXEのあるフォルダ, "Capture_img");
2642 strFullPath = Path.Combine(strFullPath, DateTime.Now.ToString("yyyyMMddHHmmss") + ".png");
2643 SaveResultScreen(strFullPath);
2644 }
2645 }
2646 }
2647 }
2648 private void Window_MouseUp(object sender, MouseEventArgs e)
2649 {
2650 mb = e.Button;
2651 }
2652
2653 private void Window_MouseDoubleClick(object sender, MouseEventArgs e) // #23510 2010.11.13 yyagi: to go full screen mode
2654 {
2655 if (mb.Equals(MouseButtons.Left) && ConfigIni.bIsAllowedDoubleClickFullscreen) // #26752 2011.11.27 yyagi
2656 {
2657 ConfigIni.bウィンドウモ = false;
2658 this.t全画面・ウィンドウモド切り替え();
2659 }
2660 }
2661 private void Window_ResizeEnd(object sender, EventArgs e) // #23510 2010.11.20 yyagi: to get resized window size
2662 {
2663 if (ConfigIni.bウィンドウモ)
2664 {
2665 ConfigIni.n初期ウィンドウ開始位置X = base.Window.Location.X; // #30675 2013.02.04 ikanick add
2666 ConfigIni.n初期ウィンドウ開始位置Y = base.Window.Location.Y; //
2667 }
2668
2669 ConfigIni.nウインドウwidth = (ConfigIni.bウィンドウモ) ? base.Window.ClientSize.Width : currentClientSize.Width; // #23510 2010.10.31 yyagi add
2670 ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモ) ? base.Window.ClientSize.Height : currentClientSize.Height;
2671 }
2672 #endregion
2673
2674 //internal sealed class GCBeep // GC発生の度にbeep
2675 //{
2676 // ~GCBeep()
2677 // {
2678 // Console.Beep();
2679 // if ( !AppDomain.CurrentDomain.IsFinalizingForUnload()
2680 // && !Environment.HasShutdownStarted )
2681 // {
2682 // new GCBeep();
2683 // }
2684 // }
2685 //}
2686
2687 //-----------------
2688 #endregion
2689 }
2690 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26