예제 #1
0
 public static SceneSettingsData CreateDefault()
 {
     return(new SceneSettingsData
     {
         HiddenGizmos = new List <string> {
             DisplayAttribute.GetDisplayName(typeof(TransformComponent)), DisplayAttribute.GetDisplayName(typeof(PhysicsComponent))
         }
     });
 }
예제 #2
0
        protected override void UpdateNode(IAssetNodePresenter node)
        {
            if (!(node.Asset is GameSettingsViewModel))
            {
                return;
            }

            if (node.Name == nameof(GameSettingsAsset.Defaults) &&
                node.Value is List <Configuration> )
            {
                foreach (var item in node.Children.ToList())
                {
                    item.Order = node.Order + item.Index.Int;
                    item.AttachedProperties.Add(CategoryData.Key, true);
                }
                if (!node.Commands.Any(cmd => cmd.Name == AddNewItemCommand.CommandName))
                {
                    node.Commands.Add(new AddNewItemCommand());
                }
                if (!node.Commands.Any(cmd => cmd.Name == RemoveItemCommand.CommandName))
                {
                    node.Commands.Add(new RemoveItemCommand());
                }
            }

            if (typeof(Configuration).IsAssignableFrom(node.Type))
            {
                node.DisplayName = DisplayAttribute.GetDisplayName(node.Value?.GetType()) ??
                                   DisplayAttribute.GetDisplayName(typeof(Configuration));
            }

            if (typeof(ConfigurationOverride).IsAssignableFrom(node.Type))
            {
                node.DisplayName = $"Override {node.Index}";
                node.AttachedProperties.Add(CategoryData.Key, true);
            }

            if (node.Parent != null &&
                typeof(ConfigurationOverride).IsAssignableFrom(node.Parent.Type) &&
                node.Name == nameof(ConfigurationOverride.SpecificFilter))
            {
                if (node.Commands.All(x => x.Name != "ClearSelection"))
                {
                    node.Commands.Add(new SyncAnonymousNodePresenterCommand("ClearSelection", (n, x) => n.UpdateValue(-1)));
                }
            }

            if (typeof(ICollection <Configuration>).IsAssignableFrom(node.Type))
            {
                var types = node.AttachedProperties.Get(AbstractNodeEntryData.Key);
                types = types.Where(x =>
                                    ((ICollection <Configuration>)node.Value).All(y => !(x is AbstractNodeType &&
                                                                                         y.GetType() == ((AbstractNodeType)x).Type)));
                node.AttachedProperties.Set(AbstractNodeEntryData.Key, types);
            }
        }
예제 #3
0
 public SharedRendererFactoryViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IObjectNode sharedRenderersNode, [NotNull] Type type)
     : base(serviceProvider)
 {
     this.sharedRenderersNode = sharedRenderersNode;
     if (sharedRenderersNode == null)
     {
         throw new ArgumentNullException(nameof(sharedRenderersNode));
     }
     if (type == null)
     {
         throw new ArgumentNullException(nameof(type));
     }
     Name          = DisplayAttribute.GetDisplayName(type);
     Type          = type;
     CreateCommand = new AnonymousCommand(serviceProvider, Create);
 }
예제 #4
0
 public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(value is Type?DisplayAttribute.GetDisplayName((Type)value) : "None");
 }
 private static string GetSharedRendererDisplayName(ISharedRenderer sharedRenderer) => $"Shared: {DisplayAttribute.GetDisplayName(sharedRenderer.GetType())}";