浏览代码

Base Work

/feature-new-input-system
Thomas ICHÉ 3 年前
当前提交
dc7844df
共有 20 个文件被更改,包括 165 次插入10 次删除
  1. 2
      Editor/CustomInspectors/PingableEditor.cs
  2. 4
      Runtime/Attributes/WarnDisabledModuleAttribute.cs
  3. 1
      Runtime/GameplayIngredients.cs
  4. 1
      Runtime/LevelScripting/Actions/CinemachineCameraShakeAction.cs
  5. 2
      Runtime/LevelScripting/Actions/CinemachineSetCameraNoiseAction.cs
  6. 1
      Runtime/LevelScripting/Actions/CinemachineSetCustomBlendsAction.cs
  7. 7
      Runtime/LevelScripting/Events/OnButtonDownEvent.cs
  8. 8
      Runtime/LevelScripting/Events/OnKeyDownEvent.cs
  9. 8
      Runtime/Managers/Implementations/ScreenshotManager.cs
  10. 19
      Runtime/Managers/Manager.cs
  11. 1
      Resources/DefaultControls.inputactions
  12. 14
      Resources/DefaultControls.inputactions.meta
  13. 45
      Resources/Default_InputSystemManager.prefab
  14. 7
      Resources/Default_InputSystemManager.prefab.meta
  15. 8
      Runtime/Input.meta
  16. 7
      Runtime/Managers/DoNotCreateManagerAttribute.cs
  17. 11
      Runtime/Managers/DoNotCreateManagerAttribute.cs.meta
  18. 18
      Runtime/Input/InputSystemManager.cs
  19. 11
      Runtime/Input/InputSystemManager.cs.meta

2
Editor/CustomInspectors/PingableEditor.cs


{
if(m_RequiredModule != null)
{
EditorGUILayout.HelpBox($"This Script Requires the {m_RequiredModule.module} module : It will not execute until you enable the module in the Package Manager.", MessageType.Warning);
EditorGUILayout.HelpBox($"This Script Requires the {m_RequiredModule.module} module : It will not execute until you enable the module in the {m_RequiredModule.fixLocation}.", MessageType.Warning);
EditorGUILayout.Space();
}
EditorGUI.BeginDisabledGroup(m_RequiredModule != null);

4
Runtime/Attributes/WarnDisabledModuleAttribute.cs


public class WarnDisabledModuleAttribute : Attribute
{
public string module;
public string fixLocation;
public WarnDisabledModuleAttribute(string module)
public WarnDisabledModuleAttribute(string module, string fixLocation = "Package Manager")
this.fixLocation = fixLocation;
}
}
}

1
Runtime/GameplayIngredients.cs


{
public const string basePath = "Gameplay Ingredients/";
public const string actionsPath = basePath + "Actions/";
public const string cinemachinePath = basePath + "Cinemachine/";
public const string controllerPath = basePath + "Controllers/";
public const string counterPath = basePath + "Counters/";
public const string eventsPath = basePath + "Events/";

1
Runtime/LevelScripting/Actions/CinemachineCameraShakeAction.cs


namespace GameplayIngredients.Actions
{
[Callable("Cinemachine", "Misc/ic-cinemachine.png")]
[AddComponentMenu(ComponentMenu.cinemachinePath + "Cinemachine Camera Shake Action")]
public class CinemachineCameraShakeAction : ActionBase
{
public enum ImpulseLocation

2
Runtime/LevelScripting/Actions/CinemachineSetCameraNoiseAction.cs


namespace GameplayIngredients.Actions
{
[Callable("Cinemachine", "Misc/ic-cinemachine.png")]
[AddComponentMenu(ComponentMenu.cinemachinePath + "Cinemachine Set Camera Noise Action")]
public class CinemachineSetCameraNoiseAction : ActionBase
{
[SerializeField]

1
Runtime/LevelScripting/Actions/CinemachineSetCustomBlendsAction.cs


namespace GameplayIngredients.Actions
{
[Callable("Cinemachine", "Misc/ic-cinemachine.png")]
[AddComponentMenu(ComponentMenu.cinemachinePath + "Cinemachine Set Custom Blends Action")]
public class CinemachineSetCustomBlendsAction : ActionBase
{
public enum Action

7
Runtime/LevelScripting/Events/OnButtonDownEvent.cs


namespace GameplayIngredients.Events
{
[AddComponentMenu(ComponentMenu.eventsPath + "On Button Down Event")]
#if !ENABLE_LEGACY_INPUT_MANAGER
[WarnDisabledModule("Legacy Input Manager","Player Settings")]
#endif
[AddComponentMenu(ComponentMenu.eventsPath + "On Button Down Event (Legacy Input System)")]
public class OnButtonDownEvent : EventBase
{
public string Button = "Fire1";

#if !ENABLE_LEGACY_INPUT_MANAGER
void Update()
{
if (Input.GetButtonDown(Button))

Callable.Call(OnButtonUp, gameObject);
}
#endif
}
}

8
Runtime/LevelScripting/Events/OnKeyDownEvent.cs


namespace GameplayIngredients.Events
{
[AddComponentMenu(ComponentMenu.eventsPath + "On Key Down Event")]
#if !ENABLE_LEGACY_INPUT_MANAGER
[WarnDisabledModule("Legacy Input Manager","Player Settings")]
#endif
[AddComponentMenu(ComponentMenu.eventsPath + "On Key Down Event (Legacy Input System)")]
public class OnKeyDownEvent : EventBase
{
public KeyCode Key = KeyCode.F5;

#if !ENABLE_LEGACY_INPUT_MANAGER
if (Input.GetKeyDown(Key))
Callable.Call(OnKeyDown, gameObject);

#endif
}
}

8
Runtime/Managers/Implementations/ScreenshotManager.cs


public class ScreenshotManager : Manager
{
[Header("Capture")]
#if ENABLE_LEGACY_INPUT_MANAGER
#endif
[Range(1, 5)]
public int SuperSize = 1;

public void Update()
{
#if ENABLE_LEGACY_INPUT_MANAGER
#elif ENABLE_INPUT_SYSTEM
if (true)
#else
if(false)
#endif
{
#if MODULE_SCREENCAPTURE
var now = System.DateTime.Now;

19
Runtime/Managers/Manager.cs


foreach(var type in kAllManagerTypes)
{
if(exclusionList != null && exclusionList.ToList().Contains(type.Name))
// Check for any Do Not Create Attribute
var doNotCreateAttr = type.GetCustomAttribute<DoNotCreateManagerAttribute>();
if (doNotCreateAttr != null)
continue;
// Check for entries in exclusion List
if (exclusionList != null && exclusionList.ToList().Contains(type.Name))
var attrib = type.GetCustomAttribute<ManagerDefaultPrefabAttribute>();
var prefabAttr = type.GetCustomAttribute<ManagerDefaultPrefabAttribute>();
if(attrib != null)
if(prefabAttr != null)
var prefab = Resources.Load<GameObject>(attrib.prefab);
var prefab = Resources.Load<GameObject>(prefabAttr.prefab);
prefab = Resources.Load<GameObject>("Default_"+attrib.prefab);
prefab = Resources.Load<GameObject>("Default_"+prefabAttr.prefab);
}
if(prefab != null)

else
{
Debug.LogError($"Could not instantiate default prefab for {type.ToString()} : No prefab '{attrib.prefab}' found in resources folders. Ignoring...");
Debug.LogError($"Could not instantiate default prefab for {type.ToString()} : No prefab '{prefabAttr.prefab}' found in resources folders. Ignoring...");
continue;
}
}

1
Resources/DefaultControls.inputactions


{}

14
Resources/DefaultControls.inputactions.meta


fileFormatVersion: 2
guid: c0c261de82a1d5b4b82c2213150ca73e
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 0
wrapperCodePath:
wrapperClassName:
wrapperCodeNamespace:

45
Resources/Default_InputSystemManager.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8406094827024957934
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4168283503589276939}
- component: {fileID: -4413551057955569625}
m_Layer: 0
m_Name: Default_InputSystemManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4168283503589276939
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8406094827024957934}
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: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &-4413551057955569625
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8406094827024957934}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 44bbe53f07c77d14da3555d7d06ba904, type: 3}
m_Name:
m_EditorClassIdentifier:

7
Resources/Default_InputSystemManager.prefab.meta


fileFormatVersion: 2
guid: 63a0d71fc5ba40644b03c49f0e64a0a9
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Runtime/Input.meta


fileFormatVersion: 2
guid: 672bda0d6f34a7746be00d708786bbb2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

7
Runtime/Managers/DoNotCreateManagerAttribute.cs


using System;
namespace GameplayIngredients
{
[AttributeUsage(AttributeTargets.Class)]
public class DoNotCreateManagerAttribute : Attribute { }
}

11
Runtime/Managers/DoNotCreateManagerAttribute.cs.meta


fileFormatVersion: 2
guid: 52ebbad63c8873c489c057ca3e7ac15e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

18
Runtime/Input/InputSystemManager.cs


using UnityEngine;
namespace GameplayIngredients.Managers
{
#if !ENABLE_INPUT_SYSTEM
[DoNotCreateManager]
[WarnDisabledModule("New Input System","Player Settings")]
#endif
[AddComponentMenu(ComponentMenu.managersPath + "Input System Manager (New Input System)")]
[ManagerDefaultPrefab("InputSystemManager")]
public class InputSystemManager : Manager
{
//public InputActionAsset
}
}

11
Runtime/Input/InputSystemManager.cs.meta


fileFormatVersion: 2
guid: 44bbe53f07c77d14da3555d7d06ba904
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存