Peter Bay Bastian
8 年前
当前提交
c6e6d4e4
共有 8 个文件被更改,包括 151 次插入 和 56 次删除
-
5MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphEditWindow.cs
-
41MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/TitleBarDrawData.cs
-
68MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/TitleBarDrawer.cs
-
1MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/TitleBar.uss
-
10MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/TitleBarButtonDrawData.cs
-
12MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/TitleBarButtonDrawData.cs.meta
-
58MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/TitleBarButtonDrawer.cs
-
12MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/TitleBarButtonDrawer.cs.meta
|
|||
using RMGUI.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine; |
|||
using System.Collections.Generic; |
|||
List<TitleBarButtonDrawData> m_leftItems; |
|||
List<TitleBarButtonDrawData> m_rightItems; |
|||
|
|||
public IEnumerable<TitleBarButtonDrawData> leftItems |
|||
{ |
|||
get { return m_leftItems; } |
|||
} |
|||
|
|||
public IEnumerable<TitleBarButtonDrawData> rightItems |
|||
{ |
|||
get { return m_rightItems; } |
|||
} |
|||
|
|||
public string title; |
|||
public void Initialize(IGraphAsset graphAsset) |
|||
{ |
|||
m_leftItems = new List<TitleBarButtonDrawData>(); |
|||
m_rightItems = new List<TitleBarButtonDrawData>(); |
|||
public void Initialize(IGraphAsset graphAsset) |
|||
{ |
|||
if (graphAsset == null) |
|||
title = ""; |
|||
else |
|||
title = graphAsset.GetScriptableObject().name; |
|||
} |
|||
var currentGraphItem = CreateInstance<TitleBarButtonDrawData>(); |
|||
currentGraphItem.text = graphAsset != null ? graphAsset.GetScriptableObject().name : ""; |
|||
m_leftItems.Add(currentGraphItem); |
|||
|
|||
var showInProjectItem = CreateInstance<TitleBarButtonDrawData>(); |
|||
showInProjectItem.text = "Show in project"; |
|||
m_leftItems.Add(showInProjectItem); |
|||
|
|||
var optionsItem = CreateInstance<TitleBarButtonDrawData>(); |
|||
optionsItem.text = "Options"; |
|||
m_rightItems.Add(optionsItem); |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
namespace UnityEditor.Graphing.Drawing |
|||
{ |
|||
public class TitleBarButtonDrawData : ScriptableObject |
|||
{ |
|||
public string text; |
|||
|
|||
protected TitleBarButtonDrawData() { } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d6d4afb1c6ac74a1bb0d4bd98b973f76 |
|||
timeCreated: 1479800767 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.RMGUI; |
|||
using RMGUI.GraphView; |
|||
using UnityEngine.RMGUI.StyleSheets; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Graphing.Drawing |
|||
{ |
|||
public class TitleBarButtonDrawer : DataWatchContainer |
|||
{ |
|||
TitleBarButtonDrawData m_dataProvider; |
|||
VisualElement m_label; |
|||
|
|||
public TitleBarButtonDrawData dataProvider |
|||
{ |
|||
get { return m_dataProvider; } |
|||
set |
|||
{ |
|||
if (m_dataProvider == value) |
|||
return; |
|||
RemoveWatch(); |
|||
m_dataProvider = value; |
|||
OnDataChanged(); |
|||
AddWatch(); |
|||
} |
|||
} |
|||
|
|||
public TitleBarButtonDrawer(TitleBarButtonDrawData dataProvider) |
|||
{ |
|||
classList = new ClassList("titleBarItem"); |
|||
|
|||
AddChild(new VisualElement() { classList = new ClassList("titleBarItemBorder") }); |
|||
m_label = new VisualElement() |
|||
{ |
|||
classList = new ClassList("titleBarItemLabel"), |
|||
content = new GUIContent("") |
|||
}; |
|||
AddChild(m_label); |
|||
AddChild(new VisualElement() { classList = new ClassList("titleBarItemBorder") }); |
|||
|
|||
this.dataProvider = dataProvider; |
|||
} |
|||
|
|||
public override void OnDataChanged() |
|||
{ |
|||
if (m_dataProvider == null) |
|||
return; |
|||
|
|||
m_label.content.text = m_dataProvider.text; |
|||
|
|||
this.Touch(ChangeType.Repaint); |
|||
} |
|||
|
|||
protected override object toWatch |
|||
{ |
|||
get { return dataProvider; } |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8ed8055e98d8f4ff5a17ea3415c08411 |
|||
timeCreated: 1479800767 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue