Пример #1
0
        private static HashSet <ResourceData> ScanObjectData(NodeObjectData parentNodeData)
        {
            PropertyAccessorHandler[] resourceProperties = parentNodeData.GetResourceProperties();
            HashSet <ResourceData>    resourceDataSet    = new HashSet <ResourceData>();

            if (resourceProperties != null)
            {
                foreach (PropertyAccessorHandler propertyAccessorHandler in resourceProperties)
                {
                    ResourceItemData resourceItemData = propertyAccessorHandler.GetValue((object)parentNodeData, (object[])null) as ResourceItemData;
                    if ((ResourceData)resourceItemData != (ResourceData)null)
                    {
                        resourceDataSet.Add((ResourceData)resourceItemData);
                    }
                }
            }
            if (parentNodeData.Children != null)
            {
                foreach (NodeObjectData child in parentNodeData.Children)
                {
                    resourceDataSet.UnionWith((IEnumerable <ResourceData>)GameProjectContent.ScanObjectData(child));
                }
            }
            return(resourceDataSet);
        }
Пример #2
0
        private static HashSet <ResourceData> ScanObjectData(NodeObjectData parentNodeData)
        {
            PropertyAccessorHandler[] resourceProperties = parentNodeData.GetResourceProperties();
            HashSet <ResourceData>    hashSet            = new HashSet <ResourceData>();

            if (resourceProperties != null)
            {
                PropertyAccessorHandler[] array = resourceProperties;
                for (int i = 0; i < array.Length; i++)
                {
                    PropertyAccessorHandler propertyAccessorHandler = array[i];
                    ResourceItemData        resourceItemData        = propertyAccessorHandler.GetValue(parentNodeData, null) as ResourceItemData;
                    if (resourceItemData != null)
                    {
                        hashSet.Add(resourceItemData);
                    }
                }
            }
            if (parentNodeData.Children != null)
            {
                foreach (NodeObjectData current in parentNodeData.Children)
                {
                    hashSet.UnionWith(GameProjectContent.ScanObjectData(current));
                }
            }
            return(hashSet);
        }
Пример #3
0
        private static bool UpdateResourcesInObjectData(NodeObjectData parentNodeData, ChangedResourceCollection changedResourceCollection)
        {
            PropertyAccessorHandler[] resourceProperties = parentNodeData.GetResourceProperties();
            bool result;

            if (resourceProperties == null)
            {
                result = false;
            }
            else
            {
                bool flag = false;
                PropertyAccessorHandler[] array = resourceProperties;
                for (int i = 0; i < array.Length; i++)
                {
                    PropertyAccessorHandler propertyAccessorHandler = array[i];
                    ResourceItemData        resourceItemData        = propertyAccessorHandler.GetValue(parentNodeData, null) as ResourceItemData;
                    if (!(resourceItemData == null))
                    {
                        ResourceFile resourceFile = null;
                        if (changedResourceCollection.TryGetValue(resourceItemData, out resourceFile))
                        {
                            if (resourceFile != null)
                            {
                                resourceItemData.Update(resourceFile.GetResourceData());
                            }
                            else
                            {
                                propertyAccessorHandler.SetValue(parentNodeData, null, null);
                            }
                            if (!flag)
                            {
                                flag = true;
                            }
                        }
                    }
                }
                if (parentNodeData.Children != null)
                {
                    foreach (NodeObjectData current in parentNodeData.Children)
                    {
                        bool flag2 = GameProjectContent.UpdateResourcesInObjectData(current, changedResourceCollection);
                        if (!flag && flag2)
                        {
                            flag = flag2;
                        }
                    }
                }
                result = flag;
            }
            return(result);
        }
Пример #4
0
        private static bool UpdateResourcesInObjectData(NodeObjectData parentNodeData, ChangedResourceCollection changedResourceCollection)
        {
            PropertyAccessorHandler[] resourceProperties = parentNodeData.GetResourceProperties();
            if (resourceProperties == null)
            {
                return(false);
            }
            bool flag1 = false;

            foreach (PropertyAccessorHandler propertyAccessorHandler in resourceProperties)
            {
                ResourceItemData resourceItemData = propertyAccessorHandler.GetValue((object)parentNodeData, (object[])null) as ResourceItemData;
                if (!((ResourceData)resourceItemData == (ResourceData)null))
                {
                    ResourceFile resourceFile = (ResourceFile)null;
                    if (changedResourceCollection.TryGetValue((ResourceData)resourceItemData, out resourceFile))
                    {
                        if (resourceFile != null)
                        {
                            resourceItemData.Update(resourceFile.GetResourceData());
                        }
                        else
                        {
                            propertyAccessorHandler.SetValue((object)parentNodeData, (object)null, (object[])null);
                        }
                        if (!flag1)
                        {
                            flag1 = true;
                        }
                    }
                }
            }
            if (parentNodeData.Children != null)
            {
                foreach (NodeObjectData child in parentNodeData.Children)
                {
                    bool flag2 = GameProjectContent.UpdateResourcesInObjectData(child, changedResourceCollection);
                    if (!flag1 && flag2)
                    {
                        flag1 = flag2;
                    }
                }
            }
            return(flag1);
        }