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); }
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)); }
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); }
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); }
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); }
private EntityRef(RSEntityId inSource, string inDescriptor, object inUserData) { Entity = inSource; Descriptor = inDescriptor; UserData = inUserData; }
public EntityIdRefVisitor(RSEntityId inId) { m_EntityId = inId; }
public EntityRefUpdateVisitor(RSEntityId inOldId, RSEntityId inNewId) { m_OldId = inOldId; m_NewId = inNewId; }
/// <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)); }
/// <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; }