using InControl;
using UnityEngine;

public class UIActions : PlayerActionSet
{
	public PlayerAction Up { get; private set; }
	public PlayerAction Down { get; private set; }
	public PlayerAction Left { get; private set; }
	public PlayerAction Right { get; private set; }
	
	public PlayerTwoAxisAction Move { get; private set; }

	public PlayerAction Select { get; private set; }
	public PlayerAction Back { get; private set; }

	public UIActions()
	{
		Up = CreatePlayerAction("Move Up");
		Down = CreatePlayerAction("Move Down");
		Left = CreatePlayerAction("Move Left");
		Right = CreatePlayerAction("Move Right");
		Move = CreateTwoAxisPlayerAction(Left, Right, Down, Up);

		Select = CreatePlayerAction("Select");
		Back = CreatePlayerAction("Back");

		SetDefaultValues();
	}

	public void SetDefaultValues()
	{
		Up.ClearBindings();
		Up.AddDefaultBinding(InputControlType.LeftStickUp);
		Up.AddDefaultBinding(InputControlType.DPadUp);
		Up.AddDefaultBinding(Key.W);
		Up.AddDefaultBinding(Key.UpArrow);

		Down.ClearBindings();
		Down.AddDefaultBinding(InputControlType.LeftStickDown);
		Down.AddDefaultBinding(InputControlType.DPadDown);
		Down.AddDefaultBinding(Key.S);
		Down.AddDefaultBinding(Key.DownArrow);

		Left.ClearBindings();
		Left.AddDefaultBinding(InputControlType.LeftStickLeft);
		Left.AddDefaultBinding(InputControlType.DPadLeft);
		Left.AddDefaultBinding(Key.A);
		Left.AddDefaultBinding(Key.UpArrow);

		Right.ClearBindings();
		Right.AddDefaultBinding(InputControlType.LeftStickRight);
		Right.AddDefaultBinding(InputControlType.DPadRight);
		Right.AddDefaultBinding(Key.D);
		Right.AddDefaultBinding(Key.RightArrow);

		Select.ClearBindings();
		Select.AddDefaultBinding(InputControlType.Action1);
		Select.AddDefaultBinding(Key.F);
		Select.AddDefaultBinding(Key.P);

		Back.ClearBindings();
		Back.AddDefaultBinding(InputControlType.Action2);
		Back.AddDefaultBinding(Key.G);
		Back.AddDefaultBinding(Key.O);
		Back.AddDefaultBinding(Key.Escape);
	}
}