public void ReplaceGridService(svanderweele.Core.Pieces.Grid.Core.Service.IGridService newService) { var index = MetaComponentsLookup.GridService; var component = CreateComponent <svanderweele.Core.Pieces.Grid.Core.Service.GridServiceComponent>(index); component.service = newService; ReplaceComponent(index, component); }
public MetaEntity SetGridService(svanderweele.Core.Pieces.Grid.Core.Service.IGridService newService) { if (hasGridService) { throw new Entitas.EntitasException("Could not set GridService!\n" + this + " already has an entity with svanderweele.Core.Pieces.Grid.Core.Service.GridServiceComponent!", "You should check if the context already has a gridServiceEntity before setting it or use context.ReplaceGridService()."); } var entity = CreateEntity(); entity.AddGridService(newService); return(entity); }
public void ReplaceGridService(svanderweele.Core.Pieces.Grid.Core.Service.IGridService newService) { var entity = gridServiceEntity; if (entity == null) { entity = SetGridService(newService); } else { entity.ReplaceGridService(newService); } }