浏览代码

Merge branch 'master' into HDRP_GraphicTests

/main
Remy 7 年前
当前提交
229f2e88
共有 2 个文件被更改,包括 15 次插入13 次删除
  1. 9
      ScriptableRenderPipeline/Core/CoreRP/Debugging/DebugUI.Fields.cs
  2. 19
      ScriptableRenderPipeline/Core/CoreRP/Inputs/InputRegistering.cs

9
ScriptableRenderPipeline/Core/CoreRP/Debugging/DebugUI.Fields.cs


set
{
enumNames = Enum.GetNames(value).Select(x => new GUIContent(x)).ToArray();
enumValues = Enum.GetValues(value).Cast<int>().ToArray();
// Linq.Cast<T> on a typeless Array breaks the JIT on PS4/Mono so we have to do it manually
//enumValues = Enum.GetValues(value).Cast<int>().ToArray();
var values = Enum.GetValues(value);
enumValues = new int[values.Length];
for (int i = 0; i < values.Length; i++)
enumValues[i] = (int)values.GetValue(i);
}
}
}

19
ScriptableRenderPipeline/Core/CoreRP/Inputs/InputRegistering.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class InputManagerEntry
{
public enum Kind { KeyOrButton, Mouse, Axis }

public class InputRegistering
{
static bool InputAlreadyRegistered(string name, InputManagerEntry.Kind kind, UnityEditor.SerializedProperty spAxes)
static bool InputAlreadyRegistered(string name, InputManagerEntry.Kind kind, SerializedProperty spAxes)
{
for (var i = 0; i < spAxes.arraySize; ++i)
{

return false;
}
static void WriteEntry(UnityEditor.SerializedProperty spAxes, InputManagerEntry entry)
static void WriteEntry(SerializedProperty spAxes, InputManagerEntry entry)
{
if (InputAlreadyRegistered(entry.name, entry.kind, spAxes))
return;

spAxis.FindPropertyRelative("joyNum").intValue = (int)entry.joystick;
}
static public void RegisterInputs(List<InputManagerEntry> entries)
public static void RegisterInputs(List<InputManagerEntry> entries)
/*
var currentSelection = UnityEditor.Selection.activeObject;
UnityEditor.EditorApplication.ExecuteMenuItem("Edit/Project Settings/Input");
var inputManager = UnityEditor.Selection.activeObject;
var inputManager = AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0];
var soInputManager = new UnityEditor.SerializedObject(inputManager);
var soInputManager = new SerializedObject(inputManager);
var spAxes = soInputManager.FindProperty("m_Axes");
foreach(InputManagerEntry entry in entries)

// Commit
soInputManager.ApplyModifiedProperties();
UnityEditor.Selection.activeObject = currentSelection;
*/
}
}
#endif
正在加载...
取消
保存