private void 拡張設定() { DDEngine.FreezeInput(); for (; ;) { // ==== // 入力判定ここから // ==== if ( DDInput.A.GetInput() == 1 || DDInput.B.GetInput() == 1 || DDMouse.R.GetInput() == -1 ) { this.Mode = Mode_e.END; break; } if (DDMouse.L.GetInput() == -1) { if (this.GetTabTitleCrash_基本設定().IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y)))) { this.Mode = Mode_e.基本設定; break; } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_ウィンドウサイズ設定) { this.Mode = Mode_e.画面サイズ設定; break; } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_ゲームパッドのボタン設定 && 1 <= DDPad.GetPadCount()) { this.Mode = Mode_e.ボタン設定; break; } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_キーボードのキー設定) { this.Mode = Mode_e.キー設定; break; } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_デフォルトに戻す) { this.デフォルトに戻す(); } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_戻る) { this.Mode = Mode_e.END; break; } } // ==== // 入力判定ここまで // ==== // ==== // 描画ここから // ==== this.BeforeDrawContents(); DDDraw.DrawSimple(Ground.I.Picture.拡張設定枠, 0, 0); this.DrawTabTitles(true); this.DrawButton(960, 330, Ground.I.Picture.SettingButton_ウィンドウサイズ設定, true); this.DrawButton(960, 530, Ground.I.Picture.SettingButton_ゲームパッドのボタン設定, 1 <= DDPad.GetPadCount()); this.DrawButton(960, 730, Ground.I.Picture.SettingButton_キーボードのキー設定, true); this.DrawUnderButtons(); // ==== // 描画ここまで // ==== DDEngine.EachFrame(); } DDEngine.FreezeInput(); }
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(); } } }