Esempio n. 1
0
        public override void Initialize(QFrameworkContainer container)
        {
            //
//#if UNITY_EDITOR

//            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
//            {
//                InvertApplication.CachedAssemblies.Add(assembly);
//            }
//#endif
            var typeContainer = InvertGraphEditor.TypesContainer;

            // Drawers
            container.Register <DiagramViewModel, DiagramViewModel>();
            container.RegisterDrawer <PropertyFieldViewModel, PropertyFieldDrawer>();
            container.Register <SectionHeaderDrawer, SectionHeaderDrawer>();
            container.RegisterItemDrawer <GenericItemHeaderViewModel, GenericChildItemHeaderDrawer>();

            container.RegisterDrawer <InspectorViewModel, InspectorDrawer>();
            container.RegisterDrawer <SectionHeaderViewModel, SectionHeaderDrawer>();
            container.RegisterDrawer <ConnectorViewModel, ConnectorDrawer>();
            container.RegisterDrawer <ConnectionViewModel, ConnectionDrawer>();
            container.RegisterDrawer <InputOutputViewModel, SlotDrawer>();

            container.RegisterDrawer <DiagramViewModel, DiagramDrawer>();
            //typeContainer.AddItem<GenericSlot,InputOutputViewModel,SlotDrawer>();
            //typeContainer.AddItem<BaseClassReference, InputOutputViewModel, SlotDrawer>();

            container.RegisterInstance <IConnectionStrategy>(new InputOutputStrategy(), "InputOutputStrategy");
            //container.RegisterConnectable<GenericTypedChildItem, IClassTypeNode>();
            container.RegisterConnectable <GenericInheritableNode, GenericInheritableNode>();
            container.RegisterInstance <IConnectionStrategy>(new TypedItemConnectionStrategy(), "TypedConnectionStrategy");
            //container.RegisterInstance<IConnectionStrategy>(new RegisteredConnectionStrategy(),"RegisteredConnectablesStrategy");

            container.AddNode <EnumNode>("Enum")
            .AddCodeTemplate <EnumNode, EnumNodeGenerator>();
            container.AddItem <EnumChildItem>();

            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(int), Group = "", Label = "int", IsPrimitive = true
            }, "int");
            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(string), Group = "", Label = "string", IsPrimitive = true
            }, "string");
            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(decimal), Group = "", Label = "decimal", IsPrimitive = true
            }, "decimal");
            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(float), Group = "", Label = "float", IsPrimitive = true
            }, "float");
            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(bool), Group = "", Label = "bool", IsPrimitive = true
            }, "bool");
            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(char), Group = "", Label = "char", IsPrimitive = true
            }, "char");
            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(DateTime), Group = "", Label = "date", IsPrimitive = true
            }, "date");
            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(Vector2), Group = "", Label = "Vector2", IsPrimitive = true
            }, "Vector2");
            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(Vector3), Group = "", Label = "Vector3", IsPrimitive = true
            }, "Vector3");

            container.Register <DesignerGeneratorFactory, RegisteredTemplateGeneratorsFactory>("TemplateGenerators");

#if UNITY_EDITOR
            typeContainer.RegisterInstance(new GraphTypeInfo()
            {
                Type = typeof(Quaternion), Group = "", Label = "Quaternion", IsPrimitive = true
            }, "Quaternion");
            //container.Register<DesignerGeneratorFactory, Invert.uFrame.CodeGen.ClassNodeGenerators.SimpleClassNodeCodeFactory>("ClassNodeData");
#endif
            // Register the container itself
            container.RegisterInstance <IQFrameworkContainer>(container);
            container.RegisterInstance <QFrameworkContainer>(container);

            container.AddNode <TypeReferenceNode, TypeReferenceNodeViewModel, TypeReferenceNodeDrawer>("Type Reference");
            container.AddNode <NoteNode, NoteNodeViewModel, NoteNodeDrawer>("Note");

            // TODO 2.0 Key-bindings
//            container.RegisterKeyBinding(new RenameCommand(), "Rename", KeyCode.F2);
//            container.RegisterKeyBinding(new SimpleEditorCommand<DiagramViewModel>((p) =>
//            {
//                p.DeselectAll();
//            }), "End All Editing", KeyCode.Return);

//            container.RegisterKeyBinding(new DeleteItemCommand(), "Delete Item", KeyCode.X, true);
//            container.RegisterKeyBinding(new DeleteCommand(), "Delete", KeyCode.Delete);
//#if UNITY_EDITOR
//            container.RegisterKeyBinding(new MoveUpCommand(), "Move Up", KeyCode.UpArrow);
//            container.RegisterKeyBinding(new MoveDownCommand(), "Move Down", KeyCode.DownArrow);
//#endif


//            container.RegisterKeyBinding(new SimpleEditorCommand<DiagramViewModel>((p) =>
//            {
//                InvertGraphEditor.Settings.ShowHelp = !InvertGraphEditor.Settings.ShowHelp;
//            }), "Show/Hide This Help", KeyCode.F1);
//#if DEBUG
//            container.RegisterKeyBinding(new SimpleEditorCommand<DiagramViewModel>((p) =>
//            {
//                InvertGraphEditor.Settings.ShowGraphDebug = !InvertGraphEditor.Settings.ShowGraphDebug;
//            }), "Show/Hide Debug", KeyCode.F3);
//#endif
//            container.RegisterKeyBinding(new SimpleEditorCommand<DiagramViewModel>((p) =>
//            {
//                var saveCommand = InvertApplication.Container.Resolve<IToolbarCommand>("Save");
//                InvertGraphEditor.ExecuteCommand(saveCommand);
//            }), "Save & Compile", KeyCode.S, true, true);
        }
Esempio n. 2
0
        public override void Initialize(QFrameworkContainer container)
        {
            var typeContainer = InvertGraphEditor.TypesContainer;

            // Drawers
            container.Register <DiagramViewModel, DiagramViewModel>();
            container.RegisterDrawer <PropertyFieldViewModel, PropertyFieldDrawer>();
            container.Register <SectionHeaderDrawer, SectionHeaderDrawer>();
            container.RegisterItemDrawer <GenericItemHeaderViewModel, GenericChildItemHeaderDrawer>();

            container.RegisterDrawer <InspectorViewModel, InspectorDrawer>();
            container.RegisterDrawer <SectionHeaderViewModel, SectionHeaderDrawer>();
            container.RegisterDrawer <ConnectorViewModel, ConnectorDrawer>();
            container.RegisterDrawer <ConnectionViewModel, ConnectionDrawer>();
            container.RegisterDrawer <InputOutputViewModel, SlotDrawer>();

            container.RegisterDrawer <DiagramViewModel, DiagramDrawer>();

            container.RegisterInstance <IConnectionStrategy>(new InputOutputStrategy(), "InputOutputStrategy");
            container.RegisterConnectable <GenericInheritableNode, GenericInheritableNode>();
            container.RegisterInstance <IConnectionStrategy>(new TypedItemConnectionStrategy(),
                                                             "TypedConnectionStrategy");

            container.AddNode <EnumNode>("Enum")
            .AddCodeTemplate <EnumNode, EnumNodeGenerator>();
            container.AddItem <EnumChildItem>();

            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(int), Group = "", Label = "int", IsPrimitive = true
            }, "int");
            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(string), Group = "", Label = "string", IsPrimitive = true
            }, "string");
            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(decimal), Group = "", Label = "decimal", IsPrimitive = true
            },
                "decimal");
            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(float), Group = "", Label = "float", IsPrimitive = true
            }, "float");
            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(bool), Group = "", Label = "bool", IsPrimitive = true
            }, "bool");
            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(char), Group = "", Label = "char", IsPrimitive = true
            }, "char");
            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(DateTime), Group = "", Label = "date", IsPrimitive = true
            }, "date");
            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(Vector2), Group = "", Label = "Vector2", IsPrimitive = true
            },
                "Vector2");
            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(Vector3), Group = "", Label = "Vector3", IsPrimitive = true
            },
                "Vector3");

            container.Register <DesignerGeneratorFactory, RegisteredTemplateGeneratorsFactory>("TemplateGenerators");

#if UNITY_EDITOR
            typeContainer.RegisterInstance(
                new GraphTypeInfo()
            {
                Type = typeof(Quaternion), Group = "", Label = "Quaternion", IsPrimitive = true
            },
                "Quaternion");
            //container.Register<DesignerGeneratorFactory, Invert.uFrame.CodeGen.ClassNodeGenerators.SimpleClassNodeCodeFactory>("ClassNodeData");
#endif
            // Register the container itself
            container.RegisterInstance <IQFrameworkContainer>(container);
            container.RegisterInstance <QFrameworkContainer>(container);

            container.AddNode <TypeReferenceNode, TypeReferenceNodeViewModel, TypeReferenceNodeDrawer>("Type Reference");
            container.AddNode <NoteNode, NoteNodeViewModel, NoteNodeDrawer>("Note");
        }