public IEnumerable <object> GetUniqueValues(MonoBehaviourProperty query)
 {
     foreach (var v in myUniquePropertyValues.GetValues(query))
     {
         yield return(v);
     }
 }
        public void Remove(MonoBehaviourProperty property, MonoBehaviourPropertyValueWithLocation valueWithLocation)
        {
            var value = valueWithLocation.Value.Value;

            if (value != null)
            {
                myUniquePropertyValues.Remove(property, new MonoBehaviorPropertyValueBox(valueWithLocation));

                // file changes index
                var query = new MonoBehaviourPropertyWithFile(property, valueWithLocation.File);
                var beforeRemoveDifferentValuesCount = myValueCountPerPropertyAndFile.GetOrEmpty(query).Count;
                myValueCountPerPropertyAndFile.Remove(query, value);
                var afterRemoveDifferentValuesCount = myValueCountPerPropertyAndFile.GetOrEmpty(query).Count;

                if (beforeRemoveDifferentValuesCount == 2 && afterRemoveDifferentValuesCount == 1)
                {
                    myValuesWhichAreUniqueInWholeFile.Add(new MonoBehaviourPropertyWithValue(property, myValueCountPerPropertyAndFile.GetOrEmpty(query).First().Key));
                }
                else if (beforeRemoveDifferentValuesCount == 1 && afterRemoveDifferentValuesCount == 0)
                {
                    myValuesWhichAreUniqueInWholeFile.Remove(new MonoBehaviourPropertyWithValue(property, value));
                }

                myPropertyFiles.Remove(property, valueWithLocation.File);
            }

            myPropertyValues.Remove(property, valueWithLocation);
        }
예제 #3
0
        public int GetFilesWithPropertyCount(string guid, string propertyName)
        {
            myShellLocks.AssertReadAccessAllowed();

            var query = new MonoBehaviourProperty(guid, propertyName);

            return(myPropertyValueLocalCache.GetFilesWithPropertyCount(query));
        }
예제 #4
0
        public int GetFilesCountWithoutChanges(string guid, string propertyName, object value)
        {
            myShellLocks.AssertReadAccessAllowed();

            var query = new MonoBehaviourProperty(guid, propertyName);

            return(myPropertyValueLocalCache.GetFilesCountWithoutChanges(query, value));
        }
예제 #5
0
        public IEnumerable <MonoBehaviourPropertyValueWithLocation> GetUniqueValuesWithLocation(string guid, string propertyName)
        {
            myShellLocks.AssertReadAccessAllowed();

            var query = new MonoBehaviourProperty(guid, propertyName);

            return(myPropertyValueLocalCache.GetUniqueValuesWithLocation(query));
        }
예제 #6
0
        private static void FillProperties(Dictionary <string, string> simpleValues, Dictionary <string, FileID> referenceValues,
                                           OneToListMap <MonoBehaviourProperty, MonoBehaviourPropertyValue> result)
        {
            var anchor = simpleValues.GetValueSafe("&anchor");

            if (anchor == null)
            {
                return;
            }

            var guid = referenceValues.GetValueSafe(UnityYamlConstants.ScriptProperty)?.guid;

            if (guid == null)
            {
                return;
            }

            var gameObject = referenceValues.GetValueSafe(UnityYamlConstants.GameObjectProperty)?.fileID;

            if (gameObject == null)
            {
                return;
            }

            foreach (var(fieldName, value) in simpleValues)
            {
                if (ourIgnoredMonoBehaviourEntries.Contains(fieldName))
                {
                    continue;
                }

                var property      = new MonoBehaviourProperty(guid, fieldName);
                var propertyValue = new MonoBehaviourPrimitiveValue(value, anchor, gameObject);
                result.Add(property, propertyValue);
            }

            foreach (var(fieldName, value) in referenceValues)
            {
                if (ourIgnoredMonoBehaviourEntries.Contains(fieldName))
                {
                    continue;
                }

                var property      = new MonoBehaviourProperty(guid, fieldName);
                var propertyValue = new MonoBehaviourReferenceValue(value, anchor, gameObject);
                result.Add(property, propertyValue);
            }
        }
 public static void WriteTo(UnsafeWriter writer, MonoBehaviourProperty value)
 {
     writer.Write(value.Guid);
     writer.Write(value.FieldName);
 }
 public int GetFilesWithPropertyCount(MonoBehaviourProperty query)
 {
     return(myPropertyFiles.GetOrEmpty(query).Count);
 }
 public int GetFilesCountWithoutChanges(MonoBehaviourProperty query, object value)
 {
     return(myValuesWhichAreUniqueInWholeFile.GetCount(new MonoBehaviourPropertyWithValue(query, value)));
 }
 public IEnumerable <MonoBehaviourPropertyValueWithLocation> GetUniqueValuesWithLocation(MonoBehaviourProperty query)
 {
     foreach (var v in myUniquePropertyValues.GetValues(query))
     {
         yield return(v.BoxedValue);
     }
 }
 public int GetPropertyUniqueValuesCount(MonoBehaviourProperty query)
 {
     return(myUniquePropertyValues.GetOrEmpty(query).Count);
 }
 public int GetValueCount(MonoBehaviourProperty query, object value)
 {
     return(myUniquePropertyValues.GetCount(query, new MonoBehaviorPropertyValueBox(value)));
 }
 public IEnumerable <MonoBehaviourPropertyValueWithLocation> GetPropertyValues(MonoBehaviourProperty query)
 {
     foreach (var v in myPropertyValues.GetValues(query))
     {
         yield return(v);
     }
 }
 public MonoBehaviourPropertyWithValue(MonoBehaviourProperty property, object value)
 {
     Property = property;
     Value    = value;
 }
 public MonoBehaviourPropertyWithFile(MonoBehaviourProperty property, IPsiSourceFile file)
 {
     Property = property;
     File     = file;
 }