add new input mouse system
This commit is contained in:
@@ -0,0 +1,426 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.7.0
|
||||
// from Assets/Scripts/Managers/InputSystem/InputActions.inputactions
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
||||
public partial class @InputActions: IInputActionCollection2, IDisposable
|
||||
{
|
||||
public InputActionAsset asset { get; }
|
||||
public @InputActions()
|
||||
{
|
||||
asset = InputActionAsset.FromJson(@"{
|
||||
""name"": ""InputActions"",
|
||||
""maps"": [
|
||||
{
|
||||
""name"": ""Player"",
|
||||
""id"": ""277864dc-d6c8-485b-860f-70382a4eaa1e"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""PointClick"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""fb720cef-8db9-45ea-94b8-34ee20907014"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""105098b7-cb9c-4bea-a128-25fb122efd3d"",
|
||||
""path"": ""<Mouse>/leftButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""PointClick"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""Camera"",
|
||||
""id"": ""9f9ddc51-3eac-495d-9e72-48577c8c8f4b"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""Move"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""42ed90e2-8e04-4002-a0a1-953fae8787ce"",
|
||||
""expectedControlType"": ""Vector2"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""Rotate"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""d269ae49-9dbe-4e7c-9a80-1276e29898d8"",
|
||||
""expectedControlType"": ""Axis"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""Zoom"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""41d86dbc-39e0-4655-bc19-0eab9d5014a6"",
|
||||
""expectedControlType"": ""Axis"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""MouseRotate"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""646b1fc6-f255-4d12-927e-de1a93611e1b"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": ""WASD"",
|
||||
""id"": ""6a0891b5-2eec-48ad-850d-8f3d4589816b"",
|
||||
""path"": ""2DVector"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""up"",
|
||||
""id"": ""2e6af5dd-f093-4f51-8df7-996b3d0b7d8e"",
|
||||
""path"": ""<Keyboard>/w"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""down"",
|
||||
""id"": ""ef522e93-330b-4a04-8be5-9d719c461129"",
|
||||
""path"": ""<Keyboard>/s"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""left"",
|
||||
""id"": ""4785db1d-a198-4f1b-a4a3-15825b7301fd"",
|
||||
""path"": ""<Keyboard>/a"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""right"",
|
||||
""id"": ""8fdeb47b-06d1-4535-9742-01aacdd7d7a1"",
|
||||
""path"": ""<Keyboard>/d"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""1D Axis"",
|
||||
""id"": ""4c934323-993d-4354-8897-20bcd2f9dddc"",
|
||||
""path"": ""1DAxis"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Rotate"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Negative"",
|
||||
""id"": ""6f9e4496-b244-4667-8720-9096c41e3b4a"",
|
||||
""path"": ""<Keyboard>/e"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Rotate"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""Positive"",
|
||||
""id"": ""a89182c9-b935-4450-94e4-6d630806f6cc"",
|
||||
""path"": ""<Keyboard>/q"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Rotate"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""1D Axis"",
|
||||
""id"": ""c813ebc8-78b7-4e4d-8340-564c7231e367"",
|
||||
""path"": ""1DAxis"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Zoom"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""negative"",
|
||||
""id"": ""6bc3cbff-c850-49b7-bb63-6d49712aa2b7"",
|
||||
""path"": ""<Mouse>/scroll/down"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Zoom"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""positive"",
|
||||
""id"": ""d1a58c3b-b104-4c55-ab6f-faaf03b9b5c5"",
|
||||
""path"": ""<Mouse>/scroll/up"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Zoom"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""e84dc7e3-3c1e-4bb9-af62-e3ef4261fbbc"",
|
||||
""path"": ""<Mouse>/middleButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""MouseRotate"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": []
|
||||
}");
|
||||
// Player
|
||||
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
|
||||
m_Player_PointClick = m_Player.FindAction("PointClick", throwIfNotFound: true);
|
||||
// Camera
|
||||
m_Camera = asset.FindActionMap("Camera", throwIfNotFound: true);
|
||||
m_Camera_Move = m_Camera.FindAction("Move", throwIfNotFound: true);
|
||||
m_Camera_Rotate = m_Camera.FindAction("Rotate", throwIfNotFound: true);
|
||||
m_Camera_Zoom = m_Camera.FindAction("Zoom", throwIfNotFound: true);
|
||||
m_Camera_MouseRotate = m_Camera.FindAction("MouseRotate", throwIfNotFound: true);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEngine.Object.Destroy(asset);
|
||||
}
|
||||
|
||||
public InputBinding? bindingMask
|
||||
{
|
||||
get => asset.bindingMask;
|
||||
set => asset.bindingMask = value;
|
||||
}
|
||||
|
||||
public ReadOnlyArray<InputDevice>? devices
|
||||
{
|
||||
get => asset.devices;
|
||||
set => asset.devices = value;
|
||||
}
|
||||
|
||||
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
|
||||
|
||||
public bool Contains(InputAction action)
|
||||
{
|
||||
return asset.Contains(action);
|
||||
}
|
||||
|
||||
public IEnumerator<InputAction> GetEnumerator()
|
||||
{
|
||||
return asset.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
asset.Enable();
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
{
|
||||
asset.Disable();
|
||||
}
|
||||
|
||||
public IEnumerable<InputBinding> bindings => asset.bindings;
|
||||
|
||||
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
|
||||
{
|
||||
return asset.FindAction(actionNameOrId, throwIfNotFound);
|
||||
}
|
||||
|
||||
public int FindBinding(InputBinding bindingMask, out InputAction action)
|
||||
{
|
||||
return asset.FindBinding(bindingMask, out action);
|
||||
}
|
||||
|
||||
// Player
|
||||
private readonly InputActionMap m_Player;
|
||||
private List<IPlayerActions> m_PlayerActionsCallbackInterfaces = new List<IPlayerActions>();
|
||||
private readonly InputAction m_Player_PointClick;
|
||||
public struct PlayerActions
|
||||
{
|
||||
private @InputActions m_Wrapper;
|
||||
public PlayerActions(@InputActions wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @PointClick => m_Wrapper.m_Player_PointClick;
|
||||
public InputActionMap Get() { return m_Wrapper.m_Player; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
public bool enabled => Get().enabled;
|
||||
public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
|
||||
public void AddCallbacks(IPlayerActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_PlayerActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_PlayerActionsCallbackInterfaces.Add(instance);
|
||||
@PointClick.started += instance.OnPointClick;
|
||||
@PointClick.performed += instance.OnPointClick;
|
||||
@PointClick.canceled += instance.OnPointClick;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(IPlayerActions instance)
|
||||
{
|
||||
@PointClick.started -= instance.OnPointClick;
|
||||
@PointClick.performed -= instance.OnPointClick;
|
||||
@PointClick.canceled -= instance.OnPointClick;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(IPlayerActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_PlayerActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
public void SetCallbacks(IPlayerActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_PlayerActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_PlayerActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
public PlayerActions @Player => new PlayerActions(this);
|
||||
|
||||
// Camera
|
||||
private readonly InputActionMap m_Camera;
|
||||
private List<ICameraActions> m_CameraActionsCallbackInterfaces = new List<ICameraActions>();
|
||||
private readonly InputAction m_Camera_Move;
|
||||
private readonly InputAction m_Camera_Rotate;
|
||||
private readonly InputAction m_Camera_Zoom;
|
||||
private readonly InputAction m_Camera_MouseRotate;
|
||||
public struct CameraActions
|
||||
{
|
||||
private @InputActions m_Wrapper;
|
||||
public CameraActions(@InputActions wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @Move => m_Wrapper.m_Camera_Move;
|
||||
public InputAction @Rotate => m_Wrapper.m_Camera_Rotate;
|
||||
public InputAction @Zoom => m_Wrapper.m_Camera_Zoom;
|
||||
public InputAction @MouseRotate => m_Wrapper.m_Camera_MouseRotate;
|
||||
public InputActionMap Get() { return m_Wrapper.m_Camera; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
public bool enabled => Get().enabled;
|
||||
public static implicit operator InputActionMap(CameraActions set) { return set.Get(); }
|
||||
public void AddCallbacks(ICameraActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_CameraActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_CameraActionsCallbackInterfaces.Add(instance);
|
||||
@Move.started += instance.OnMove;
|
||||
@Move.performed += instance.OnMove;
|
||||
@Move.canceled += instance.OnMove;
|
||||
@Rotate.started += instance.OnRotate;
|
||||
@Rotate.performed += instance.OnRotate;
|
||||
@Rotate.canceled += instance.OnRotate;
|
||||
@Zoom.started += instance.OnZoom;
|
||||
@Zoom.performed += instance.OnZoom;
|
||||
@Zoom.canceled += instance.OnZoom;
|
||||
@MouseRotate.started += instance.OnMouseRotate;
|
||||
@MouseRotate.performed += instance.OnMouseRotate;
|
||||
@MouseRotate.canceled += instance.OnMouseRotate;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(ICameraActions instance)
|
||||
{
|
||||
@Move.started -= instance.OnMove;
|
||||
@Move.performed -= instance.OnMove;
|
||||
@Move.canceled -= instance.OnMove;
|
||||
@Rotate.started -= instance.OnRotate;
|
||||
@Rotate.performed -= instance.OnRotate;
|
||||
@Rotate.canceled -= instance.OnRotate;
|
||||
@Zoom.started -= instance.OnZoom;
|
||||
@Zoom.performed -= instance.OnZoom;
|
||||
@Zoom.canceled -= instance.OnZoom;
|
||||
@MouseRotate.started -= instance.OnMouseRotate;
|
||||
@MouseRotate.performed -= instance.OnMouseRotate;
|
||||
@MouseRotate.canceled -= instance.OnMouseRotate;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(ICameraActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_CameraActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
public void SetCallbacks(ICameraActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_CameraActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_CameraActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
public CameraActions @Camera => new CameraActions(this);
|
||||
public interface IPlayerActions
|
||||
{
|
||||
void OnPointClick(InputAction.CallbackContext context);
|
||||
}
|
||||
public interface ICameraActions
|
||||
{
|
||||
void OnMove(InputAction.CallbackContext context);
|
||||
void OnRotate(InputAction.CallbackContext context);
|
||||
void OnZoom(InputAction.CallbackContext context);
|
||||
void OnMouseRotate(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user