Beispiel #1
0
    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);
    }
Beispiel #2
0
    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);
    }
Beispiel #3
0
    public void ReplaceViewService(svanderweele.Core.Pieces.View.IViewService newInstance)
    {
        var entity = viewServiceEntity;

        if (entity == null)
        {
            entity = SetViewService(newInstance);
        }
        else
        {
            entity.ReplaceViewService(newInstance);
        }
    }