private void OnScreenChanged(Ui.Screen screen) { _content.ToOption() .Select(v => v.Length != 0 ? v : GetChildren()) .ValueOr(GetChildren) .Slinq() .ForEach((t, v) => t.gameObject.SetActive(v), _screen == screen); }
public void ReplaceScreen(Ui.Screen newValue) { var index = UiComponentsLookup.Screen; var component = CreateComponent <Ui.ScreenComponent>(index); component.value = newValue; ReplaceComponent(index, component); }
public UiEntity SetScreen(Ui.Screen newValue) { if (hasScreen) { throw new Entitas.EntitasException("Could not set Screen!\n" + this + " already has an entity with Ui.ScreenComponent!", "You should check if the context already has a screenEntity before setting it or use context.ReplaceScreen()."); } var entity = CreateEntity(); entity.AddScreen(newValue); return(entity); }
public void ReplaceScreen(Ui.Screen newValue) { var entity = screenEntity; if (entity == null) { entity = SetScreen(newValue); } else { entity.ReplaceScreen(newValue); } }