Exemplo n.º 1
0
 /// <summary>An Element is removed from it's previous Parent and Parented to this Element</summary>
 public CGElement AddChild(CGElement element)
 {
     if(element.GetParent() != null) element.GetParent().GetChildren().Remove(element);
     element.SetParentRaw(this);
     children.Add(element);
     return element;
 }
Exemplo n.º 2
0
 /// <summary>Modifies the Parent of the Element while adjusting the Children of the previous and new parent Elements</summary>
 public void SetParent(CGElement p)
 {
     try{
         if (IsAboveInHierarchy(p))
         {
             p.GetParent().GetChildren().Remove(p);
             p.SetParentRaw(parent);
             parent.GetChildren().Add(p);
             SetParent(p);
         }
         else
         {
             p.GetChildren().Add(this);
             if (parent != null)
             {
                 parent.GetChildren().Remove(this);
             }
             parent = p;
                             #if UNITY_EDITOR
             foldout = true;
                             #endif
         }
     }catch (System.Exception e) {
         Debug.LogWarning("CreateGUI - \"" + name + "\" could not set parent \"" + p.name + "\" \n" + e.Message);
     }
 }
Exemplo n.º 3
0
    public CGElement AddElement(string baseName, CGElement parent)
    {
        CGElement element = ScriptableObject.CreateInstance(selectedElementType) as CGElement;

        Undo.RegisterCreatedObjectUndo(element, "CreateGUI Add Element");
        element.name = baseName;
        element.SetParentRaw(parent);
        parent.GetChildren().Add(element);
        return(element);
    }
Exemplo n.º 4
0
 /// <summary>An Element is removed from it's previous Parent and Parented to this Element</summary>
 public CGElement AddChild(CGElement element)
 {
     if (element.GetParent() != null)
     {
         element.GetParent().GetChildren().Remove(element);
     }
     element.SetParentRaw(this);
     children.Add(element);
     return(element);
 }
Exemplo n.º 5
0
    /// <summary>Modifies the Parent of the Element while adjusting the Children of the previous and new parent Elements</summary>
    public void SetParent(CGElement p)
    {
        try{
            if(IsAboveInHierarchy(p)){

                p.GetParent().GetChildren().Remove(p);
                p.SetParentRaw(parent);
                parent.GetChildren().Add(p);
                SetParent(p);
            }else{
                p.GetChildren().Add(this);
                if(parent != null) parent.GetChildren().Remove(this);
                parent = p;
                #if UNITY_EDITOR
                foldout = true;
                #endif
            }
        }catch(System.Exception e){
            Debug.LogWarning("CreateGUI - \""+name+"\" could not set parent \""+p.name+"\" \n"+e.Message);
        }
    }