public void Test01() { for (; ;) { DDCurtain.DrawCurtain(); DDPrint.SetPrint(); DDPrint.Print("PrimaryPadId: " + DDGround.PrimaryPadId); DDPrint.PrintRet(); for (int btnId = 0; btnId < DDPad.PAD_BUTTON_MAX; btnId++) { DDPrint.Print(btnId + " ==> " + DDPad.GetInput(DDGround.PrimaryPadId, btnId)); DDPrint.PrintRet(); } DDEngine.EachFrame(); } }
private bool CheckInputPadButtonKey(bool キー設定Flag, DDInput.Button targetButton) // ret: 設定した。 { DDInput.Button[] buttons = new DDInput.Button[] { DDInput.DIR_2, DDInput.DIR_4, DDInput.DIR_6, DDInput.DIR_8, DDInput.A, DDInput.B, DDInput.L, }; if (キー設定Flag) { int pressKeyId = -1; foreach (int keyId in DDSimpleMenu.GetAllKeyId()) { if (DDKey.GetInput(keyId) == 1) { pressKeyId = keyId; } } if (pressKeyId != -1) { int[] keyIds; switch (pressKeyId) { case DX.KEY_INPUT_LCONTROL: case DX.KEY_INPUT_RCONTROL: keyIds = new int[] { DX.KEY_INPUT_LCONTROL, DX.KEY_INPUT_RCONTROL }; break; case DX.KEY_INPUT_LSHIFT: case DX.KEY_INPUT_RSHIFT: keyIds = new int[] { DX.KEY_INPUT_LSHIFT, DX.KEY_INPUT_RSHIFT }; break; case DX.KEY_INPUT_LALT: case DX.KEY_INPUT_RALT: keyIds = new int[] { DX.KEY_INPUT_LALT, DX.KEY_INPUT_RALT }; break; default: keyIds = new int[] { pressKeyId }; break; } // 他ボタンとの重複回避 if (SCommon.Comp(targetButton.KeyIds, keyIds, SCommon.Comp) != 0) // ? 違う { foreach (DDInput.Button button in buttons) { if (SCommon.Comp(button.KeyIds, keyIds, SCommon.Comp) == 0) // ? 同じ { button.KeyIds = targetButton.KeyIds; } } } targetButton.KeyIds = keyIds; return(true); } } else { int pressBtnId = -1; for (int padId = 0; padId < DDPad.GetPadCount(); padId++) { for (int btnId = 0; btnId < DDPad.PAD_BUTTON_MAX; btnId++) { if (DDPad.GetInput(padId, btnId) == 1) { pressBtnId = btnId; } } } if (pressBtnId != -1) { int[] btnIds = new int[] { pressBtnId }; // 他ボタンとの重複回避 if (SCommon.Comp(targetButton.BtnIds, btnIds, SCommon.Comp) != 0) // ? 違う { foreach (DDInput.Button button in buttons) { if (SCommon.Comp(button.BtnIds, btnIds, SCommon.Comp) == 0) // ? 同じ { button.BtnIds = targetButton.BtnIds; } } } targetButton.BtnIds = btnIds; return(true); } } return(false); }
private void CheckInputPadButtonKey(bool キー設定Flag, DDInput.Button targetButton) { DDInput.Button[] buttons = new DDInput.Button[] { DDInput.DIR_2, DDInput.DIR_4, DDInput.DIR_6, DDInput.DIR_8, DDInput.A, DDInput.B, DDInput.L, }; if (キー設定Flag) { int pressKeyId = -1; foreach (int keyId in DDSimpleMenu.GetAllKeyId()) { if (DDKey.GetInput(keyId) == 1) { pressKeyId = keyId; } } if (pressKeyId != -1) { // 他ボタンとの重複回避 foreach (DDInput.Button button in buttons) { button.KeyIds = button.KeyIds.Where(keyId => keyId != pressKeyId).ToArray(); } targetButton.KeyIds = targetButton.KeyIds.Concat(new int[] { pressKeyId }).ToArray(); } } else { int pressBtnId = -1; for (int padId = 0; padId < DDPad.GetPadCount(); padId++) { for (int btnId = 0; btnId < DDPad.PAD_BUTTON_MAX; btnId++) { if (DDPad.GetInput(padId, btnId) == 1) { pressBtnId = btnId; } } } if (pressBtnId != -1) { // 他ボタンとの重複回避 foreach (DDInput.Button button in buttons) { button.BtnIds = button.BtnIds.Where(btnId => btnId != pressBtnId).ToArray(); } targetButton.BtnIds = targetButton.BtnIds.Concat(new int[] { pressBtnId }).ToArray(); } } }