AssetBundleGraph.ConnectionData.CanConnect C# (CSharp) Method

CanConnect() public static method

public static CanConnect ( NodeData from, NodeData to ) : bool
from NodeData
to NodeData
return bool
        public static bool CanConnect(NodeData from, NodeData to)
        {
            switch (from.Kind) {
            case NodeKind.GROUPING_GUI:
                {
                    switch (to.Kind) {
                    case NodeKind.GROUPING_GUI:
                    case NodeKind.PREFABBUILDER_GUI:
                    case NodeKind.BUNDLECONFIG_GUI:
                        return true;
                    }
                    return false;
                }

            case NodeKind.LOADER_GUI:
            case NodeKind.FILTER_GUI:
            case NodeKind.IMPORTSETTING_GUI:
            case NodeKind.MODIFIER_GUI:
            case NodeKind.PREFABBUILDER_GUI:
                {
                    switch (to.Kind) {
                    case NodeKind.BUNDLEBUILDER_GUI:
                        return false;
                    }
                    return true;
                }

            case NodeKind.EXPORTER_GUI:
                {
                    // there is no output from exporter
                    return false;
                }

            case NodeKind.BUNDLEBUILDER_GUI:
                {
                    switch (to.Kind) {
                    case NodeKind.FILTER_GUI:
                    case NodeKind.GROUPING_GUI:
                    case NodeKind.EXPORTER_GUI:
                    case NodeKind.BUNDLECONFIG_GUI:
                        return true;
                    }
                    return false;
                }
            case NodeKind.BUNDLECONFIG_GUI:
                {
                    switch (to.Kind) {
                    case NodeKind.BUNDLEBUILDER_GUI:
                        return true;
                    }
                    return false;
                }
            }
            return true;
        }

Usage Example

Example #1
0
        public void DrawConnectionInputPointMark(NodeEvent eventSource, bool justConnecting)
        {
            if (scaleFactor != SCALE_MAX)
            {
                return;
            }

            var  defaultPointTex  = NodeGUIUtility.inputPointMarkTex;
            bool shouldDrawEnable =
                !(eventSource != null && eventSource.eventSourceNode != null &&
                  !ConnectionData.CanConnect(eventSource.eventSourceNode.Data, m_data)
                  );

            if (shouldDrawEnable && justConnecting && eventSource != null)
            {
                if (eventSource.eventSourceNode.Id != this.Id)
                {
                    var connectionPoint = eventSource.point;
                    if (connectionPoint.IsOutput)
                    {
                        defaultPointTex = NodeGUIUtility.enablePointMarkTex;
                    }
                }
            }

            foreach (var point in m_data.InputPoints)
            {
                if (IsValidInputConnectionPoint(point))
                {
                    GUI.DrawTexture(point.GetGlobalPointRegion(this), defaultPointTex);
                }
            }
        }
All Usage Examples Of AssetBundleGraph.ConnectionData::CanConnect