Exemplo n.º 1
0
        public void DrawGraph(InternalGraphGroupAsset groupAsset, InternalBaseGraphAsset graphAsset)
        {
            GUILayoutExtension.HorizontalGroup(() => {
                EditorGUILayout.LabelField(graphAsset.name, GUILayout.Width(150));

                if (GUILayout.Button("打开", GUILayout.Width(50)))
                {
                    BaseGraphWindow.Open(graphAsset);
                }

                if (GUILayout.Button("删除", GUILayout.Width(50)))
                {
                    groupAsset.RemoveGraph(graphAsset);
                }

                if (GUILayout.Button("重命名", GUILayout.Width(50)))
                {
                    MiscHelper.Input($"输入{groupAsset.DisplayName}名:", (string name) =>
                    {
                        graphAsset.name = name;
                        EditorUtility.SetDirty(graphAsset);
                        EditorUtility.SetDirty(target);
                        AssetDatabase.SaveAssets();
                        AssetDatabase.Refresh();
                    });
                }
            });
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            IGraphAsset graphAsset = target as IGraphAsset;

            if (GUILayout.Button("Open", GUILayout.Height(30)))
            {
                BaseGraphWindow.Open(target as InternalBaseGraphAsset);
            }
        }