浏览代码

Base Fixes

/2018.3
peeweek 5 年前
当前提交
dcdead9d
共有 5 个文件被更改,包括 13 次插入71 次删除
  1. 4
      Editor/HierarchyHints/HierarchyHints.cs
  2. 63
      Editor/MenuItems.cs
  3. 8
      Runtime/GameplayIngredients.asmdef
  4. 5
      Runtime/Ingredients/Interactions/InteractionManager.cs
  5. 4
      Runtime/LevelScripting/Callable.cs

4
Editor/HierarchyHints/HierarchyHints.cs


if (!Active) return;
var fullRect = selectionRect;
fullRect.xMin = 0;
fullRect.xMin = 24;
fullRect.xMax = EditorGUIUtility.currentViewWidth;
GameObject o = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (o == null) return;

{
GUI.Label(fullRect, "(s)");
GUI.Label(fullRect, " S");
EditorGUI.DrawRect(fullRect, Colors.dimGray);
}

63
Editor/MenuItems.cs


{
public static class MenuItems
{
const int kSelectMenuPriority = 149;
[MenuItem("Edit/Unelect All #D", priority = kSelectMenuPriority)]
static void UnselectAll()
{
Selection.activeObject = null;
}
[MenuItem("Edit/Play from SceneView Position #%&P", priority = kPlayMenuPriority)]
static void PlayHere()

#endregion
#region TOGGLE GIZMOS
static bool s_ShowAllGizmos = true;
const string kToggleGizmosMenu = "Edit/Show Gizmos #G";
[MenuItem(kToggleGizmosMenu, priority = kMenuPriority)]
static void ToggleGizmos()
{
s_ShowAllGizmos = !s_ShowAllGizmos;
SetAllAnnotations(AnnotationType.Gizmo, s_ShowAllGizmos);
SetAllAnnotations(AnnotationType.Icon, s_ShowAllGizmos);
Menu.SetChecked(kToggleGizmosMenu, s_ShowAllGizmos);
}
[MenuItem(kToggleGizmosMenu, priority = 600, validate = true)]
static bool CheckToggleGizmos()
{
Menu.SetChecked(kToggleGizmosMenu, s_ShowAllGizmos);
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
return true;
}
enum AnnotationType
{
Gizmo,
Icon
}
static void SetAllAnnotations(AnnotationType type, bool value)
{
var Annotation = Type.GetType("UnityEditor.Annotation, UnityEditor");
var ClassId = Annotation.GetField("classID");
var ScriptClass = Annotation.GetField("scriptClass");
Type AnnotationUtility = Type.GetType("UnityEditor.AnnotationUtility, UnityEditor");
var GetAnnotations = AnnotationUtility.GetMethod("GetAnnotations", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
var SetGizmoEnabled = AnnotationUtility.GetMethod("SetGizmoEnabled", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
var SetIconEnabled = AnnotationUtility.GetMethod("SetIconEnabled", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
Array annotations = (Array)GetAnnotations.Invoke(null, null);
foreach (var a in annotations)
{
int classId = (int)ClassId.GetValue(a);
string scriptClass = (string)ScriptClass.GetValue(a);
switch (type)
{
case AnnotationType.Gizmo:
SetGizmoEnabled.Invoke(null, new object[] { classId, scriptClass, value ? 1 : 0 });
break;
case AnnotationType.Icon:
SetIconEnabled.Invoke(null, new object[] { classId, scriptClass, value ? 1 : 0 });
break;
}
}
}
#endregion
}
}

8
Runtime/GameplayIngredients.asmdef


{
"name": "GameplayIngredients",
"references": [
"NaughtyAttributes",
"Cinemachine"
"GUID:8159fdb6c7801b34fb01c3bf046a6e57",
"GUID:4307f53044263cf4b835bd812fc161a4",
"GUID:f06555f75b070af458a003d92f9efb00"
],
"optionalUnityReferences": [],
"includePlatforms": [],

"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": []
}

5
Runtime/Ingredients/Interactions/InteractionManager.cs


{
public static class InteractionManager
{
public static IEnumerable<Interactive> interactives { get { return s_Interactives; } }
static List<Interactive> s_Interactives = new List<Interactive>();
public static void RegisterInteractive(Interactive interactive)

}
}
private static Interactive[] GetCandidates(InteractiveUser user)
public static Interactive[] GetCandidates(InteractiveUser user)
{
List<Interactive> candidates = new List<Interactive>();

return user.SortCandidates(candidates.ToArray());
}
}
}

4
Runtime/LevelScripting/Callable.cs


{
foreach (var call in calls)
{
if(Debug.isDebugBuild || Application.isEditor)
Debug.Log($"Callable : {call.gameObject.name} :> {call.GetType().Name} ({call.Name})");
if (Debug.isDebugBuild || Application.isEditor)
Debug.Log($"[CALL] : {call.gameObject.scene.name} : {call.gameObject.name} :> {call.GetType().Name} ({call.Name})");
if(call != null)
call.Execute(instigator);

正在加载...
取消
保存