コード例 #1
0
        private void DoChildEditor(Rect rect, int index)
        {
            if (myNode.getChilds().Count <= index)
            {
                return;
            }

            var hasLink = myNode.getChilds()[index] != null;

            if (GUI.Button(rect, hasLink ? linkTex : noLinkTex, noBackgroundSkin.button))
            {
                parent.StartSetChild(this.myNode, index);
            }
        }
コード例 #2
0
        public void draw()
        {
            using (new GUILayout.VerticalScope())
            {
                EditorGUILayout.HelpBox(TC.get("ConversationEditor.AtLeastOne"), MessageType.None);

                var min = linesList.headerHeight + linesList.footerHeight + linesList.elementHeight + 5;
                linesList.DoList(Mathf.Max(min, Mathf.Min(200, linesList.elementHeight * (linesList.count - 1) + min)));

                EditorGUILayout.HelpBox(TC.get("ConversationEditor.NodeOption"), MessageType.None);

                using (new GUILayout.HorizontalScope())
                {
                    using (new EditorGUI.DisabledGroupScope(myNode.getChildCount() > 0 || myNode.getAddableNodes().Length == 0))
                    {
                        if (GUILayout.Button(TC.get("ConversationEditor.CreateChild")))
                        {
                            var options = new List <GUIContent>();
                            foreach (var addable in Node.getAddableNodes())
                            {
                                options.Add(new GUIContent("Create " + TC.get("Element.Name" + addable)));
                            }

                            EditorUtility.DisplayCustomMenu(new Rect(Event.current.mousePosition, Vector2.one), options.ToArray(), -1, (param, ops, selected) =>
                            {
                                var option = Node.getAddableNodes()[selected];
                                parent.Content.addNode(myNode, option);
                            }, Event.current.mousePosition);
                        }
                    }

                    if (GUILayout.Button(TC.get("ConversationEditor.SetChild")))
                    {
                        parent.StartSetChild(this.myNode, 0);
                    }

                    var hasEffects = myNode.getEffects().getEffects().Count > 0;
                    if (GUILayout.Button(hasEffects ? effectTex : noEffectTex, noBackgroundSkin.button, GUILayout.Width(24), GUILayout.Height(24)))
                    {
                        EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                        window.Init(myNode.getEffects());
                    }
                }
            }
        }