Ejemplo n.º 1
0
        public ObjectValue[] GetChildren(SoftEvaluationContext ctx, IDebuggerValueOwner <Value> objectSource,
                                         TypeMirror type, Value obj,
                                         int firstItemIndex, int count, bool dereferenceProxy)
        {
            var options = ctx.Options;

            if (!options.AllowTargetInvoke)
            {
                return(EmptyArray <ObjectValue> .Instance);
            }

            if (IsExpectedType(type, "UnityEngine.GameObject"))
            {
                return(GetChildrenForGameObject(ctx, objectSource, obj));
            }
            if (IsExpectedType(type, "UnityEngine.SceneManagement.Scene"))
            {
                return(GetChildrenForScene(ctx, objectSource, obj));
            }
            if (IsExpectedType(type, "Unity.Entities.Entity"))
            {
                return(GetChildrenForEntity(ctx, objectSource, obj));
            }

            return(EmptyArray <ObjectValue> .Instance);
        }
Ejemplo n.º 2
0
        private ObjectValue[] GetChildrenForScene(SoftEvaluationContext ctx, IDebuggerValueOwner <Value> parentSource,
                                                  Value scene)
        {
            var rootObjectsSource = new SceneRootObjectsSource(ctx, parentSource, scene);
            var rootObjectsValue  = InitialiseObjectValues(rootObjectsSource);

            return(new[] { rootObjectsValue });
        }
Ejemplo n.º 3
0
        private ObjectValue[] GetChildrenForGameObject(SoftEvaluationContext ctx,
                                                       IDebuggerValueOwner <Value> parentSource, Value gameObject)
        {
            var componentsSource      = new GameObjectComponentsSource(ctx, parentSource, gameObject);
            var componentsObjectValue = InitialiseObjectValues(componentsSource);

            var childrenSource      = new GameObjectChildrenSource(ctx, parentSource, gameObject);
            var childrenObjectValue = InitialiseObjectValues(childrenSource);

            return(new[] { componentsObjectValue, childrenObjectValue });
        }
Ejemplo n.º 4
0
        private ObjectValue[] GetChildrenForEntity(SoftEvaluationContext ctx, IDebuggerValueOwner <Value> parentSource,
                                                   Value entity)
        {
            var entityManager = GetValue(ctx,
                                         "global::Unity.Entities.World.Active.GetExistingManager<Unity.Entities.EntityManager>()");

            if (entityManager == null)
            {
                return(EmptyArray <ObjectValue> .Instance);
            }

            var objectValueSource = new EntityComponentDataSource(ctx, parentSource, entity, entityManager);
            var objectValue       = InitialiseObjectValues(objectValueSource);

            return(new[] { objectValue });
        }