Ejemplo n.º 1
0
        private void OnMenuAdd(object type)
        {
            string typeString = (string)type;

            var current = UFSelection.ActiveControl;

            if (current == null)
            {
                if (typeString == "UFCanvas")
                {
                    var canvas = new UFCanvas();
                    canvas.Name = "canvas";
                    canvas.Text = "canvas";
                    UFProject.Current.Controls.Add(canvas);
                }

                return;
            }
            else
            {
                var  assembly  = Assembly.GetAssembly(typeof(UFControl));
                Type childType = assembly.GetType(typeString);
                if (childType != null)
                {
                    UFControl child = Activator.CreateInstance(childType) as UFControl;
                    child.Name = child.DefaultName;
                    child.Text = child.DefaultName;
                    current.Add(child);
                    UFSelection.ActiveControl = child;
                }
            }
        }
Ejemplo n.º 2
0
        void WindowCallback(int id)
        {
            UFControl current = this.drawList[id];

            if (UFSelection.ActiveControl != current)
            {
                GUILayout.Space(-1);
            }

            GUILayout.BeginHorizontal();

            if (UFSelection.ActiveControl != current)
            {
                GUILayout.Space(-3);
            }

            GUILayout.Space(current.Nest * 10);

            if (current.HasChild)
            {
                string text = (current.Foldout ? "\u25BC" : "\u25BA");

                if (GUILayout.Button(text, EditorStyles.label, GUILayout.Width(13)))
                {
                    current.Foldout = !current.Foldout;
                }
            }
            else
            {
                GUILayout.Label(" ", GUILayout.Width(13));
            }

            GUILayout.Label(current.Name);

            GUIContent visibleContent = (current.IsHidden ? UFContent.Minus : UFContent.VisibleSwitch);

            if (GUILayout.Button(visibleContent, EditorStyles.label, GUILayout.Width(20)))
            {
                current.IsHidden = !current.IsHidden;
            }

            GUILayout.EndHorizontal();

            if (GUI.changed)
            {
                UFStudio.RepaintAll();
            }
        }
Ejemplo n.º 3
0
 public void Add(UFControl child)
 {
     child.parent = this;
     this.childList.Add(child);
 }
Ejemplo n.º 4
0
 public void Add(UFControl child)
 {
     child.parent = this;
     this.childList.Add(child);
 }