Exemple #1
0
            public bool RemoveAllLinks(RSEntityId inEntity)
            {
                if (m_Source.Links == null)
                {
                    return(false);
                }

                List <RSEntityLinkData> linkList = new List <RSEntityLinkData>(m_Source.Links);

                bool bChanged = false;

                for (int i = linkList.Count - 1; i >= 0; --i)
                {
                    if (linkList[i].EntityId == inEntity)
                    {
                        linkList.RemoveAt(i);
                        bChanged = true;
                    }
                }

                if (bChanged)
                {
                    m_Source.Links = linkList.ToArray();
                }
                return(bChanged);
            }
        public RSEntityId NextId()
        {
            int  index = m_NextId++;
            byte flags = (byte)(m_UseRuntime ? 2 : 1);

            return(RSEntityId.GenerateId(index, flags));
        }
        public T EntityWithId(RSEntityId inId)
        {
            T entity;

            m_IdMap.TryGetValue(inId, out entity);
            return(entity);
        }
Exemple #4
0
 public void CopyFrom(RSPersistEntityData inClone)
 {
     EntityId = inClone.EntityId;
     Active   = inClone.Active;
     CloneUtils.CopyFrom(ref ComponentData, inClone.ComponentData);
     CloneUtils.CopyFrom(ref TableData, inClone.TableData);
     CloneUtils.CopyFrom(ref CustomData, inClone.CustomData);
 }
 static public EntityScopeData Entity(RSEntityId inId)
 {
     if (inId == RSEntityId.Invalid)
     {
         return(Invalid());
     }
     return(new EntityScopeData(EntityScopeType.ObjectById, (int)inId));
 }
Exemple #6
0
            public bool AddLink(RSEntityId inEntity, string inLinkId)
            {
                int currentIndex = IndexOf(inEntity, inLinkId);

                if (currentIndex >= 0)
                {
                    return(false);
                }

                ArrayUtils.Add(ref m_Source.Links, new RSEntityLinkData(inEntity, inLinkId));
                return(true);
            }
Exemple #7
0
            public bool RemoveLink(RSEntityId inEntity, string inLinkId)
            {
                int currentIndex = IndexOf(inEntity, inLinkId);

                if (currentIndex < 0)
                {
                    return(false);
                }

                ArrayUtils.RemoveAt(ref m_Source.Links, currentIndex);
                return(true);
            }
Exemple #8
0
            private int IndexOf(RSEntityId inEntity, string inLinkId)
            {
                if (m_Source.Links == null)
                {
                    return(-1);
                }

                for (int i = 0; i < m_Source.Links.Length; ++i)
                {
                    if (m_Source.Links[i].EntityId == inEntity && m_Source.Links[i].Name == inLinkId)
                    {
                        return(i);
                    }
                }

                return(-1);
            }
Exemple #9
0
 private EntityRef(RSEntityId inSource, string inDescriptor, object inUserData)
 {
     Entity     = inSource;
     Descriptor = inDescriptor;
     UserData   = inUserData;
 }
Exemple #10
0
 public EntityIdRefVisitor(RSEntityId inId)
 {
     m_EntityId = inId;
 }
Exemple #11
0
 public EntityRefUpdateVisitor(RSEntityId inOldId, RSEntityId inNewId)
 {
     m_OldId = inOldId;
     m_NewId = inNewId;
 }
Exemple #12
0
 /// <summary>
 /// Deletes all references to an entity id within the given table.
 /// </summary>
 static public bool DeleteEntityRef(RSRuleTableData ioTableData, RSEntityId inEntityId)
 {
     return(UpdateEntityRef(ioTableData, inEntityId, RSEntityId.Invalid));
 }
Exemple #13
0
        /// <summary>
        /// Updates all references to an entity id within the given table.
        /// </summary>
        static public bool UpdateEntityRef(RSRuleTableData ioTableData, RSEntityId inEntityId, RSEntityId inNewId)
        {
            EntityRefUpdateVisitor updater = new EntityRefUpdateVisitor(inEntityId, inNewId);

            return(updater.Visit(ioTableData));
        }
 public RSEntityLinkData(RSEntityId inEntity, string inName)
 {
     EntityId = inEntity;
     Name     = inName;
 }