From e10d588cf547d82c4a6e15a7f347e3000cec7324 Mon Sep 17 00:00:00 2001 From: Roman <1325980292@qq.com> Date: Fri, 11 Mar 2022 22:42:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=EF=BC=9A=E7=BC=96=E5=86=99?= =?UTF-8?q?=E6=93=8D=E6=8E=A7=E5=9C=B0=E5=9B=BE=201.=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E6=93=8D=E4=BD=9C=EF=BC=9A=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E3=80=81=E8=B7=B3=E8=B7=83=E3=80=81=E4=BA=A4=E4=BA=92=E5=92=8C?= =?UTF-8?q?=E6=94=BB=E5=87=BB=E7=9A=84=E6=8C=89=E9=94=AE=E7=9B=91=E5=90=AC?= =?UTF-8?q?=EF=BC=8C=E7=BC=96=E5=86=99=E5=A5=BD=E4=BA=86=E7=88=B6=E7=B1=BB?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E6=97=B6=E5=8F=AA=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=BB=A7=E6=89=BFPlayerControl=EF=BC=8C=E7=84=B6=E5=90=8E?= =?UTF-8?q?=E9=87=8D=E5=86=99=E9=87=8C=E9=9D=A2=E7=9A=84=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=8D=B3=E5=8F=AF=EF=BC=8C=E6=B3=A8=E9=87=8A=E5=92=8C=E6=91=98?= =?UTF-8?q?=E8=A6=81=E9=BD=90=E5=85=A8=EF=BC=8C=E5=A6=82=E6=97=A0=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E8=AF=B7=E5=8B=BF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 我是每天上班提醒小助手,今天你上班了吗?😺 --- Assets/InputAssets.meta | 8 + Assets/InputAssets/PlayerC.cs | 424 +++++++++++++++++++ Assets/InputAssets/PlayerC.cs.meta | 11 + Assets/InputAssets/PlayerC.inputactions | 227 ++++++++++ Assets/InputAssets/PlayerC.inputactions.meta | 14 + Assets/Scenes/勍/InputTest.unity | 251 +++++++++++ Assets/Scenes/勍/InputTest.unity.meta | 7 + Assets/Scripts/勍/PlayerControl.cs | 66 +++ Assets/Scripts/勍/PlayerControl.cs.meta | 11 + Logs/ApiUpdaterCheck.txt | 20 + UserSettings/EditorUserSettings.asset | 3 + 11 files changed, 1042 insertions(+) create mode 100644 Assets/InputAssets.meta create mode 100644 Assets/InputAssets/PlayerC.cs create mode 100644 Assets/InputAssets/PlayerC.cs.meta create mode 100644 Assets/InputAssets/PlayerC.inputactions create mode 100644 Assets/InputAssets/PlayerC.inputactions.meta create mode 100644 Assets/Scenes/勍/InputTest.unity create mode 100644 Assets/Scenes/勍/InputTest.unity.meta create mode 100644 Assets/Scripts/勍/PlayerControl.cs create mode 100644 Assets/Scripts/勍/PlayerControl.cs.meta diff --git a/Assets/InputAssets.meta b/Assets/InputAssets.meta new file mode 100644 index 0000000..93d3cd7 --- /dev/null +++ b/Assets/InputAssets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: db5923efc8eaf284d90325c629a8519e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/InputAssets/PlayerC.cs b/Assets/InputAssets/PlayerC.cs new file mode 100644 index 0000000..a0f12d7 --- /dev/null +++ b/Assets/InputAssets/PlayerC.cs @@ -0,0 +1,424 @@ +//------------------------------------------------------------------------------ +// +// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator +// version 1.3.0 +// from Assets/InputAssets/PlayerC.inputactions +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.Utilities; + +public partial class @PlayerC : IInputActionCollection2, IDisposable +{ + public InputActionAsset asset { get; } + public @PlayerC() + { + asset = InputActionAsset.FromJson(@"{ + ""name"": ""PlayerC"", + ""maps"": [ + { + ""name"": ""Normal"", + ""id"": ""a9509238-4ac2-4968-9104-7e40d5ee5be8"", + ""actions"": [ + { + ""name"": ""Move"", + ""type"": ""Value"", + ""id"": ""4850f4e1-f2c9-4d5c-bd75-a8673acfb61a"", + ""expectedControlType"": ""Axis"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Atk"", + ""type"": ""Button"", + ""id"": ""514296f3-ecfc-4870-85d4-dd364fe8773e"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Jump"", + ""type"": ""Button"", + ""id"": ""abed25a0-995f-4034-84f5-d751e6bc0a7f"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Interact"", + ""type"": ""Button"", + ""id"": ""b014aa44-5a26-4e36-b7b0-2bf89fc8617c"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + } + ], + ""bindings"": [ + { + ""name"": ""Keyboard"", + ""id"": ""dfa90ca2-5172-40a9-a51c-0302d90846b4"", + ""path"": ""1DAxis"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Move"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""negative"", + ""id"": ""034d425f-6336-4c6d-a571-d5bc9a090686"", + ""path"": ""/a"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Normal"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""positive"", + ""id"": ""d58eeeaf-86a4-4adc-acb8-c647c77cd7b4"", + ""path"": ""/d"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Normal"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""GamePad"", + ""id"": ""a4b44fd8-a2cb-4a05-ab0d-ac14de8d17b6"", + ""path"": ""1DAxis"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Move"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""negative"", + ""id"": ""ca1377ed-502a-4c18-b5da-542b0ab2f78a"", + ""path"": ""/leftStick/left"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Normal"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""positive"", + ""id"": ""be7d0a09-9192-417e-b737-ea3e160f4156"", + ""path"": ""/leftStick/right"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Normal"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""74439205-ca18-4731-809e-9db029435012"", + ""path"": ""/j"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Atk"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""41256d78-e271-4ffe-a025-708f7f7dd055"", + ""path"": ""/buttonWest"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Atk"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""d26afab9-340e-4c38-905f-576f82ce664c"", + ""path"": ""/buttonSouth"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Jump"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""310e0ce7-9635-4c78-bf18-8b46b039dbb4"", + ""path"": ""/k"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Jump"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""56e4c8f3-5f31-4e4c-b216-914499d0d7a8"", + ""path"": ""/f"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Interact"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""d38f2194-30e2-45a5-a803-89534727cf65"", + ""path"": ""/buttonWest"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Interact"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""Null"", + ""id"": ""d35487bf-8b39-4ef8-932a-e057537f5cff"", + ""actions"": [ + { + ""name"": ""New action"", + ""type"": ""Button"", + ""id"": ""8227df78-160c-4425-939a-fb42da1254ef"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""522de362-9c2e-4df0-8a98-33364cf3737b"", + ""path"": """", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Normal"", + ""action"": ""New action"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + } + ], + ""controlSchemes"": [ + { + ""name"": ""Normal"", + ""bindingGroup"": ""Normal"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": true, + ""isOR"": false + }, + { + ""devicePath"": """", + ""isOptional"": true, + ""isOR"": false + } + ] + } + ] +}"); + // Normal + m_Normal = asset.FindActionMap("Normal", throwIfNotFound: true); + m_Normal_Move = m_Normal.FindAction("Move", throwIfNotFound: true); + m_Normal_Atk = m_Normal.FindAction("Atk", throwIfNotFound: true); + m_Normal_Jump = m_Normal.FindAction("Jump", throwIfNotFound: true); + m_Normal_Interact = m_Normal.FindAction("Interact", throwIfNotFound: true); + // Null + m_Null = asset.FindActionMap("Null", throwIfNotFound: true); + m_Null_Newaction = m_Null.FindAction("New action", throwIfNotFound: true); + } + + public void Dispose() + { + UnityEngine.Object.Destroy(asset); + } + + public InputBinding? bindingMask + { + get => asset.bindingMask; + set => asset.bindingMask = value; + } + + public ReadOnlyArray? devices + { + get => asset.devices; + set => asset.devices = value; + } + + public ReadOnlyArray controlSchemes => asset.controlSchemes; + + public bool Contains(InputAction action) + { + return asset.Contains(action); + } + + public IEnumerator GetEnumerator() + { + return asset.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Enable() + { + asset.Enable(); + } + + public void Disable() + { + asset.Disable(); + } + public IEnumerable 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); + } + + // Normal + private readonly InputActionMap m_Normal; + private INormalActions m_NormalActionsCallbackInterface; + private readonly InputAction m_Normal_Move; + private readonly InputAction m_Normal_Atk; + private readonly InputAction m_Normal_Jump; + private readonly InputAction m_Normal_Interact; + public struct NormalActions + { + private @PlayerC m_Wrapper; + public NormalActions(@PlayerC wrapper) { m_Wrapper = wrapper; } + public InputAction @Move => m_Wrapper.m_Normal_Move; + public InputAction @Atk => m_Wrapper.m_Normal_Atk; + public InputAction @Jump => m_Wrapper.m_Normal_Jump; + public InputAction @Interact => m_Wrapper.m_Normal_Interact; + public InputActionMap Get() { return m_Wrapper.m_Normal; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(NormalActions set) { return set.Get(); } + public void SetCallbacks(INormalActions instance) + { + if (m_Wrapper.m_NormalActionsCallbackInterface != null) + { + @Move.started -= m_Wrapper.m_NormalActionsCallbackInterface.OnMove; + @Move.performed -= m_Wrapper.m_NormalActionsCallbackInterface.OnMove; + @Move.canceled -= m_Wrapper.m_NormalActionsCallbackInterface.OnMove; + @Atk.started -= m_Wrapper.m_NormalActionsCallbackInterface.OnAtk; + @Atk.performed -= m_Wrapper.m_NormalActionsCallbackInterface.OnAtk; + @Atk.canceled -= m_Wrapper.m_NormalActionsCallbackInterface.OnAtk; + @Jump.started -= m_Wrapper.m_NormalActionsCallbackInterface.OnJump; + @Jump.performed -= m_Wrapper.m_NormalActionsCallbackInterface.OnJump; + @Jump.canceled -= m_Wrapper.m_NormalActionsCallbackInterface.OnJump; + @Interact.started -= m_Wrapper.m_NormalActionsCallbackInterface.OnInteract; + @Interact.performed -= m_Wrapper.m_NormalActionsCallbackInterface.OnInteract; + @Interact.canceled -= m_Wrapper.m_NormalActionsCallbackInterface.OnInteract; + } + m_Wrapper.m_NormalActionsCallbackInterface = instance; + if (instance != null) + { + @Move.started += instance.OnMove; + @Move.performed += instance.OnMove; + @Move.canceled += instance.OnMove; + @Atk.started += instance.OnAtk; + @Atk.performed += instance.OnAtk; + @Atk.canceled += instance.OnAtk; + @Jump.started += instance.OnJump; + @Jump.performed += instance.OnJump; + @Jump.canceled += instance.OnJump; + @Interact.started += instance.OnInteract; + @Interact.performed += instance.OnInteract; + @Interact.canceled += instance.OnInteract; + } + } + } + public NormalActions @Normal => new NormalActions(this); + + // Null + private readonly InputActionMap m_Null; + private INullActions m_NullActionsCallbackInterface; + private readonly InputAction m_Null_Newaction; + public struct NullActions + { + private @PlayerC m_Wrapper; + public NullActions(@PlayerC wrapper) { m_Wrapper = wrapper; } + public InputAction @Newaction => m_Wrapper.m_Null_Newaction; + public InputActionMap Get() { return m_Wrapper.m_Null; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(NullActions set) { return set.Get(); } + public void SetCallbacks(INullActions instance) + { + if (m_Wrapper.m_NullActionsCallbackInterface != null) + { + @Newaction.started -= m_Wrapper.m_NullActionsCallbackInterface.OnNewaction; + @Newaction.performed -= m_Wrapper.m_NullActionsCallbackInterface.OnNewaction; + @Newaction.canceled -= m_Wrapper.m_NullActionsCallbackInterface.OnNewaction; + } + m_Wrapper.m_NullActionsCallbackInterface = instance; + if (instance != null) + { + @Newaction.started += instance.OnNewaction; + @Newaction.performed += instance.OnNewaction; + @Newaction.canceled += instance.OnNewaction; + } + } + } + public NullActions @Null => new NullActions(this); + private int m_NormalSchemeIndex = -1; + public InputControlScheme NormalScheme + { + get + { + if (m_NormalSchemeIndex == -1) m_NormalSchemeIndex = asset.FindControlSchemeIndex("Normal"); + return asset.controlSchemes[m_NormalSchemeIndex]; + } + } + public interface INormalActions + { + void OnMove(InputAction.CallbackContext context); + void OnAtk(InputAction.CallbackContext context); + void OnJump(InputAction.CallbackContext context); + void OnInteract(InputAction.CallbackContext context); + } + public interface INullActions + { + void OnNewaction(InputAction.CallbackContext context); + } +} diff --git a/Assets/InputAssets/PlayerC.cs.meta b/Assets/InputAssets/PlayerC.cs.meta new file mode 100644 index 0000000..53e92fb --- /dev/null +++ b/Assets/InputAssets/PlayerC.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 774714dcc947aea43a4dd46adaad3d28 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/InputAssets/PlayerC.inputactions b/Assets/InputAssets/PlayerC.inputactions new file mode 100644 index 0000000..a46786e --- /dev/null +++ b/Assets/InputAssets/PlayerC.inputactions @@ -0,0 +1,227 @@ +{ + "name": "PlayerC", + "maps": [ + { + "name": "Normal", + "id": "a9509238-4ac2-4968-9104-7e40d5ee5be8", + "actions": [ + { + "name": "Move", + "type": "Value", + "id": "4850f4e1-f2c9-4d5c-bd75-a8673acfb61a", + "expectedControlType": "Axis", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Atk", + "type": "Button", + "id": "514296f3-ecfc-4870-85d4-dd364fe8773e", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Jump", + "type": "Button", + "id": "abed25a0-995f-4034-84f5-d751e6bc0a7f", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Interact", + "type": "Button", + "id": "b014aa44-5a26-4e36-b7b0-2bf89fc8617c", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + } + ], + "bindings": [ + { + "name": "Keyboard", + "id": "dfa90ca2-5172-40a9-a51c-0302d90846b4", + "path": "1DAxis", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "negative", + "id": "034d425f-6336-4c6d-a571-d5bc9a090686", + "path": "/a", + "interactions": "", + "processors": "", + "groups": "Normal", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "positive", + "id": "d58eeeaf-86a4-4adc-acb8-c647c77cd7b4", + "path": "/d", + "interactions": "", + "processors": "", + "groups": "Normal", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "GamePad", + "id": "a4b44fd8-a2cb-4a05-ab0d-ac14de8d17b6", + "path": "1DAxis", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "negative", + "id": "ca1377ed-502a-4c18-b5da-542b0ab2f78a", + "path": "/leftStick/left", + "interactions": "", + "processors": "", + "groups": "Normal", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "positive", + "id": "be7d0a09-9192-417e-b737-ea3e160f4156", + "path": "/leftStick/right", + "interactions": "", + "processors": "", + "groups": "Normal", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "", + "id": "74439205-ca18-4731-809e-9db029435012", + "path": "/j", + "interactions": "", + "processors": "", + "groups": "", + "action": "Atk", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "41256d78-e271-4ffe-a025-708f7f7dd055", + "path": "/buttonWest", + "interactions": "", + "processors": "", + "groups": "", + "action": "Atk", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "d26afab9-340e-4c38-905f-576f82ce664c", + "path": "/buttonSouth", + "interactions": "", + "processors": "", + "groups": "", + "action": "Jump", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "310e0ce7-9635-4c78-bf18-8b46b039dbb4", + "path": "/k", + "interactions": "", + "processors": "", + "groups": "", + "action": "Jump", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "56e4c8f3-5f31-4e4c-b216-914499d0d7a8", + "path": "/f", + "interactions": "", + "processors": "", + "groups": "", + "action": "Interact", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "d38f2194-30e2-45a5-a803-89534727cf65", + "path": "/buttonWest", + "interactions": "", + "processors": "", + "groups": "", + "action": "Interact", + "isComposite": false, + "isPartOfComposite": false + } + ] + }, + { + "name": "Null", + "id": "d35487bf-8b39-4ef8-932a-e057537f5cff", + "actions": [ + { + "name": "New action", + "type": "Button", + "id": "8227df78-160c-4425-939a-fb42da1254ef", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + } + ], + "bindings": [ + { + "name": "", + "id": "522de362-9c2e-4df0-8a98-33364cf3737b", + "path": "", + "interactions": "", + "processors": "", + "groups": "Normal", + "action": "New action", + "isComposite": false, + "isPartOfComposite": false + } + ] + } + ], + "controlSchemes": [ + { + "name": "Normal", + "bindingGroup": "Normal", + "devices": [ + { + "devicePath": "", + "isOptional": true, + "isOR": false + }, + { + "devicePath": "", + "isOptional": true, + "isOR": false + } + ] + } + ] +} \ No newline at end of file diff --git a/Assets/InputAssets/PlayerC.inputactions.meta b/Assets/InputAssets/PlayerC.inputactions.meta new file mode 100644 index 0000000..d75b4f0 --- /dev/null +++ b/Assets/InputAssets/PlayerC.inputactions.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 52fa29fa6b2d9da41929715d6ccd69c1 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} + generateWrapperCode: 1 + wrapperCodePath: + wrapperClassName: + wrapperCodeNamespace: diff --git a/Assets/Scenes/勍/InputTest.unity b/Assets/Scenes/勍/InputTest.unity new file mode 100644 index 0000000..cf66c20 --- /dev/null +++ b/Assets/Scenes/勍/InputTest.unity @@ -0,0 +1,251 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1721685559 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1721685562} + - component: {fileID: 1721685561} + - component: {fileID: 1721685560} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1721685560 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1721685559} + m_Enabled: 1 +--- !u!20 &1721685561 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1721685559} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1721685562 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1721685559} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1768031467 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1768031469} + - component: {fileID: 1768031468} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1768031468 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1768031467} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 02b642358c4be914281c3462ff8eab86, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1768031469 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1768031467} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scenes/勍/InputTest.unity.meta b/Assets/Scenes/勍/InputTest.unity.meta new file mode 100644 index 0000000..cd9b9f1 --- /dev/null +++ b/Assets/Scenes/勍/InputTest.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 778e3ae1d9c4fa347836d6c9573116a4 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/勍/PlayerControl.cs b/Assets/Scripts/勍/PlayerControl.cs new file mode 100644 index 0000000..bdd3f2a --- /dev/null +++ b/Assets/Scripts/勍/PlayerControl.cs @@ -0,0 +1,66 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.InputSystem; +using Sirenix.OdinInspector; + +/// +/// 玩家的控制器部分,玩家主类必须继承这个类才能对控制做出反应 +/// +public class PlayerControl : MonoBehaviour +{ + private PlayerC playerC; + + /// + /// 此帧输入方向,-1为左,1为右,0此帧不输入 + /// + [SerializeField][ReadOnly][Header("此帧输入方向,-1为左,1为右,0表示此帧不输入")] + protected int inputDir; + + void Start() + { + playerC = new PlayerC(); + //playerC.Enable(); + playerC.Normal.Enable(); + //为事件订阅方法 + //为移动操作订阅方法 + playerC.Normal.Move.performed += ctx => OnMove(ctx); + playerC.Normal.Move.canceled += ctx => { inputDir = 0; }; + //为攻击操作订阅方法 + playerC.Normal.Atk.performed += ctx => OnAtk(); + //为跳跃操作订阅方法 + playerC.Normal.Jump.performed += ctx => OnJump(); + //为交互操作订阅方法 + playerC.Normal.Interact.performed += ctx => OnInteract(); + } + + /// + /// 当有移动输入的时候触发,因为涉及读值,重些的时候记得必须Base + /// + protected virtual void OnMove(InputAction.CallbackContext ctx){ + //根据读值设置记录的输入方向 + if(ctx.ReadValue() > 0){ + inputDir = 1; + }else if(ctx.ReadValue() < 0){ + inputDir = -1; + } + if(ctx.ReadValue().Equals(0f)){ + inputDir = 0; + } + } + + /// + /// 按下攻击时触发 + /// + protected virtual void OnAtk(){} + + /// + /// 按下跳跃时触发 + /// + protected virtual void OnJump(){} + + /// + /// 按下交互时触发 + /// + protected virtual void OnInteract(){} +} diff --git a/Assets/Scripts/勍/PlayerControl.cs.meta b/Assets/Scripts/勍/PlayerControl.cs.meta new file mode 100644 index 0000000..5dc4b90 --- /dev/null +++ b/Assets/Scripts/勍/PlayerControl.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 02b642358c4be914281c3462ff8eab86 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Logs/ApiUpdaterCheck.txt b/Logs/ApiUpdaterCheck.txt index c9882a8..e4a7d4b 100644 --- a/Logs/ApiUpdaterCheck.txt +++ b/Logs/ApiUpdaterCheck.txt @@ -8,3 +8,23 @@ C# parse time : 672ms candidates check time : 52ms console write time : 32ms +[api-updater (non-obsolete-error-filter)] 2022/3/11 22:33:29 : Starting D:/unity/Editor/2020.3.30f1c1/Editor/Data/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe +[api-updater (non-obsolete-error-filter)] +---------------------------------- +jit/startup time : 660.5614ms +moved types parse time: 50ms +candidates parse time : 1ms +C# parse time : -1ms +candidates check time : -1ms +console write time : -1ms + +[api-updater (non-obsolete-error-filter)] 2022/3/11 22:34:57 : Starting D:/unity/Editor/2020.3.30f1c1/Editor/Data/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe +[api-updater (non-obsolete-error-filter)] +---------------------------------- +jit/startup time : 71.0488ms +moved types parse time: 49ms +candidates parse time : 1ms +C# parse time : -1ms +candidates check time : -1ms +console write time : -1ms + diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 8b0c099..24574d9 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -17,6 +17,9 @@ EditorUserSettings: RecentlyUsedScenePath-3: value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d flags: 0 + RecentlyUsedScenePath-4: + value: 22424703114646680e0b0227036cdafbfb5831243c3d3204283a097df7ee3d2cfb + flags: 0 vcSharedLogLevel: value: 0d5e400f0650 flags: 0