Пример #1
0
    private FoldObject[] GetObjectPriv(string Path)
    {
        if (Path == "")
        {
            FoldObject[] Fold = new FoldObject[Folds.Count];

            for (int i = 0; i < Fold.Length; i++)
            {
                Fold[i] = Folds[i];
            }

            return(Fold);
        }
        else
        {
            string[] pth = ParsePath(Path);

            if (FoldNames.ContainsKey(pth[0]))
            {
                return(FoldNames[pth[0]].DataManager.GetObjectPriv(pth[1]));
            }
            else
            {
                return(null);
            }
        }
    }
Пример #2
0
    private void Dest(FoldObject obj)
    {
        if (rd.CurrentFolds.ContainsKey(obj.Name))
        {
            rd.CurrentFolds.Remove(obj.Name);
        }
        string[] loc  = DividePath(obj.Name);
        int      loca = -1;

        for (int i = 0; i < Folds.Count; i++)
        {
            if (Folds[i].Name == obj.Name)
            {
                loca = i;
                break;
            }
        }
        if (loca > -1)
        {
            Folds.RemoveAt(loca);
        }
        if (FoldNames.ContainsKey(loc[1]))
        {
            FoldNames.Remove(loc[1]);
        }
        GameObject.Destroy(obj.Obj.gameObject);
        FoldStateChanged();
    }
Пример #3
0
    public FoldObject CreateObject(string Path, object[] Args, string Type)
    {
        if (!rd.PrefabDic.ContainsKey(Type))
        {
            return(null);
        }
        if (ValidString(Path))
        {
            string[] pth = ParsePath(Path);
            if (pth[1] == "")
            {
                Transform df = CreateNewDropFold();
                df.SetParent(this.transform, false);
                Transform        obj = AttachChild(df, Args, Type);
                IModuleInterface imi = obj.GetComponent <IModuleInterface>();



                FoldObject fo = new FoldObject();
                fo.DataManager = df.GetComponent <FoldManager>();
                fo.Name        = Path;
                string[] splitname = DividePath(Path);
                fo.NameSimple        = splitname[1];
                fo.Path              = splitname[0];
                fo.ChildObj          = obj;
                fo.Obj               = df;
                fo.Params            = Args;
                imi.ParameterChange += fo.InternalParameterSet;

                fo.MyType        = new KeyValuePair <string, Transform>(Type, rd.PrefabDic[Type]);
                fo.VisualManager = df.GetComponent <DropControl>();
                fo.VisualManager.InstallRD(rd);

                Folds.Add(fo);
                FoldNames.Add(pth[0], fo);
                rd.CurrentFolds.Add(Path, fo);
                fo.DataManager.PassChild(obj);

                FoldStateChanged();

                return(fo);
            }
            else
            {
                if (FoldNames.ContainsKey(pth[0]))
                {
                    return(FoldNames[pth[0]].DataManager.CreateObjectPrivate(pth[1], Args, Type, Path));
                }
                else
                {
                    return(null);
                }
            }
        }
        else
        {
            return(null);
        }
    }
Пример #4
0
 public void DestroyObject(FoldObject MyObj)
 {
     for (int i = 0; i < Folds.Count; i++)
     {
         Folds[i].Destroy();
     }
     Parent.Dest(MyObj);
 }
Пример #5
0
    /// <summary>
    /// Adds a new object to the TreeView. Returns A FoldObject allowing access to the instantiated TreeViewObject.  Returns null if either the Path, Parameters or TypeKey fail.
    /// </summary>
    /// <returns>The object.</returns>
    /// <param name="Path">A path consisting of alphanumerics separated by periods only.</param>
    /// <param name="Parameters">Array representing the parameters of the object to add to the TreeView</param>
    /// <param name="TypeKey">The Key as designated under "Key" on the FoldManager object</param>
    public FoldObject CreateObject(string Path, object[] Parameters, string TypeKey)
    {
        FoldObject fo = fm.CreateObject(Path, Parameters, TypeKey);

        if (fo == null)
        {
            return(null);
        }
        return(fo);
    }