浏览代码

Base Fixes

/main
Thomas ICHÉ 6 年前
当前提交
99f82ca6
共有 7 个文件被更改,包括 34 次插入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
  6. 14
      DELTA.md
  7. 7
      DELTA.md.meta

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);

14
DELTA.md


# GameplayIngredients - Delta Changelog
This Delta changelog states all changes made in order to run on Spaceship Demo
## 2019-03-26 Initial Release
- (thomasi) Added a reference to Timeline package in GameplayIngredients runtime ASMDEF
- (thomas) tweaked Advanced Hierarchy view so the (s) static is not displayed on top of the view toggle (2019.2)
- (BACKPORT) (thomas) Changed the default player prefab to have the Player Tag
- (thomas) Removed the Menu item for toggling gizmos
- (thomas) Removed Unselect All menu shortcut
- (BACKPORT) (thomas) Added Static accessor InteractionManger for accessing information for Hovering.
- (BACKPORT) (thomas) Made static InteractionManger.GetCandidates public for accessing information for Hovering.
- (BACKPORT) (thomas) Tweaked Debug Log for Callables

7
DELTA.md.meta


fileFormatVersion: 2
guid: 5b89cfcd817e6504bb76eb2d35d24868
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存