Tim Cooper
7 年前
当前提交
9557fcee
共有 52 个文件被更改,包括 1235 次插入 和 724 次删除
-
26MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/Edge.cs
-
97MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/SerializableGraph.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/SerializableNode.cs
-
26MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/SerializableSlot.cs
-
41MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/GraphChange.cs
-
4MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/IEdge.cs
-
1MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/IGraph.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/INode.cs
-
4MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/ISlot.cs
-
25MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/SlotReference.cs
-
217MaterialGraphProject/Assets/PartyPreview.ShaderGraph
-
5MaterialGraphProject/Assets/PartyPreview.ShaderGraph.meta
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/AbstractMaterialGraphEditWindow.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorPresenter.cs
-
183MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
-
17MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphPreviewGenerator.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/GraphEditorPresenter.cs
-
237MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialNodePresenter.cs
-
67MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewSystem.cs
-
71MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
-
54MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
-
130MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
-
5MaterialGraphProject/Assets/UnityShaderEditor/Editor/Util/UIUtilities.cs
-
72MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractMaterialGraph.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractShaderProperty.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/TextureShaderProperty.cs
-
1MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/AbstractLightweightMasterNode.cs
-
17MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/AbstractMaterialNode.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Remapper/MasterRemapGraph.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/AbstractSubGraphNode.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/SubGraphOutputNode.cs
-
2MaterialGraphProject/ProjectSettings/ProjectVersion.txt
-
105MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/ShaderPropertyView.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/ShaderPropertyView.cs.meta
-
9MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewRate.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewRate.cs.meta
-
39MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs
-
28MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Interfaces/MaterialGraphChange.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Interfaces/MaterialGraphChange.cs.meta
-
32MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/PreviewNode.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/PreviewNode.cs.meta
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/TitleBarButtonPresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/TitleBarButtonPresenter.cs.meta
-
83MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/TitleBarPresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/TitleBarPresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarButtonView.cs.meta
-
81MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarButtonView.cs
-
68MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarView.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/TitleBar.uss.meta
-
54MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/TitleBar.uss
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs.meta
|
|||
using System; |
|||
|
|||
public interface IEdge |
|||
public interface IEdge : IEquatable<IEdge> |
|||
{ |
|||
SlotReference outputSlot { get; } |
|||
SlotReference inputSlot { get; } |
217
MaterialGraphProject/Assets/PartyPreview.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: e67b8be7b087145ab87b7ae0a690c35e |
|||
timeCreated: 1505629362 |
|||
licenseType: Pro |
|||
nonModifiableTextures: [] |
|||
nonModifiableTextures: |
|||
- Texture: {fileID: 2800000, guid: e2e7994f2c9b58f40aaebdaabbbd0ad8, type: 3} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
m_EditorVersion: 2017.3.0b1 |
|||
m_EditorVersion: 2018.1.0a1 |
|
|||
using System; |
|||
using UnityEngine; |
|||
using UnityEngine.Assertions; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using UnityEngine.Graphing; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Inspector |
|||
{ |
|||
public class ShaderPropertyView : VisualElement |
|||
{ |
|||
Action m_ValueAction; |
|||
public AbstractMaterialGraph graph { get; private set; } |
|||
public IShaderProperty property { get; private set; } |
|||
|
|||
public ShaderPropertyView(AbstractMaterialGraph graph, IShaderProperty property) |
|||
{ |
|||
this.graph = graph; |
|||
this.property = property; |
|||
|
|||
m_ValueAction = null; |
|||
if (property is FloatShaderProperty) |
|||
m_ValueAction = FloatField; |
|||
else if (property is Vector2ShaderProperty) |
|||
m_ValueAction = Vector2Field; |
|||
else if (property is Vector3ShaderProperty) |
|||
m_ValueAction = Vector3Field; |
|||
else if (property is Vector4ShaderProperty) |
|||
m_ValueAction = Vector4Field; |
|||
else if (property is ColorShaderProperty) |
|||
m_ValueAction = ColorField; |
|||
else if (property is TextureShaderProperty) |
|||
m_ValueAction = TextureField; |
|||
Assert.IsNotNull(m_ValueAction); |
|||
|
|||
Add(new IMGUIContainer(DisplayNameField) { name = "displayName" }); |
|||
Add(new IMGUIContainer(ValueField) { name = "value" }); |
|||
Add(new Button(OnClickRemove) { name = "remove", text = "Remove" }); |
|||
} |
|||
|
|||
void OnClickRemove() |
|||
{ |
|||
graph.RemoveShaderProperty(property.guid); |
|||
NotifyNodes(); |
|||
} |
|||
|
|||
void DisplayNameField() |
|||
{ |
|||
EditorGUI.BeginChangeCheck(); |
|||
property.displayName = EditorGUILayout.DelayedTextField(property.displayName); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
NotifyNodes(); |
|||
} |
|||
|
|||
void ValueField() |
|||
{ |
|||
EditorGUI.BeginChangeCheck(); |
|||
m_ValueAction(); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
NotifyNodes(); |
|||
} |
|||
|
|||
void NotifyNodes() |
|||
{ |
|||
foreach (var node in graph.GetNodes<PropertyNode>()) |
|||
node.onModified(node, ModificationScope.Node); |
|||
} |
|||
|
|||
void FloatField() |
|||
{ |
|||
var fProp = (FloatShaderProperty) property; |
|||
fProp.value = EditorGUILayout.FloatField(fProp.value); |
|||
} |
|||
|
|||
void Vector2Field() |
|||
{ |
|||
var fProp = (Vector2ShaderProperty) property; |
|||
fProp.value = EditorGUILayout.Vector2Field("", fProp.value); |
|||
} |
|||
|
|||
void Vector3Field() |
|||
{ |
|||
var fProp = (Vector3ShaderProperty) property; |
|||
fProp.value = EditorGUILayout.Vector3Field("", fProp.value); |
|||
} |
|||
|
|||
void Vector4Field() |
|||
{ |
|||
var fProp = (Vector4ShaderProperty) property; |
|||
fProp.value = EditorGUILayout.Vector4Field("", fProp.value); |
|||
} |
|||
|
|||
void ColorField() |
|||
{ |
|||
var fProp = (ColorShaderProperty) property; |
|||
fProp.value = EditorGUILayout.ColorField("", fProp.value); |
|||
} |
|||
|
|||
void TextureField() |
|||
{ |
|||
var fProp = (TextureShaderProperty) property; |
|||
fProp.value.texture = EditorGUILayout.MiniThumbnailObjectField(new GUIContent("Texture"), fProp.value.texture, typeof(Texture), null) as Texture; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a7487f4dc0fc4cf6a84bde37e66b60cb |
|||
timeCreated: 1507035849 |
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
public enum PreviewRate |
|||
{ |
|||
Full, |
|||
Throttled, |
|||
Off |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: fa070520993a4b839e705dcd7f22e4d6 |
|||
timeCreated: 1506421104 |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
public class ToolbarView : VisualElement |
|||
{ |
|||
public ToolbarView() |
|||
{ |
|||
AddStyleSheetPath("Styles/MaterialGraph"); |
|||
} |
|||
} |
|||
|
|||
public class ToolbarButtonView : VisualElement |
|||
{ |
|||
public ToolbarButtonView() |
|||
{ |
|||
AddStyleSheetPath("Styles/MaterialGraph"); |
|||
} |
|||
} |
|||
|
|||
public class ToolbarSeparatorView : VisualElement |
|||
{ |
|||
public ToolbarSeparatorView() |
|||
{ |
|||
AddStyleSheetPath("Styles/MaterialGraph"); |
|||
} |
|||
} |
|||
|
|||
public class ToolbarSpaceView : VisualElement |
|||
{ |
|||
public ToolbarSpaceView() |
|||
{ |
|||
AddStyleSheetPath("Styles/MaterialGraph"); |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
public class ShaderPropertyAdded : GraphChange |
|||
{ |
|||
public ShaderPropertyAdded(IShaderProperty shaderProperty) |
|||
{ |
|||
this.shaderProperty = shaderProperty; |
|||
} |
|||
|
|||
public IShaderProperty shaderProperty { get; private set; } |
|||
} |
|||
|
|||
public class ShaderPropertyRemoved : GraphChange |
|||
{ |
|||
public ShaderPropertyRemoved(Guid guid) |
|||
{ |
|||
this.guid = guid; |
|||
} |
|||
|
|||
public Guid guid { get; private set; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 53af639a9c00c2740ba7f23e2b38cf34 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Preview Node")] |
|||
public class PreviewNode : CodeFunctionNode |
|||
{ |
|||
public override bool hasPreview { get { return true; } } |
|||
|
|||
public PreviewNode() |
|||
{ |
|||
name = "Preview"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Preview", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Preview( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector input, |
|||
[Slot(1, Binding.None)] out DynamicDimensionVector output) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
output = input; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0a9c3dd2c3b0c4347876f3e448be2046 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
// TODO JOCE: Needed at all?
|
|||
public class TitleBarButtonPresenter : ScriptableObject |
|||
{ |
|||
public delegate void ClickCallback(); |
|||
|
|||
public string text; |
|||
public ClickCallback onClick { get; set; } |
|||
|
|||
protected TitleBarButtonPresenter() {} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d6d4afb1c6ac74a1bb0d4bd98b973f76 |
|||
timeCreated: 1479800767 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
using System.Collections.Generic; |
|||
using UnityEngine.MaterialGraph; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using UnityEditor.MaterialGraph.Drawing; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
// TODO JOCE: Not sure the title bar requires a presenter at all.
|
|||
public class TitleBarPresenter : ScriptableObject |
|||
{ |
|||
List<TitleBarButtonPresenter> m_leftItems; |
|||
List<TitleBarButtonPresenter> m_rightItems; |
|||
IMaterialGraphEditWindow m_Owner; |
|||
|
|||
public IEnumerable<TitleBarButtonPresenter> leftItems |
|||
{ |
|||
get { return m_leftItems; } |
|||
} |
|||
|
|||
public IEnumerable<TitleBarButtonPresenter> rightItems |
|||
{ |
|||
get { return m_rightItems; } |
|||
} |
|||
|
|||
protected TitleBarPresenter() |
|||
{} |
|||
|
|||
public void Initialize(IMaterialGraphEditWindow graphWindow) |
|||
{ |
|||
m_Owner = graphWindow; |
|||
m_leftItems = new List<TitleBarButtonPresenter>(); |
|||
m_rightItems = new List<TitleBarButtonPresenter>(); |
|||
|
|||
var currentGraphItem = CreateInstance<TitleBarButtonPresenter>(); |
|||
currentGraphItem.text = "Put name here"; |
|||
m_leftItems.Add(currentGraphItem); |
|||
|
|||
var updateAsset = CreateInstance<TitleBarButtonPresenter>(); |
|||
updateAsset.text = "Update Asset"; |
|||
updateAsset.onClick += UpdateAsset; |
|||
m_leftItems.Add(updateAsset); |
|||
|
|||
var toSubGraph = CreateInstance<TitleBarButtonPresenter>(); |
|||
toSubGraph.text = "Selection -> Subgraph"; |
|||
toSubGraph.onClick += ToSubGraph; |
|||
m_leftItems.Add(toSubGraph); |
|||
|
|||
var showInProjectItem = CreateInstance<TitleBarButtonPresenter>(); |
|||
showInProjectItem.text = "Show in project"; |
|||
showInProjectItem.onClick += OnShowInProjectClick; |
|||
m_leftItems.Add(showInProjectItem); |
|||
|
|||
var optionsItem = CreateInstance<TitleBarButtonPresenter>(); |
|||
optionsItem.text = "Time"; |
|||
optionsItem.onClick += ToggleTime; |
|||
m_rightItems.Add(optionsItem); |
|||
} |
|||
|
|||
void OnShowInProjectClick() |
|||
{ |
|||
if (m_Owner != null) |
|||
m_Owner.PingAsset(); |
|||
} |
|||
|
|||
void UpdateAsset() |
|||
{ |
|||
m_Owner.UpdateAsset(); |
|||
} |
|||
|
|||
void ToSubGraph() |
|||
{ |
|||
m_Owner.ToSubGraph(); |
|||
} |
|||
|
|||
void ToggleTime() |
|||
{ |
|||
m_Owner.ToggleRequiresTime(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b93a304d64ffa46d39b22539fc917b41 |
|||
timeCreated: 1478775744 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 8ed8055e98d8f4ff5a17ea3415c08411 |
|||
timeCreated: 1479800767 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
public class TitleBarButtonView : DataWatchContainer |
|||
{ |
|||
TitleBarButtonPresenter m_dataProvider; |
|||
Clicker m_clicker; |
|||
VisualElement m_label; |
|||
|
|||
public TitleBarButtonPresenter dataProvider |
|||
{ |
|||
get { return m_dataProvider; } |
|||
set |
|||
{ |
|||
if (m_dataProvider == value) |
|||
return; |
|||
RemoveWatch(); |
|||
m_dataProvider = value; |
|||
OnDataChanged(); |
|||
AddWatch(); |
|||
} |
|||
} |
|||
|
|||
public TitleBarButtonView(TitleBarButtonPresenter dataProvider) |
|||
{ |
|||
AddToClassList("titleBarItem"); |
|||
|
|||
m_clicker = new Clicker(); |
|||
m_clicker.onClick += OnClick; |
|||
m_clicker.onStateChange += OnClickStateChanged; |
|||
this.AddManipulator(m_clicker); |
|||
|
|||
var ve = new VisualElement(); |
|||
ve.AddToClassList("titleBarItemBorder"); |
|||
Add(ve); |
|||
|
|||
|
|||
m_label = new VisualElement(); |
|||
m_label.AddToClassList("titleBarItemLabel"); |
|||
Add(m_label); |
|||
|
|||
var ve2 = new VisualElement(); |
|||
ve2.AddToClassList("titleBarItemBorder"); |
|||
|
|||
this.dataProvider = dataProvider; |
|||
} |
|||
|
|||
public override void OnDataChanged() |
|||
{ |
|||
if (m_dataProvider == null) |
|||
return; |
|||
|
|||
m_label.text = m_dataProvider.text; |
|||
|
|||
this.Dirty(ChangeType.Repaint); |
|||
} |
|||
|
|||
void OnClick() |
|||
{ |
|||
if (m_dataProvider != null && m_dataProvider.onClick != null) |
|||
m_dataProvider.onClick(); |
|||
} |
|||
|
|||
void OnClickStateChanged(ClickerState newState) |
|||
{ |
|||
if (newState == ClickerState.Active) |
|||
AddToClassList("active"); |
|||
else if (newState == ClickerState.Inactive) |
|||
RemoveFromClassList("active"); |
|||
this.Dirty(ChangeType.Repaint); |
|||
} |
|||
|
|||
protected override Object[] toWatch |
|||
{ |
|||
get { return new Object[] {dataProvider}; } |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
public class TitleBarView : DataWatchContainer |
|||
{ |
|||
TitleBarPresenter m_DataProvider; |
|||
VisualContainer m_LeftContainer; |
|||
VisualContainer m_RightContainer; |
|||
|
|||
public TitleBarPresenter dataProvider |
|||
{ |
|||
get { return m_DataProvider; } |
|||
set |
|||
{ |
|||
if (m_DataProvider == value) |
|||
return; |
|||
RemoveWatch(); |
|||
m_DataProvider = value; |
|||
OnDataChanged(); |
|||
AddWatch(); |
|||
} |
|||
} |
|||
|
|||
public TitleBarView() |
|||
{ |
|||
name = "TitleBar"; |
|||
|
|||
m_LeftContainer = new VisualContainer() |
|||
{ |
|||
name = "left" |
|||
}; |
|||
Add(m_LeftContainer); |
|||
|
|||
m_RightContainer = new VisualContainer() |
|||
{ |
|||
name = "right" |
|||
}; |
|||
Add(m_RightContainer); |
|||
|
|||
AddStyleSheetPath("Styles/TitleBar"); |
|||
} |
|||
|
|||
public override void OnDataChanged() |
|||
{ |
|||
if (m_DataProvider == null) |
|||
return; |
|||
|
|||
UpdateContainer(m_LeftContainer, m_DataProvider.leftItems); |
|||
UpdateContainer(m_RightContainer, m_DataProvider.rightItems); |
|||
} |
|||
|
|||
static void UpdateContainer(VisualContainer container, IEnumerable<TitleBarButtonPresenter> itemDatas) |
|||
{ |
|||
container.ClearChildren(); |
|||
foreach (var itemPresenter in itemDatas) |
|||
container.AddChild(new TitleBarButtonView(itemPresenter)); |
|||
} |
|||
|
|||
protected override Object[] toWatch |
|||
{ |
|||
get { return new Object[] {dataProvider}; } |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2bdb46d80eb734cc2bc61fa6a2302e52 |
|||
timeCreated: 1479148211 |
|||
licenseType: Pro |
|||
StyleSheetImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
TitleBarView { |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
align-items: stretch; |
|||
background-color: rgba(33, 33, 33, 0.5); |
|||
padding-bottom: 1; |
|||
/*margin-top: -1;*/ |
|||
} |
|||
|
|||
TitleBarView #left, |
|||
TitleBarView #right { |
|||
flex: 1; |
|||
height: 16; |
|||
background-color: #3d3d3d; |
|||
align-items: stretch; |
|||
flex-direction: row; |
|||
} |
|||
|
|||
TitleBarView #left { |
|||
justify-content: flex-start; |
|||
} |
|||
|
|||
TitleBarView #right { |
|||
justify-content: flex-end; |
|||
} |
|||
|
|||
.titleBarItem { |
|||
flex-direction: row; |
|||
} |
|||
|
|||
.titleBarItem.active { |
|||
background-color: rgba(33, 33, 33, 0.5); |
|||
} |
|||
|
|||
#left .titleBarItem { |
|||
margin-left: 5; |
|||
} |
|||
|
|||
#right .titleBarItem { |
|||
margin-right: 5; |
|||
} |
|||
|
|||
.titleBarItemBorder { |
|||
background-color: rgba(33, 33, 33, 0.5); |
|||
width: 1; |
|||
} |
|||
|
|||
.titleBarItemLabel { |
|||
text-color: rgba(255, 255, 255, 0.6); |
|||
font-size: 9; |
|||
text-alignment: middle-left; |
|||
padding-left: 5; |
|||
padding-right: 5; |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue