Exemple #1
0
 public GraphNestEditor(Metadata metadata) : base(metadata)
 {
 }
 public static Inspector Inspector(this Metadata metadata)
 {
     return(InspectorProvider.instance.GetDecorator(metadata));
 }
 public UnknownInspector(Metadata metadata) : base(metadata)
 {
 }
 public Ray2DInspector(Metadata metadata) : base(metadata)
 {
 }
 public EnumInspector(Metadata metadata) : base(metadata)
 {
 }
 public virtual Inspector GetPortInspector(IUnitPort port, Metadata metadata)
 {
     return(metadata.Inspector());
 }
        // Using TSubpath to avoid boxing and alloc of object
        protected TMetadata Dig <TSubpath, TMetadata>(TSubpath subpath, Func <Metadata, TMetadata> constructor, bool createInPrefab, Metadata prefabInstance = null) where TMetadata : Metadata
        {
            if (subpath == null)
            {
                throw new ArgumentNullException(nameof(subpath));
            }

            if (constructor == null)
            {
                throw new ArgumentNullException(nameof(constructor));
            }

            var subhash = subpath.GetHashCode();

            Metadata child;

            if (children.TryGetValue(subhash, out child))
            {
                if (child is TMetadata)
                {
                    return((TMetadata)child);
                }
                else
                {
                    throw new InvalidOperationException($"Metadata mismatch: expected '{typeof(TMetadata).Name}', found '{child.GetType().Name}'.");
                }
            }
            else
            {
                try
                {
                    var containsBefore = children.Contains(subhash);

                    child = constructor(this);

                    if (!containsBefore && children.Contains(child.subhash))
                    {
                        throw new InvalidOperationException($"Children didn't contain '{subpath}' subpath before the constructor but now does.");
                    }

                    child.CachePath();
                    child.AnalyzeCollection();

                    if (isPrefabInstanceWithDefinition)
                    {
                        if (createInPrefab)
                        {
                            child.prefabDefinition = prefabDefinition.Dig(subpath, constructor, false, child);
                        }
                        else if (prefabDefinition.children.Contains(subhash))
                        {
                            child.prefabDefinition = prefabDefinition.children[subhash];
                        }
                        else
                        {
                            child.isPrefabInstanceWithoutDefinition = true;
                        }
                    }
                    else if (isPrefabInstanceWithoutDefinition)
                    {
                        child.isPrefabInstanceWithoutDefinition = true;
                    }

                    children.Add(child);

                    if (PluginContainer.initialized && BoltCore.Configuration.developerMode && BoltCore.Configuration.trackMetadataState)
                    {
                        Debug.LogWarningFormat
                        (
                            "Created {0} node{1}:\n{2}",
                            child.GetType().CSharpName(false),
                            child.isPrefabInstance ? " (prefab instance)" : (prefabInstance != null ? " (prefab definition)" : ""),
                            child
                        );
                    }

                    return((TMetadata)child);
                }
                catch
                {
                    // If digging fails and we're creating a prefab definition mirror,
                    // we will simply notify the instance metadata that it has no hierarchy equivalent.
                    if (prefabInstance != null)
                    {
                        prefabInstance.isPrefabInstanceWithoutDefinition = true;
                        return(null);
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }
 public InspectorBlock(Metadata metadata, Rect position)
 {
     this.metadata = metadata;
     this.position = position;
 }
 public ImplementationInspector(Metadata metadata) : base(metadata)
 {
 }
Exemple #10
0
 public ProxyMetadata Proxy(object subpath, Metadata binding)
 {
     return(Dig(subpath, parent => new ProxyMetadata(subpath, binding, parent), false));
 }
 public UnityObjectInspector(Metadata metadata) : base(metadata)
 {
 }
Exemple #12
0
 public VariableDeclarationInspector(Metadata metadata)
     : base(metadata)
 {
     VSUsageUtility.isVisualScriptingUsed = true;
 }
 public VariableDeclarationInspector(Metadata metadata) : base(metadata)
 {
 }
 public static TInspector Inspector <TInspector>(this Metadata metadata) where TInspector : Inspector
 {
     return(InspectorProvider.instance.GetDecorator <TInspector>(metadata));
 }
Exemple #15
0
 public ListInspector(Metadata metadata) : base(metadata)
 {
     adaptor = new MetadataListAdaptor(metadata, this);
 }
 public static bool HasInspector(this Metadata metadata)
 {
     return(InspectorProvider.instance.HasInspector(metadata.definedType));
 }
Exemple #17
0
 public KeyValuePairInspector(Metadata metadata) : base(metadata)
 {
 }