コード例 #1
0
        internal bool FindTraitCollections(ProxyConditions conditions, CachedTraitCollection cache)
        {
            if (cache.fulfilled)
            {
                return(true);
            }

            cache.fulfilled = FindTraitsInternal(conditions, cache);
            return(cache.fulfilled);
        }
        void ClearInternal(CachedTraitCollection self)
        {
            if (SemanticTagCollections != null)
            {
                for (var i = 0; i < SemanticTagCollections.Count; i++)
                {
                    SemanticTagCollections[i] = null;
                }
            }

            if (IntCollections != null)
            {
                for (var i = 0; i < IntCollections.Count; i++)
                {
                    IntCollections[i] = null;
                }
            }

            if (FloatCollections != null)
            {
                for (var i = 0; i < FloatCollections.Count; i++)
                {
                    FloatCollections[i] = null;
                }
            }

            if (StringCollections != null)
            {
                for (var i = 0; i < StringCollections.Count; i++)
                {
                    StringCollections[i] = null;
                }
            }

            if (PoseCollections != null)
            {
                for (var i = 0; i < PoseCollections.Count; i++)
                {
                    PoseCollections[i] = null;
                }
            }

            if (Vector2Collections != null)
            {
                for (var i = 0; i < Vector2Collections.Count; i++)
                {
                    Vector2Collections[i] = null;
                }
            }
        }
        bool CheckDestroyedInternal(CachedTraitCollection self)
        {
            if (SemanticTagCollections != null)
            {
                foreach (var dictionary in SemanticTagCollections)
                {
                    if (dictionary == null)
                    {
                        return(true);
                    }
                }
            }

            if (IntCollections != null)
            {
                foreach (var dictionary in IntCollections)
                {
                    if (dictionary == null)
                    {
                        return(true);
                    }
                }
            }

            if (FloatCollections != null)
            {
                foreach (var dictionary in FloatCollections)
                {
                    if (dictionary == null)
                    {
                        return(true);
                    }
                }
            }

            if (StringCollections != null)
            {
                foreach (var dictionary in StringCollections)
                {
                    if (dictionary == null)
                    {
                        return(true);
                    }
                }
            }

            if (PoseCollections != null)
            {
                foreach (var dictionary in PoseCollections)
                {
                    if (dictionary == null)
                    {
                        return(true);
                    }
                }
            }

            if (Vector2Collections != null)
            {
                foreach (var dictionary in Vector2Collections)
                {
                    if (dictionary == null)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #4
0
        bool FindTraitsInternal(Conditions conditions, CachedTraitCollection cache)
        {
            if (conditions.GetTypeCount(out ISemanticTagCondition[] semanticTagConditions) > 0)
            {
                if (!cache.TryGetType(out List <Dictionary <int, System.Boolean> > semanticTagCollections))
                {
                    return(false);
                }

                for (var i = 0; i < semanticTagConditions.Length; i++)
                {
                    var condition = semanticTagConditions[i];
                    if (!SemanticTagTraitProvider.TryGetAllTraitValues(condition.traitName, out Dictionary <int, System.Boolean> traits))
                    {
                        if (condition.matchRule == SemanticTagMatchRule.Match)
                        {
                            return(false);
                        }
                    }

                    semanticTagCollections[i] = traits;
                }
            }

            if (conditions.GetTypeCount(out ICondition <System.Int32>[] intConditions) > 0)
            {
                if (!cache.TryGetType(out List <Dictionary <int, System.Int32> > intCollections))
                {
                    return(false);
                }

                for (var i = 0; i < intConditions.Length; i++)
                {
                    var condition = intConditions[i];
                    if (!IntTraitProvider.TryGetAllTraitValues(condition.traitName, out Dictionary <int, System.Int32> traits))
                    {
                        return(false);
                    }

                    intCollections[i] = traits;
                }
            }

            if (conditions.GetTypeCount(out ICondition <System.Single>[] floatConditions) > 0)
            {
                if (!cache.TryGetType(out List <Dictionary <int, System.Single> > floatCollections))
                {
                    return(false);
                }

                for (var i = 0; i < floatConditions.Length; i++)
                {
                    var condition = floatConditions[i];
                    if (!FloatTraitProvider.TryGetAllTraitValues(condition.traitName, out Dictionary <int, System.Single> traits))
                    {
                        return(false);
                    }

                    floatCollections[i] = traits;
                }
            }

            if (conditions.GetTypeCount(out ICondition <System.String>[] stringConditions) > 0)
            {
                if (!cache.TryGetType(out List <Dictionary <int, System.String> > stringCollections))
                {
                    return(false);
                }

                for (var i = 0; i < stringConditions.Length; i++)
                {
                    var condition = stringConditions[i];
                    if (!StringTraitProvider.TryGetAllTraitValues(condition.traitName, out Dictionary <int, System.String> traits))
                    {
                        return(false);
                    }

                    stringCollections[i] = traits;
                }
            }

            if (conditions.GetTypeCount(out ICondition <UnityEngine.Pose>[] poseConditions) > 0)
            {
                if (!cache.TryGetType(out List <Dictionary <int, UnityEngine.Pose> > poseCollections))
                {
                    return(false);
                }

                for (var i = 0; i < poseConditions.Length; i++)
                {
                    var condition = poseConditions[i];
                    if (!PoseTraitProvider.TryGetAllTraitValues(condition.traitName, out Dictionary <int, UnityEngine.Pose> traits))
                    {
                        return(false);
                    }

                    poseCollections[i] = traits;
                }
            }

            if (conditions.GetTypeCount(out ICondition <UnityEngine.Vector2>[] vector2Conditions) > 0)
            {
                if (!cache.TryGetType(out List <Dictionary <int, UnityEngine.Vector2> > vector2Collections))
                {
                    return(false);
                }

                for (var i = 0; i < vector2Conditions.Length; i++)
                {
                    var condition = vector2Conditions[i];
                    if (!Vector2TraitProvider.TryGetAllTraitValues(condition.traitName, out Dictionary <int, UnityEngine.Vector2> traits))
                    {
                        return(false);
                    }

                    vector2Collections[i] = traits;
                }
            }
            return(true);
        }