OSDN Git Service

リポジトリの中間ファイルをすべて削除し、再構築。
[dtxmania/dtxmania.git] / DTXManiaプロジェクト / コード / ステージ / 05.選曲 / CActSelectPresound.cs
1 using System;\r
2 using System.Collections.Generic;\r
3 using System.Text;\r
4 using System.Diagnostics;\r
5 using FDK;\r
6 \r
7 namespace DTXMania\r
8 {\r
9         internal class CActSelectPresound : CActivity\r
10         {\r
11                 // メソッド\r
12 \r
13                 public CActSelectPresound()\r
14                 {\r
15                         base.b活性化してない = true;\r
16                 }\r
17                 public void tサウンド停止()\r
18                 {\r
19                         if( this.sound != null )\r
20                         {\r
21                                 this.sound.t再生を停止する();\r
22                                 CDTXMania.Sound管理.tサウンドを破棄する( this.sound );\r
23                                 this.sound = null;\r
24                         }\r
25                 }\r
26                 public void t選択曲が変更された()\r
27                 {\r
28                         Cスコア cスコア = CDTXMania.stage選曲.r現在選択中のスコア;\r
29                         if( ( cスコア != null ) && ( ( !( cスコア.ファイル情報.フォルダの絶対パス + cスコア.譜面情報.Presound ).Equals( this.str現在のファイル名 ) || ( this.sound == null ) ) || !this.sound.b再生中 ) )\r
30                         {\r
31                                 this.tサウンド停止();\r
32                                 this.tBGMフェードイン開始();\r
33                                 if( ( cスコア.譜面情報.Presound != null ) && ( cスコア.譜面情報.Presound.Length > 0 ) )\r
34                                 {\r
35                                         this.ct再生待ちウェイト = new CCounter( 0, CDTXMania.ConfigIni.n曲が選択されてからプレビュー音が鳴るまでのウェイトms, 1, CDTXMania.Timer );\r
36                                 }\r
37                         }\r
38                 }\r
39 \r
40 \r
41                 // CActivity 実装\r
42 \r
43                 public override void On活性化()\r
44                 {\r
45                         this.sound = null;\r
46                         this.str現在のファイル名 = "";\r
47                         this.ct再生待ちウェイト = null;\r
48                         this.ctBGMフェードアウト用 = null;\r
49                         this.ctBGMフェードイン用 = null;\r
50                         base.On活性化();\r
51                 }\r
52                 public override void On非活性化()\r
53                 {\r
54                         this.tサウンド停止();\r
55                         this.ct再生待ちウェイト = null;\r
56                         this.ctBGMフェードイン用 = null;\r
57                         this.ctBGMフェードアウト用 = null;\r
58                         base.On非活性化();\r
59                 }\r
60                 public override int On進行描画()\r
61                 {\r
62                         if( !base.b活性化してない )\r
63                         {\r
64                                 if( ( this.ctBGMフェードイン用 != null ) && this.ctBGMフェードイン用.b進行中 )\r
65                                 {\r
66                                         this.ctBGMフェードイン用.t進行();\r
67                                         CDTXMania.Skin.bgm選曲画面.n音量・現在のサウンド = this.ctBGMフェードイン用.n現在の値;\r
68                                         if( this.ctBGMフェードイン用.b終了値に達した )\r
69                                         {\r
70                                                 this.ctBGMフェードイン用.t停止();\r
71                                         }\r
72                                 }\r
73                                 if( ( this.ctBGMフェードアウト用 != null ) && this.ctBGMフェードアウト用.b進行中 )\r
74                                 {\r
75                                         this.ctBGMフェードアウト用.t進行();\r
76                                         CDTXMania.Skin.bgm選曲画面.n音量・現在のサウンド = 100 - this.ctBGMフェードアウト用.n現在の値;\r
77                                         if( this.ctBGMフェードアウト用.b終了値に達した )\r
78                                         {\r
79                                                 this.ctBGMフェードアウト用.t停止();\r
80                                         }\r
81                                 }\r
82                                 this.t進行処理・プレビューサウンド();\r
83                         }\r
84                         return 0;\r
85                 }\r
86 \r
87 \r
88                 // その他\r
89 \r
90                 #region [ private ]\r
91                 //-----------------\r
92                 private CCounter ctBGMフェードアウト用;\r
93                 private CCounter ctBGMフェードイン用;\r
94                 private CCounter ct再生待ちウェイト;\r
95                 private CSound sound;\r
96                 private string str現在のファイル名;\r
97                 \r
98                 private void tBGMフェードアウト開始()\r
99                 {\r
100                         if( this.ctBGMフェードイン用 != null )\r
101                         {\r
102                                 this.ctBGMフェードイン用.t停止();\r
103                         }\r
104                         this.ctBGMフェードアウト用 = new CCounter( 0, 100, 10, CDTXMania.Timer );\r
105                         this.ctBGMフェードアウト用.n現在の値 = 100 - CDTXMania.Skin.bgm選曲画面.n音量・現在のサウンド;\r
106                 }\r
107                 private void tBGMフェードイン開始()\r
108                 {\r
109                         if( this.ctBGMフェードアウト用 != null )\r
110                         {\r
111                                 this.ctBGMフェードアウト用.t停止();\r
112                         }\r
113                         this.ctBGMフェードイン用 = new CCounter( 0, 100, 20, CDTXMania.Timer );\r
114                         this.ctBGMフェードイン用.n現在の値 = CDTXMania.Skin.bgm選曲画面.n音量・現在のサウンド;\r
115                 }\r
116                 private void tプレビューサウンドの作成()\r
117                 {\r
118                         Cスコア cスコア = CDTXMania.stage選曲.r現在選択中のスコア;\r
119                         if( ( cスコア != null ) && !string.IsNullOrEmpty( cスコア.譜面情報.Presound ) )\r
120                         {\r
121                                 string str = cスコア.ファイル情報.フォルダの絶対パス + cスコア.譜面情報.Presound;\r
122                                 try\r
123                                 {\r
124                                         this.sound = CDTXMania.Sound管理.tサウンドを生成する( str );\r
125                                         this.sound.n音量 = CDTXMania.ConfigIni.n自動再生音量;\r
126                                         this.sound.t再生を開始する( true );\r
127                                         this.str現在のファイル名 = str;\r
128                                         this.tBGMフェードアウト開始();\r
129                                         Trace.TraceInformation( "サウンドを生成しました。({0})", new object[] { str } );\r
130                                 }\r
131                                 catch\r
132                                 {\r
133                                         Trace.TraceError( "サウンドの生成に失敗しました。({0})", new object[] { str } );\r
134                                         if( this.sound != null )\r
135                                         {\r
136                                                 this.sound.Dispose();\r
137                                         }\r
138                                         this.sound = null;\r
139                                 }\r
140                         }\r
141                 }\r
142                 private void t進行処理・プレビューサウンド()\r
143                 {\r
144                         if( ( this.ct再生待ちウェイト != null ) && !this.ct再生待ちウェイト.b停止中 )\r
145                         {\r
146                                 this.ct再生待ちウェイト.t進行();\r
147                                 if( !this.ct再生待ちウェイト.b終了値に達してない )\r
148                                 {\r
149                                         this.ct再生待ちウェイト.t停止();\r
150                                         if( !CDTXMania.stage選曲.bスクロール中 )\r
151                                         {\r
152                                                 this.tプレビューサウンドの作成();\r
153                                         }\r
154                                 }\r
155                         }\r
156                 }\r
157                 //-----------------\r
158                 #endregion\r
159         }\r
160 }\r