added ogIcons

pull/685/head
Greenlamp 2024-05-14 01:09:53 +02:00
parent 66414e9bbc
commit b5841471d2
3 changed files with 8 additions and 4 deletions

View File

@ -338,6 +338,7 @@ export class InputsController {
const gamepadID = gamepad.toLowerCase();
const config = deepCopy(this.getConfig(gamepadID));
config.custom = this.configs[gamepad]?.custom || {...config.default};
config.ogIcons = {...config.icons};
config.currentKeys = this.configs[gamepad]?.currentKeys;
if (!this.configs[gamepad]?.currentKeys)
reloadCurrentKeys(config);
@ -354,6 +355,7 @@ export class InputsController {
const config = deepCopy(this.getConfigKeyboard(layout));
config.custom = this.keyboardConfigs[layout]?.custom || {...config.default};
config.currentKeys = this.keyboardConfigs[layout]?.currentKeys;
config.ogIcons = {...config.icons};
if (!this.keyboardConfigs[layout]?.currentKeys)
reloadCurrentKeys(config);
else

View File

@ -3,7 +3,7 @@ import AbstractBindingUiHandler from "../settings/abrast-binding-ui-handler";
import {Mode} from "../ui";
import {
getKeyAndActionFromCurrentKeysWithPressedButton,
getKeyAndActionFromCurrentKeysWithSettingName,
getKeyAndActionFromCurrentKeysWithSettingName, getKeyFromMapping,
} from "#app/configs/gamepad-utils";
@ -22,7 +22,8 @@ export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
this.buttonPressed = button.index;
const activeConfig = this.scene.inputController.getActiveConfig();
const type = activeConfig.padType
const buttonIcon = getKeyAndActionFromCurrentKeysWithPressedButton(activeConfig, this.buttonPressed)?.icon
const key = getKeyFromMapping(activeConfig, this.buttonPressed);
const buttonIcon = activeConfig.ogIcons[key];
if (!buttonIcon) return;
const assignedButtonIcon = getKeyAndActionFromCurrentKeysWithSettingName(activeConfig, this.target)?.icon;
this.onInputDown(buttonIcon, assignedButtonIcon, type);

View File

@ -3,7 +3,7 @@ import AbstractBindingUiHandler from "../settings/abrast-binding-ui-handler";
import {Mode} from "../ui";
import {
getKeyAndActionFromCurrentKeysWithPressedButton,
getKeyAndActionFromCurrentKeysWithSettingName,
getKeyAndActionFromCurrentKeysWithSettingName, getKeyFromMapping,
} from "#app/configs/gamepad-utils";
@ -21,7 +21,8 @@ export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler {
if (!this.listening || this.buttonPressed !== null) return;
this.buttonPressed = key;
const activeConfig = this.scene.inputController.getActiveKeyboardConfig();
const buttonIcon = getKeyAndActionFromCurrentKeysWithPressedButton(activeConfig, key)?.icon
const _key = getKeyFromMapping(activeConfig, key);
const buttonIcon = activeConfig.ogIcons[_key];
if (!buttonIcon) return;
const assignedButtonIcon = getKeyAndActionFromCurrentKeysWithSettingName(activeConfig, this.target)?.icon;
this.onInputDown(buttonIcon, assignedButtonIcon, 'keyboard');