コード例 #1
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);
     }
 }
コード例 #2
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;
 }
コード例 #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);
    }
コード例 #4
0
 CGElement SearchElements(CGElement element, string Name)
 {
     foreach (CGElement child in element.GetChildren())
     {
         if (child.name == Name)
         {
             return(child);
         }
         else
         {
             CGElement result = SearchElements(child, Name);
             if (result != null)
             {
                 return(result);
             }
         }
     }
     return(null);
 }
コード例 #5
0
    List <CGElement> SaveRecursively(List <CGElement> children, string save)
    {
        List <CGElement> copies = new List <CGElement>();

        foreach (CGElement child in children)
        {
            if (child != null)
            {
                CGElement copy = (CGElement)Instantiate(child);
                copy.name = child.name;
                copies.Add(copy);
                if (save != "")
                {
                    AssetDatabase.AddObjectToAsset(copy, save);
                }
                copy.SetChildren(SaveRecursively(copy.GetChildren(), save));
            }
        }
        return(copies);
    }
コード例 #6
0
ファイル: CGElement.cs プロジェクト: Zewzit/OZone-GameRealm
    /// <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);
        }
    }
コード例 #7
0
ファイル: CreateGUI.cs プロジェクト: Zewzit/OZone-GameRealm
    CGElement SearchElements(CGElement element,string Name)
    {
        foreach(CGElement child in element.GetChildren()){

            if(child.name == Name) return child;
            else{
                CGElement result = SearchElements(child,Name);
                if(result != null) return result;
            }
        }
        return null;
    }