const Actions = ["left", "right", "jump", "moveLeftCursor", "moveRightCursor", "moveDownCursor", "moveUpCursor", "undoLayer", "removeLayer"];

class Controls {
  constructor(controlsSettings = {}, actionList = Actions) {
    this.controlsSettings = controlsSettings;
    this.actionList = actionList;
    this.isQwerty = true;
  };

  getKey(action) {
    if(!this.controlsSettings[action]) {
      console.error(`cannot find ${action} in the action list`);
    }
    return this.controlsSettings[action];
  }

  addControls(params) {
    Object.keys(params).forEach(action => this.addControl(params[action], action));
  }

  qwertyKeyboard() {
    return {
      "left" : Phaser.Keyboard.A,
      "right" : Phaser.Keyboard.D,
      "jump" : Phaser.Keyboard.W,
      "undoLayer" : Phaser.Keyboard.SPACEBAR,
      "removeLayer" : Phaser.Keyboard.SHIFT
    }
  }

  azertyKeyBoard() {
    return {
      "left" : Phaser.Keyboard.Q,
      "right" : Phaser.Keyboard.D,
      "jump" : Phaser.Keyboard.Z,
      "undoLayer" : Phaser.Keyboard.SPACEBAR,
      "removeLayer" : Phaser.Keyboard.SHIFT
    }
  }

  padConfig() {
    "jump": Phaser.Gamepad.XBOX360_A,
    "undoLayer" : Phaser.Gamepad.XBOX360_X,
    "removeLayer" : Phaser.Gamepad.XBOX360_B,
    //"right": 
  }

  injectPropsDueToKeyboardType() {
    if(!this.isQwerty) {
      return this.azertyKeyBoard();
    }
    return this.qwertyKeyboard();
  }

  defaultConfig() {
    const defaultConfigParams = {
        "moveLeftCursor" : Phaser.Keyboard.A,
        "moveRightCursor" : Phaser.Keyboard.D,
        "moveDownCursor": Phaser.Keyboard.S,
        "moveUpCursor" : Phaser.Keyboard.W,
      };
      this.addControls(defaultConfigParams);
  }

  PostMortemDefaultConfig() {
    let defaultConfigParams = {
        "moveLeftCursor" : Phaser.Keyboard.LEFT,
        "moveRightCursor" : Phaser.Keyboard.RIGHT,
        "moveDownCursor": Phaser.Keyboard.DOWN,
        "moveUpCursor" : Phaser.Keyboard.UP,
      };

      defaultConfigParams = Object.assign({}, defaultConfigParams, this.injectPropsDueToKeyboardType());
      this.addControls(defaultConfigParams);
  }

  // // { {ref: pointer, action: left key: Z}}
  // setUpControl(params) {

  //   this.keyUndoLayer = this.game.input.keyboard.addKey(Phaser.Keyboard.B);
  //   this.keyUndoLayer.onDown.add(this.undoBlockKeyboard, this);
  // }

  addControl(key, action) {
    if(!this.actionList.includes(action)) {
      console.error(`the action named '${action}' does not exist`);
    }
    this.controlsSettings[action] = key;
  }

  toggleKeyboardType() {
    this.isQwerty = !this.isQwerty;
    this.PostMortemDefaultConfig();
  }

  export() {
    return this.controlsSettings;
  }


  hasGamepad(game) {
    return game.input.gamepad.supported && game.input.gamepad.active && game.input.gamepad.pad1.connected;
  }


  initAndInstallGamepad1(game) {
    game.input.gamepad.start();
    return game.input.gamepad.pad1;
  }



}
export default Controls;
@@ -314,19 +314,20 @@
 werty = 
-tru
+fals
 e;%0A  %7D;%0A
@@ -1106,24 +1106,39 @@
 dConfig() %7B%0A
+    return %7B%0A  
     %22jump%22: 
@@ -1135,16 +1135,17 @@
   %22jump%22
+ 
 : Phaser
@@ -1164,16 +1164,18 @@
 X360_A,%0A
+  
     %22und
@@ -1210,24 +1210,26 @@
 X360_X,%0A    
+  
 %22removeLayer
@@ -1262,16 +1262,18 @@
 _B,%0A    
+ 
+ 
 //%22right
@@ -1276,16 +1276,22 @@
 ight%22: %0A
+    %7D%0A
   %7D%0A%0A  i

fix syntax