public void LoadSettings([NotNull] SceneSettingsData sceneSettings) { GizmoSize = sceneSettings.ComponentGizmoSize; FixedSize = sceneSettings.FixedSizeGizmos; var hiddenGizmos = sceneSettings.HiddenGizmos; hiddenGizmos.Select(x => ActiveGizmos.FirstOrDefault(y => y.ComponentName == x)).NotNull().ForEach(x => x.IsActive = false); FallbackGizmo.IsActive = hiddenGizmos.All(x => x != FallbackGizmo.ComponentName); }
public void SaveSettings([NotNull] SceneSettingsData sceneSettings) { sceneSettings.ComponentGizmoSize = GizmoSize; sceneSettings.FixedSizeGizmos = FixedSize; var hiddenComponents = sceneSettings.HiddenGizmos; hiddenComponents.Clear(); ActiveGizmos.Where(x => !x.IsActive).Select(x => x.ComponentName).ForEach(hiddenComponents.Add); if (!FallbackGizmo.IsActive) { hiddenComponents.Add(FallbackGizmo.ComponentName); } }
public EntityGizmosViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.controller = controller; activeGizmos.AddRange(typeof(EntityComponent).GetInheritedTypes().Where(x => StrideDefaultAssetsPlugin.GizmoTypeDictionary.ContainsKey(x)).OrderBy(DisplayAttribute.GetDisplayName).Select(x => new GizmoViewModel(ServiceProvider, x, controller))); FallbackGizmo = new GizmoViewModel(ServiceProvider, typeof(TransformComponent), controller); ToggleAllGizmosCommand = new AnonymousCommand <bool>(ServiceProvider, value => ActiveGizmos.ForEach(x => x.IsActive = value)); }