2 using System.Collections.Generic;
\r
4 using System.Diagnostics;
\r
5 using System.Runtime.InteropServices;
\r
7 using System.Drawing;
\r
8 using System.Threading;
\r
9 using System.Globalization;
\r
10 using System.Runtime.Serialization.Formatters.Binary;
\r
12 using SlimDX.Direct3D9;
\r
14 using SampleFramework;
\r
18 internal class CActEnumSongs : CActivity
\r
20 public bool bコマンドでの曲データ取得;
\r
26 public CActEnumSongs()
\r
31 public CActEnumSongs(bool _bコマンドでの曲データ取得)
\r
33 Init(_bコマンドでの曲データ取得);
\r
35 private void Init(bool _bコマンドでの曲データ取得)
\r
37 base.b活性化してない = true;
\r
38 bコマンドでの曲データ取得 = _bコマンドでの曲データ取得;
\r
43 public override void On活性化()
\r
51 this.ctNowEnumeratingSongs = new CCounter(); // 0, 1000, 17, CDTXMania.Instance.Timer );
\r
52 this.ctNowEnumeratingSongs.t開始(0, 100, 17, CDTXMania.Instance.Timer);
\r
58 public override void On非活性化()
\r
63 this.ctNowEnumeratingSongs = null;
\r
65 public override void OnManagedリソースの作成()
\r
69 string pathNowEnumeratingSongs = CSkin.Path(@"Graphics\ScreenTitle NowEnumeratingSongs.png");
\r
70 if (File.Exists(pathNowEnumeratingSongs))
\r
72 this.txNowEnumeratingSongs = TextureFactory.tテクスチャの生成(pathNowEnumeratingSongs, false);
\r
76 this.txNowEnumeratingSongs = null;
\r
78 string pathDialogNowEnumeratingSongs = CSkin.Path(@"Graphics\ScreenConfig NowEnumeratingSongs.png");
\r
79 if (File.Exists(pathDialogNowEnumeratingSongs))
\r
81 this.txDialogNowEnumeratingSongs = TextureFactory.tテクスチャの生成(pathDialogNowEnumeratingSongs, false);
\r
85 this.txDialogNowEnumeratingSongs = null;
\r
90 System.Drawing.Font ftMessage = new System.Drawing.Font("MS PGothic", 40 * 3f, FontStyle.Bold, GraphicsUnit.Pixel);
\r
91 string[] strMessage =
\r
93 " 曲データの一覧を\n 取得しています。\n しばらくお待ちください。",
\r
94 " Now enumerating songs.\n Please wait..."
\r
96 int ci = (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ja") ? 0 : 1;
\r
97 if ((strMessage != null) && (strMessage.Length > 0))
\r
99 Bitmap image = new Bitmap(1, 1);
\r
100 Graphics graphics = Graphics.FromImage(image);
\r
101 SizeF ef = graphics.MeasureString(strMessage[ci], ftMessage);
\r
102 Size size = new Size((int)Math.Ceiling((double)ef.Width), (int)Math.Ceiling((double)ef.Height));
\r
103 graphics.Dispose();
\r
105 image = new Bitmap(size.Width, size.Height);
\r
106 graphics = Graphics.FromImage(image);
\r
107 graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
\r
108 graphics.DrawString(strMessage[ci], ftMessage, Brushes.White, (float)0f, (float)0f);
\r
109 graphics.Dispose();
\r
110 this.txMessage = new CTexture(CDTXMania.Instance.Device, image, CDTXMania.Instance.TextureFormat);
\r
111 this.txMessage.vc拡大縮小倍率 = new Vector3(0.5f, 0.5f, 1f);
\r
113 TextureFactory.t安全にDisposeする(ref ftMessage);
\r
117 this.txMessage = null;
\r
120 catch (CTextureCreateFailedException)
\r
122 Trace.TraceError("テクスチャの生成に失敗しました。(txMessage)");
\r
123 this.txMessage = null;
\r
126 base.OnManagedリソースの作成();
\r
128 public override void OnManagedリソースの解放()
\r
133 TextureFactory.t安全にDisposeする(ref this.txDialogNowEnumeratingSongs);
\r
134 TextureFactory.t安全にDisposeする(ref this.txNowEnumeratingSongs);
\r
135 TextureFactory.t安全にDisposeする(ref this.txMessage);
\r
136 base.OnManagedリソースの解放();
\r
139 public override int On進行描画()
\r
145 this.ctNowEnumeratingSongs.t進行Loop();
\r
146 if (this.txNowEnumeratingSongs != null)
\r
148 this.txNowEnumeratingSongs.n透明度 = (int)(176.0 + 80.0 * Math.Sin((double)(2 * Math.PI * this.ctNowEnumeratingSongs.n現在の値 * 2 / 100.0)));
\r
149 this.txNowEnumeratingSongs.t2D描画(CDTXMania.Instance.Device, 18, 7);
\r
151 if (bコマンドでの曲データ取得 && this.txDialogNowEnumeratingSongs != null)
\r
153 this.txDialogNowEnumeratingSongs.t2D描画(CDTXMania.Instance.Device, 500, 300);
\r
154 this.txMessage.t2D描画(CDTXMania.Instance.Device, 540, 320);
\r
161 private CCounter ctNowEnumeratingSongs;
\r
162 private CTexture txNowEnumeratingSongs = null;
\r
163 private CTexture txDialogNowEnumeratingSongs = null;
\r
164 private CTexture txMessage;
\r