static void InternalBuildEntityViews(int entityID, Dictionary <Type, ITypeSafeList> entityViewsByType, IEntityDescriptorInfo eentityViewsToBuildDescriptor, object[] implementors) { var entityViewsToBuildDescriptor = eentityViewsToBuildDescriptor as EntityDescriptorInfo; var entityViewsToBuild = entityViewsToBuildDescriptor.entityViewsToBuild; var count = entityViewsToBuild.Length; for (var index = 0; index < count; index++) { var entityViewBuilder = entityViewsToBuild[index]; var entityViewType = entityViewBuilder.GetEntityViewType(); var entityViewObjectToFill = BuildEntityView(entityID, entityViewsByType, entityViewType, entityViewBuilder); if (entityViewBuilder.mustBeFilled) { FillEntityView(entityViewObjectToFill as EntityView , implementors , entityViewsToBuildDescriptor.name); } } }
static void InternalBuildEntityViews(int entityID, Dictionary <Type, ITypeSafeList> entityViewsByType, IEntityDescriptorInfo eentityViewsToBuildDescriptor, object[] implementors, RemoveEntityImplementor removeEntityImplementor) { var entityViewsToBuildDescriptor = eentityViewsToBuildDescriptor as EntityDescriptorInfo; var entityViewsToBuild = entityViewsToBuildDescriptor.entityViewsToBuild; int count = entityViewsToBuild.Length; for (int index = 0; index < count; index++) { var entityViewBuilder = entityViewsToBuild[index]; var entityViewType = entityViewBuilder.GetEntityViewType(); //only class EntityView will be returned //struct EntityView cannot be filled so it will be null. var entityViewObjectToFill = BuildEntityView(entityID, entityViewsByType, entityViewType, entityViewBuilder); //the semantic of this code must still be improved //but only classes can be filled, so I am aware //it's a EntityView if (entityViewObjectToFill != null) { FillEntityView(entityViewObjectToFill as EntityView, implementors, removeEntityImplementor, entityViewsToBuildDescriptor.name); } } }
internal static void BuildGroupedEntityViews(int entityID, int groupID, Dictionary <int, Dictionary <Type, ITypeSafeList> > groupEntityViewsByType, Dictionary <Type, ITypeSafeList> entityViewsByType, IEntityDescriptorInfo eentityViewsToBuildDescriptor, object[] implementors) { var entityViewsToBuildDescriptor = eentityViewsToBuildDescriptor as EntityDescriptorInfo; Dictionary <Type, ITypeSafeList> groupedEntityViewsTyped; if (groupEntityViewsByType.TryGetValue(groupID, out groupedEntityViewsTyped) == false) { groupedEntityViewsTyped = new Dictionary <Type, ITypeSafeList>(); groupEntityViewsByType.Add(groupID, groupedEntityViewsTyped); } InternalBuildEntityViews(entityID, groupedEntityViewsTyped, entityViewsToBuildDescriptor, implementors); var removeEntityView = EntityView <EntityInfoView> .BuildEntityView(entityID); removeEntityView.groupID = groupID; removeEntityView.isInAGroup = true; removeEntityView.entityViews = entityViewsToBuildDescriptor.entityViewsToBuild; AddEntityInfoView(entityViewsByType, removeEntityView); }
void BuildEntityInGroup(int entityID, int groupID, IEntityDescriptorInfo entityDescriptor, object[] implementors = null) { EntityFactory.BuildGroupedEntityViews(entityID, groupID, _groupedEntityViewsToAdd.current, _entityViewsToAdd.current, entityDescriptor, implementors); }
internal static void BuildEntityViews(int entityID, Dictionary <Type, ITypeSafeList> entityViewsByType, IEntityDescriptorInfo eentityViewsToBuildDescriptor, object[] implementors) { var entityViewsToBuildDescriptor = eentityViewsToBuildDescriptor as EntityDescriptorInfo; var removeEntityImplementor = entityViewsToBuildDescriptor.removeEntityImplementor; InternalBuildEntityViews(entityID, entityViewsByType, entityViewsToBuildDescriptor, implementors, removeEntityImplementor); }
internal static void BuildEntityViews(int entityID, Dictionary <Type, ITypeSafeList> entityViewsByType, IEntityDescriptorInfo eentityViewsToBuildDescriptor, object[] implementors) { var entityViewsToBuildDescriptor = eentityViewsToBuildDescriptor as EntityDescriptorInfo; InternalBuildEntityViews(entityID, entityViewsByType, entityViewsToBuildDescriptor, implementors); var removeEntityView = EntityView <EntityInfoView> .BuildEntityView(entityID); removeEntityView.entityViews = entityViewsToBuildDescriptor.entityViewsToBuild; AddEntityInfoView(entityViewsByType, removeEntityView); }
internal static void BuildGroupedEntityViews(int entityID, int groupID, Dictionary <int, Dictionary <Type, ITypeSafeList> > groupEntityViewsByType, IEntityDescriptorInfo eentityViewsToBuildDescriptor, object[] implementors) { var entityViewsToBuildDescriptor = eentityViewsToBuildDescriptor as EntityDescriptorInfo; Dictionary <Type, ITypeSafeList> groupedEntityViewsTyped; if (groupEntityViewsByType.TryGetValue(groupID, out groupedEntityViewsTyped) == false) { groupedEntityViewsTyped = new Dictionary <Type, ITypeSafeList>(); groupEntityViewsByType.Add(groupID, groupedEntityViewsTyped); } //I would like to find a better solution for this var removeEntityImplementor = new RemoveEntityImplementor(entityViewsToBuildDescriptor.entityViewsToBuild, groupID); InternalBuildEntityViews(entityID, groupedEntityViewsTyped, entityViewsToBuildDescriptor, implementors, removeEntityImplementor); }
public void OnContextCreated(UnityContext contextHolder) { IEntityDescriptorHolder[] entities = contextHolder.GetComponentsInChildren <IEntityDescriptorHolder>(); foreach (IEntityDescriptorHolder entity in entities) { IEntityDescriptorInfo entityInfo = entity.RetrieveDescriptor(); m_EntityFactory.BuildEntity(((MonoBehaviour)entity).gameObject.GetInstanceID(), entityInfo, (entity as MonoBehaviour).GetComponentsInChildren <IImplementor>()); } GameObject player = Camera.main.gameObject; List <IImplementor> implementors = new List <IImplementor>(); player.GetComponents(implementors); implementors.Add(new PlayerInputImplementor()); m_EntityFactory.BuildEntity <PlayerEntity>(player.GetInstanceID(), implementors.ToArray()); }
/// <summary> /// When the type of the entity is not known (this is a special case!) an EntityDescriptorInfo /// can be built in place of the generic parameter T. /// </summary> /// <param name="entityID"></param> /// <param name="entityDescriptor"></param> /// <param name="implementors"></param> void BuildEntity(int entityID, IEntityDescriptorInfo entityDescriptor, object[] implementors) { EntityFactory.BuildEntityViews (entityID, _entityViewsToAdd.current, entityDescriptor, implementors); }
public void BuildEntityInGroup(int entityID, int groupID, IEntityDescriptorInfo entityDescriptor, object[] implementors) { _weakEngine.Target.BuildEntityInGroup(entityID, groupID, entityDescriptor, implementors); }
public void BuildEntity(int entityID, IEntityDescriptorInfo entityDescriptor, object[] implementors = null) { _weakEngine.Target.BuildEntity(entityID, entityDescriptor, implementors); }