Example #1
0
        public ManagerAttributes(SerializedManagerAttributes source)
        {
            managerType                  = null;
            isAlwaysGlobal               = source.isGlobalOnly;
            managerDepenedencyTypes      = null;
            managerDependencyTypesLookup = null;

            var assembly = GetType().Assembly;

            managerType = !string.IsNullOrEmpty(source.managerTypeName) ? assembly.GetType(source.managerTypeName):null;
            var list = new List <System.Type>();

            if (source.managerDependencyTypeNames != null)
            {
                managerDepenedencyTypes = new System.Type[source.managerDependencyTypeNames.Length];
                for (int i = 0; i < managerDepenedencyTypes.Length; ++i)
                {
                    if (string.IsNullOrEmpty(source.managerDependencyTypeNames[i]))
                    {
                        continue;
                    }
                    var type = assembly.GetType(source.managerDependencyTypeNames[i]);
                    if (type == null)
                    {
                        continue;
                    }
                    list.Add(type);
                }
            }
            managerDepenedencyTypes = list.ToArray();

            managerDependencyTypesLookup = new HashSet <System.Type>(managerDepenedencyTypes);
        }
Example #2
0
    void ISerializationCallbackReceiver.OnBeforeSerialize()
    {
        int numTypes = m_attributes.Count;

        m_serializedAttributes = new SerializedManagerAttributes[numTypes];
        var e = m_attributes.Values.GetEnumerator();
        int i = 0;

        while (e.MoveNext())
        {
            m_serializedAttributes[i] = new SerializedManagerAttributes(e.Current);
            ++i;
        }
    }