Пример #1
0
 /// <summary>
 /// Re-links the UID dictionary to the actual components in our list.
 /// Also, if any items do not have a UID assigned to them, they will
 /// automatically have a UID assigned.
 /// </summary>
 public void ResolveUIDs()
 {
     m_Dictionary.Clear();
     foreach (T item in m_Components)
     {
         if ((item as UniqueComponent).UID == null)
         {
             (item as UniqueComponent).UID = UniqueComponent.NewUID();
         }
         m_Dictionary[(item as UniqueComponent).UID.Value] = item;
     }
 }
Пример #2
0
        public void Add(T item)
        {
            if (!m_Components.Contains(item))
            {
                m_Components.Add(item);

                UniqueComponent uc = item as UniqueComponent;
                uc.UIDChanged += new UniqueComponent.UIDChangedEventHandler(UIDChangedHandler);

                if (uc.UID != null)
                {
                    m_Dictionary[uc.UID] = item;
                }
            }
        }
 public UniqueComponentSerializer(UniqueComponent uc) : base(uc) {}