public void ReplaceViewService(svanderweele.Core.Pieces.View.IViewService newInstance) { var index = MetaComponentsLookup.ViewService; var component = CreateComponent <svanderweele.Core.Pieces.View.ViewServiceComponent>(index); component.instance = newInstance; ReplaceComponent(index, component); }
public MetaEntity SetViewService(svanderweele.Core.Pieces.View.IViewService newInstance) { if (hasViewService) { throw new Entitas.EntitasException("Could not set ViewService!\n" + this + " already has an entity with svanderweele.Core.Pieces.View.ViewServiceComponent!", "You should check if the context already has a viewServiceEntity before setting it or use context.ReplaceViewService()."); } var entity = CreateEntity(); entity.AddViewService(newInstance); return(entity); }
public void ReplaceViewService(svanderweele.Core.Pieces.View.IViewService newInstance) { var entity = viewServiceEntity; if (entity == null) { entity = SetViewService(newInstance); } else { entity.ReplaceViewService(newInstance); } }