Exemplo n.º 1
0
        public GDETwoDListData ShallowClone()
        {
            string          newKey   = Guid.NewGuid().ToString();
            GDETwoDListData newClone = new GDETwoDListData(newKey);

            newClone.b = new List <List <bool> >(b);
            newClone.Set_b();
            newClone.i = new List <List <int> >(i);
            newClone.Set_i();
            newClone.f = new List <List <float> >(f);
            newClone.Set_f();
            newClone.s = new List <List <string> >(s);
            newClone.Set_s();
            newClone.v2 = new List <List <Vector2> >(v2);
            newClone.Set_v2();
            newClone.v3 = new List <List <Vector3> >(v3);
            newClone.Set_v3();
            newClone.v4 = new List <List <Vector4> >(v4);
            newClone.Set_v4();
            newClone.c = new List <List <Color> >(c);
            newClone.Set_c();

            Dictionary <string, object> dict;

            GDEDataManager.Get(_key, out dict);

            List <List <string> > path2DList;

            dict.TryGetStringTwoDList(goKey, out path2DList);
            GDEDataManager.SetStringTwoDList(newClone.Key, goKey, path2DList);
            newClone.go = new List <List <GameObject> >(go);
            newClone.Set_go();

            dict.TryGetStringTwoDList(texKey, out path2DList);
            GDEDataManager.SetStringTwoDList(newClone.Key, texKey, path2DList);
            newClone.tex = new List <List <Texture2D> >(tex);
            newClone.Set_tex();

            dict.TryGetStringTwoDList(matKey, out path2DList);
            GDEDataManager.SetStringTwoDList(newClone.Key, matKey, path2DList);
            newClone.mat = new List <List <Material> >(mat);
            newClone.Set_mat();

            dict.TryGetStringTwoDList(audKey, out path2DList);
            GDEDataManager.SetStringTwoDList(newClone.Key, audKey, path2DList);
            newClone.aud = new List <List <AudioClip> >(aud);
            newClone.Set_aud();

            newClone.cus = new List <List <GDETwoDListCustomData> >(cus);
            newClone.Set_cus();

            return(newClone);
        }
Exemplo n.º 2
0
        public GDETwoDListData DeepClone()
        {
            GDETwoDListData newClone = ShallowClone();

            newClone.cus = new List <List <GDETwoDListCustomData> >();
            if (cus != null)
            {
                foreach (var sublist in cus)
                {
                    var newSubList = new List <GDETwoDListCustomData>();
                    if (sublist != null)
                    {
                        foreach (var val in sublist)
                        {
                            newSubList.Add(val.DeepClone());
                        }
                    }
                    newClone.cus.Add(newSubList);
                }
            }
            newClone.Set_cus();
            return(newClone);
        }