コード例 #1
0
 public SerializableMultiTargetInt(SerializableMultiTargetInt rhs)
 {
     m_values = new List<Entry>();
     foreach(var v in rhs.m_values) {
         m_values.Add(new Entry(v.targetGroup, v.value));
     }
 }
コード例 #2
0
 public SerializableMultiTargetInt(SerializableMultiTargetInt rhs)
 {
     m_values = new List <Entry>();
     foreach (var v in rhs.m_values)
     {
         m_values.Add(new Entry(v.targetGroup, v.value));
     }
 }
コード例 #3
0
        public override bool Equals(object rhs)
        {
            SerializableMultiTargetInt other = rhs as SerializableMultiTargetInt;

            if (other == null)
            {
                return(false);
            }
            else
            {
                return(other == this);
            }
        }
コード例 #4
0
        /*
         * Constructor used to create new node from GUI
         */
        public NodeData(string name, NodeKind kind, float x, float y)
        {
            m_id               = Guid.NewGuid().ToString();
            m_name             = name;
            m_x                = x;
            m_y                = y;
            m_kind             = kind;
            m_nodeNeedsRevisit = false;
            m_scriptClassName  = String.Empty;

            m_inputPoints  = new List <ConnectionPointData>();
            m_outputPoints = new List <ConnectionPointData>();

            // adding defalut input point.
            // Loader does not take input
            if (kind != NodeKind.LOADER_GUI)
            {
                m_inputPoints.Add(new ConnectionPointData(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL, this, true));
            }

            // adding default output point.
            // Filter and Exporter does not have output.
            if (kind != NodeKind.FILTER_GUI && kind != NodeKind.EXPORTER_GUI)
            {
                m_outputPoints.Add(new ConnectionPointData(AssetBundleGraphSettings.DEFAULT_OUTPUTPOINT_LABEL, this, false));
            }

            switch (m_kind)
            {
            case NodeKind.PREFABBUILDER_GUI:
                m_prefabBuilderReplacePrefabOptions = (int)UnityEditor.ReplacePrefabOptions.Default;
                m_scriptInstanceData = new SerializableMultiTargetString();
                break;

            case NodeKind.MODIFIER_GUI:
                m_scriptInstanceData = new SerializableMultiTargetString();
                break;

            case NodeKind.IMPORTSETTING_GUI:
                break;

            case NodeKind.FILTER_GUI:
                m_filter = new List <FilterEntry>();
                break;

            case NodeKind.LOADER_GUI:
                m_loaderLoadPath = new SerializableMultiTargetString();
                break;

            case NodeKind.GROUPING_GUI:
                m_groupingKeyword = new SerializableMultiTargetString(AssetBundleGraphSettings.GROUPING_KEYWORD_DEFAULT);
                break;

            case NodeKind.BUNDLECONFIG_GUI:
                m_bundleConfigBundleNameTemplate = new SerializableMultiTargetString(AssetBundleGraphSettings.BUNDLECONFIG_BUNDLENAME_TEMPLATE_DEFAULT);
                m_bundleConfigUseGroupAsVariants = false;
                m_variants = new List <Variant>();
                break;

            case NodeKind.BUNDLEBUILDER_GUI:
                m_bundleBuilderEnabledBundleOptions = new SerializableMultiTargetInt();
                break;

            case NodeKind.EXPORTER_GUI:
                m_exporterExportPath   = new SerializableMultiTargetString();
                m_exporterExportOption = new SerializableMultiTargetInt();
                break;

            default:
                throw new AssetBundleGraphException("[FATAL]Unhandled nodekind. unimplmented:" + m_kind);
            }
        }
コード例 #5
0
        public void FromJsonDictionary(Dictionary <string, object> jsonData)
        {
            m_name             = jsonData[NODE_NAME] as string;
            m_id               = jsonData[NODE_ID] as string;
            m_kind             = AssetBundleGraphSettings.NodeKindFromString(jsonData[NODE_KIND] as string);
            m_scriptClassName  = string.Empty;
            m_nodeNeedsRevisit = false;

            if (jsonData.ContainsKey(NODE_SCRIPT_CLASSNAME))
            {
                m_scriptClassName = jsonData[NODE_SCRIPT_CLASSNAME] as string;
            }

            var pos = jsonData[NODE_POS] as Dictionary <string, object>;

            m_x = (float)Convert.ToDouble(pos[NODE_POS_X]);
            m_y = (float)Convert.ToDouble(pos[NODE_POS_Y]);

            var inputs  = jsonData[NODE_INPUTPOINTS] as List <object>;
            var outputs = jsonData[NODE_OUTPUTPOINTS] as List <object>;

            m_inputPoints  = new List <ConnectionPointData>();
            m_outputPoints = new List <ConnectionPointData>();

            foreach (var obj in inputs)
            {
                var pDic = obj as Dictionary <string, object>;
                m_inputPoints.Add(new ConnectionPointData(pDic, this, true));
            }

            foreach (var obj in outputs)
            {
                var pDic = obj as Dictionary <string, object>;
                m_outputPoints.Add(new ConnectionPointData(pDic, this, false));
            }

            switch (m_kind)
            {
            case NodeKind.IMPORTSETTING_GUI:
                // nothing to do
                break;

            case NodeKind.PREFABBUILDER_GUI:
            {
                if (jsonData.ContainsKey(NODE_PREFABBUILDER_REPLACEPREFABOPTIONS))
                {
                    m_prefabBuilderReplacePrefabOptions = Convert.ToInt32(jsonData[NODE_PREFABBUILDER_REPLACEPREFABOPTIONS]);
                }
                if (jsonData.ContainsKey(NODE_SCRIPT_INSTANCE_DATA))
                {
                    m_scriptInstanceData = new SerializableMultiTargetString(_SafeGet(jsonData, NODE_SCRIPT_INSTANCE_DATA));
                }
            }
            break;

            case NodeKind.MODIFIER_GUI:
            {
                if (jsonData.ContainsKey(NODE_SCRIPT_INSTANCE_DATA))
                {
                    m_scriptInstanceData = new SerializableMultiTargetString(_SafeGet(jsonData, NODE_SCRIPT_INSTANCE_DATA));
                }
            }
            break;

            case NodeKind.LOADER_GUI:
            {
                m_loaderLoadPath = new SerializableMultiTargetString(_SafeGet(jsonData, NODE_LOADER_LOAD_PATH));
            }
            break;

            case NodeKind.FILTER_GUI:
            {
                var filters = jsonData[NODE_FILTER] as List <object>;

                m_filter = new List <FilterEntry>();

                for (int i = 0; i < filters.Count; ++i)
                {
                    var f = filters[i] as Dictionary <string, object>;

                    var keyword = f[NODE_FILTER_KEYWORD] as string;
                    var keytype = f[NODE_FILTER_KEYTYPE] as string;
                    var pointId = f[NODE_FILTER_POINTID] as string;

                    var point = m_outputPoints.Find(p => p.Id == pointId);
                    UnityEngine.Assertions.Assert.IsNotNull(point, "Output point not found for " + keyword);
                    m_filter.Add(new FilterEntry(keyword, keytype, point));
                }
            }
            break;

            case NodeKind.GROUPING_GUI:
            {
                m_groupingKeyword = new SerializableMultiTargetString(_SafeGet(jsonData, NODE_GROUPING_KEYWORD));
            }
            break;

            case NodeKind.BUNDLECONFIG_GUI:
            {
                m_bundleConfigBundleNameTemplate = new SerializableMultiTargetString(_SafeGet(jsonData, NODE_BUNDLECONFIG_BUNDLENAME_TEMPLATE));
                if (jsonData.ContainsKey(NODE_BUNDLECONFIG_USE_GROUPASVARIANTS))
                {
                    m_bundleConfigUseGroupAsVariants = Convert.ToBoolean(jsonData[NODE_BUNDLECONFIG_USE_GROUPASVARIANTS]);
                }
                m_variants = new List <Variant>();
                if (jsonData.ContainsKey(NODE_BUNDLECONFIG_VARIANTS))
                {
                    var variants = jsonData[NODE_BUNDLECONFIG_VARIANTS] as List <object>;

                    for (int i = 0; i < variants.Count; ++i)
                    {
                        var v = variants[i] as Dictionary <string, object>;

                        var name    = v[NODE_BUNDLECONFIG_VARIANTS_NAME] as string;
                        var pointId = v[NODE_BUNDLECONFIG_VARIANTS_POINTID] as string;

                        var point = m_inputPoints.Find(p => p.Id == pointId);
                        UnityEngine.Assertions.Assert.IsNotNull(point, "Input point not found for " + name);
                        m_variants.Add(new Variant(name, point));
                    }
                }
            }
            break;

            case NodeKind.BUNDLEBUILDER_GUI:
            {
                m_bundleBuilderEnabledBundleOptions = new SerializableMultiTargetInt(_SafeGet(jsonData, NODE_BUNDLEBUILDER_ENABLEDBUNDLEOPTIONS));
            }
            break;

            case NodeKind.EXPORTER_GUI:
            {
                m_exporterExportPath   = new SerializableMultiTargetString(_SafeGet(jsonData, NODE_EXPORTER_EXPORT_PATH));
                m_exporterExportOption = new SerializableMultiTargetInt(_SafeGet(jsonData, NODE_EXPORTER_EXPORT_OPTION));
            }
            break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #6
0
ファイル: NodeData.cs プロジェクト: unity3d-jp/AssetGraph
        /*
         * Constructor used to create new node from GUI
         */
        public NodeData(string name, NodeKind kind, float x, float y)
        {
            m_id = Guid.NewGuid().ToString();
            m_name = name;
            m_x = x;
            m_y = y;
            m_kind = kind;

            m_inputPoints  = new List<ConnectionPointData>();
            m_outputPoints = new List<ConnectionPointData>();

            // adding defalut input point.
            // Loader does not take input
            if(kind != NodeKind.LOADER_GUI) {
                m_inputPoints.Add(new ConnectionPointData(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL, this, true));
            }

            // adding default output point.
            // Filter and Exporter does not have output.
            if(kind != NodeKind.FILTER_GUI && kind != NodeKind.EXPORTER_GUI) {
                m_outputPoints.Add(new ConnectionPointData(AssetBundleGraphSettings.DEFAULT_OUTPUTPOINT_LABEL, this, false));
            }

            switch(m_kind) {
            case NodeKind.PREFABBUILDER_GUI:
            case NodeKind.MODIFIER_GUI:
                m_scriptClassName 	= String.Empty;
                m_scriptInstanceData = new SerializableMultiTargetString();
                break;

            case NodeKind.IMPORTSETTING_GUI:
                break;

            case NodeKind.FILTER_GUI:
                m_filter = new List<FilterEntry>();
                break;

            case NodeKind.LOADER_GUI:
                m_loaderLoadPath = new SerializableMultiTargetString();
                break;

            case NodeKind.GROUPING_GUI:
                m_groupingKeyword = new SerializableMultiTargetString(AssetBundleGraphSettings.GROUPING_KEYWORD_DEFAULT);
                break;

            case NodeKind.BUNDLECONFIG_GUI:
                m_bundleConfigBundleNameTemplate = new SerializableMultiTargetString(AssetBundleGraphSettings.BUNDLECONFIG_BUNDLENAME_TEMPLATE_DEFAULT);
                m_variants = new List<Variant>();
                break;

            case NodeKind.BUNDLEBUILDER_GUI:
                m_bundleBuilderEnabledBundleOptions = new SerializableMultiTargetInt();
                break;

            case NodeKind.EXPORTER_GUI:
                m_exporterExportPath = new SerializableMultiTargetString();
                break;

            default:
                throw new AssetBundleGraphException("[FATAL]Unhandled nodekind. unimplmented:"+ m_kind);
            }
        }
コード例 #7
0
ファイル: NodeData.cs プロジェクト: unity3d-jp/AssetGraph
        /*
         *  Create NodeData from JSON
         */
        public NodeData(Dictionary<string, object> jsonData)
        {
            m_name = jsonData[NODE_NAME] as string;
            m_id = jsonData[NODE_ID]as string;
            m_kind = AssetBundleGraphSettings.NodeKindFromString(jsonData[NODE_KIND] as string);

            var pos = jsonData[NODE_POS] as Dictionary<string, object>;
            m_x = (float)Convert.ToDouble(pos[NODE_POS_X]);
            m_y = (float)Convert.ToDouble(pos[NODE_POS_Y]);

            var inputs  = jsonData[NODE_INPUTPOINTS] as List<object>;
            var outputs = jsonData[NODE_OUTPUTPOINTS] as List<object>;
            m_inputPoints  = new List<ConnectionPointData>();
            m_outputPoints = new List<ConnectionPointData>();

            foreach(var obj in inputs) {
                var pDic = obj as Dictionary<string, object>;
                m_inputPoints.Add(new ConnectionPointData(pDic, this, true));
            }

            foreach(var obj in outputs) {
                var pDic = obj as Dictionary<string, object>;
                m_outputPoints.Add(new ConnectionPointData(pDic, this, false));
            }

            switch (m_kind) {
            case NodeKind.IMPORTSETTING_GUI:
                // nothing to do
                break;
            case NodeKind.PREFABBUILDER_GUI:
            case NodeKind.MODIFIER_GUI:
                {
                    if(jsonData.ContainsKey(NODE_SCRIPT_CLASSNAME)) {
                        m_scriptClassName = jsonData[NODE_SCRIPT_CLASSNAME] as string;
                    }
                    if(jsonData.ContainsKey(NODE_SCRIPT_INSTANCE_DATA)) {
                        m_scriptInstanceData = new SerializableMultiTargetString(jsonData[NODE_SCRIPT_INSTANCE_DATA] as Dictionary<string, object>);
                    }
                }
                break;
            case NodeKind.LOADER_GUI:
                {
                    m_loaderLoadPath = new SerializableMultiTargetString(jsonData[NODE_LOADER_LOAD_PATH] as Dictionary<string, object>);
                }
                break;
            case NodeKind.FILTER_GUI:
                {
                    var filters = jsonData[NODE_FILTER] as List<object>;

                    m_filter = new List<FilterEntry>();

                    for(int i=0; i<filters.Count; ++i) {
                        var f = filters[i] as Dictionary<string, object>;

                        var keyword = f[NODE_FILTER_KEYWORD] as string;
                        var keytype = f[NODE_FILTER_KEYTYPE] as string;
                        var pointId = f[NODE_FILTER_POINTID] as string;

                        var point = m_outputPoints.Find(p => p.Id == pointId);
                        UnityEngine.Assertions.Assert.IsNotNull(point, "Output point not found for " + keyword);
                        m_filter.Add(new FilterEntry(keyword, keytype, point));
                    }
                }
                break;
            case NodeKind.GROUPING_GUI:
                {
                    m_groupingKeyword = new SerializableMultiTargetString(jsonData[NODE_GROUPING_KEYWORD] as Dictionary<string, object>);
                }
                break;
            case NodeKind.BUNDLECONFIG_GUI:
                {
                    m_bundleConfigBundleNameTemplate = new SerializableMultiTargetString(jsonData[NODE_BUNDLECONFIG_BUNDLENAME_TEMPLATE] as Dictionary<string, object>);
                    m_variants = new List<Variant>();
                    if(jsonData.ContainsKey(NODE_BUNDLECONFIG_VARIANTS)){
                        var variants = jsonData[NODE_BUNDLECONFIG_VARIANTS] as List<object>;

                        for(int i=0; i<variants.Count; ++i) {
                            var v = variants[i] as Dictionary<string, object>;

                            var name    = v[NODE_BUNDLECONFIG_VARIANTS_NAME] as string;
                            var pointId = v[NODE_BUNDLECONFIG_VARIANTS_POINTID] as string;

                            var point = m_inputPoints.Find(p => p.Id == pointId);
                            UnityEngine.Assertions.Assert.IsNotNull(point, "Input point not found for " + name);
                            m_variants.Add(new Variant(name, point));
                        }
                    }
                }
                break;
            case NodeKind.BUNDLEBUILDER_GUI:
                {
                    m_bundleBuilderEnabledBundleOptions = new SerializableMultiTargetInt(jsonData[NODE_BUNDLEBUILDER_ENABLEDBUNDLEOPTIONS] as Dictionary<string, object>);
                }
                break;
            case NodeKind.EXPORTER_GUI:
                {
                    m_exporterExportPath = new SerializableMultiTargetString(jsonData[NODE_EXPORTER_EXPORT_PATH] as Dictionary<string, object>);
                }
                break;
            default:
                throw new ArgumentOutOfRangeException ();
            }
        }