2 using System.Collections.Generic;
\r
4 using System.Runtime.InteropServices;
\r
5 using System.Drawing;
\r
10 internal class CActConfigKeyAssign : CActivity
\r
14 public bool bキー入力待ちの最中である
\r
18 return this.bキー入力待ち;
\r
25 public void t開始( E楽器パート part, Eパッド pad, string strパッド名 )
\r
27 if( part != E楽器パート.UNKNOWN )
\r
31 this.strパッド名 = strパッド名;
\r
32 for( int i = 0; i < 0x10; i++ )
\r
34 this.structReset用KeyAssign[ i ].入力デバイス = CDTXMania.ConfigIni.KeyAssign[ (int) part ][ (int) pad ][ i ].入力デバイス;
\r
35 this.structReset用KeyAssign[ i ].ID = CDTXMania.ConfigIni.KeyAssign[ (int) part ][ (int) pad ][ i ].ID;
\r
36 this.structReset用KeyAssign[ i ].コード = CDTXMania.ConfigIni.KeyAssign[ (int) part ][ (int) pad ][ i ].コード;
\r
40 public void tEnter押下()
\r
44 CDTXMania.Skin.sound決定音.t再生する();
\r
45 switch( this.n現在の選択行 )
\r
48 for( int i = 0; i < 0x10; i++ )
\r
50 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ i ].入力デバイス = this.structReset用KeyAssign[ i ].入力デバイス;
\r
51 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ i ].ID = this.structReset用KeyAssign[ i ].ID;
\r
52 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ i ].コード = this.structReset用KeyAssign[ i ].コード;
\r
57 CDTXMania.stageコンフィグ.tアサイン完了通知();
\r
60 this.bキー入力待ち = true;
\r
67 CDTXMania.Skin.soundカーソル移動音.t再生する();
\r
68 this.n現在の選択行 = ( this.n現在の選択行 + 1 ) % 0x12;
\r
75 CDTXMania.Skin.soundカーソル移動音.t再生する();
\r
76 this.n現在の選択行 = ( ( this.n現在の選択行 - 1 ) + 0x12 ) % 0x12;
\r
83 public override void On活性化()
\r
85 this.part = E楽器パート.UNKNOWN;
\r
86 this.pad = Eパッド.UNKNOWN;
\r
89 this.bキー入力待ち = false;
\r
90 this.structReset用KeyAssign = new CConfigIni.CKeyAssign.STKEYASSIGN[ 0x10 ];
\r
93 public override void On非活性化()
\r
95 if( !base.b活性化してない )
\r
97 CDTXMania.tテクスチャの解放( ref this.txカーソル );
\r
98 CDTXMania.tテクスチャの解放( ref this.txHitKeyダイアログ );
\r
102 public override void OnManagedリソースの作成()
\r
104 if( !base.b活性化してない )
\r
106 this.txカーソル = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\ScreenConfig menu cursor.png" ), false );
\r
107 this.txHitKeyダイアログ = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\ScreenConfig hit key to assign dialog.png" ), false );
\r
108 base.OnManagedリソースの作成();
\r
111 public override int On進行描画()
\r
113 if( !base.b活性化してない )
\r
117 if( CDTXMania.Input管理.Keyboard.bキーが押された( (int)SlimDX.DirectInput.Key.Escape ) )
\r
119 CDTXMania.Skin.sound取消音.t再生する();
\r
120 this.bキー入力待ち = false;
\r
121 CDTXMania.Input管理.tポーリング( CDTXMania.app.bApplicationActive, false );
\r
123 else if( ( this.tキーチェックとアサイン・Keyboard() || this.tキーチェックとアサイン・MidiIn() ) || ( this.tキーチェックとアサイン・Joypad() || this.tキーチェックとアサイン・Mouse() ) )
\r
125 this.bキー入力待ち = false;
\r
126 CDTXMania.Input管理.tポーリング( CDTXMania.app.bApplicationActive, false );
\r
129 else if( ( CDTXMania.Input管理.Keyboard.bキーが押された( (int)SlimDX.DirectInput.Key.Delete ) && ( this.n現在の選択行 >= 0 ) ) && ( this.n現在の選択行 <= 15 ) )
\r
131 CDTXMania.Skin.sound決定音.t再生する();
\r
132 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].入力デバイス = E入力デバイス.不明;
\r
133 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].ID = 0;
\r
134 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].コード = 0;
\r
136 if( this.txカーソル != null )
\r
140 int num3 = 0x3e + ( num * ( this.n現在の選択行 + 1 ) );
\r
141 this.txカーソル.t2D描画( CDTXMania.app.Device, num2, num3, new Rectangle( 0, 0, 0x10, 0x20 ) );
\r
143 Rectangle rectangle = new Rectangle( 8, 0, 0x10, 0x20 );
\r
144 for( int j = 0; j < 14; j++ )
\r
146 this.txカーソル.t2D描画( CDTXMania.app.Device, num2, num3, rectangle );
\r
149 this.txカーソル.t2D描画( CDTXMania.app.Device, num2, num3, new Rectangle( 0x10, 0, 0x10, 0x20 ) );
\r
154 CDTXMania.stageコンフィグ.actFont.t文字列描画( x, y, this.strパッド名, false, 0.75f );
\r
156 CConfigIni.CKeyAssign.STKEYASSIGN[] stkeyassignArray = CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ];
\r
157 for( int i = 0; i < 0x10; i++ )
\r
159 switch( stkeyassignArray[ i ].入力デバイス )
\r
161 case E入力デバイス.キーボード:
\r
162 this.tアサインコードの描画・Keyboard( i + 1, x + 20, y, stkeyassignArray[ i ].ID, stkeyassignArray[ i ].コード, this.n現在の選択行 == i );
\r
165 case E入力デバイス.MIDI入力:
\r
166 this.tアサインコードの描画・MidiIn( i + 1, x + 20, y, stkeyassignArray[ i ].ID, stkeyassignArray[ i ].コード, this.n現在の選択行 == i );
\r
169 case E入力デバイス.ジョイパッド:
\r
170 this.tアサインコードの描画・Joypad( i + 1, x + 20, y, stkeyassignArray[ i ].ID, stkeyassignArray[ i ].コード, this.n現在の選択行 == i );
\r
174 this.tアサインコードの描画・Mouse( i + 1, x + 20, y, stkeyassignArray[ i ].ID, stkeyassignArray[ i ].コード, this.n現在の選択行 == i );
\r
178 CDTXMania.stageコンフィグ.actFont.t文字列描画( x + 20, y, string.Format( "{0,2}.", i + 1 ), this.n現在の選択行 == i, 0.75f );
\r
183 CDTXMania.stageコンフィグ.actFont.t文字列描画( x + 20, y, "Reset", this.n現在の選択行 == 0x10, 0.75f );
\r
185 CDTXMania.stageコンフィグ.actFont.t文字列描画( x + 20, y, "<< Returnto List", this.n現在の選択行 == 0x11, 0.75f );
\r
187 if( this.bキー入力待ち && ( this.txHitKeyダイアログ != null ) )
\r
189 this.txHitKeyダイアログ.t2D描画( CDTXMania.app.Device, 0x185, 0xd7 );
\r
198 #region [ private ]
\r
199 //-----------------
\r
200 [StructLayout( LayoutKind.Sequential )]
\r
201 private struct STKEYLABEL
\r
204 public string strLabel;
\r
205 public STKEYLABEL( int nCode, string strLabel )
\r
207 this.nCode = nCode;
\r
208 this.strLabel = strLabel;
\r
212 private bool bキー入力待ち;
\r
213 private STKEYLABEL[] KeyLabel = new STKEYLABEL[] {
\r
214 new STKEYLABEL(0x35, "[ESC]"), new STKEYLABEL(1, "[ 1 ]"), new STKEYLABEL(2, "[ 2 ]"), new STKEYLABEL(3, "[ 3 ]"), new STKEYLABEL(4, "[ 4 ]"), new STKEYLABEL(5, "[ 5 ]"), new STKEYLABEL(6, "[ 6 ]"), new STKEYLABEL(7, "[ 7 ]"), new STKEYLABEL(8, "[ 8 ]"), new STKEYLABEL(9, "[ 9 ]"), new STKEYLABEL(0, "[ 0 ]"), new STKEYLABEL(0x53, "[ - ]"), new STKEYLABEL(0x34, "[ = ]"), new STKEYLABEL(0x2a, "[BSC]"), new STKEYLABEL(0x81, "[TAB]"), new STKEYLABEL(0x1a, "[ Q ]"),
\r
215 new STKEYLABEL(0x20, "[ W ]"), new STKEYLABEL(14, "[ E ]"), new STKEYLABEL(0x1b, "[ R ]"), new STKEYLABEL(0x1d, "[ T ]"), new STKEYLABEL(0x22, "[ Y ]"), new STKEYLABEL(30, "[ U ]"), new STKEYLABEL(0x12, "[ I ]"), new STKEYLABEL(0x18, "[ O ]"), new STKEYLABEL(0x19, "[ P ]"), new STKEYLABEL(0x4a, "[ [ ]"), new STKEYLABEL(0x73, "[ ] ]"), new STKEYLABEL(0x75, "[Enter]"), new STKEYLABEL(0x4b, "[L-Ctrl]"), new STKEYLABEL(10, "[ A ]"), new STKEYLABEL(0x1c, "[ S ]"), new STKEYLABEL(13, "[ D ]"),
\r
216 new STKEYLABEL(15, "[ F ]"), new STKEYLABEL(0x10, "[ G ]"), new STKEYLABEL(0x11, "[ H ]"), new STKEYLABEL(0x13, "[ J ]"), new STKEYLABEL(20, "[ K ]"), new STKEYLABEL(0x15, "[ L ]"), new STKEYLABEL(0x7b, "[ ; ]"), new STKEYLABEL(0x26, "[ ' ]"), new STKEYLABEL(0x45, "[ ` ]"), new STKEYLABEL(0x4e, "[L-Shift]"), new STKEYLABEL(0x2b, @"[ \]"), new STKEYLABEL(0x23, "[ Z ]"), new STKEYLABEL(0x21, "[ X ]"), new STKEYLABEL(12, "[ C ]"), new STKEYLABEL(0x1f, "[ V ]"), new STKEYLABEL(11, "[ B ]"),
\r
217 new STKEYLABEL(0x17, "[ N ]"), new STKEYLABEL(0x16, "[ M ]"), new STKEYLABEL(0x2f, "[ , ]"), new STKEYLABEL(0x6f, "[ . ]"), new STKEYLABEL(0x7c, "[ / ]"), new STKEYLABEL(120, "[R-Shift]"), new STKEYLABEL(0x6a, "[ * ]"), new STKEYLABEL(0x4d, "[L-Alt]"), new STKEYLABEL(0x7e, "[Space]"), new STKEYLABEL(0x2d, "[CAPS]"), new STKEYLABEL(0x36, "[F1]"), new STKEYLABEL(0x37, "[F2]"), new STKEYLABEL(0x38, "[F3]"), new STKEYLABEL(0x39, "[F4]"), new STKEYLABEL(0x3a, "[F5]"), new STKEYLABEL(0x3b, "[F6]"),
\r
218 new STKEYLABEL(60, "[F7]"), new STKEYLABEL(0x3d, "[F8]"), new STKEYLABEL(0x3e, "[F9]"), new STKEYLABEL(0x3f, "[F10]"), new STKEYLABEL(0x58, "[NumLock]"), new STKEYLABEL(0x7a, "[Scroll]"), new STKEYLABEL(0x60, "[NPad7]"), new STKEYLABEL(0x61, "[NPad8]"), new STKEYLABEL(0x62, "[NPad9]"), new STKEYLABEL(0x66, "[NPad-]"), new STKEYLABEL(0x5d, "[NPad4]"), new STKEYLABEL(0x5e, "[NPad5]"), new STKEYLABEL(0x5f, "[NPad6]"), new STKEYLABEL(0x68, "[NPad+]"), new STKEYLABEL(90, "[NPad1]"), new STKEYLABEL(0x5b, "[NPad2]"),
\r
219 new STKEYLABEL(0x5c, "[NPad3]"), new STKEYLABEL(0x59, "[NPad0]"), new STKEYLABEL(0x67, "[NPad.]"), new STKEYLABEL(0x40, "[F11]"), new STKEYLABEL(0x41, "[F12]"), new STKEYLABEL(0x42, "[F13]"), new STKEYLABEL(0x43, "[F14]"), new STKEYLABEL(0x44, "[F15]"), new STKEYLABEL(0x48, "[Kana]"), new STKEYLABEL(0x24, "[ ? ]"), new STKEYLABEL(0x30, "[Henkan]"), new STKEYLABEL(0x57, "[MuHenkan]"), new STKEYLABEL(0x8f, @"[ \ ]"), new STKEYLABEL(0x25, "[NPad.]"), new STKEYLABEL(0x65, "[NPad=]"), new STKEYLABEL(0x72, "[ ^ ]"),
\r
220 new STKEYLABEL(40, "[ @ ]"), new STKEYLABEL(0x2e, "[ : ]"), new STKEYLABEL(130, "[ _ ]"), new STKEYLABEL(0x49, "[Kanji]"), new STKEYLABEL(0x7f, "[Stop]"), new STKEYLABEL(0x29, "[AX]"), new STKEYLABEL(100, "[NPEnter]"), new STKEYLABEL(0x74, "[R-Ctrl]"), new STKEYLABEL(0x54, "[Mute]"), new STKEYLABEL(0x2c, "[Calc]"), new STKEYLABEL(0x70, "[PlayPause]"), new STKEYLABEL(0x52, "[MediaStop]"), new STKEYLABEL(0x85, "[Volume-]"), new STKEYLABEL(0x86, "[Volume+]"), new STKEYLABEL(0x8b, "[WebHome]"), new STKEYLABEL(0x63, "[NPad,]"),
\r
221 new STKEYLABEL(0x69, "[ / ]"), new STKEYLABEL(0x80, "[PrtScn]"), new STKEYLABEL(0x77, "[R-Alt]"), new STKEYLABEL(110, "[Pause]"), new STKEYLABEL(70, "[Home]"), new STKEYLABEL(0x84, "[Up]"), new STKEYLABEL(0x6d, "[PageUp]"), new STKEYLABEL(0x4c, "[Left]"), new STKEYLABEL(0x76, "[Right]"), new STKEYLABEL(0x33, "[End]"), new STKEYLABEL(50, "[Down]"), new STKEYLABEL(0x6c, "[PageDown]"), new STKEYLABEL(0x47, "[Insert]"), new STKEYLABEL(0x31, "[Delete]"), new STKEYLABEL(0x4f, "[L-Win]"), new STKEYLABEL(0x79, "[R-Win]"),
\r
222 new STKEYLABEL(0x27, "[APP]"), new STKEYLABEL(0x71, "[Power]"), new STKEYLABEL(0x7d, "[Sleep]"), new STKEYLABEL(0x87, "[Wake]")
\r
224 private int n現在の選択行;
\r
226 private E楽器パート part;
\r
227 private CConfigIni.CKeyAssign.STKEYASSIGN[] structReset用KeyAssign;
\r
228 private string strパッド名;
\r
229 private CTexture txHitKeyダイアログ;
\r
230 private CTexture txカーソル;
\r
232 private void tアサインコードの描画・Joypad( int line, int x, int y, int nID, int nCode, bool b強調 )
\r
262 if( ( 6 <= nCode ) && ( nCode < 6 + 128 ) ) // other buttons (128 types)
\r
264 str = string.Format( "Button{0}", nCode - 5 );
\r
266 else if ( ( 6 + 128 <= nCode ) && ( nCode < 6 + 128 + 8 ) ) // POV HAT ( 8 types; 45 degrees per HATs)
\r
268 str = string.Format( "POV {0}", ( nCode - 6 - 128 ) * 45 );
\r
272 str = string.Format( "Code{0}", nCode );
\r
276 CDTXMania.stageコンフィグ.actFont.t文字列描画( x, y, string.Format( "{0,2}. Joypad #{1} ", line, nID ) + str, b強調, 0.75f );
\r
278 private void tアサインコードの描画・Keyboard( int line, int x, int y, int nID, int nCode, bool b強調 )
\r
281 foreach( STKEYLABEL stkeylabel in this.KeyLabel )
\r
283 if( stkeylabel.nCode == nCode )
\r
285 str = string.Format( "{0,2}. Key {1}", line, stkeylabel.strLabel );
\r
291 str = string.Format( "{0,2}. Key 0x{1:X2}", line, nCode );
\r
293 CDTXMania.stageコンフィグ.actFont.t文字列描画( x, y, str, b強調, 0.75f );
\r
295 private void tアサインコードの描画・MidiIn( int line, int x, int y, int nID, int nCode, bool b強調 )
\r
297 CDTXMania.stageコンフィグ.actFont.t文字列描画( x, y, string.Format( "{0,2}. MidiIn #{1} code.{2}", line, nID, nCode ), b強調, 0.75f );
\r
299 private void tアサインコードの描画・Mouse( int line, int x, int y, int nID, int nCode, bool b強調 )
\r
301 CDTXMania.stageコンフィグ.actFont.t文字列描画( x, y, string.Format( "{0,2}. Mouse Button{1}", line, nCode ), b強調, 0.75f );
\r
303 private bool tキーチェックとアサイン・Joypad()
\r
305 foreach( IInputDevice device in CDTXMania.Input管理.list入力デバイス )
\r
307 if( device.e入力デバイス種別 == E入力デバイス種別.Joystick )
\r
309 for( int i = 0; i < 0x80; i++ )
\r
311 if( device.bキーが押された( 6 + i ) )
\r
313 CDTXMania.Skin.sound決定音.t再生する();
\r
314 CDTXMania.ConfigIni.t指定した入力が既にアサイン済みである場合はそれを全削除する( E入力デバイス.ジョイパッド, device.ID, 6 + i );
\r
315 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].入力デバイス = E入力デバイス.ジョイパッド;
\r
316 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].ID = device.ID;
\r
317 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].コード = 6 + i;
\r
321 for( int i = 0; i < 6; i++ )
\r
323 if( device.bキーが押された( i ) )
\r
325 CDTXMania.Skin.sound決定音.t再生する();
\r
326 CDTXMania.ConfigIni.t指定した入力が既にアサイン済みである場合はそれを全削除する( E入力デバイス.ジョイパッド, device.ID, i );
\r
327 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].入力デバイス = E入力デバイス.ジョイパッド;
\r
328 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].ID = device.ID;
\r
329 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].コード = i;
\r
333 for ( int i = 6 + 0x80; i < 6 + 0x80 + 8; i++ ) // #24341 2011.3.10 yyagi; to supoprt HAT switch
\r
335 if ( device.bキーが押された( i ) )
\r
337 CDTXMania.Skin.sound決定音.t再生する();
\r
338 CDTXMania.ConfigIni.t指定した入力が既にアサイン済みである場合はそれを全削除する( E入力デバイス.ジョイパッド, device.ID, 6 );
\r
339 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].入力デバイス = E入力デバイス.ジョイパッド;
\r
340 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].ID = device.ID;
\r
341 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].コード = i;
\r
349 private bool tキーチェックとアサイン・Keyboard()
\r
351 for( int i = 0; i < 0x100; i++ )
\r
353 if( i != (int)SlimDX.DirectInput.Key.Escape &&
\r
354 i != (int)SlimDX.DirectInput.Key.UpArrow &&
\r
355 i != (int)SlimDX.DirectInput.Key.DownArrow &&
\r
356 i != (int)SlimDX.DirectInput.Key.LeftArrow &&
\r
357 i != (int)SlimDX.DirectInput.Key.RightArrow &&
\r
358 i != (int)SlimDX.DirectInput.Key.Delete &&
\r
359 CDTXMania.Input管理.Keyboard.bキーが押された( i ) )
\r
361 CDTXMania.Skin.sound決定音.t再生する();
\r
362 CDTXMania.ConfigIni.t指定した入力が既にアサイン済みである場合はそれを全削除する( E入力デバイス.キーボード, 0, i );
\r
363 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].入力デバイス = E入力デバイス.キーボード;
\r
364 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].ID = 0;
\r
365 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].コード = i;
\r
371 private bool tキーチェックとアサイン・MidiIn()
\r
373 foreach( IInputDevice device in CDTXMania.Input管理.list入力デバイス )
\r
375 if( device.e入力デバイス種別 == E入力デバイス種別.MidiIn )
\r
377 for( int i = 0; i < 0x100; i++ )
\r
379 if( device.bキーが押された( i ) )
\r
381 CDTXMania.Skin.sound決定音.t再生する();
\r
382 CDTXMania.ConfigIni.t指定した入力が既にアサイン済みである場合はそれを全削除する( E入力デバイス.MIDI入力, device.ID, i );
\r
383 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].入力デバイス = E入力デバイス.MIDI入力;
\r
384 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].ID = device.ID;
\r
385 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].コード = i;
\r
393 private bool tキーチェックとアサイン・Mouse()
\r
395 for( int i = 0; i < 8; i++ )
\r
397 if( CDTXMania.Input管理.Mouse.bキーが押された( i ) )
\r
399 CDTXMania.ConfigIni.t指定した入力が既にアサイン済みである場合はそれを全削除する( E入力デバイス.マウス, 0, i );
\r
400 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].入力デバイス = E入力デバイス.マウス;
\r
401 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].ID = 0;
\r
402 CDTXMania.ConfigIni.KeyAssign[ (int) this.part ][ (int) this.pad ][ this.n現在の選択行 ].コード = i;
\r
407 //-----------------
\r