Exemple #1
0
        private static Dictionary <UnityObject, int> ToDictionary(ResourceGroup[] resourceGroups)
        {
            Dictionary <UnityObject, int> dict = new Dictionary <UnityObject, int>();

            for (int i = 0; i < resourceGroups.Length; ++i)
            {
                ResourceGroup group = resourceGroups[i];
                for (int j = 0; j < group.Mapping.Length; ++j)
                {
                    ObjectToID objToID = group.Mapping[j];
                    if (objToID.Object == null)
                    {
                        continue;
                    }
                    dict.Add(objToID.Object, objToID.Id);
                }
            }

            return(dict);
        }
        private void LoadMappings(ResourceGroup group, bool ignoreConflicts = false, List <int> ids = null)
        {
            if (!group.gameObject.IsPrefab())
            {
                PersistentIgnore ignore = group.GetComponent <PersistentIgnore>();
                if (ignore == null || ignore.IsRuntime)
                {
                    return;
                }
            }

            ObjectToID[] mappings = group.Mapping;
            for (int j = 0; j < mappings.Length; ++j)
            {
                ObjectToID mapping = mappings[j];
                if (mapping.Object == null)
                {
                    continue;
                }

                int realId = mapping.Object.GetInstanceID();
                if (m_idToId.ContainsKey(realId))
                {
                    if (ignoreConflicts)
                    {
                        continue;
                    }
                    Debug.LogError("key " + realId + "already added. Group " + group.name + " guid " + group.Guid + " mapping " + j + " mapped object " + mapping.Object);
                }
                m_idToId.Add(realId, mapping.Id);
                if (ids != null)
                {
                    //ss
                    ids.Add(realId);
                }
            }
        }