Пример #1
0
 public static TypeHandle GenerateTypeHandle(this Type t, Stencil stencil)
 {
     Assert.IsNotNull(t);
     Assert.IsNotNull(stencil);
     Assert.IsNotNull(stencil.GraphContext);
     return(t.GenerateTypeHandle(stencil.GraphContext.CSharpTypeSerializer));
 }
Пример #2
0
        public static bool IsSubclassOf(this TypeHandle self, TypeHandle other, Stencil stencil)
        {
            var selfMetadata  = self.GetMetadata(stencil);
            var otherMetadata = other.GetMetadata(stencil);

            return(selfMetadata.IsSubclassOf(otherMetadata));
        }
Пример #3
0
        public static bool IsAssignableFrom(this TypeHandle self, TypeHandle other, Stencil stencil)
        {
            var selfMetadata  = self.GetMetadata(stencil);
            var otherMetadata = other.GetMetadata(stencil);

            return(selfMetadata.IsAssignableFrom(otherMetadata));
        }
Пример #4
0
 public IEnumerable <TypeHandle> GetGenericArguments(Stencil stencil)
 {
     foreach (var t in this.Resolve(stencil).GenericTypeArguments)
     {
         yield return(t.GenerateTypeHandle(stencil));
     }
 }
Пример #5
0
 public string Name(Stencil stencil)
 {
     if (GraphModelReference != null)
     {
         return(GraphModelReference.name);
     }
     return(this.Resolve(stencil).Name);
 }
Пример #6
0
 public static TypeSyntax ToTypeSyntax(this TypeHandle handle, Stencil stencil)
 {
     if (handle.GraphModelReference != null)
     {
         return(handle.GraphModelReference.ToTypeSyntax());
     }
     return(handle.Resolve(stencil).ToTypeSyntax());
 }
Пример #7
0
 public string FriendlyName(Stencil stencil)
 {
     if (!string.IsNullOrEmpty(Identification))
     {
         return(this.Resolve(stencil).FriendlyName());
     }
     return("");
 }
Пример #8
0
 public string FriendlyName(Stencil stencil)
 {
     if (GraphModelReference != null)
     {
         return(GraphModelReference.name);
     }
     if (!string.IsNullOrEmpty(Identification))
     {
         return(this.Resolve(stencil).FriendlyName());
     }
     return("");
 }
        internal static IEnumerable <Tuple <string, TypeHandle> > GetDataInputsFromComponentType(
            Stencil stencil,
            TypeHandle componentTypeHandle
            )
        {
            var componentType = componentTypeHandle.Resolve(stencil);
            var fields        = componentType.GetFields(BindingFlags.Public | BindingFlags.Instance);
            var type          = HasSinglePredefinedFieldType(fields)
                    ? fields[0].FieldType
                    : componentType;

            return(type.GetFields(BindingFlags.Public | BindingFlags.Instance)
                   .Select(f => new Tuple <string, TypeHandle>(f.Name, f.FieldType.GenerateTypeHandle(stencil))));
        }
Пример #10
0
 public TypeHandle MakeVsArrayType(Stencil stencil)
 {
     return(this.Resolve(stencil).MakeVsArrayType().GenerateTypeHandle(stencil));
 }
Пример #11
0
 public void SetParent(Type type, VSGraphAssetModel asset)
 {
     Assert.IsTrue(typeof(Stencil).IsAssignableFrom(type));
     m_Parent = (Stencil)CreateInstance(type);
     Utility.SaveAssetIntoObject(m_Parent, asset);
 }
Пример #12
0
 public static ITypeMetadata GetMetadata(this TypeHandle th, Stencil stencil)
 {
     return(th.GetMetadata(stencil.GraphContext.TypeMetadataResolver));
 }
Пример #13
0
 public static ITypeMetadata GetMetadata(this IGraphModel graphModel, Stencil stencil)
 {
     return(graphModel.GenerateTypeHandle(stencil).GetMetadata(stencil));
 }
Пример #14
0
 public static ITypeMetadata GetMetadata(this IGraphAssetModel asset, Stencil stencil)
 {
     return(asset.GenerateTypeHandle(stencil).GetMetadata(stencil));
 }
Пример #15
0
 public static ITypeMetadata GetMetadata(this Type t, Stencil stencil)
 {
     return(t.GenerateTypeHandle(stencil).GetMetadata(stencil));
 }
Пример #16
0
 public static Type Resolve(this TypeHandle th, Stencil stencil)
 {
     return(th.Resolve(stencil.GraphContext.TypeHandleSerializer));
 }
 public EcsTypeSearcherDatabase(Stencil stencil, List <ITypeMetadata> typesMetadata)
     : base(stencil, typesMetadata)
 {
     m_Stencil = stencil;
 }
 public ClassSearcherFilterProvider(Stencil stencil)
 {
     m_Stencil = stencil;
 }
Пример #19
0
 public bool IsVsArrayType(Stencil stencil)
 {
     return(!string.IsNullOrEmpty(Identification) && this.Resolve(stencil).IsVsArrayType());
 }
 public void SetParent(Type type, VSGraphModel graphModel)
 {
     Assert.IsTrue(typeof(Stencil).IsAssignableFrom(type));
     m_Parent = (Stencil)Activator.CreateInstance(type);
     graphModel.AssetModel.SetAssetDirty();
 }
Пример #21
0
 public string Name(Stencil stencil)
 {
     return(this.Resolve(stencil).Name);
 }
Пример #22
0
 public static TypeSyntax ToTypeSyntax(this TypeHandle handle, Stencil stencil)
 {
     return(handle.Resolve(stencil).ToTypeSyntax());
 }
Пример #23
0
        public static List <NodeModel> SpawnAllNodeModelsInGraph(VSGraphModel graphModel)
        {
            List <NodeModel>          spawnedNodes = new List <NodeModel>();
            Stencil                   stencil      = graphModel.Stencil;
            StackModel                stack;
            FunctionModel             funcModel;
            OnUpdateEntitiesNodeModel onUpdateModel;

            //--Floating Nodes--

            //Stack-Derived NodeModels
            spawnedNodes.Add(stack         = graphModel.CreateNode <StackModel>("StackModel"));
            spawnedNodes.Add(funcModel     = graphModel.CreateNode <FunctionModel>("FunctionModel"));
            spawnedNodes.Add(onUpdateModel = graphModel.CreateNode <OnUpdateEntitiesNodeModel>("OnUpdateEntitiesNodeModel"));

            var methodInfo = TypeSystem.GetMethod(typeof(Debug), nameof(Debug.Log), true);

            spawnedNodes.Add(graphModel.CreateEventFunction(methodInfo, Vector2.zero));
            spawnedNodes.Add(graphModel.CreateNode <OnEndEntitiesNodeModel>("OnEndEntitiesNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <OnEventNodeModel>("OnEventNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <OnStartEntitiesNodeModel>("OnStartEntitiesNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <PostUpdate>("PostUpdate"));
            spawnedNodes.Add(graphModel.CreateNode <PreUpdate>("PreUpdate"));
            spawnedNodes.Add(graphModel.CreateNode <KeyDownEventModel>("KeyDownEventModel"));
            spawnedNodes.Add(graphModel.CreateNode <CountEntitiesNodeModel>("CountEntitiesNodeModel"));
            spawnedNodes.Add(graphModel.CreateLoopStack(typeof(ForEachHeaderModel), Vector2.zero));
            spawnedNodes.Add(graphModel.CreateLoopStack(typeof(WhileHeaderModel), Vector2.zero));
            spawnedNodes.Add(graphModel.CreateLoopStack(typeof(ForAllEntitiesStackModel), Vector2.zero));
            spawnedNodes.Add(graphModel.CreateLoopStack(typeof(CoroutineStackModel), Vector2.zero));

            //Constant-typed NodeModels
            spawnedNodes.Add(graphModel.CreateNode <BooleanConstantNodeModel>("BooleanConstantNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <ColorConstantModel>("ColorConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <CurveConstantNodeModel>("CurveConstantNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <DoubleConstantModel>("DoubleConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <EnumConstantNodeModel>("EnumConstantNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <FloatConstantModel>("FloatConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <GetPropertyGroupNodeModel>("GetPropertyGroupNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <InputConstantModel>("InputConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <IntConstantModel>("IntConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <LayerConstantModel>("LayerConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <LayerMaskConstantModel>("LayerMaskConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <ObjectConstantModel>("ObjectConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <QuaternionConstantModel>("QuaternionConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <StringConstantModel>("StringConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <TagConstantModel>("TagConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <Vector2ConstantModel>("Vector2ConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <Vector3ConstantModel>("Vector3ConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <Vector4ConstantModel>("Vector4ConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <ConstantSceneAssetNodeModel>("ConstantSceneAssetNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <Float2ConstantModel>("Float2ConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <Float3ConstantModel>("Float3ConstantModel"));
            spawnedNodes.Add(graphModel.CreateNode <Float4ConstantModel>("Float4ConstantModel"));

            //Misc
            void DefineSystemConstant(SystemConstantNodeModel m)
            {
                m.ReturnType    = typeof(float).GenerateTypeHandle(stencil);
                m.DeclaringType = typeof(Mathf).GenerateTypeHandle(stencil);
                m.Identifier    = "PI";
            }

            spawnedNodes.Add(graphModel.CreateNode <SystemConstantNodeModel>("SystemConstantNodeModel", Vector2.zero, SpawnFlags.Default, DefineSystemConstant));
            spawnedNodes.Add(graphModel.CreateNode <GetInputNodeModel>("GetInputNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <GetOrCreateComponentNodeModel>("GetOrCreateComponentNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <GetSingletonNodeModel>("GetSingletonNodeModel"));
            spawnedNodes.Add(graphModel.CreateNode <ThisNodeModel>("ThisNodeModel"));
            VariableDeclarationModel decl = graphModel.CreateGraphVariableDeclaration("MyVariableName", typeof(int).GenerateTypeHandle(graphModel.Stencil), true);

            spawnedNodes.Add((NodeModel)graphModel.CreateVariableNode(decl, Vector2.zero));
            spawnedNodes.Add(graphModel.CreateNode <MacroRefNodeModel>("MacroRefNodeModel"));
            spawnedNodes.Add(graphModel.CreateInlineExpressionNode("2+2", Vector2.zero));
            spawnedNodes.Add(graphModel.CreateBinaryOperatorNode(BinaryOperatorKind.Add, Vector2.zero));
            spawnedNodes.Add(graphModel.CreateUnaryOperatorNode(UnaryOperatorKind.PostIncrement, Vector2.zero));

            //--Stack-Contained Nodes--
            spawnedNodes.Add(stack.CreateStackedNode <AddComponentNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <DestroyEntityNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <ForAllEntitiesNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <ForEachNodeModel>());
            spawnedNodes.Add(stack.CreateFunctionCallNode(TypeSystem.GetMethod(typeof(Debug), nameof(Debug.Log), true)));
            spawnedNodes.Add(stack.CreateFunctionRefCallNode(funcModel));
            spawnedNodes.Add(stack.CreateStackedNode <InstantiateNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <CreateEntityNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <IfConditionNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <LogNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <RemoveComponentNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <SetComponentNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <SetPositionNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <SetRotationNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <WhileNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <SetPropertyGroupNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <SetVariableNodeModel>());
            spawnedNodes.Add(stack.CreateStackedNode <CoroutineNodeModel>());
            spawnedNodes.Add(funcModel.CreateStackedNode <ReturnNodeModel>());

            TypeHandle eventTypeHandle = typeof(DummyEvent).GenerateTypeHandle(stencil);

            spawnedNodes.Add(onUpdateModel.CreateStackedNode <SendEventNodeModel>("SendEventNodeModel", 0, SpawnFlags.Default, n => n.EventType = eventTypeHandle));

            return(spawnedNodes);
        }
Пример #24
0
 public TypeHandle GetVsArrayElementType(Stencil stencil)
 {
     return(this.Resolve(stencil).GetVsArrayElementType().GenerateTypeHandle(stencil));
 }
 public ClassSearcherDatabaseProvider(Stencil stencil)
 {
     m_Stencil = stencil;
 }
Пример #26
0
 public static TypeHandle GenerateTypeHandle(this IGraphAssetModel asset, Stencil stencil)
 {
     return(asset.GenerateTypeHandle(stencil.GraphContext.TypeHandleSerializer));
 }
 public MacroSearcherFilterProvider(Stencil stencil)
 {
     m_Stencil = stencil;
 }
Пример #28
0
 public static TypeHandle GenerateTypeHandle(this IGraphModel graphModel, Stencil stencil)
 {
     return(stencil.GenerateTypeHandle(graphModel as VSGraphModel));
 }