2 using System.Collections.Generic;
7 namespace DTXCreator.譜面
9 public class Cチップ : IComparable<Cチップ>
11 public bool bドラッグで選択中;
16 public int n移動開始時のレーン番号0to;
17 public int n移動開始時の小節内の位置grid;
18 public int n移動開始時の小節番号0to;
19 public int n読み込み時の解像度 = 0xc0;
21 public int nチャンネル番号00toFF
25 return this._nチャンネル番号00toFF;
29 if( ( value < 0 ) || ( value > 0xff ) )
31 throw new Exception( "値が範囲(0~255)を超えています。-->[" + value + "]" );
33 this._nチャンネル番号00toFF = value;
40 return this._nレーン番号0to;
46 throw new Exception( "値が範囲を超えています。-->[" + value + "]" );
48 this._nレーン番号0to = value;
59 this._n位置grid = value;
62 public int n値_整数1to1295
66 return this._n値_整数1to1295;
70 if( ( value < 0 ) || ( value > 36 * 36 - 1 ) )
72 throw new Exception( "値が範囲(0~1295)を超えています。-->[" + value + "]" );
74 this._n値_整数1to1295 = value;
77 public static readonly int nチップの高さdot = 9;
79 public int CompareTo( Cチップ other )
81 return ( this.n位置grid - other.n位置grid );
83 public static void tOPENチップを描画する( Graphics g, Rectangle rcチップ描画領域 )
85 t表チップを描画する_本体( g, rcチップ描画領域, Color.White );
86 string str = "O P E N";
87 t表チップを描画する_番号( g, rcチップ描画領域, str );
89 public void tコピーfrom( Cチップ ccコピー元 )
91 this._nチャンネル番号00toFF = ccコピー元._nチャンネル番号00toFF;
92 this._nレーン番号0to = ccコピー元._nレーン番号0to;
93 this._n値_整数1to1295 = ccコピー元._n値_整数1to1295;
94 this.f値_浮動小数 = ccコピー元.f値_浮動小数;
95 this._n位置grid = ccコピー元._n位置grid;
97 this.bドラッグで選択中 = ccコピー元.bドラッグで選択中;
98 this.b確定選択中 = ccコピー元.b確定選択中;
99 this.n読み込み時の解像度 = ccコピー元.n読み込み時の解像度;
100 this.b移動済 = ccコピー元.b移動済;
101 this.n枠外レーン数 = ccコピー元.n枠外レーン数;
102 this.n移動開始時の小節番号0to = ccコピー元.n移動開始時の小節番号0to;
103 this.n移動開始時のレーン番号0to = ccコピー元.n移動開始時のレーン番号0to;
104 this.n移動開始時の小節内の位置grid = ccコピー元.n移動開始時の小節内の位置grid;
106 public static void tチップの周囲の太枠を描画する( Graphics g, Rectangle rcチップ描画領域 )
108 Pen pen = new Pen( Color.White, 2f );
109 g.DrawRectangle( pen, rcチップ描画領域 );
112 public static void t表チップを描画する( Graphics g, Rectangle rcチップ描画領域, int nチップ番号, Color col色 )
114 t表チップを描画する( g, rcチップ描画領域, nチップ番号, col色, Cレーン.E種別.WAV ); // とにかくCレーン.E種別.BEAT以外を指定する
116 public static void t表チップを描画する( Graphics g, Rectangle rcチップ描画領域, int nチップ番号, Color col色, Cレーン.E種別 e種別 )
118 if ( e種別 == Cレーン.E種別.BEAT )
120 t表チップを描画する_本体( g, rcチップ描画領域, col色, e種別 );
124 t表チップを描画する_本体( g, rcチップ描画領域, col色 );
127 string str = C変換.str数値を36進数2桁に変換して返す( nチップ番号 );
128 str = str[ 0 ] + " " + str[ 1 ];
129 t表チップを描画する_番号( g, rcチップ描画領域, str );
133 public static void t表チップを描画する( Graphics g, Rectangle rcチップ描画領域, float fチップ数値, Color col色 )
135 t表チップを描画する_本体( g, rcチップ描画領域, col色 );
138 string str = fチップ数値.ToString();
139 t表チップを描画する_番号( g, rcチップ描画領域, str );
142 public static void t裏チップを描画する( Graphics g, Rectangle rcチップ描画領域, int nチップ番号, Color col色 )
144 t裏チップを描画する( g, rcチップ描画領域, nチップ番号, col色, Cレーン.E種別.WAV ); // とにかくCレーン.E種別.BEAT以外を指定する
146 public static void t裏チップを描画する( Graphics g, Rectangle rcチップ描画領域, int nチップ番号, Color col色, Cレーン.E種別 e種別 )
148 t裏チップを描画する_本体( g, rcチップ描画領域, col色, e種別 );
150 if ( e種別 == Cレーン.E種別.BEAT )
152 t裏チップを描画する_本体( g, rcチップ描画領域, col色, e種別 );
156 t裏チップを描画する_本体( g, rcチップ描画領域, col色 );
159 string str = C変換.str数値を36進数2桁に変換して返す( nチップ番号 );
160 str = str[ 0 ] + " " + str[ 1 ];
161 t裏チップを描画する_番号( g, rcチップ描画領域, str );
166 public static void t裏チップを描画する( Graphics g, Rectangle rcチップ描画領域, float fチップ数値, Color col色 )
168 t裏チップを描画する_本体( g, rcチップ描画領域, col色 );
171 string str = fチップ数値.ToString();
172 t裏チップを描画する_番号( g, rcチップ描画領域, str );
175 protected static Font ftチップ文字用フォント = new Font( "MS Gothic", 8f, FontStyle.Bold );
179 private int _nチャンネル番号00toFF;
180 private int _nレーン番号0to;
181 private int _n位置grid;
182 private int _n値_整数1to1295;
184 private static void t表チップを描画する_番号( Graphics g, Rectangle rcチップ描画領域, string str番号文字列 )
186 tチップを描画する_番号( g, rcチップ描画領域, str番号文字列, false );
190 private static void t表チップを描画する_本体( Graphics g, Rectangle rcチップ描画領域, Color col色, Cレーン.E種別 e種別 )
192 if ( e種別 == Cレーン.E種別.BEAT )
194 tチップを描画する_本体( g, rcチップ描画領域, col色, false, true );
198 tチップを描画する_本体( g, rcチップ描画領域, col色, false, false );
201 private static void t表チップを描画する_本体( Graphics g, Rectangle rcチップ描画領域, Color col色 )
203 tチップを描画する_本体( g, rcチップ描画領域, col色, false, false );
205 private static void t裏チップを描画する_番号( Graphics g, Rectangle rcチップ描画領域, string str番号文字列 )
207 tチップを描画する_番号( g, rcチップ描画領域, str番号文字列, true );
211 private static void t裏チップを描画する_本体( Graphics g, Rectangle rcチップ描画領域, Color col色, Cレーン.E種別 e種別 )
213 if ( e種別 == Cレーン.E種別.BEAT )
215 tチップを描画する_本体( g, rcチップ描画領域, col色, true, true );
219 tチップを描画する_本体( g, rcチップ描画領域, col色, true, false );
222 private static void t裏チップを描画する_本体( Graphics g, Rectangle rcチップ描画領域, Color col色 )
224 tチップを描画する_本体( g, rcチップ描画領域, col色, true, false );
227 private static void tチップを描画する_本体( Graphics g, Rectangle rcチップ描画領域, Color col色, bool b裏チップである, bool bBEATチップである )
229 int alphaBrush = 128;
234 rcチップ描画領域.Width -= 8;
235 rcチップ描画領域.Height -= 2;
242 SolidBrush brush = new SolidBrush( Color.FromArgb( alphaBrush, col色.R, col色.G, col色.B ) );
243 Pen pen = new Pen( Color.FromArgb( alphaPen, col色.R, col色.G, col色.B ) );
244 Pen pen2 = new Pen( Color.FromArgb( alphaPen2, col色.R, col色.G, col色.B ) );
245 g.FillRectangle( brush, rcチップ描画領域 );
246 g.DrawLine( pen, rcチップ描画領域.X, rcチップ描画領域.Y, rcチップ描画領域.Right, rcチップ描画領域.Y );
247 g.DrawLine( pen, rcチップ描画領域.X, rcチップ描画領域.Y, rcチップ描画領域.X, rcチップ描画領域.Bottom );
248 g.DrawLine( pen2, rcチップ描画領域.X, rcチップ描画領域.Bottom, rcチップ描画領域.Right, rcチップ描画領域.Bottom );
249 g.DrawLine( pen2, rcチップ描画領域.Right, rcチップ描画領域.Bottom, rcチップ描画領域.Right, rcチップ描画領域.Y );
252 SolidBrush brushWhite = new SolidBrush( Color.White );
255 ( rcチップ描画領域.X + rcチップ描画領域.Width / 2.0f ) - ( rcチップ描画領域.Height / 2.0f ),
260 brushWhite.Dispose();
264 Pen pen3 = new Pen( Color.White );
265 g.DrawLine( pen3, rcチップ描画領域.X, rcチップ描画領域.Y, rcチップ描画領域.X + rcチップ描画領域.Width, rcチップ描画領域.Y + rcチップ描画領域.Height );
266 g.DrawLine( pen3, rcチップ描画領域.X, rcチップ描画領域.Y + rcチップ描画領域.Height, rcチップ描画領域.X + rcチップ描画領域.Width, rcチップ描画領域.Y );
274 private static void tチップを描画する_番号( Graphics g, Rectangle rcチップ描画領域, string str番号文字列, bool b裏チップである )
278 StringFormat format = new StringFormat();
279 format.Alignment = StringAlignment.Center;
280 format.LineAlignment = StringAlignment.Near;
281 RectangleF layoutRectangle = new RectangleF();
282 layoutRectangle.X = rcチップ描画領域.X;
283 layoutRectangle.Y = rcチップ描画領域.Y + 1;
284 layoutRectangle.Width = rcチップ描画領域.Width;
285 layoutRectangle.Height = rcチップ描画領域.Height;
286 g.DrawString( str番号文字列, ftチップ文字用フォント, Brushes.Black, layoutRectangle, format );
289 g.DrawString( str番号文字列, ftチップ文字用フォント, Brushes.White, layoutRectangle, format );