浏览代码

Custom Scene View Delegate

/refactor-2021-2-sceneview-toolbar
Thomas ICHÉ 3 年前
当前提交
9d31c66f
共有 4 个文件被更改,包括 56 次插入11 次删除
  1. 39
      Editor/SceneViewToolbar/SceneViewToolbar.Overlays.cs
  2. 3
      Editor/SceneViewToolbar/SceneViewToolbar.cs
  3. 14
      Editor/SceneViewToolbar/SceneViewToolbar.Delegate.cs
  4. 11
      Editor/SceneViewToolbar/SceneViewToolbar.Delegate.cs.meta

39
Editor/SceneViewToolbar/SceneViewToolbar.Overlays.cs


{
const string prefix = "IngredientsToolbarOverlay.";
public IngredientsToolbarOverlay() : base(
PlayFromHereButton.id,
LinkGameViewButton.id,
PointOfViewButton.id,
CommentsButton.id,
PlayFromHereButton.id,
LinkGameViewButton.id,
PointOfViewButton.id,
CommentsButton.id,
) { }
)
{ }
protected override Layout supportedLayouts => Layout.HorizontalToolbar | Layout.VerticalToolbar;

{
var m = new GenericMenu();
m.AddItem(new GUIContent("Link Camera"), LinkGameView.LockedSceneView == containerWindow as SceneView,
() => {
() =>
{
() => {
() =>
{
LinkGameView.CinemachineActive = true;
value = true;
UpdateIcon();

}
#endregion
static class Contents
{
public static Texture2D playFromHere;

ingredientsExplorer = EditorGUIUtility.Load("Packages/net.peeweek.gameplay-ingredients/Icons/Misc/ic-callable.png") as Texture2D;
}
}
}
[Overlay(typeof(SceneView), "Custom (Gameplay Ingredients)", true)]
public class IngredientsCustomToolbarOverlay : Overlay, IAccessContainerWindow
{
EditorWindow IAccessContainerWindow.containerWindow { get; set; }
SceneView sceneView => containerWindow as SceneView;
protected override Layout supportedLayouts => Layout.HorizontalToolbar;
public override VisualElement CreatePanelContent()
{
return new IMGUIContainer(() =>
{
using(new GUILayout.HorizontalScope(EditorStyles.toolbar))
{
SceneViewToolbar.OnSceneViewToolbarGUI?.Invoke(sceneView);
}
});
}
}
}
}

3
Editor/SceneViewToolbar/SceneViewToolbar.cs


{
#if !UNITY_2021_2_OR_NEWER
public delegate void SceneViewToolbarDelegate(SceneView sceneView);
public static event SceneViewToolbarDelegate OnSceneViewToolbarGUI;
[InitializeOnLoadMethod]
static void Initialize()

14
Editor/SceneViewToolbar/SceneViewToolbar.Delegate.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
using GameplayIngredients.Comments.Editor;
namespace GameplayIngredients.Editor
{
public static partial class SceneViewToolbar
{
public delegate void SceneViewToolbarDelegate(SceneView sceneView);
public static event SceneViewToolbarDelegate OnSceneViewToolbarGUI;
}
}

11
Editor/SceneViewToolbar/SceneViewToolbar.Delegate.cs.meta


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