public GameEntity ReplaceViewCreator(Assets.Code.Services.IViewService newValue) { var index = GameComponentsLookup.ViewCreator; var component = (Assets.Code.Components.ViewCreator)CreateComponent(index, typeof(Assets.Code.Components.ViewCreator)); component.Value = newValue; ReplaceComponent(index, component); return(this); }
public GameEntity SetViewCreator(Assets.Code.Services.IViewService newValue) { if (hasViewCreator) { throw new Entitas.EntitasException("Could not set ViewCreator!\n" + this + " already has an entity with Assets.Code.Components.ViewCreator!", "You should check if the context already has a viewCreatorEntity before setting it or use context.ReplaceViewCreator()."); } var entity = CreateEntity(); entity.AddViewCreator(newValue); return(entity); }
public void ReplaceViewCreator(Assets.Code.Services.IViewService newValue) { var entity = viewCreatorEntity; if (entity == null) { entity = SetViewCreator(newValue); } else { entity.ReplaceViewCreator(newValue); } }