OSDN Git Service

DTXManiaソリューション、DTXManiaプロジェクト、DTXCreatorプロジェクト、FDKプロジェクトについて英語化。
[dtxmania/dtxmania.git] / DTXMania / コード / ステージ / 05.選曲 / CActSelectShowCurrentPosition.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Drawing;
5 using System.Diagnostics;
6 using System.IO;
7 using SharpDX;
8 using FDK;
9
10 using Rectangle = System.Drawing.Rectangle;
11
12 namespace DTXMania
13 {
14         internal class CActSelectShowCurrentPosition : CActivity
15         {
16                 // メソッド
17
18                 public CActSelectShowCurrentPosition()
19                 {
20                         base.b活性化してない = true;
21                 }
22
23                 // CActivity 実装
24
25                 public override void On活性化()
26                 {
27                         if (this.b活性化してる)
28                                 return;
29
30                         base.On活性化();
31                 }
32                 public override void On非活性化()
33                 {
34                         base.On非活性化();
35                 }
36                 public override void OnManagedリソースの作成()
37                 {
38                         if (!base.b活性化してない)
39                         {
40                                 string pathScrollBar = CSkin.Path(@"Graphics\ScreenSelect scrollbar.png");
41                                 string pathScrollPosition = CSkin.Path(@"Graphics\ScreenSelect scrollbar.png");
42                                 if (File.Exists(pathScrollBar))
43                                 {
44                                         this.txScrollBar = TextureFactory.tテクスチャの生成(pathScrollBar, false);
45                                 }
46                                 if (File.Exists(pathScrollPosition))
47                                 {
48                                         this.txScrollPosition = TextureFactory.tテクスチャの生成(pathScrollPosition, false);
49                                 }
50                                 base.OnManagedリソースの作成();
51                         }
52                 }
53                 public override void OnManagedリソースの解放()
54                 {
55                         if (!base.b活性化してない)
56                         {
57                                 TextureFactory.t安全にDisposeする(ref this.txScrollBar);
58                                 TextureFactory.t安全にDisposeする(ref this.txScrollPosition);
59
60                                 base.OnManagedリソースの解放();
61                         }
62                 }
63                 public override int On進行描画()
64                 {
65                         #region [ スクロールバーの描画 #27648 ]
66                         if (this.txScrollBar != null)
67                         {
68                                 for (int sy = 0; sy < (int)(336 * Scale.Y); sy += (int)(128 * Scale.Y))
69                                 {
70                                         int ry = (sy / (int)(128 * Scale.Y));
71                                         int h = ((ry + 1) * (int)(128 * Scale.Y) > (int)(336 * Scale.Y)) ? (int)(336 * Scale.Y) - ry * (int)(128 * Scale.Y) : (int)(128 * Scale.Y);
72                                         this.txScrollBar.t2D描画(
73                                                 CDTXMania.Instance.Device,
74                                                 SampleFramework.GameWindowSize.Width - 12 * Scale.X,
75                                                 58 * Scale.Y + sy,
76                                                 new Rectangle(
77                                                         (int)(ry * 12 * Scale.X),
78                                                         0,
79                                                         (int)(12 * Scale.X),
80                                                         h
81                                                 )
82                                         );  // 本当のy座標は88なんだが、なぜか約30のバイアスが掛かる・・・
83                                 }
84                         }
85                         #endregion
86                         #region [ スクロール地点の描画 (計算はCActSelect曲リストで行う。スクロール位置と選曲項目の同期のため。)#27648 ]
87                         if (this.txScrollPosition != null)
88                         {
89                                 int py = CDTXMania.Instance.stage選曲.nスクロールバー相対y座標;
90                                 if (py <= 336 * Scale.Y - 6 - 8 && py >= 0)
91                                 {
92                                         this.txScrollPosition.t2D描画(
93                                                 CDTXMania.Instance.Device,
94                                                 SampleFramework.GameWindowSize.Width - (12 - 3) * Scale.X,
95                                                 58 * Scale.Y + py,
96                                                 new Rectangle(
97                                                         (int)(30 * Scale.X),
98                                                         (int)(120 * Scale.Y),
99                                                         (int)(6 * Scale.X),
100                                                         (int)(8 * Scale.Y)
101                                                 )
102                                         );
103                                 }
104                         }
105                         #endregion
106
107                         return 0;
108                 }
109
110
111                 // その他
112
113                 #region [ private ]
114                 //-----------------
115                 private CTexture txScrollPosition;
116                 private CTexture txScrollBar;
117                 //-----------------
118                 #endregion
119         }
120 }