示例#1
0
        public static void Write(GroupAdapter parentAdapter, ChildGroupPack pack)
        {
            ChildGroupPack currentGroupPack = ChildGroupPack.Read(parentAdapter);

            Debug.Log(string.Format("ParentAdapter: {0}, {1}", parentAdapter,
                                    parentAdapter.GetInstanceID()));

            for (int i = 0; i < currentGroupPack.Groups.Count; i++)
            {
                var currentGroup = currentGroupPack.Groups[i];
                Debug.Log("newGroup.Adapters: " + currentGroup.Adapters.Count);
                currentGroup.Adapters.Clear();
                //Debug.Log("newGroup.Adapters 2: " + newGroup.Adapters.Count);
                currentGroup.Adapters.AddRange(pack.Groups[i].Adapters);
                Debug.Log("newGroup.Adapters 2: " + currentGroup.Adapters.Count);
            }
        }
示例#2
0
        public SaveablePack ToSaveablePack()
        {
            SaveablePack saveablePack = new SaveablePack(_parentAdapter.GetInstanceID());

            foreach (ChildGroup childGroup in _groups)
            {
                List <int> ids = new List <int>();
                foreach (ComponentAdapter adapter in childGroup.Adapters)
                {
                    if (null == adapter)
                    {
                        Debug.LogWarning("No adapter found");
                        continue;
                    }

                    ids.Add(adapter.GetInstanceID());
                }
                saveablePack.Add(ids);
            }

            return(saveablePack);
        }