public void 描画する(グラフィックデバイス gd) { this._パネル.描画する(gd, 1458f, 3f); this._サムネイルを描画する(gd); this._曲名を描画する(gd); this._サブタイトルを描画する(gd); }
protected virtual void 進行描画する(グラフィックデバイス gd, StoryboardStatus 描画しないStatus) { bool すべて完了 = true; // ストーリーボードが動作しているなら、すべて完了 フラグを切る。 //if( context.ストーリーボード.Status != StoryboardStatus.Ready ) // すべて完了 = false; // 描画するステータスなら描画する。 //if( context.ストーリーボード.Status != 描画しないStatus ) //{ // ... //} if (すべて完了) { if (this.現在のフェーズ == フェーズ.クローズ) { this.現在のフェーズ = フェーズ.クローズ完了; } else if (this.現在のフェーズ == フェーズ.オープン) { this.現在のフェーズ = フェーズ.オープン完了; } } }
protected override void On活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this.現在のフェーズ = フェーズ.開始; } }
protected override void On活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this._判定種別文字の矩形リスト = new 矩形リスト(@"$(System)images\パラメータ用判定種別文字矩形.xml"); } }
protected override void On非活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { FDKUtilities.解放する(ref this._見出し用TextFormat); } }
/// <summary> /// 現在のステージを非活性化し、指定されたステージに遷移して、活性化する。 /// </summary> /// <param name="遷移先ステージ名">Nullまたは空文字列なら、非活性化のみ行う。</param> public void ステージを遷移する(グラフィックデバイス gd, string 遷移先ステージ名) { Log.Header($"{遷移先ステージ名} へ遷移します。"); using (Log.Block(FDKUtilities.現在のメソッド名)) { if (null != this._現在のステージ && this._現在のステージ.活性化している) { this._現在のステージ.非活性化する(gd); } if (遷移先ステージ名.Nullでも空でもない()) { this._現在のステージ = this.ステージリスト[遷移先ステージ名]; this._現在のステージ.活性化する(gd); //App.入力管理.すべての入力デバイスをポーリングする(); } else { Log.Header("ステージの遷移を終了します。"); this._現在のステージ = null; } } }
/// <summary> /// クリアパネルに初期背景を上書きすることで、それまで描かれていた内容を消去する。 /// </summary> public void クリアする(グラフィックデバイス gd) { this.クリアパネル.ビットマップへ描画する(gd, (dc, bmp) => { dc.PrimitiveBlend = PrimitiveBlend.Copy; dc.DrawBitmap(this._背景.Bitmap, opacity: 1f, interpolationMode: InterpolationMode.Linear); }); }
protected override void On非活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this._レーンtoレーンContext.Clear(); } }
private void _サムネイルを描画する(グラフィックデバイス gd) { var 選択曲 = App.曲ツリー.フォーカス曲ノード; Debug.Assert(null != 選択曲); var サムネイル画像 = 選択曲.ノード画像 ?? Node.既定のノード画像; Debug.Assert(null != サムネイル画像); // テクスチャは画面中央が (0,0,0) で、Xは右がプラス方向, Yは上がプラス方向, Zは奥がプラス方向+。 var 画面左上dpx = new Vector3( // 3D視点で見る画面左上の座標。 -gd.設計画面サイズ.Width / 2f, +gd.設計画面サイズ.Height / 2f, 0f); var 換行列 = Matrix.Scaling(this._サムネイル画像表示サイズdpx) * Matrix.Translation( 画面左上dpx.X + this._サムネイル画像表示位置dpx.X + this._サムネイル画像表示サイズdpx.X / 2f, 画面左上dpx.Y - this._サムネイル画像表示位置dpx.Y - this._サムネイル画像表示サイズdpx.Y / 2f, 0f); サムネイル画像.描画する(gd, 換行列); }
protected override void On活性化(グラフィックデバイス gd) { this._斜めジオメトリマスク = new PathGeometry(gd.D2DFactory); using (var sink = this._斜めジオメトリマスク.Open()) { // 長方形。これを、縮小&45°回転してマスクさせる。 const float w = 1920f; const float h = 1080f * 2.0f; // 斜めになるのでこのくらいいる。 sink.SetFillMode(FillMode.Winding); sink.BeginFigure(new Vector2(-w / 2f, -h / 2f), FigureBegin.Filled); // (0,0) を長方形の中心とする。(スケーリング&回転させるのに都合がいい) sink.AddLine(new Vector2(-w / 2f, +h / 2f)); sink.AddLine(new Vector2(+w / 2f, +h / 2f)); sink.AddLine(new Vector2(+w / 2f, -h / 2f)); sink.EndFigure(FigureEnd.Closed); sink.Close(); } this._斜めレイヤーパラメータ = new LayerParameters1 { ContentBounds = RectangleF.Infinite, GeometricMask = this._斜めジオメトリマスク, MaskAntialiasMode = AntialiasMode.PerPrimitive, MaskTransform = Matrix3x2.Identity, Opacity = 1.0f, OpacityBrush = null, LayerOptions = LayerOptions1.None, }; this.現在のフェーズ = フェーズ.未定; }
protected override void On活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this._現在表示しているノード = null; } }
protected override void On活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this._見出し用TextFormat = new TextFormat(gd.DWriteFactory, "Century Gothic", 50f); } }
public virtual void オープンする(グラフィックデバイス gd, float 速度倍率 = 1.0f) { // // ここに、ストーリーボードと変数の生成、トラジションの追加、ストーリーボードの開始コードを記述する。 // this.現在のフェーズ = フェーズ.オープン; }
public override void クローズする(グラフィックデバイス gd, float 速度倍率 = 1.0f) { double 秒(double v) => (v / 速度倍率); var start = gd.Animation.Timer.Time; for (int i = 0; i < シャッター枚数; i++) { using (var 開閉遷移 = gd.Animation.TrasitionLibrary.SmoothStop(maximumDuration: 秒(this._シャッター情報[i].開閉時間sec), finalValue: 1.0)) // 終了値 1.0(完全閉じ) { this._シャッター情報[i].開to閉割合?.Dispose(); this._シャッター情報[i].開to閉割合 = new Variable(gd.Animation.Manager, initialValue: 0.0); // 初期値 0.0(完全開き) this._シャッター情報[i].ストーリーボード?.Abandon(); this._シャッター情報[i].ストーリーボード?.Dispose(); this._シャッター情報[i].ストーリーボード = new Storyboard(gd.Animation.Manager); this._シャッター情報[i].ストーリーボード.AddTransition(this._シャッター情報[i].開to閉割合, 開閉遷移); this._シャッター情報[i].ストーリーボード.Schedule(start + 秒(this._シャッター情報[i].完全開き時刻sec)); // 開始時刻: 完全開き時刻 } } using (var _不透明度遷移 = gd.Animation.TrasitionLibrary.Linear(duration: 秒(0.75f), finalValue: 1.0)) // 終了値 1.0(完全不透明) { this._ロゴ不透明度?.Dispose(); this._ロゴ不透明度 = new Variable(gd.Animation.Manager, initialValue: 0.0); // 初期値 0.0(完全透明) this._ロゴボード = new Storyboard(gd.Animation.Manager); this._ロゴボード.AddTransition(this._ロゴ不透明度, _不透明度遷移); this._ロゴボード.Schedule(start); } this.現在のフェーズ = フェーズ.クローズ; }
protected override void On活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this._光彩アニメカウンタ = new LoopCounter(0, 200, 5); } }
protected override void On活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this._帯ブラシ = new SolidColorBrush(gd.D2DDeviceContext, new Color4(0f, 0f, 0f, 0.8f)); this.現在のフェーズ = フェーズ.表示; } }
protected override void On活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this.現在のフェーズ = フェーズ.フェードイン; this._初めての進行描画 = true; } }
/// <summary> /// クリアパネルに初期背景を上書きすることで、それまで描かれていた内容を消去する。 /// </summary> public void クリアする(グラフィックデバイス gd) { this.クリアパネル.ビットマップへ描画する(gd, (dc, bmp) => { dc.Transform = Matrix3x2.Identity; // 等倍描画(DPXtoDPX) dc.PrimitiveBlend = PrimitiveBlend.Copy; dc.DrawBitmap(this._背景.Bitmap, opacity: 1f, interpolationMode: InterpolationMode.Linear); }); }
protected override void On非活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { FDKUtilities.解放する(ref this._線グラブラシ); FDKUtilities.解放する(ref this._線グラ頂点集合); } }
protected override void On活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this._黒ブラシ = new SolidColorBrush(gd.D2DDeviceContext, Color.Black); this.現在のフェーズ = フェーズ.未定; } }
protected override void On活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this._レーン色ブラシ = new SolidColorBrush(gd.D2DDeviceContext, new Color4(0xff5d5d5d)); this._レーンエリア色ブラシ = new SolidColorBrush(gd.D2DDeviceContext, new Color4(0f, 0f, 0f, 0.5f)); } }
private void _選択曲を囲む枠を描画する(グラフィックデバイス gd) { var 矩形 = new RectangleF(1015f, 485f, 905f, 113f); this._青い線.描画する(gd, new Vector2(矩形.Left - this._青枠のマージンdpx, 矩形.Top), 幅dpx: 矩形.Width + this._青枠のマージンdpx * 2f); this._青い線.描画する(gd, new Vector2(矩形.Left - this._青枠のマージンdpx, 矩形.Bottom), 幅dpx: 矩形.Width + this._青枠のマージンdpx * 2f); this._青い線.描画する(gd, new Vector2(矩形.Left, 矩形.Top - this._青枠のマージンdpx), 高さdpx: 矩形.Height + this._青枠のマージンdpx * 2f); }
protected override void On非活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { FDKUtilities.解放する(ref this._パラメータアニメ); base.On非活性化(gd); } }
protected override void On非活性化(グラフィックデバイス gd) { FDKUtilities.解放する(ref this._通常ブラシ); FDKUtilities.解放する(ref this._DANGERブラシ); FDKUtilities.解放する(ref this._MAXブラシ); FDKUtilities.解放する(ref this._ゲージ量のストーリーボード); FDKUtilities.解放する(ref this._ゲージ量); }
protected override void On非活性化(グラフィックデバイス gd) { FDKUtilities.解放する(ref this._backBrush); FDKUtilities.解放する(ref this._subtitleFontBrush); FDKUtilities.解放する(ref this._titleFontBrush); FDKUtilities.解放する(ref this._textFormat); base.On非活性化(gd); // 忘れずに。 }
/// <summary> /// よこ線(左→右)か、たて線(上→下)のいずれかを描画できる。 /// よこ線を描画したい場合は<paramref name="幅dpx"/>を指定し、 /// たて線を描画したい場合は<paramref name="高さdpx"/>を指定する。 /// <paramref name="幅dpx"/> と <paramref name="高さdpx"/> を同時に指定することはできない。 /// </summary> /// <param name="幅dpx">横方向(左→右)の長さ。<paramref name="高さdpx"/>と同時に指定してはならない。</param> /// <param name="高さdpx">縦方向(上→下)の長さ。<paramref name="幅dpx"/>と同時に指定してはならない。</param> public void 描画する(グラフィックデバイス gd, Vector2 開始位置dpx, float 幅dpx = -1f, float 高さdpx = -1f) { var check = (幅dpx * 高さdpx); Debug.Assert(0f >= check, "幅か高さが両方指定されていないか、両方指定されています。どちらか一方だけを指定してください。"); if (0f == check) { return; // 面積ゼロ } gd.D2DBatchDraw((dc) => { dc.PrimitiveBlend = PrimitiveBlend.Add; // 加算合成 if (0f < 幅dpx) { // (A) 横方向(左→右)の枠 var 矩形 = new RectangleF( 開始位置dpx.X, 開始位置dpx.Y - this.太さdpx / 2f, 幅dpx, this.太さdpx); this._線グラブラシ?.Dispose(); this._線グラブラシ = new LinearGradientBrush( dc, new LinearGradientBrushProperties() { StartPoint = new Vector2(矩形.Left, 矩形.Top), EndPoint = new Vector2(矩形.Left, 矩形.Bottom), }, this._線グラ頂点集合); dc.FillRectangle(矩形, this._線グラブラシ); } else { // (B) 縦方向(上→下)の枠 var 矩形 = new RectangleF( 開始位置dpx.X - this.太さdpx / 2f, 開始位置dpx.Y, this.太さdpx, 高さdpx); this._線グラブラシ?.Dispose(); this._線グラブラシ = new LinearGradientBrush( dc, new LinearGradientBrushProperties() { StartPoint = new Vector2(矩形.Left, 矩形.Top), EndPoint = new Vector2(矩形.Right, 矩形.Top), }, this._線グラ頂点集合); dc.FillRectangle(矩形, this._線グラブラシ); } }); }
protected override void On活性化(グラフィックデバイス gd) { this.現在のフェーズ = フェーズ.未定; #region " Go! " //---------------- this._文字 = new 文字[3] { new 文字() { 画像 = new 画像(@"$(System)images\G.png") }, new 文字() { 画像 = new 画像(@"$(System)images\O.png") }, new 文字() { 画像 = new 画像(@"$(System)images\!.png") }, }; foreach (var s in this._文字) { s.画像.加算合成 = true; this.子リスト.Add(s.画像); } //---------------- #endregion #region " ぐるぐる棒 " //---------------- this._ぐるぐる棒s = new ぐるぐる棒[12]; for (int i = 0; i < this._ぐるぐる棒s.Length; i++) { this._ぐるぐる棒s[i] = new ぐるぐる棒(); } //---------------- #endregion #region " フラッシュオーバー棒 " //---------------- this._フラッシュオーバー棒s = new フラッシュオーバー棒[6]; for (int i = 0; i < this._フラッシュオーバー棒s.Length; i++) { this._フラッシュオーバー棒s[i] = new フラッシュオーバー棒(); } //---------------- #endregion #region " フェードイン " //---------------- this._フェードイン = new フェードイン(); //---------------- #endregion }
public void 描画する(グラフィックデバイス gd) { var 見出し描画領域 = new RectangleF(783f, 117f, 414f, 63f); var 数値描画領域 = new RectangleF(783f, 180f, 414f, 213f); var node = App.曲ツリー.フォーカス曲ノード; var anker = App.曲ツリー.フォーカス難易度; (string label, float level)難易度; if (node.親ノード is SetNode) { // 親が SetNode なら、難易度はそっちから取得する。 難易度 = node.親ノード.難易度[anker]; } else { 難易度 = node.難易度[anker]; } gd.D2DBatchDraw((dc) => { var pretrans = dc.Transform; using (var 見出し背景ブラシ = new SolidColorBrush(dc, Node.難易度色[anker])) using (var 黒ブラシ = new SolidColorBrush(dc, Color4.Black)) using (var 黒透過ブラシ = new SolidColorBrush(dc, new Color4(Color3.Black, 0.5f))) using (var 白ブラシ = new SolidColorBrush(dc, Color4.White)) { dc.Transform = pretrans; // 背景領域を塗りつぶす。 dc.FillRectangle(見出し描画領域, 見出し背景ブラシ); dc.FillRectangle(数値描画領域, 黒ブラシ); // 見出し文字列を描画する。 this._見出し用TextFormat.TextAlignment = TextAlignment.Trailing; var 見出し文字領域 = 見出し描画領域; 見出し文字領域.Width -= 8f; // 右マージン dc.DrawText(難易度.label, this._見出し用TextFormat, 見出し文字領域, 白ブラシ); // 小数部を描画する。 var 数値文字列 = 難易度.level.ToString("0.00").PadLeft(1); dc.Transform = Matrix3x2.Scaling(2.2f, 2.2f) * Matrix3x2.Translation(数値描画領域.X + 175f, 数値描画領域.Y) * pretrans; this._数字画像.描画する(dc, 0f, 0f, 数値文字列.Substring(2)); // 整数部と小数点を描画する。 dc.Transform = Matrix3x2.Scaling(2.2f, 2.2f) * Matrix3x2.Translation(数値描画領域.X + 15f, 数値描画領域.Y) * pretrans; this._数字画像.描画する(dc, 0f, 0f, 数値文字列.Substring(0, 2)); } }); }
private void _サブタイトルを描画する(グラフィックデバイス gd) { // 拡大率を計算して描画する。 this._サブタイトル画像.描画する( gd, this._曲名表示位置dpx.X, this._曲名表示位置dpx.Y + 30f, X方向拡大率: (this._サブタイトル画像.サイズ.Width <= this._曲名表示サイズdpx.X) ? 1f : this._曲名表示サイズdpx.X / this._サブタイトル画像.サイズ.Width); }
protected override void On非活性化(グラフィックデバイス gd) { using (Log.Block(FDKUtilities.現在のメソッド名)) { this._factory = null; // Disposeはしない FDKUtilities.解放する(ref this._文字色); FDKUtilities.解放する(ref this._TextLayout); FDKUtilities.解放する(ref this._TextFormat); } }