├── .gitignore ├── README.md ├── koinonia.config.json └── uFrame.Architect ├── Source.meta └── Source ├── Editor.meta └── Editor ├── Data.meta ├── Data ├── IInputCapable.cs ├── IInputCapable.cs.meta ├── IInputOutpuItem.cs ├── IInputOutpuItem.cs.meta ├── IOutputCapable.cs ├── IOutputCapable.cs.meta ├── IReferenceNode.cs ├── IReferenceNode.cs.meta ├── IShellConnectable.cs ├── IShellConnectable.cs.meta ├── IShellNode.cs ├── IShellNode.cs.meta ├── IShellNodeConfigItem.cs ├── IShellNodeConfigItem.cs.meta ├── IShellNodeItem.cs ├── IShellNodeItem.cs.meta ├── IShellNodeTypeClass.cs ├── IShellNodeTypeClass.cs.meta ├── IShellReferenceType.cs ├── IShellReferenceType.cs.meta ├── IShellSlotType.cs ├── IShellSlotType.cs.meta ├── ReferenceItemType.cs ├── ReferenceItemType.cs.meta ├── ShellAcceptableReferenceType.cs ├── ShellAcceptableReferenceType.cs.meta ├── ShellChildItemTypeNode.cs ├── ShellChildItemTypeNode.cs.meta ├── ShellConnectableReferenceType.cs ├── ShellConnectableReferenceType.cs.meta ├── ShellConnectionDefitionNode.cs ├── ShellConnectionDefitionNode.cs.meta ├── ShellGeneratorTypeNode.cs ├── ShellGeneratorTypeNode.cs.meta ├── ShellGraphTypeNode.cs ├── ShellGraphTypeNode.cs.meta ├── ShellInheritableNode.cs ├── ShellInheritableNode.cs.meta ├── ShellNode.cs ├── ShellNode.cs.meta ├── ShellNodeChildTypeNode.cs ├── ShellNodeChildTypeNode.cs.meta ├── ShellNodeConfig.cs ├── ShellNodeConfig.cs.meta ├── ShellNodeConfigDrawer.cs ├── ShellNodeConfigDrawer.cs.meta ├── ShellNodeConfigInput.cs ├── ShellNodeConfigInput.cs.meta ├── ShellNodeConfigInputPointer.cs ├── ShellNodeConfigInputPointer.cs.meta ├── ShellNodeConfigItem.cs ├── ShellNodeConfigItem.cs.meta ├── ShellNodeConfigOutput.cs ├── ShellNodeConfigOutput.cs.meta ├── ShellNodeConfigOutputPointer.cs ├── ShellNodeConfigOutputPointer.cs.meta ├── ShellNodeConfigSection.cs ├── ShellNodeConfigSection.cs.meta ├── ShellNodeConfigSectionPointer.cs ├── ShellNodeConfigSectionPointer.cs.meta ├── ShellNodeConfigSectionType.cs ├── ShellNodeConfigSectionType.cs.meta ├── ShellNodeConfigSelector.cs ├── ShellNodeConfigSelector.cs.meta ├── ShellNodeConfigViewModel.cs ├── ShellNodeConfigViewModel.cs.meta ├── ShellNodeGeneratorsSlot.cs ├── ShellNodeGeneratorsSlot.cs.meta ├── ShellNodeInputsSlot.cs ├── ShellNodeInputsSlot.cs.meta ├── ShellNodeOutputsSlot.cs ├── ShellNodeOutputsSlot.cs.meta ├── ShellNodeSectionsSlot.cs ├── ShellNodeSectionsSlot.cs.meta ├── ShellNodeSubNodesSlot.cs ├── ShellNodeSubNodesSlot.cs.meta ├── ShellNodeTypeNode.cs ├── ShellNodeTypeNode.cs.meta ├── ShellNodeTypeNodeDrawer.cs ├── ShellNodeTypeNodeDrawer.cs.meta ├── ShellNodeTypeNodeViewModel.cs ├── ShellNodeTypeNodeViewModel.cs.meta ├── ShellNodeTypeReferenceSection.cs ├── ShellNodeTypeReferenceSection.cs.meta ├── ShellNodeTypeSection.cs ├── ShellNodeTypeSection.cs.meta ├── ShellPluginNode.cs ├── ShellPluginNode.cs.meta ├── ShellSectionNode.cs ├── ShellSectionNode.cs.meta ├── ShellSectionReferenceSlot.cs ├── ShellSectionReferenceSlot.cs.meta ├── ShellSlotTypeNode.cs ├── ShellSlotTypeNode.cs.meta ├── ShellTemplateConfigNode.cs ├── ShellTemplateConfigNode.cs.meta ├── TemplateEventReference.cs ├── TemplateEventReference.cs.meta ├── TemplateFieldReference.cs ├── TemplateFieldReference.cs.meta ├── TemplateMethodReference.cs ├── TemplateMethodReference.cs.meta ├── TemplatePropertyReference.cs ├── TemplatePropertyReference.cs.meta ├── TemplateReference.cs └── TemplateReference.cs.meta ├── DocumentationPageTemplate.cs ├── DocumentationPageTemplate.cs.meta ├── DocumentationTemplate.cs ├── DocumentationTemplate.cs.meta ├── Generators.meta ├── Generators ├── ShellChildItemTemplate.cs ├── ShellChildItemTemplate.cs.meta ├── ShellChildTemplate.cs ├── ShellChildTemplate.cs.meta ├── ShellConfigPluginTemplate.cs ├── ShellConfigPluginTemplate.cs.meta ├── ShellGraphTemplate.cs ├── ShellGraphTemplate.cs.meta ├── ShellNodeAsGraphTemplate.cs ├── ShellNodeAsGraphTemplate.cs.meta ├── ShellNodeConfigChildItemTemplate.cs ├── ShellNodeConfigChildItemTemplate.cs.meta ├── ShellNodeConfigDrawerTemplate.cs ├── ShellNodeConfigDrawerTemplate.cs.meta ├── ShellNodeConfigReferenceSectionTemplate.cs ├── ShellNodeConfigReferenceSectionTemplate.cs.meta ├── ShellNodeConfigTemplate.cs ├── ShellNodeConfigTemplate.cs.meta ├── ShellNodeConfigTemplateTemplate.cs ├── ShellNodeConfigTemplateTemplate.cs.meta ├── ShellNodeConfigViewModelTemplate.cs ├── ShellNodeConfigViewModelTemplate.cs.meta ├── ShellNodeTypeDrawerTemplate.cs ├── ShellNodeTypeDrawerTemplate.cs.meta ├── ShellNodeTypeTemplate.cs ├── ShellNodeTypeTemplate.cs.meta ├── ShellNodeTypeViewModelTemplate.cs ├── ShellNodeTypeViewModelTemplate.cs.meta ├── ShellPluginClassGenerator.cs ├── ShellPluginClassGenerator.cs.meta ├── ShellPluginTemplate.cs ├── ShellPluginTemplate.cs.meta ├── ShellReferenceSectionTemplate.cs ├── ShellReferenceSectionTemplate.cs.meta ├── ShellSlotItemTemplate.cs └── ShellSlotItemTemplate.cs.meta ├── PluginDesigner.cs ├── PluginDesigner.cs.meta ├── PluginGraphData.cs ├── PluginGraphData.cs.meta ├── ShellPropertySelectorItem.cs └── ShellPropertySelectorItem.cs.meta /.gitignore: -------------------------------------------------------------------------------- 1 | /*.meta -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # uFrame Architect 2 | --- 3 | uFrame Architect Framework 4 | [![Join the chat at https://gitter.im/micahosborne/uFrame](https://badges.gitter.im/micahosborne/uFrame.svg)](https://gitter.im/micahosborne/uFrame?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 5 | 6 | ## What is uFrame Architect? 7 | uFrame Architect Framework is an internal project that let's you generate Models, ViewModels and Drawers based on diagram data. It allows you to prototype your own node-based framework, such as uFrame ECS, uFrame MVVM and basically build with uFrame Architect Framework. 8 | 9 | ## Quick Getting Started 10 | 11 | ##### Prerequirement 12 | 1. Github personal access token 13 | 14 | Please follow [this guide](https://github.com/blog/1509-personal-api-tokens) to create personal access token. 15 | 16 | 2. Koinonia Plugin (Package Manager) 17 | 18 | Download Zip or Clone [Koinonia](https://github.com/nitreo/Koinonia) into your project Assets folder 19 | 20 | > Make sure Koinonia is located under Editor folder 21 | 22 | ##### Step 1. 23 | 24 | In Unity Editor, Locate `Packages -> Manager...` in the top menu, and a terminal will open. 25 | 26 | ##### Step 2. 27 | 28 | In command line, type in 29 | `ghtoken (Your github personal access token)` 30 | Hit enter. 31 | 32 | ##### Step 3.(Optional) 33 | 34 | Install CSharp 6.0 support if you get a UWeave Error, type in 35 | `install nitreo/csharp60` 36 | Hit enter 37 | 38 | ##### Step 4. 39 | Install uFrame Architect, type in 40 | `install uFrame/Architect` 41 | Hit enter -------------------------------------------------------------------------------- /koinonia.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "title" : "uFrame Architect", 3 | "author" : "uFrame", 4 | "license" : "MIT", 5 | "dependencies" : { 6 | "uFrame/Core" : "master" 7 | } 8 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8ff51b2a866fac4da04776340859e82 3 | folderAsset: yes 4 | timeCreated: 1504138408 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33144e0058809eb49a4a2b4800e95b98 3 | folderAsset: yes 4 | timeCreated: 1468206136 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61bf189194d22e74b920da160e560030 3 | folderAsset: yes 4 | timeCreated: 1468206165 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IInputCapable.cs: -------------------------------------------------------------------------------- 1 | namespace uFrame.Architect.Editor.Data 2 | { 3 | public interface IInputCapable 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IInputCapable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27209340460d7f845bd59988477846f1 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IInputOutpuItem.cs: -------------------------------------------------------------------------------- 1 | namespace uFrame.Architect.Editor.Data 2 | { 3 | public interface IInputOutpuItem : IShellNode 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IInputOutpuItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5fbe24d521ac0df4aa479adccdcc1245 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IOutputCapable.cs: -------------------------------------------------------------------------------- 1 | namespace uFrame.Architect.Editor.Data 2 | { 3 | public interface IOutputCapable 4 | { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IOutputCapable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba3480c95dc94f049ae9f684a4ef5f5d 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IReferenceNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using uFrame.Editor.Configurations; 3 | 4 | namespace uFrame.Architect.Editor.Data 5 | { 6 | public interface IReferenceNode : IShellNode 7 | { 8 | string ReferenceClassName { get; } 9 | [ReferenceSection("Acceptable Types", SectionVisibility.Always, false)] 10 | IEnumerable AcceptableTypes { get; } 11 | IEnumerable PossibleAcceptableTypes { get; } 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IReferenceNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b077cf1e1bcdad442b0bc4662deef4a7 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellConnectable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using uFrame.Editor.Configurations; 3 | using uFrame.Editor.Graphs.Data; 4 | 5 | namespace uFrame.Architect.Editor.Data 6 | { 7 | public interface IShellConnectable : IDiagramNode, IShellNode 8 | { 9 | [ReferenceSection("Connectable To", SectionVisibility.Always, false)] 10 | IEnumerable ConnectableTo { get; } 11 | 12 | bool MultipleInputs { get; set; } 13 | 14 | bool MultipleOutputs { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellConnectable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7f9ad83d79cf9c4d88728bdf80defd3 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellNode.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Core; 2 | using uFrame.Editor.Graphs.Data; 3 | 4 | namespace uFrame.Architect.Editor.Data 5 | { 6 | public interface IShellNode : IDiagramNode, IItem, IClassTypeNode, IConnectable 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d12b33af93bfaf4aaef3b7fca15de96 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellNodeConfigItem.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using uFrame.Editor.Attributes; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Documentation; 5 | using uFrame.Editor.Graphs.Data; 6 | using uFrame.Json; 7 | 8 | namespace uFrame.Architect.Editor.Data 9 | { 10 | public interface IShellNodeConfigItem : IDocumentable, IClassTypeNode 11 | { 12 | [JsonProperty, InspectorProperty] 13 | int Row { get; set; } 14 | [JsonProperty, InspectorProperty] 15 | int Column { get; set; } 16 | [InspectorProperty, JsonProperty] 17 | SectionVisibility Visibility { get; set; } 18 | string ReferenceClassName { get; } 19 | //string ClassName { get; } 20 | IEnumerable IncludedInSections { get; } 21 | string TypeName { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellNodeConfigItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1283f18a3a3398748bc5eb5e7e939d5d 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellNodeItem.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Graphs.Data; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public interface IShellNodeItem : IConnectable, IDiagramNodeItem 6 | { 7 | string ReferenceClassName { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellNodeItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c10a11124b600743a8e2c11ef7151d2 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellNodeTypeClass.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public interface IShellNodeTypeClass : IShellNodeConfigItem 6 | { 7 | //bool AllowMultipleInputs { get; set; } 8 | //bool AllowMultipleOutputs { get; set; } 9 | bool Inheritable { get; set; } 10 | IEnumerable Sections { get; set; } 11 | IEnumerable InputSlots { get; set; } 12 | IEnumerable OutputSlots { get; set; } 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellNodeTypeClass.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ef9e6b4e3ad26b4fbfacfadedb30908 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellReferenceType.cs: -------------------------------------------------------------------------------- 1 | namespace uFrame.Architect.Editor.Data 2 | { 3 | 4 | //TODO 5 | } 6 | 7 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellReferenceType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f1751d4a98c6cc4d9c6057d06ebfb3a 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellSlotType.cs: -------------------------------------------------------------------------------- 1 | namespace uFrame.Architect.Editor.Data 2 | { 3 | public interface IShellSlotType : IShellNodeConfigItem 4 | { 5 | bool IsOutput { get; set; } 6 | bool AllowMultiple { get; set; } 7 | 8 | bool AllowSelection { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/IShellSlotType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 451ca7bb61bd0eb4c8a24827d808966f 3 | timeCreated: 1442108386 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ReferenceItemType.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Graphs.Data; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class ReferenceItemType : GenericSlot 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ReferenceItemType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e722a8b6de45f24780568601c32c821 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellAcceptableReferenceType.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Graphs.Data; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class ShellAcceptableReferenceType : GenericReferenceItem 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellAcceptableReferenceType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf461f15d59b136408ea05ef47b5d59b 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellChildItemTypeNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace uFrame.Architect.Editor.Data 5 | { 6 | public class ShellChildItemTypeNode : ShellInheritableNode, IShellNode 7 | { 8 | public IShellNode ReferenceType 9 | { 10 | get { return GetConnectionReference().InputFrom(); } 11 | } 12 | 13 | public override string ClassName 14 | { 15 | get { return this.Name + "ChildItem"; } 16 | } 17 | public IEnumerable IncludedInSections 18 | { 19 | get 20 | { 21 | return Repository.AllOf().Where(p => p.AcceptableTypes.Any(x => x.SourceItem == this)); 22 | } 23 | } 24 | 25 | 26 | 27 | public string ReferenceClassName 28 | { 29 | get { return "I" + Name + "Connectable"; } 30 | } 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellChildItemTypeNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9032a9ca906194241ab6d839a86f0abd 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellConnectableReferenceType.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Graphs.Data; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class ShellConnectableReferenceType : GenericReferenceItem 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellConnectableReferenceType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fc5234076859b6499b6c6f762425330 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellConnectionDefitionNode.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Configurations; 2 | using uFrame.Editor.Graphs.Data; 3 | 4 | namespace uFrame.Architect.Editor.Data 5 | { 6 | public class ShellConnectionDefitionNode 7 | { 8 | [InputSlot("Output")] 9 | public SingleInputSlot OutputItem { get; set; } 10 | [OutputSlot("Input")] 11 | public SingleInputSlot InputItem { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellConnectionDefitionNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43c6eb188a79f4c4b849610e80fa6829 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellGeneratorTypeNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using uFrame.Editor.Attributes; 6 | using uFrame.Editor.Core; 7 | using uFrame.Editor.Graphs.Data; 8 | using uFrame.Json; 9 | 10 | namespace uFrame.Architect.Editor.Data 11 | { 12 | public class ShellGeneratorTypeNode : GenericNode 13 | { 14 | private Type _baseType; 15 | private string _templateType; 16 | private string _classNameFormat = "{0}"; 17 | private MemberInfo[] _templateMembers; 18 | private string _folderName; 19 | 20 | public ShellGeneratorTypeNode() 21 | { 22 | _templateType = typeof(System.Object).Name; 23 | } 24 | 25 | 26 | public Type BaseType 27 | { 28 | get 29 | { 30 | 31 | return _baseType ?? (BaseType = InvertApplication.FindTypeByName(TemplateType)); 32 | } 33 | set 34 | { 35 | _baseType = value; 36 | TemplateMembers = null; 37 | } 38 | } 39 | 40 | [JsonProperty, InspectorProperty(InspectorType.TypeSelection)] 41 | public string TemplateType 42 | { 43 | get { return _templateType; } 44 | set 45 | { 46 | _templateType = value; 47 | _baseType = null; 48 | TemplateMembers = null; 49 | } 50 | } 51 | 52 | [JsonProperty, InspectorProperty] 53 | public bool IsEditorExtension { get; set; } 54 | 55 | [JsonProperty, InspectorProperty] 56 | public bool IsDesignerOnly { get; set; } 57 | 58 | [JsonProperty, InspectorProperty] 59 | public string ClassNameFormat 60 | { 61 | get { return _classNameFormat; } 62 | set { _classNameFormat = value; } 63 | } 64 | 65 | [JsonProperty, InspectorProperty] 66 | public string FolderName 67 | { 68 | get 69 | { 70 | if (string.IsNullOrEmpty(_folderName)) 71 | { 72 | return Name; 73 | } 74 | return _folderName; 75 | } 76 | set { _folderName = value; } 77 | } 78 | 79 | //public ShellNodeGeneratorsSlot ShellNodeShellNodeGeneratorsSlot 80 | //{ 81 | // get 82 | // { 83 | // return this.InputFrom(); 84 | // } 85 | //} 86 | public ShellNodeTypeNode GeneratorFor 87 | { 88 | get 89 | { 90 | var item = this.InputsFrom>().FirstOrDefault(); 91 | if (item == null) return null; 92 | return item.Node as ShellNodeTypeNode; 93 | } 94 | } 95 | public IEnumerable Overrides 96 | { 97 | get { return PersistedItems.OfType(); } 98 | } 99 | 100 | public MemberInfo[] TemplateMembers 101 | { 102 | get 103 | { 104 | if (_templateMembers == null) 105 | { 106 | _templateMembers = BaseType.GetMembers(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic); 107 | } 108 | return _templateMembers; 109 | } 110 | set { _templateMembers = value; } 111 | } 112 | 113 | public IEnumerable TemplateProperties 114 | { 115 | get { return PersistedItems.OfType(); } 116 | } 117 | public IEnumerable TemplateMethods 118 | { 119 | get { return PersistedItems.OfType(); } 120 | } 121 | public IEnumerable TemplateEvents 122 | { 123 | get { return PersistedItems.OfType(); } 124 | } 125 | public IEnumerable TemplateFields 126 | { 127 | get { return PersistedItems.OfType(); } 128 | } 129 | 130 | } 131 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellGeneratorTypeNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef1e6b6768f769a4baa39bbf612ce2f3 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellGraphTypeNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | 6 | namespace uFrame.Architect.Editor.Data 7 | { 8 | public class ShellGraphTypeNode : ShellNode 9 | { 10 | public override void Validate(List errors) 11 | { 12 | base.Validate(errors); 13 | if (!RootNodeSlot.Outputs.Any()) 14 | { 15 | errors.AddError("Root node must be specified.", this); 16 | } 17 | } 18 | 19 | [OutputSlot("Root Node")] 20 | public SingleOutputSlot RootNodeSlot { get; set; } 21 | 22 | public ShellNodeTypeNode RootNode 23 | { 24 | get 25 | { 26 | return RootNodeSlot.Item; 27 | } 28 | } 29 | 30 | public override string ClassName 31 | { 32 | get { return string.Format("{0}Graph", Name); } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellGraphTypeNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea8a99f2ac65f344986d1317fedc2ace 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellInheritableNode.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Attributes; 2 | using uFrame.Editor.Graphs.Data; 3 | using uFrame.Editor.Database.Data; 4 | using uFrame.Json; 5 | 6 | namespace uFrame.Architect.Editor.Data 7 | { 8 | public class ShellInheritableNode : GenericInheritableNode, IShellNode 9 | { 10 | private string _baseIdentifier; 11 | 12 | [JsonProperty] 13 | public string BaseIdentifier 14 | { 15 | get { return _baseIdentifier; } 16 | set 17 | { 18 | this.Changed("BaseIdentifier", ref _baseIdentifier, value); 19 | } 20 | } 21 | 22 | [InspectorProperty(InspectorType.GraphItems)] 23 | public override GenericInheritableNode BaseNode 24 | { 25 | get 26 | { 27 | if (string.IsNullOrEmpty(BaseIdentifier) || Repository == null) 28 | return null; 29 | return Repository.GetById(BaseIdentifier); 30 | } 31 | set 32 | { 33 | if (value != null) 34 | BaseIdentifier = value.Identifier; 35 | else 36 | { 37 | BaseIdentifier = null; 38 | } 39 | } 40 | } 41 | 42 | public virtual string ClassName 43 | { 44 | get { return string.Format("{0}", Name); } 45 | } 46 | 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellInheritableNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9388f897a9a27624182d307f6ce7ea58 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNode.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Attributes; 2 | using uFrame.Editor.Graphs.Data; 3 | 4 | namespace uFrame.Architect.Editor.Data 5 | { 6 | public class ShellNode : GenericNode, IShellNode 7 | { 8 | 9 | [InspectorProperty] 10 | public bool IsCustom 11 | { 12 | get { return this["Custom"]; } 13 | set { this["Custom"] = value; } 14 | } 15 | 16 | 17 | public virtual string ClassName 18 | { 19 | get { return string.Format("{0}", Name); } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f610a748ef3e34478ad91763ae9e074 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeChildTypeNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using uFrame.Editor.Graphs.Data; 4 | 5 | namespace uFrame.Architect.Editor.Data 6 | { 7 | public class ShellNodeChildTypeNode : GenericNode 8 | { 9 | public IEnumerable IncludedInSections 10 | { 11 | get 12 | { 13 | return Repository.AllOf().Where(p => p.AcceptableTypes.Any(x => x.SourceItem == this)); 14 | } 15 | } 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeChildTypeNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2513da41d8cbe954796bfce0a489042f 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using uFrame.Editor.Attributes; 4 | using uFrame.Editor.Compiling.CodeGen; 5 | using uFrame.Editor.Configurations; 6 | using uFrame.Editor.Documentation; 7 | using uFrame.Editor.Graphs.Data; 8 | using uFrame.Editor.Database.Data; 9 | using uFrame.Editor.Platform; 10 | using uFrame.Json; 11 | 12 | namespace uFrame.Architect.Editor.Data 13 | { 14 | public class ShellNodeConfig : ShellInheritableNode, IShellNodeTypeClass, IDocumentable 15 | { 16 | public override bool AllowMultipleInputs 17 | { 18 | get { return true; } 19 | } 20 | 21 | private string _nodeLabel; 22 | private NodeColor _color; 23 | private bool _inheritable; 24 | private bool _isClass; 25 | 26 | public string NodeLabel 27 | { 28 | get 29 | { 30 | if (string.IsNullOrEmpty(_nodeLabel)) 31 | return Name; 32 | return _nodeLabel; 33 | } 34 | set { _nodeLabel = value; } 35 | } 36 | 37 | [InspectorProperty, JsonProperty] 38 | public NodeColor NodeColor 39 | { 40 | get { return _color; } 41 | set 42 | { 43 | this.Changed("NodeColor", ref _color, value); 44 | } 45 | } 46 | 47 | [InspectorProperty("Visual appearance of the node"), JsonProperty] 48 | public NodeStyle NodeStyle 49 | { 50 | get { return _nodeStyle; } 51 | set 52 | { 53 | this.Changed("NodeStyle", ref _nodeStyle, value); 54 | } 55 | } 56 | 57 | [InspectorProperty, JsonProperty] 58 | public bool Inheritable 59 | { 60 | get { return _inheritable; } 61 | set 62 | { 63 | 64 | this.Changed("Inheritable", ref _inheritable, value); 65 | } 66 | } 67 | 68 | [InspectorProperty, JsonProperty] 69 | public bool IsClass 70 | { 71 | get { return _isClass; } 72 | set 73 | { 74 | 75 | this.Changed("IsClass", ref _isClass, value); 76 | } 77 | } 78 | 79 | private SectionVisibility _visibility; 80 | private int _column; 81 | private int _row; 82 | private NodeStyle _nodeStyle; 83 | 84 | [InspectorProperty, JsonProperty] 85 | public int Row 86 | { 87 | get { return _row; } 88 | set 89 | { 90 | this.Changed("Row", ref _row, value); 91 | } 92 | } 93 | 94 | [InspectorProperty, JsonProperty] 95 | public int Column 96 | { 97 | get { return _column; } 98 | set 99 | { 100 | 101 | this.Changed("Column", ref _column, value); 102 | } 103 | } 104 | 105 | [InspectorProperty, JsonProperty] 106 | public SectionVisibility Visibility 107 | { 108 | get { return _visibility; } 109 | set 110 | { 111 | this.Changed("Visibility", ref _visibility, value); 112 | } 113 | } 114 | 115 | public string ReferenceClassName 116 | { 117 | get { return "I" + this.Name + "Connectable"; } 118 | } 119 | 120 | public override string ClassName 121 | { 122 | get { return this.Name + "Node"; } 123 | } 124 | 125 | public IEnumerable Sections 126 | { 127 | get { return PersistedItems.OfType().Concat(PersistedItems.OfType().Select(p => p.SourceItem)); } 128 | set { } 129 | } 130 | 131 | public IEnumerable InputSlots 132 | { 133 | get { return PersistedItems.OfType().Concat(PersistedItems.OfType().Select(p => p.SourceItem)); } 134 | set { } 135 | } 136 | 137 | public IEnumerable OutputSlots 138 | { 139 | get { return PersistedItems.OfType().Concat(PersistedItems.OfType().Select(p => p.SourceItem)); } 140 | set { } 141 | } 142 | 143 | public IEnumerable IncludedInSections 144 | { 145 | get { return this.OutputsTo(); } 146 | } 147 | 148 | public override string TypeName 149 | { 150 | get 151 | { 152 | return base.TypeName; 153 | } 154 | } 155 | 156 | //public string TypeName 157 | //{ 158 | // get { return Name.Clean(); } 159 | // set 160 | // { 161 | 162 | // } 163 | //} 164 | 165 | [InspectorProperty] 166 | public bool IsGraphType 167 | { 168 | get { return this["Graph Type"]; } 169 | set { this["Graph Type"] = value; } 170 | } 171 | 172 | public IEnumerable SubNodes 173 | { 174 | get { return this.FilterNodes.OfType().Where(p => p != this); } 175 | } 176 | } 177 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0bf8025360620aa48aeb3900807f7680 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigDrawer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using uFrame.Editor.Core; 4 | using uFrame.Editor.Graphs.Data; 5 | using uFrame.Editor.GraphUI.Drawers; 6 | using uFrame.Editor.GraphUI.ViewModels; 7 | using uFrame.Editor.Platform; 8 | using UnityEngine; 9 | 10 | namespace uFrame.Architect.Editor.Data 11 | { 12 | public class ShellNodeConfigDrawer : DiagramNodeDrawer, IInspectorDrawer 13 | { 14 | public ShellNodeConfigDrawer(ShellNodeConfigViewModel viewModel) 15 | : base(viewModel) 16 | { 17 | } 18 | 19 | public override void Draw(IPlatformDrawer platform, float scale) 20 | { 21 | base.Draw(platform, scale); 22 | 23 | if (IsSelected) 24 | { 25 | var selectedChild = Children.Skip(1).FirstOrDefault(p => p.IsSelected); 26 | var width = 85f; 27 | var buttonHeight = 25; 28 | var toolbarRect = new Rect(this.Bounds.x - width - 4, this.Bounds.y + 8, width, selectedChild == null ? (buttonHeight * 3) + 20 : (buttonHeight * 4) + 20); 29 | 30 | platform.DrawStretchBox(toolbarRect, CachedStyles.WizardSubBoxStyle, 12f); 31 | toolbarRect.y += 10; 32 | 33 | var x = toolbarRect.x; 34 | var y = toolbarRect.y; 35 | 36 | if (selectedChild != null) 37 | { 38 | platform.DoButton(new Rect(x, y, toolbarRect.width, buttonHeight), "Remove", CachedStyles.WizardListItemBoxStyle, 39 | () => 40 | { 41 | NodeViewModel.RemoveSelected(); 42 | }); 43 | y += buttonHeight; 44 | } 45 | platform.DoButton(new Rect(x, y, toolbarRect.width, buttonHeight), "+ Add Section", CachedStyles.WizardListItemBoxStyle, 46 | () => 47 | { 48 | ShowAddPointerMenu("Section", () => 49 | { 50 | NodeViewModel.AddSectionItem(); 51 | }, _ => { NodeViewModel.AddSectionPointer(_); }); 52 | }); 53 | y += buttonHeight; 54 | platform.DoButton(new Rect(x, y, toolbarRect.width, buttonHeight), "+ Input", CachedStyles.WizardListItemBoxStyle, 55 | () => 56 | { 57 | ShowAddPointerMenu("Input", () => 58 | { 59 | NodeViewModel.AddInputItem(); 60 | }, _ => { NodeViewModel.AddInputPointer(_); }); 61 | }); 62 | y += buttonHeight; 63 | platform.DoButton(new Rect(x, y, toolbarRect.width, buttonHeight), "+ Output", CachedStyles.WizardListItemBoxStyle, 64 | () => 65 | { 66 | ShowAddPointerMenu("Output", () => 67 | { 68 | NodeViewModel.AddOutputItem(); 69 | }, _ => { NodeViewModel.AddOutputPointer(_); }); 70 | 71 | }); 72 | y += buttonHeight; 73 | 74 | 75 | 76 | } 77 | 78 | 79 | } 80 | 81 | private void ShowAddPointerMenu(string name, Action addItem, Action addPointer) where TItem : IDiagramNodeItem 82 | { 83 | 84 | 85 | 86 | var ctxMenu = new UnityEditor.GenericMenu(); 87 | ctxMenu.AddItem(new GUIContent("New " + name), false, 88 | () => { InvertApplication.Execute(() => { addItem(); }); }); 89 | ctxMenu.AddSeparator(""); 90 | var nodeConfigSection = 91 | NodeViewModel.DiagramViewModel.CurrentRepository.AllOf(); 92 | foreach (var item in nodeConfigSection) 93 | { 94 | var item1 = item; 95 | ctxMenu.AddItem(new GUIContent(item.Name), false, 96 | () => { InvertApplication.Execute(() => { addPointer(item1); }); }); 97 | } 98 | ctxMenu.ShowAsContext(); 99 | 100 | } 101 | 102 | protected override void DrawChildren(IPlatformDrawer platform, float scale) 103 | { 104 | for (int index = 0; index < Children.Count; index++) 105 | { 106 | var item = Children[index]; 107 | 108 | if (index == 0) 109 | { 110 | item.Draw(platform, scale); 111 | continue; 112 | } 113 | var optionsBounds = new Rect(item.Bounds.x, item.Bounds.y + 4, item.Bounds.width, 114 | item.Bounds.height); 115 | if (item.IsSelected) 116 | { 117 | platform.DrawStretchBox(optionsBounds, CachedStyles.Item1, 0f); 118 | } 119 | optionsBounds.width -= 35; 120 | //optionsBounds.x += 15; 121 | item.Draw(platform, scale); 122 | platform.DoButton(optionsBounds, "", CachedStyles.ClearItemStyle, () => 123 | { 124 | ViewModel.DiagramViewModel.DeselectAll(); 125 | ViewModel.Select(); 126 | item.ViewModelObject.Select(); 127 | InvertApplication.SignalEvent(_ => _.SelectionChanged(item.ViewModelObject)); 128 | }); 129 | } 130 | } 131 | 132 | public void DrawInspector(IPlatformDrawer platformDrawer) 133 | { 134 | #if UNITY_EDITOR 135 | 136 | #endif 137 | } 138 | } 139 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2bc6f0ee9bcd574ba304c97541e25e0 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigInput.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | using uFrame.Editor.Attributes; 3 | using uFrame.Editor.Graphs.Data; 4 | using uFrame.Editor.Database.Data; 5 | using uFrame.Json; 6 | 7 | namespace uFrame.Architect.Editor.Data 8 | { 9 | public class ShellNodeConfigInput : ShellNodeConfigItem, IShellSlotType, IConnectable 10 | { 11 | private bool _allowMultiple; 12 | private bool _allowSelection; 13 | 14 | public bool IsOutput 15 | { 16 | get { return false; } 17 | set 18 | { 19 | 20 | } 21 | } 22 | 23 | [JsonProperty, InspectorProperty] 24 | public bool AllowMultiple 25 | { 26 | get { return _allowMultiple; } 27 | set 28 | { 29 | this.Changed("AllowMultiple", ref _allowMultiple, value); 30 | } 31 | } 32 | 33 | public override string TypeName 34 | { 35 | get 36 | { 37 | return Regex.Replace(Name, @"[^a-zA-Z0-9_\.]+", ""); 38 | 39 | } 40 | set { } 41 | } 42 | 43 | public override string ClassName 44 | { 45 | get { return TypeName; } 46 | } 47 | 48 | [InspectorProperty, JsonProperty] 49 | public bool AllowSelection 50 | { 51 | get { return _allowSelection; } 52 | set { this.Changed("AllowSelection", ref _allowSelection, value); } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigInput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c34270e0b79da34b8524148d21a2b34 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigInputPointer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using uFrame.Editor.Attributes; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | using uFrame.Editor.Database.Data; 6 | using uFrame.Json; 7 | 8 | namespace uFrame.Architect.Editor.Data 9 | { 10 | public class ShellNodeConfigInputPointer : GenericReferenceItem, IShellNodeConfigItem 11 | { 12 | private SectionVisibility _visibility; 13 | private int _column; 14 | private int _row; 15 | 16 | [InspectorProperty, JsonProperty] 17 | public int Row 18 | { 19 | get { return _row; } 20 | set 21 | { 22 | this.Changed("Row", ref _row, value); 23 | } 24 | } 25 | 26 | [InspectorProperty, JsonProperty] 27 | public int Column 28 | { 29 | get { return _column; } 30 | set 31 | { 32 | 33 | this.Changed("Column", ref _column, value); 34 | } 35 | } 36 | 37 | [InspectorProperty, JsonProperty] 38 | public SectionVisibility Visibility 39 | { 40 | get { return _visibility; } 41 | set 42 | { 43 | this.Changed("Visibility", ref _visibility, value); 44 | } 45 | } 46 | 47 | public string ClassName 48 | { 49 | get { return this.SourceItem.TypeName; } 50 | } 51 | 52 | public string ReferenceClassName 53 | { 54 | get { return this.SourceItem.ReferenceClassName; } 55 | } 56 | 57 | public IEnumerable IncludedInSections 58 | { 59 | get { return this.OutputsTo(); } 60 | } 61 | 62 | public string TypeName 63 | { 64 | get { return SourceItem.TypeName; } 65 | set 66 | { 67 | 68 | } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigInputPointer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed765e9217fae1b4fab7a1c704a9f336 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigItem.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.RegularExpressions; 3 | using uFrame.Editor.Attributes; 4 | using uFrame.Editor.Configurations; 5 | using uFrame.Editor.Graphs.Data; 6 | using uFrame.Editor.Database.Data; 7 | using uFrame.Json; 8 | 9 | namespace uFrame.Architect.Editor.Data 10 | { 11 | public class ShellNodeConfigItem : GenericNodeChildItem, IShellNodeConfigItem, IClassTypeNode 12 | { 13 | [JsonProperty, InspectorProperty] 14 | public int Row 15 | { 16 | get { return _row; } 17 | set { this.Changed("Row", ref _row, value); } 18 | } 19 | 20 | [JsonProperty, InspectorProperty] 21 | public int Column 22 | { 23 | get { return _column; } 24 | set { this.Changed("Column", ref _column, value); } 25 | } 26 | 27 | [JsonProperty, InspectorProperty] 28 | public int ColumnSpan 29 | { 30 | get { return _columnSpan; } 31 | set { this.Changed("ColumnSpan", ref _columnSpan, value); } 32 | } 33 | 34 | [JsonProperty, InspectorProperty] 35 | public bool IsNewRow 36 | { 37 | get { return _isNewRow; } 38 | set { this.Changed("IsNewRow", ref _isNewRow, value); } 39 | } 40 | 41 | [JsonProperty, InspectorProperty(InspectorType.TextArea)] 42 | public string Comments 43 | { 44 | get { return _comments; } 45 | set { this.Changed("Comments", ref _comments, value); } 46 | } 47 | 48 | [InspectorProperty, JsonProperty] 49 | public override string Name 50 | { 51 | get { return base.Name; } 52 | set { base.Name = value; } 53 | } 54 | 55 | //private string _typeName; 56 | private SectionVisibility _visibility; 57 | private int _row; 58 | private bool _isNewRow; 59 | private int _column; 60 | private int _columnSpan; 61 | private string _comments; 62 | 63 | 64 | //[InspectorProperty, JsonProperty] 65 | public virtual string TypeName 66 | { 67 | get 68 | { 69 | return Regex.Replace(Name, @"[^a-zA-Z0-9_\.]+", ""); 70 | //if (string.IsNullOrEmpty(_typeName)) 71 | //{ 72 | 73 | //} 74 | //return _typeName; 75 | } 76 | set { } 77 | //set { _typeName = value; } 78 | } 79 | 80 | public override bool AutoFixName 81 | { 82 | get { return false; } 83 | } 84 | 85 | [InspectorProperty, JsonProperty] 86 | public SectionVisibility Visibility 87 | { 88 | get { return _visibility; } 89 | set 90 | { 91 | 92 | this.Changed("Visibility", ref _visibility, value); 93 | } 94 | } 95 | 96 | public virtual string ClassName 97 | { 98 | get { return this.Node.Name + TypeName; } 99 | } 100 | 101 | public string ReferenceClassName 102 | { 103 | get { return "I" + this.TypeName + "Connectable"; } 104 | } 105 | public virtual IEnumerable IncludedInSections 106 | { 107 | get 108 | { 109 | return this.OutputsTo(); 110 | } 111 | } 112 | 113 | 114 | } 115 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b8913df9cd4deb48b7ea213e7330d47 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigOutput.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | using uFrame.Editor.Attributes; 3 | using uFrame.Json; 4 | using uFrame.Editor.Database.Data; 5 | 6 | namespace uFrame.Architect.Editor.Data 7 | { 8 | public class ShellNodeConfigOutput : ShellNodeConfigItem, IShellSlotType 9 | { 10 | private bool _allowMultiple; 11 | private bool _allowSelection; 12 | 13 | public bool IsOutput 14 | { 15 | get { return true; } 16 | set 17 | { 18 | 19 | } 20 | } 21 | public override string TypeName 22 | { 23 | get 24 | { 25 | return Regex.Replace(Name, @"[^a-zA-Z0-9_\.]+", ""); 26 | 27 | } 28 | set { } 29 | } 30 | [JsonProperty, InspectorProperty] 31 | public bool AllowMultiple 32 | { 33 | get { return _allowMultiple; } 34 | set 35 | { 36 | this.Changed("AllowMultiple", ref _allowMultiple, value); 37 | } 38 | } 39 | 40 | public bool AllowSelection 41 | { 42 | get { return _allowSelection; } 43 | set { this.Changed("AllowSelection", ref _allowSelection, value); } 44 | } 45 | 46 | public override string ClassName 47 | { 48 | get { return TypeName; } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigOutput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7a6cd43a7fac1049a041f0de7534fa6 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigOutputPointer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using uFrame.Editor.Attributes; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | using uFrame.Editor.Database.Data; 6 | using uFrame.Json; 7 | 8 | namespace uFrame.Architect.Editor.Data 9 | { 10 | public class ShellNodeConfigOutputPointer : GenericReferenceItem, IShellNodeConfigItem 11 | { 12 | private SectionVisibility _visibility; 13 | private int _column; 14 | private int _row; 15 | 16 | [InspectorProperty, JsonProperty] 17 | public int Row 18 | { 19 | get { return _row; } 20 | set 21 | { 22 | 23 | this.Changed("Row", ref _row, value); 24 | } 25 | } 26 | 27 | [InspectorProperty, JsonProperty] 28 | public int Column 29 | { 30 | get { return _column; } 31 | set 32 | { 33 | 34 | this.Changed("Column", ref _column, value); 35 | } 36 | } 37 | 38 | [InspectorProperty, JsonProperty] 39 | public SectionVisibility Visibility 40 | { 41 | get { return _visibility; } 42 | set 43 | { 44 | 45 | this.Changed("Visibility", ref _visibility, value); 46 | } 47 | } 48 | public string ClassName 49 | { 50 | get { return this.SourceItem.TypeName; } 51 | } 52 | 53 | public string ReferenceClassName 54 | { 55 | get { return this.SourceItem.ReferenceClassName; } 56 | } 57 | 58 | public IEnumerable IncludedInSections 59 | { 60 | get { return this.OutputsTo(); } 61 | } 62 | 63 | public string TypeName 64 | { 65 | get { return SourceItem.TypeName; } 66 | set 67 | { 68 | 69 | } 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigOutputPointer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd0811ec87ae3a74da2f10c637d19849 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigSection.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Attributes; 2 | using uFrame.Json; 3 | using uFrame.Editor.Database.Data; 4 | 5 | namespace uFrame.Architect.Editor.Data 6 | { 7 | public class ShellNodeConfigSection : ShellNodeConfigItem 8 | { 9 | private bool _allowAdding; 10 | private ShellNodeConfigSectionType _sectionType; 11 | private bool _isTyped; 12 | private bool _isEditable; 13 | private bool _allowDuplicates; 14 | private bool _isAutomatic; 15 | private bool _hasPredefinedOptions; 16 | 17 | [JsonProperty, InspectorProperty] 18 | public ShellNodeConfigSectionType SectionType 19 | { 20 | get { return _sectionType; } 21 | set 22 | { 23 | 24 | this.Changed("SectionType", ref _sectionType, value); 25 | } 26 | } 27 | 28 | [InspectorProperty, JsonProperty] 29 | public bool IsTyped 30 | { 31 | get { return _isTyped; } 32 | set 33 | { 34 | 35 | this.Changed("IsTyped", ref _isTyped, value); 36 | } 37 | } 38 | 39 | [InspectorProperty, JsonProperty] 40 | public virtual bool AllowAdding 41 | { 42 | get 43 | { 44 | if (SectionType == ShellNodeConfigSectionType.ChildItems) 45 | { 46 | return true; 47 | } 48 | return _allowAdding; 49 | } 50 | set 51 | { 52 | 53 | this.Changed("AllowAdding", ref _allowAdding, value); 54 | } 55 | } 56 | 57 | public override string ClassName 58 | { 59 | get 60 | { 61 | if (SectionType == ShellNodeConfigSectionType.ChildItems) 62 | { 63 | return TypeName + "ChildItem"; 64 | } 65 | return TypeName + "Reference"; 66 | } 67 | } 68 | 69 | 70 | [InspectorProperty, JsonProperty] 71 | public bool IsEditable 72 | { 73 | get { return _isEditable; } 74 | set 75 | { 76 | this.Changed("IsEditable", ref _isEditable, value); 77 | } 78 | } 79 | 80 | [InspectorProperty, JsonProperty] 81 | public bool AllowDuplicates 82 | { 83 | get { return _allowDuplicates; } 84 | set 85 | { 86 | 87 | this.Changed("AllowDuplicates", ref _allowDuplicates, value); 88 | } 89 | } 90 | 91 | [InspectorProperty, JsonProperty] 92 | public bool IsAutomatic 93 | { 94 | get { return _isAutomatic; } 95 | set 96 | { 97 | this.Changed("IsAutomatic", ref _isAutomatic, value); 98 | } 99 | } 100 | 101 | [InspectorProperty, JsonProperty] 102 | public bool HasPredefinedOptions 103 | { 104 | get { return _hasPredefinedOptions; } 105 | set 106 | { 107 | this.Changed("HasPredefinedOptions", ref _hasPredefinedOptions, value); 108 | } 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigSection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b411997331488e64aa2510694eb7df72 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigSectionPointer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using uFrame.Editor.Attributes; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | using uFrame.Editor.Database.Data; 6 | using uFrame.Json; 7 | 8 | namespace uFrame.Architect.Editor.Data 9 | { 10 | public class ShellNodeConfigSectionPointer : GenericReferenceItem, IShellNodeConfigItem 11 | { 12 | private SectionVisibility _visibility; 13 | private int _column; 14 | private int _row; 15 | 16 | [InspectorProperty, JsonProperty] 17 | public int Row 18 | { 19 | get { return _row; } 20 | set 21 | { 22 | this.Changed("Row", ref _row, value); 23 | } 24 | } 25 | 26 | [InspectorProperty, JsonProperty] 27 | public int Column 28 | { 29 | get { return _column; } 30 | set 31 | { 32 | this.Changed("Column", ref _column, value); 33 | } 34 | } 35 | 36 | [InspectorProperty, JsonProperty] 37 | public SectionVisibility Visibility 38 | { 39 | get { return _visibility; } 40 | set 41 | { 42 | this.Changed("Visibility", ref _visibility, value); 43 | } 44 | } 45 | 46 | public string ReferenceClassName 47 | { 48 | get { return this.SourceItem.ReferenceClassName; } 49 | } 50 | 51 | public string ClassName 52 | { 53 | get { return this.SourceItem.ClassName; } 54 | } 55 | 56 | public IEnumerable IncludedInSections 57 | { 58 | get { return this.OutputsTo(); } 59 | } 60 | 61 | public string TypeName 62 | { 63 | get { return SourceItem.TypeName; } 64 | set 65 | { 66 | 67 | } 68 | } 69 | 70 | public bool AllowMultiple { get; set; } 71 | } 72 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigSectionPointer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e44157aeb9c17d74f9418b5397627c9c 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigSectionType.cs: -------------------------------------------------------------------------------- 1 | namespace uFrame.Architect.Editor.Data 2 | { 3 | public enum ShellNodeConfigSectionType 4 | { 5 | ChildItems, 6 | ReferenceItems, 7 | ProxyItems 8 | } 9 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigSectionType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ceebcaea0594d774aafe7a4c649650cb 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigSelector.cs: -------------------------------------------------------------------------------- 1 | namespace uFrame.Architect.Editor.Data 2 | { 3 | public class ShellNodeConfigSelector : ShellNodeConfigItem 4 | { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigSelector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4bcd1bd4f9a7ec248b88b791eae7b24f 3 | timeCreated: 1442108387 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using uFrame.Editor.Core; 3 | using uFrame.Editor.Graphs.Data; 4 | using uFrame.Editor.GraphUI.Drawers.Schemas; 5 | using uFrame.Editor.GraphUI.ViewModels; 6 | using uFrame.Editor.Platform; 7 | 8 | namespace uFrame.Architect.Editor.Data 9 | { 10 | public class ShellNodeConfigViewModel : GenericNodeViewModel 11 | { 12 | public ShellNodeConfigViewModel(ShellNodeConfig graphItemObject, DiagramViewModel diagramViewModel) 13 | : base(graphItemObject, diagramViewModel) 14 | { 15 | } 16 | 17 | public override INodeStyleSchema StyleSchema 18 | { 19 | get 20 | { 21 | switch (GraphItem.NodeStyle) 22 | { 23 | case NodeStyle.Normal: 24 | return NormalStyleSchema; 25 | case NodeStyle.Minimalistic: 26 | return MinimalisticStyleSchema; 27 | case NodeStyle.Bold: 28 | return BoldStyleSchema; 29 | } 30 | return base.StyleSchema; 31 | } 32 | } 33 | 34 | public override NodeColor Color 35 | { 36 | //get { return GraphItem.Color; } 37 | get { return GraphItem.NodeColor; } 38 | } 39 | 40 | public override bool IsCollapsed 41 | { 42 | get { return false; } 43 | set { base.IsCollapsed = value; } 44 | } 45 | 46 | public override bool AllowCollapsing 47 | { 48 | get { return false; } 49 | } 50 | 51 | protected override void CreateContent() 52 | { 53 | //base.CreateContent(); 54 | 55 | foreach (var column in GraphItem.ChildItemsWithInherited.OfType().GroupBy(p => p.Column)) 56 | { 57 | foreach (var item in column.OrderBy(p => p.Row)) 58 | { 59 | if (!IsVisible(item.Visibility)) continue; 60 | var section = item as ShellNodeConfigSection; 61 | if (section != null) 62 | { 63 | CreateHeader(section, section); 64 | continue; 65 | } 66 | var sectionPointer = item as ShellNodeConfigSectionPointer; 67 | if (sectionPointer != null) 68 | { 69 | CreateHeader(sectionPointer.SourceItem, sectionPointer); 70 | continue; 71 | } 72 | 73 | var input = item as ShellNodeConfigInput; 74 | if (input != null) 75 | { 76 | CreateInput(input, input); 77 | continue; 78 | } 79 | var inputPointer = item as ShellNodeConfigInputPointer; 80 | if (inputPointer != null) 81 | { 82 | CreateInput(inputPointer.SourceItem, inputPointer); 83 | continue; 84 | } 85 | 86 | var output = item as ShellNodeConfigOutput; 87 | if (output != null) 88 | { 89 | CreateOutput(output, output); 90 | continue; 91 | } 92 | var outputPointer = item as ShellNodeConfigOutputPointer; 93 | if (outputPointer != null) 94 | { 95 | CreateOutput(outputPointer.SourceItem, outputPointer); 96 | continue; 97 | } 98 | } 99 | } 100 | } 101 | 102 | private void CreateSelector(ShellNodeConfigSelector input) 103 | { 104 | 105 | } 106 | 107 | private void CreateOutput(ShellNodeConfigOutput output, object dataObject) 108 | { 109 | var vm = new InputOutputViewModel() 110 | { 111 | IsInput = false, 112 | IsOutput = true, 113 | DiagramViewModel = this.DiagramViewModel, 114 | Name = output.Name, 115 | DataObject = dataObject, 116 | Column = output.Column, 117 | ColumnSpan = output.ColumnSpan, 118 | IsNewLine = output.IsNewRow 119 | }; 120 | ContentItems.Add(vm); 121 | } 122 | 123 | private void CreateInput(ShellNodeConfigInput input, object dataObject) 124 | { 125 | var vm = new InputOutputViewModel() 126 | { 127 | IsInput = true, 128 | IsOutput = false, 129 | DiagramViewModel = this.DiagramViewModel, 130 | Name = input.Name, 131 | DataObject = dataObject, 132 | Column = input.Column, 133 | ColumnSpan = input.ColumnSpan, 134 | IsNewLine = input.IsNewRow, 135 | AllowSelection = input.AllowSelection 136 | }; 137 | ContentItems.Add(vm); 138 | } 139 | 140 | private void CreateHeader(ShellNodeConfigSection item, object dataObject) 141 | { 142 | var sectionViewModel = new GenericItemHeaderViewModel() 143 | { 144 | Name = item.Name, 145 | AddCommand = item.AllowAdding ? new LambdaCommand("", () => { }) : null, 146 | DataObject = dataObject, 147 | NodeViewModel = this, 148 | AllowConnections = true, 149 | Column = item.Column, 150 | ColumnSpan = item.ColumnSpan, 151 | IsNewLine = item.IsNewRow 152 | }; 153 | ContentItems.Add(sectionViewModel); 154 | } 155 | 156 | public void AddSectionItem() 157 | { 158 | DiagramViewModel.CurrentRepository.Add(new ShellNodeConfigSection() 159 | { 160 | Node = GraphItem, 161 | Name = "New Section", 162 | IsNewRow = true, 163 | }); 164 | } 165 | 166 | public void AddInputItem() 167 | { 168 | DiagramViewModel.CurrentRepository.Add(new ShellNodeConfigInput() 169 | { 170 | Node = GraphItem, 171 | Name = "New Input", 172 | IsNewRow = true, 173 | 174 | }); 175 | 176 | } 177 | 178 | public void AddOutputItem() 179 | { 180 | DiagramViewModel.CurrentRepository.Add(new ShellNodeConfigOutput() 181 | { 182 | Node = GraphItem, 183 | Name = "New Output", 184 | IsNewRow = true, 185 | 186 | }); 187 | } 188 | 189 | public void RemoveSelected() 190 | { 191 | DiagramViewModel.CurrentRepository.Remove(ContentItems.First(p => p.IsSelected).DataObject as IDiagramNodeItem); 192 | } 193 | 194 | public void AddSectionPointer(ShellNodeConfigSection item) 195 | { 196 | DiagramViewModel.CurrentRepository.Add(new ShellNodeConfigSectionPointer() 197 | { 198 | Node = GraphItem, 199 | SourceIdentifier = item.Identifier 200 | 201 | }); 202 | } 203 | public void AddInputPointer(ShellNodeConfigInput item) 204 | { 205 | DiagramViewModel.CurrentRepository.Add(new ShellNodeConfigInputPointer() 206 | { 207 | Node = GraphItem, 208 | SourceIdentifier = item.Identifier 209 | }); 210 | } 211 | public void AddOutputPointer(ShellNodeConfigOutput item) 212 | { 213 | DiagramViewModel.CurrentRepository.Add(new ShellNodeConfigOutputPointer() 214 | { 215 | Node = GraphItem, 216 | SourceIdentifier = item.Identifier 217 | }); 218 | } 219 | } 220 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeConfigViewModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a4dceee7decdd24ea39489873b720ce 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeGeneratorsSlot.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Graphs.Data; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class ShellNodeGeneratorsSlot : GenericSlot 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeGeneratorsSlot.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d90be76e2736064cada063ac0ff2283 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeInputsSlot.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Attributes; 2 | using uFrame.Editor.Graphs.Data; 3 | using uFrame.Json; 4 | 5 | namespace uFrame.Architect.Editor.Data 6 | { 7 | public class ShellNodeInputsSlot : GenericReferenceItem, IShellNodeItem 8 | { 9 | [JsonProperty, InspectorProperty] 10 | public override int Order { get; set; } 11 | 12 | public string ReferenceClassName 13 | { 14 | get { return SourceItem.ReferenceClassName; } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeInputsSlot.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2a5a6cb9b3e53b498daedd5149de847 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeOutputsSlot.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Attributes; 2 | using uFrame.Editor.Graphs.Data; 3 | using uFrame.Json; 4 | 5 | namespace uFrame.Architect.Editor.Data 6 | { 7 | public class ShellNodeOutputsSlot : GenericReferenceItem, IShellNodeItem 8 | { 9 | [JsonProperty, InspectorProperty] 10 | public override int Order { get; set; } 11 | 12 | public string ReferenceClassName 13 | { 14 | get { return SourceItem.ReferenceClassName; } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeOutputsSlot.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de87d4e3b1b3cca40a24212bcfa118b1 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeSectionsSlot.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Attributes; 2 | using uFrame.Editor.Graphs.Data; 3 | using uFrame.Json; 4 | 5 | namespace uFrame.Architect.Editor.Data 6 | { 7 | public class ShellNodeSectionsSlot : GenericReferenceItem, IShellNodeItem 8 | { 9 | [JsonProperty, InspectorProperty] 10 | public override int Order { get; set; } 11 | 12 | 13 | public string ReferenceClassName 14 | { 15 | get { return SourceItem.ReferenceClassName; } 16 | } 17 | 18 | public override void NodeRemoved(IDiagramNode nodeData) 19 | { 20 | base.NodeRemoved(nodeData); 21 | if (SourceItem == nodeData) 22 | { 23 | Repository.Remove(this); 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeSectionsSlot.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 073f066bcb3e1fe4baba0ce07963b8f7 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeSubNodesSlot.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Graphs.Data; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class ShellNodeSubNodesSlot : GenericSlot 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeSubNodesSlot.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f16b3de7963f48943ab12861d7d37117 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | using uFrame.Editor.Attributes; 5 | using uFrame.Editor.Configurations; 6 | using uFrame.Editor.Graphs.Data; 7 | using uFrame.Json; 8 | 9 | namespace uFrame.Architect.Editor.Data 10 | { 11 | public class ShellNodeTypeNode : ShellInheritableNode, IShellNode, IShellConnectable 12 | { 13 | //private string _classFormat = "{0}"; 14 | private bool _allowMultipleOutputs; 15 | 16 | [JsonProperty, InspectorProperty] 17 | public bool MultipleInputs { get; set; } 18 | 19 | [JsonProperty, InspectorProperty] 20 | public bool MultipleOutputs 21 | { 22 | get 23 | { 24 | if (this["Inheritable"]) 25 | { 26 | return true; 27 | } 28 | return _allowMultipleOutputs; 29 | } 30 | set { _allowMultipleOutputs = value; } 31 | } 32 | 33 | public NodeColor NodeColor 34 | { 35 | get 36 | { 37 | 38 | return NodeColor.Gray; 39 | } 40 | } 41 | 42 | [Browsable(false)] 43 | public IShellNode ReferenceType 44 | { 45 | get { return GetConnectionReference().InputFrom(); } 46 | } 47 | [InspectorProperty] 48 | public bool Inheritable 49 | { 50 | get 51 | { 52 | return this["Inheritable"]; 53 | } 54 | set { this["Inheritable"] = value; } 55 | 56 | } 57 | 58 | 59 | [Browsable(false)] 60 | [OutputSlot("Sub Nodes")] 61 | public MultiOutputSlot SubNodesSlot { get; set; } 62 | [Browsable(false)] 63 | public IEnumerable SubNodes 64 | { 65 | get { return SubNodesSlot.Items; } 66 | } 67 | 68 | 69 | [Browsable(false)] 70 | [ReferenceSection("Sections", SectionVisibility.WhenNodeIsFilter, false)] 71 | public IEnumerable Sections 72 | { 73 | get { return PersistedItems.OfType(); } 74 | } 75 | [Browsable(false)] 76 | public IEnumerable PossibleSections 77 | { 78 | get { return this.Repository.AllOf(); } 79 | } 80 | [Browsable(false)] 81 | public IEnumerable IncludedInSections 82 | { 83 | get 84 | { 85 | return this.Repository.AllOf().Where(p => p.AcceptableTypes.Any(x => x.SourceItem == this)); 86 | } 87 | } 88 | [Browsable(false)] 89 | public IEnumerable ReferenceSections 90 | { 91 | get { return Sections.Select(p => p.SourceItem).OfType(); } 92 | } 93 | [Browsable(false)] 94 | [ReferenceSection("Inputs", SectionVisibility.WhenNodeIsFilter, true)] 95 | public IEnumerable InputSlots 96 | { 97 | get 98 | { 99 | return PersistedItems.OfType(); 100 | } 101 | } 102 | [Browsable(false)] 103 | [ReferenceSection("Outputs", SectionVisibility.WhenNodeIsFilter, true)] 104 | public IEnumerable OutputSlots 105 | { 106 | get 107 | { 108 | return PersistedItems.OfType(); 109 | } 110 | } 111 | [Browsable(false)] 112 | public IEnumerable PossibleInputSlots 113 | { 114 | get { return this.Repository.AllOf().Where(p => !p.IsOutput); } 115 | } 116 | [Browsable(false)] 117 | public IEnumerable PossibleOutputSlots 118 | { 119 | get { return this.Repository.AllOf().Where(p => p.IsOutput); } 120 | } 121 | 122 | //[Section("Custom Selectors", SectionVisibility.WhenNodeIsFilter)] 123 | [Browsable(false)] 124 | public IEnumerable CustomSelectors 125 | { 126 | get 127 | { 128 | return PersistedItems.OfType(); 129 | } 130 | } 131 | 132 | public override string ClassName 133 | { 134 | get { return Name + "Node"; } 135 | } 136 | [Browsable(false)] 137 | [ReferenceSection("Connectable To", SectionVisibility.WhenNodeIsFilter, false)] 138 | public IEnumerable ConnectableTo 139 | { 140 | get { return PersistedItems.OfType(); } 141 | } 142 | 143 | [Browsable(false)] 144 | public IEnumerable PossibleConnectableTo 145 | { 146 | get { return this.Repository.AllOf(); } 147 | } 148 | 149 | 150 | } 151 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd449e10a07fc3f4ea11d6681ab680d6 3 | timeCreated: 1442090358 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeNodeDrawer.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.GraphUI.Drawers; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class ShellNodeTypeNodeDrawer : GenericNodeDrawer 6 | { 7 | 8 | public ShellNodeTypeNodeDrawer(ShellNodeTypeNodeViewModel viewModel) : base(viewModel) 9 | { 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeNodeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dfee9c14027c97d43959e89bbcd64ecf 3 | timeCreated: 1442108393 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeNodeViewModel.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Graphs.Data; 2 | using uFrame.Editor.GraphUI.ViewModels; 3 | 4 | namespace uFrame.Architect.Editor.Data 5 | { 6 | public class ShellNodeTypeNodeViewModel : GenericNodeViewModel 7 | { 8 | public ShellNodeTypeNodeViewModel(ShellNodeTypeNode graphItemObject, DiagramViewModel diagramViewModel) : base(graphItemObject, diagramViewModel) 9 | { 10 | } 11 | 12 | public override NodeColor Color 13 | { 14 | get { return GraphItem.NodeColor; } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeNodeViewModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7926a94eb1265b64ca2d3ff83d4785dc 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeReferenceSection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using uFrame.Editor.Attributes; 4 | using uFrame.Editor.Configurations; 5 | using uFrame.Json; 6 | 7 | namespace uFrame.Architect.Editor.Data 8 | { 9 | public class ShellNodeTypeReferenceSection : ShellNodeTypeSection, IReferenceNode, IShellConnectable 10 | { 11 | [JsonProperty, InspectorProperty] 12 | public bool IsAutomatic { get; set; } 13 | 14 | [JsonProperty, InspectorProperty] 15 | public bool AllowDuplicates { get; set; } 16 | 17 | [JsonProperty, InspectorProperty] 18 | public bool IsEditable { get; set; } 19 | 20 | [JsonProperty, InspectorProperty] 21 | public bool HasPredefinedOptions { get; set; } 22 | 23 | private bool _allowMultipleInputs = true; 24 | private bool _allowMultipleOutputs = true; 25 | 26 | [JsonProperty, InspectorProperty] 27 | public bool MultipleInputs 28 | { 29 | get { return _allowMultipleInputs; } 30 | set { _allowMultipleInputs = value; } 31 | } 32 | 33 | [JsonProperty, InspectorProperty] 34 | public bool MultipleOutputs 35 | { 36 | get { return _allowMultipleOutputs; } 37 | set { _allowMultipleOutputs = value; } 38 | } 39 | 40 | 41 | [ReferenceSection("Acceptable Types", SectionVisibility.Always, false)] 42 | public IEnumerable AcceptableTypes 43 | { 44 | get { return PersistedItems.OfType(); } 45 | } 46 | public IEnumerable PossibleAcceptableTypes 47 | { 48 | get { return Repository.AllOf(); } 49 | } 50 | 51 | 52 | [ReferenceSection("Connectable To", SectionVisibility.Always, false)] 53 | public IEnumerable ConnectableTo 54 | { 55 | get { return PersistedItems.OfType(); } 56 | } 57 | 58 | public IEnumerable PossibleConnectableTo 59 | { 60 | get { return Repository.AllOf(); } 61 | } 62 | 63 | 64 | 65 | public IEnumerable IncludedInSections 66 | { 67 | get 68 | { 69 | return Repository.AllOf().Where(p => p.AcceptableTypes.Any(x => x.SourceItem == this)); 70 | } 71 | } 72 | 73 | } 74 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeReferenceSection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e72172cacddeca46ac1ea1564cc8399 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeSection.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Attributes; 2 | using uFrame.Editor.Configurations; 3 | using uFrame.Json; 4 | 5 | namespace uFrame.Architect.Editor.Data 6 | { 7 | public class ShellNodeTypeSection : ShellNode, IShellNode 8 | { 9 | [JsonProperty] 10 | public bool AllowAdding { get; set; } 11 | 12 | public override string ClassName 13 | { 14 | get { return this.Name + "Reference"; } 15 | } 16 | 17 | [JsonProperty, InspectorProperty] 18 | public SectionVisibility Visibility { get; set; } 19 | 20 | public virtual string ReferenceClassName 21 | { 22 | get { return "I" + this.Name; } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellNodeTypeSection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0cf3f31fced4edf4d97295fc107b2f20 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellPluginNode.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Documentation; 2 | using uFrame.Editor.Graphs.Data; 3 | 4 | namespace uFrame.Architect.Editor.Data 5 | { 6 | public class ShellPluginNode : GenericNode, IDocumentable 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellPluginNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 177652ae091e1814e87faa4478fa2bad 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellSectionNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using uFrame.Editor.Attributes; 4 | using uFrame.Editor.Configurations; 5 | using uFrame.Editor.Graphs.Data; 6 | using uFrame.Json; 7 | 8 | namespace uFrame.Architect.Editor.Data 9 | { 10 | public class ShellSectionNode : ShellNodeTypeSection, IShellConnectable 11 | { 12 | [InputSlot("Reference Type")] 13 | public ShellSectionReferenceSlot ReferenceSlot { get; set; } 14 | 15 | public IShellNode ReferenceType 16 | { 17 | get 18 | { 19 | if (ReferenceSlot == null) return null; 20 | //return ReferenceSlot.Item; 21 | return ReferenceSlot.SlotItem; 22 | } 23 | } 24 | private bool _allowMultipleInputs = true; 25 | private bool _allowMultipleOutputs = true; 26 | 27 | [JsonProperty, InspectorProperty] 28 | public bool MultipleInputs 29 | { 30 | get { return _allowMultipleInputs; } 31 | set { _allowMultipleInputs = value; } 32 | } 33 | 34 | [JsonProperty, InspectorProperty] 35 | public bool MultipleOutputs 36 | { 37 | get { return _allowMultipleOutputs; } 38 | set { _allowMultipleOutputs = value; } 39 | } 40 | public override string ReferenceClassName 41 | { 42 | get 43 | { 44 | if (ReferenceType == null) return null; 45 | return ReferenceType.ClassName; 46 | } 47 | } 48 | 49 | string IClassTypeNode.ClassName 50 | { 51 | get { return ReferenceClassName; } 52 | } 53 | 54 | public override string ClassName 55 | { 56 | get { return ReferenceClassName; } 57 | } 58 | 59 | [ReferenceSection("Connectable To", SectionVisibility.Always, false)] 60 | public IEnumerable ConnectableTo 61 | { 62 | get { return PersistedItems.OfType(); } 63 | } 64 | 65 | public IEnumerable PossibleConnectableTo 66 | { 67 | get { return this.Repository.AllOf(); } 68 | } 69 | 70 | } 71 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellSectionNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c237d669508fc6a4685562957c8ee3ae 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellSectionReferenceSlot.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Graphs.Data; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class ShellSectionReferenceSlot : SingleInputSlot 6 | { 7 | public override bool Validate(IDiagramNodeItem a, IDiagramNodeItem b) 8 | { 9 | return true; 10 | //return base.Validate(a, b); 11 | } 12 | 13 | public override bool ValidateInput(IDiagramNodeItem arg1, IDiagramNodeItem arg2) 14 | { 15 | return true; 16 | //return base.ValidateInput(arg1, arg2); 17 | } 18 | 19 | public override bool ValidateOutput(IDiagramNodeItem arg1, IDiagramNodeItem arg2) 20 | { 21 | return true; 22 | //return base.ValidateOutput(arg1, arg2); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellSectionReferenceSlot.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1654ebe3bff7e094c8b7688ac5f4b576 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellSlotTypeNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using uFrame.Editor.Attributes; 4 | using uFrame.Editor.Configurations; 5 | using uFrame.Json; 6 | 7 | namespace uFrame.Architect.Editor.Data 8 | { 9 | public class ShellSlotTypeNode : ShellNode, IReferenceNode 10 | { 11 | 12 | public override string ClassName 13 | { 14 | get 15 | { 16 | return this.Name; 17 | } 18 | } 19 | [JsonProperty, InspectorProperty] 20 | public SectionVisibility Visibility { get; set; } 21 | 22 | [ReferenceSection("Acceptable Types", SectionVisibility.Always, false)] 23 | public IEnumerable AcceptableTypes 24 | { 25 | get { return PersistedItems.OfType(); } 26 | } 27 | 28 | public IEnumerable PossibleAcceptableTypes 29 | { 30 | get { return Repository.AllOf(); } 31 | } 32 | 33 | public IShellNode ReferenceType 34 | { 35 | get { return AcceptableTypes.Select(p => p.SourceItem).FirstOrDefault(); } 36 | } 37 | 38 | public IEnumerable IncludedInSections 39 | { 40 | get 41 | { 42 | return Repository.AllOf().Where(p => p.AcceptableTypes.Any(x => x.SourceItem == this)); 43 | } 44 | } 45 | 46 | 47 | public string ReferenceClassName 48 | { 49 | get 50 | { 51 | return "I" + Name; 52 | } 53 | } 54 | 55 | [InspectorProperty] 56 | public bool AllowMultiple 57 | { 58 | get { return this["Multiple"]; } 59 | set { this["Multiple"] = value; } 60 | } 61 | 62 | [InspectorProperty] 63 | public bool IsOutput 64 | { 65 | get { return this["Output"]; } 66 | set { this["Output"] = value; } 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellSlotTypeNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8c7195a0cd0fb642a1b90b9e284a3d2 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellTemplateConfigNode.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Attributes; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Editor.Graphs.Data; 4 | using uFrame.Json; 5 | 6 | namespace uFrame.Architect.Editor.Data 7 | { 8 | public class ShellTemplateConfigNode : GenericNode 9 | { 10 | 11 | private bool _autoInherit = true; 12 | 13 | public IShellNodeConfigItem ShellNodeConfig 14 | { 15 | get { return this.InputFrom(); } 16 | } 17 | 18 | [JsonProperty, NodeProperty] 19 | public string OutputPath { get; set; } 20 | [JsonProperty, NodeProperty] 21 | public string ClassNameFormat { get; set; } 22 | 23 | [JsonProperty, InspectorProperty(InspectorType.TypeSelection)] 24 | public string TemplateBaseClass { get; set; } 25 | 26 | [JsonProperty, NodeProperty] 27 | public TemplateLocation Files { get; set; } 28 | 29 | [JsonProperty, NodeProperty] 30 | public bool AutoInherit 31 | { 32 | get { return _autoInherit; } 33 | set { _autoInherit = value; } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/ShellTemplateConfigNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f74fbafed6dcbc44abf2ab496735951a 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplateEventReference.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class TemplateEventReference : TemplateReference 6 | { 7 | public EventInfo EventInfo 8 | { 9 | get { return MemberInfo as EventInfo; } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplateEventReference.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27e347fd0e103014686d7401561b0f75 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplateFieldReference.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class TemplateFieldReference : TemplateReference 6 | { 7 | public FieldInfo FieldInfo 8 | { 9 | get { return MemberInfo as FieldInfo; } 10 | } 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplateFieldReference.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af05f7f08b61d5f40b9c26264de78eae 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplateMethodReference.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class TemplateMethodReference : TemplateReference 6 | { 7 | public MethodInfo MethodInfo 8 | { 9 | get { return MemberInfo as MethodInfo; } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplateMethodReference.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e6bed11fdb98e94984fa663d94b1ac1 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplatePropertyReference.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace uFrame.Architect.Editor.Data 4 | { 5 | public class TemplatePropertyReference : TemplateReference 6 | { 7 | public PropertyInfo PropertyInfo 8 | { 9 | get { return MemberInfo as PropertyInfo; } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplatePropertyReference.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82b28ab0155f99044be9abed8f1d596e 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplateReference.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Reflection; 3 | using uFrame.Editor.Graphs.Data; 4 | 5 | namespace uFrame.Architect.Editor.Data 6 | { 7 | public class TemplateReference : GenericNodeChildItem 8 | { 9 | public ShellGeneratorTypeNode GeneratorNode 10 | { 11 | get { return this.Node as ShellGeneratorTypeNode; } 12 | } 13 | 14 | public MemberInfo MemberInfo 15 | { 16 | get { return GeneratorNode.TemplateMembers.FirstOrDefault(p => p.Name == this.Name); } 17 | } 18 | 19 | public IShellNodeItem SelectorItem 20 | { 21 | get 22 | { 23 | return this.InputFrom(); 24 | } 25 | } 26 | 27 | //public IShellReferenceType SelectorItemSection 28 | //{ 29 | // get 30 | // { 31 | // if (SelectorItem == null) 32 | // { 33 | // Debug.Log("SelectorItem is null "); 34 | // return null; 35 | // } 36 | // return SelectorItem.SourceItemObject as IShellReferenceType; 37 | // } 38 | //} 39 | 40 | public string SelectorItemSectionSourceType 41 | { 42 | get 43 | { 44 | if (SelectorItem == null) 45 | { 46 | return null; 47 | } 48 | return SelectorItem.ReferenceClassName; 49 | } 50 | } 51 | 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Data/TemplateReference.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e729afc5ec074d34c8d7bad12d6e3123 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/DocumentationPageTemplate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using uFrame.Editor.Compiling.CodeGen; 4 | using uFrame.Editor.Configurations; 5 | using uFrame.Editor.Documentation; 6 | using uFrame.Editor.Graphs.Data; 7 | 8 | namespace uFrame.Architect.Editor 9 | { 10 | [TemplateClass(TemplateLocation.Both, "{0}Page")] 11 | public class DocumentationPageTemplate : DocumentationPage, IClassTemplate 12 | { 13 | public string OutputPath 14 | { 15 | get { return Path2.Combine("Documentation", "Editor", "Pages"); } 16 | } 17 | 18 | public bool CanGenerate 19 | { 20 | get { return true; } 21 | } 22 | 23 | public void TemplateSetup() 24 | { 25 | 26 | var className = Ctx.Data.Node.Name + "Page"; 27 | if (Ctx.Data.Node != Ctx.Data) 28 | { 29 | className = Ctx.Data.Node.Name.Clean() + Ctx.Data.Name.Clean() + "Page"; 30 | } 31 | if (Ctx.IsDesignerFile) 32 | { 33 | className += "Base"; 34 | } 35 | Ctx.CurrentDeclaration.Name = className; 36 | 37 | 38 | if (Ctx.IsDesignerFile) 39 | { 40 | if (this.Ctx.Data.Node.Graph.RootFilter != Ctx.Data) 41 | { 42 | Ctx.SetBaseType(this.Ctx.Data.Node.Graph.RootFilter.Name.Clean() + "Page"); 43 | } 44 | 45 | } 46 | else 47 | { 48 | Ctx.SetBaseType(className + "Base"); 49 | } 50 | 51 | if (Ctx.IsDesignerFile || this.Ctx.Data.Node.Graph.RootFilter == Ctx.Data) 52 | { 53 | Ctx.CurrentDeclaration.TypeAttributes |= TypeAttributes.Abstract; 54 | //Ctx.CurrentDecleration.Attributes = MemberAttributes.Abstract | MemberAttributes.Public; 55 | } 56 | 57 | } 58 | 59 | public TemplateContext Ctx { get; set; } 60 | 61 | [GenerateProperty(TemplateLocation.DesignerFile)] 62 | public override Type ParentPage 63 | { 64 | get 65 | { 66 | if (Ctx.Data != Ctx.Data.Node.Graph.RootFilter) 67 | { 68 | if (Ctx.Data.Node != Ctx.Data) 69 | { 70 | Ctx._("return typeof({0}PageBase)", Ctx.Data.Node.Name); 71 | } 72 | else 73 | { 74 | Ctx._("return null"); 75 | } 76 | 77 | } 78 | else 79 | { 80 | Ctx._("return null"); 81 | } 82 | return null; 83 | } 84 | } 85 | 86 | [GenerateProperty(TemplateLocation.DesignerFile)] 87 | public override Type RelatedNodeType 88 | { 89 | get 90 | { 91 | var classType = Ctx.Data as IClassTypeNode; 92 | if (classType != null) 93 | { 94 | Ctx._("return typeof({0})", classType.ClassName); 95 | } 96 | else 97 | { 98 | Ctx._("return typeof({0})", Ctx.Data.Name); 99 | } 100 | 101 | return null; 102 | } 103 | set { base.RelatedNodeType = value; } 104 | } 105 | 106 | [GenerateProperty(TemplateLocation.DesignerFile)] 107 | public override string Name 108 | { 109 | get 110 | { 111 | if (Ctx.CurrentDeclaration.TypeAttributes == TypeAttributes.Abstract) 112 | { 113 | Ctx._("return base.Name"); 114 | } 115 | else 116 | { 117 | Ctx._("return \"{0}\"", Ctx.Data.Name); 118 | } 119 | 120 | return null; 121 | } 122 | } 123 | [GenerateMethod(TemplateLocation.Both)] 124 | public override void GetContent(IDocumentationBuilder _) 125 | { 126 | 127 | } 128 | 129 | } 130 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/DocumentationPageTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e505ba34f5e98f54eb28c63482bff682 3 | timeCreated: 1468206165 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/DocumentationTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Architect.Editor.Data; 4 | using uFrame.Editor.Configurations; 5 | using uFrame.Editor.Documentation; 6 | 7 | namespace uFrame.Architect.Editor 8 | { 9 | [TemplateClass(TemplateLocation.Both, "{0}DocumentationProvider")] 10 | public class DocumentationTemplate : DocumentationDefaultProvider, IClassTemplate 11 | { 12 | [GenerateMethod(TemplateLocation.Both)] 13 | public override void GetPages(List rootPages) 14 | { 15 | //if (Ctx.IsDesignerFile) 16 | //foreach (var item in Ctx.Data.Graph.Project.NodeItems.OfType()) 17 | //{ 18 | // //Ctx._("DocumentationPage {0}Page = null;",item.Name.Clean()); 19 | // Ctx._("rootPages.Add({0}Page)",item.Name.Clean()); 20 | 21 | 22 | 23 | //} 24 | 25 | } 26 | //[TemplateProperty(TemplateLocation.DesignerFile)] 27 | //public object DocumentNodeProperty 28 | //{ 29 | // get 30 | // { 31 | // this.Ctx.CurrentProperty.Name = Ctx.Item.Name.Clean() + "Page"; 32 | // var field = Ctx.CurrentDecleration._private_(typeof(DocumentationPage), 33 | // "_" + this.Ctx.CurrentProperty.Name); 34 | 35 | // var item = Ctx.ItemAs(); 36 | 37 | // Ctx.PushStatements(Ctx._if("{0} == null", field.Name) 38 | // .TrueStatements); 39 | 40 | // Ctx._("{0} = new DocumentationPage(\"{1}\", Document{1}Node, typeof({2})))", field.Name, item.Name, item.ClassName); 41 | // foreach (var nodeItem in item.PersistedItems.OfType()) 42 | // { 43 | // Ctx._("{0}.ChildItems.Add({1})", field.Name, nodeItem.Node.Name + nodeItem.Name.Clean() + "Page"); 44 | // } 45 | 46 | // Ctx.PopStatements(); 47 | // Ctx._("return {0}", field.Name); 48 | // return null; 49 | // } 50 | //} 51 | 52 | //[TemplateProperty(TemplateLocation.DesignerFile)] 53 | //public object DocumentItemProperty { 54 | // get 55 | // { 56 | // this.Ctx.CurrentProperty.Name = Ctx.Item.Node.Name + Ctx.Item.Name.Clean() + "Page"; 57 | // var field = Ctx.CurrentDecleration._private_(typeof (DocumentationPage), 58 | // "_" + this.Ctx.CurrentProperty.Name); 59 | 60 | // var item = Ctx.ItemAs(); 61 | 62 | // Ctx.PushStatements(Ctx._if("{0} == null",field.Name) 63 | // .TrueStatements); 64 | // Ctx._("{0} = new DocumentationPage(\"{3}\", Document{0}Node_{2}, typeof({1})))", field.Name, item.ClassName, item.TypeName.Clean(), item.Name); 65 | // Ctx.PopStatements(); 66 | // Ctx._("return {0}", field.Name); 67 | // return null; 68 | // } } 69 | 70 | 71 | 72 | //[TemplateMethod(TemplateLocation.Both, 73 | // AutoFill = AutoFillType.NameOnly, 74 | // NameFormat = "Document{0}Node")] 75 | //public virtual void DocumentNode(IDocumentationBuilder builder) 76 | //{ 77 | 78 | // if (Ctx.IsDesignerFile) 79 | // { 80 | // Ctx._("builder.Title(\"{0}\")", Ctx.Item.Name); 81 | // //Ctx._("builder.Paragraph(\"{0}\")", Ctx.ItemAs().Comments); 82 | // } 83 | //} 84 | 85 | //[TemplateMethod(TemplateLocation.Both, 86 | // AutoFill = AutoFillType.NameOnly, 87 | // NameFormat = "Document{0}")] 88 | //public virtual void DocumentItem(IDocumentationBuilder builder) 89 | //{ 90 | // this.Ctx.CurrentMethod.Name = "Document" + Ctx.Item.Node.Name + "Node_" + Ctx.ItemAs().TypeName.Clean(); 91 | // if (Ctx.IsDesignerFile) 92 | // { 93 | // Ctx._("builder.Title(\"{0}\")", Ctx.Item.Name); 94 | // } 95 | //} 96 | 97 | public string OutputPath 98 | { 99 | get { return Path2.Combine("Editor", "Documentation"); } 100 | } 101 | public bool CanGenerate { get { return true; } } 102 | public void TemplateSetup() 103 | { 104 | Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 105 | //Ctx.AddIterator("DocumentNodeProperty", _ => _.Graph.Project.NodeItems.OfType().Distinct()); 106 | //Ctx.AddIterator("DocumentItemProperty", _ => _.Graph.Project.AllGraphItems.OfType().Distinct()); 107 | 108 | //Ctx.AddIterator("DocumentNode", _ => _.Graph.Project.NodeItems.OfType().Distinct()); 109 | //Ctx.AddIterator("DocumentItem", _ => _.Graph.Project.AllGraphItems.OfType().Distinct()); 110 | } 111 | 112 | public TemplateContext Ctx { get; set; } 113 | 114 | } 115 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/DocumentationTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc07761691df99142bf340f73751296c 3 | timeCreated: 1468206165 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 270022d56bd6f6b438354856ed7c0600 3 | folderAsset: yes 4 | timeCreated: 1468206165 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellChildItemTemplate.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Architect.Editor.Data; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | 6 | namespace uFrame.Architect.Editor.Generators 7 | { 8 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}ChildItem")] 9 | public class ShellChildItemTemplate : GenericNodeChildItem, 10 | IClassTemplate 11 | { 12 | public string OutputPath 13 | { 14 | get { return Path2.Combine("Editor", "ChildItems"); } 15 | } 16 | 17 | public bool CanGenerate 18 | { 19 | get { return true; } 20 | } 21 | 22 | public void TemplateSetup() 23 | { 24 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 25 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 26 | if (Ctx.IsDesignerFile) 27 | { 28 | if (Ctx.Data["Typed"]) 29 | Ctx.SetBaseType(typeof(GenericTypedChildItem)); 30 | 31 | foreach (var item in Ctx.Data.IncludedInSections) 32 | { 33 | Ctx.AddInterface(item.ReferenceClassName); 34 | } 35 | } 36 | 37 | } 38 | 39 | public TemplateContext Ctx { get; set; } 40 | 41 | [GenerateProperty(TemplateLocation.DesignerFile)] 42 | public override bool AllowMultipleInputs 43 | { 44 | get 45 | { 46 | Ctx._("return {0}", Ctx.Data.AllowMultipleInputs ? "true" : "false"); 47 | return base.AllowMultipleInputs; 48 | } 49 | } 50 | [GenerateProperty(TemplateLocation.DesignerFile)] 51 | public override bool AllowMultipleOutputs 52 | { 53 | get 54 | { 55 | Ctx._("return {0}", Ctx.Data.AllowMultipleOutputs ? "true" : "false"); 56 | return base.AllowMultipleOutputs; 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellChildItemTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b65a16f36a6df2c489b80c2079bf82fa 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellChildTemplate.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Architect.Editor.Data; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | 6 | namespace uFrame.Architect.Editor.Generators 7 | { 8 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}ChildItem")] 9 | public class ShellChildTemplate : GenericNodeChildItem, 10 | IClassTemplate 11 | { 12 | public string OutputPath 13 | { 14 | get { return Path2.Combine("Editor", "Sections"); } 15 | } 16 | 17 | public bool CanGenerate 18 | { 19 | get { return true; } 20 | } 21 | 22 | public void TemplateSetup() 23 | { 24 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 25 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 26 | if (Ctx.IsDesignerFile) 27 | { 28 | if (Ctx.Data["Typed"] && Ctx.Data.BaseNode == null) 29 | Ctx.SetBaseType(typeof(GenericTypedChildItem)); 30 | 31 | foreach (var item in Ctx.Data.IncludedInSections) 32 | { 33 | Ctx.AddInterface(item.ReferenceClassName); 34 | } 35 | } 36 | 37 | } 38 | 39 | public TemplateContext Ctx { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellChildTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 234f23cf4984f484486291aef64824ef 3 | timeCreated: 1442090354 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellConfigPluginTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.CodeDom; 2 | using System.Linq; 3 | using uFrame.Architect.Editor.Data; 4 | using uFrame.Editor; 5 | using uFrame.Editor.Compiling.CodeGen; 6 | using uFrame.Editor.Configurations; 7 | using uFrame.Editor.Graphs.Data; 8 | using uFrame.Editor.TypesSystem; 9 | using uFrame.IOC; 10 | 11 | namespace uFrame.Architect.Editor.Generators 12 | { 13 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}")] 14 | public class ShellConfigPluginTemplate : DiagramPlugin, IClassTemplate 15 | { 16 | #region Template Setup 17 | 18 | public string OutputPath 19 | { 20 | get { return Path2.Combine("Editor", "Plugins"); } 21 | } 22 | 23 | public bool CanGenerate 24 | { 25 | get { return true; } 26 | } 27 | 28 | public void TemplateSetup() 29 | { 30 | Ctx.AddIterator("NodeConfigProperty", _ => _.Graph.NodeItems.OfType()); 31 | Ctx.AddIterator("GetSelectionCommand", _ => _.Graph.AllGraphItems.OfType().Where(x => x.IsTyped && x.SectionType == ShellNodeConfigSectionType.ChildItems)); 32 | //Ctx.TryAddNamespace("Invert.Core"); 33 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 34 | Ctx.TryAddNamespace("uFrame.Editor"); 35 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 36 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 37 | Ctx.TryAddNamespace("uFrame.Editor.GraphUI"); 38 | Ctx.TryAddNamespace("uFrame.Editor.GraphUI.Drawers"); 39 | Ctx.TryAddNamespace("uFrame.Editor.TypesSystem"); 40 | Ctx.TryAddNamespace("uFrame.IOC"); 41 | } 42 | 43 | [GenerateMethod("Get{0}SelectionCommand", TemplateLocation.Both, true)] 44 | public virtual SelectTypeCommand GetSelectionCommand() 45 | { 46 | Ctx._("return new SelectTypeCommand() {{ IncludePrimitives = true, AllowNoneType = false }}"); 47 | return null; 48 | } 49 | 50 | 51 | public TemplateContext Ctx { get; set; } 52 | #endregion 53 | 54 | public override bool Ignore 55 | { 56 | get 57 | { 58 | return true; 59 | } 60 | } 61 | 62 | [GenerateProperty("{0}"), WithField] 63 | public NodeConfig NodeConfigProperty 64 | { 65 | get 66 | { 67 | var item = Ctx.ItemAs().ClassName; 68 | Ctx.SetTypeArgument(item); 69 | return null; 70 | } 71 | set 72 | { 73 | 74 | } 75 | } 76 | 77 | [GenerateMethod(TemplateLocation.Both, true)] 78 | public override void Initialize(UFrameContainer container) 79 | { 80 | if (!Ctx.IsDesignerFile) return; 81 | Ctx.CurrentMethodAttribute.CallBase = false; 82 | var method = Ctx.CurrentMethod; 83 | 84 | //foreach (var plugin in Ctx.Data.Repository.AllOf()) 85 | //{ 86 | // //foreach (var item in Ctx.Data.Project.NodeItems.OfType().Where(p => p.IsGraphType)) 87 | // //{ 88 | // Ctx._("container.RegisterInstance(new {0}DocumentationProvider(), \"{0}\")",plugin.Name); 89 | // //} 90 | //} 91 | 92 | //foreach (var item in Ctx.Data.Graph.NodeItems.OfType()) 93 | //{ 94 | // if (!item["Typed"]) continue; 95 | 96 | 97 | //} 98 | foreach (var itemType in Ctx.Data.Repository.AllOf().Where(p => p.IsValid && p.SectionType == ShellNodeConfigSectionType.ChildItems || p.SectionType == ShellNodeConfigSectionType.ReferenceItems)) 99 | { 100 | 101 | if (itemType.IsTyped) 102 | { 103 | //if (itemType.SectionType == ShellNodeConfigSectionType.ChildItems) 104 | //method._("container.RegisterInstance(Get{0}SelectionCommand(), typeof({1}).Name + \"TypeSelection\");", itemType.Name, itemType.ClassName); 105 | 106 | //if (itemType.IsCustom) 107 | //{ 108 | // method.Statements.Add( 109 | // new CodeSnippetExpression(string.Format("container.AddTypeItem<{0},{1}ViewModel,{1}Drawer>()", itemType.ClassName, itemType.Name))); 110 | //} 111 | //else 112 | //{ 113 | method.Statements.Add( 114 | new CodeSnippetExpression(string.Format("container.AddTypeItem<{0}>()", itemType.ClassName))); 115 | //} 116 | 117 | } 118 | else 119 | { 120 | //if (itemType.Flags.ContainsKey("Custom") && itemType.Flags["Custom"]) 121 | //{ 122 | // method.Statements.Add( 123 | // new CodeSnippetExpression(string.Format("container.AddItem<{0}, {1}ViewModel, {1}Drawer>()", itemType.ClassName, itemType.Name))); 124 | //} 125 | //else 126 | //{ 127 | method.Statements.Add( 128 | new CodeSnippetExpression(string.Format("container.AddItem<{0}>()", itemType.ClassName))); 129 | //} 130 | } 131 | } 132 | 133 | //var graphTypes = Ctx.Data.Graph.NodeItems.OfType().Where(p => p.IsValid && p.IsGraphType).ToArray(); 134 | foreach (var nodeType in Ctx.Data.Repository.AllOf().Where(p => p.IsValid)) 135 | { 136 | InitializeNodeType(method, nodeType); 137 | 138 | } 139 | 140 | foreach (var item in Ctx.Data.Repository.AllOf()) 141 | { 142 | var connectableTo = item.OutputsTo(); 143 | foreach (var c in connectableTo) 144 | { 145 | method._("container.Connectable<{0},{1}>()", item.ClassName, c.ClassName); 146 | } 147 | } 148 | 149 | 150 | foreach (var item in Ctx.Data.Repository.AllOf()) 151 | { 152 | foreach (var template in item.OutputsTo()) 153 | { 154 | method.Statements.Add(new CodeSnippetExpression(string.Format("RegisteredTemplateGeneratorsFactory.RegisterTemplate<{0},{1}>()", item.ClassName, template.Name))); 155 | } 156 | } 157 | } 158 | 159 | private static void InitializeNodeType(CodeMemberMethod method, ShellNodeConfig nodeType) 160 | { 161 | var varName = nodeType.Name; 162 | 163 | if (nodeType.IsGraphType) 164 | { 165 | method.Statements.Add( 166 | new CodeSnippetExpression(string.Format("{1} = container.AddGraph<{0}, {2}>(\"{0}\")", 167 | nodeType.Name + "Graph", varName, nodeType.ClassName))); 168 | } 169 | else 170 | { 171 | 172 | method.Statements.Add( 173 | new CodeSnippetExpression(string.Format("{1} = container.AddNode<{0},{0}ViewModel,{0}Drawer>(\"{2}\")", nodeType.ClassName, varName, nodeType.NodeLabel))); 174 | 175 | } 176 | 177 | 178 | 179 | if (nodeType.Inheritable) 180 | { 181 | method.Statements.Add(new CodeSnippetExpression(string.Format("{0}.Inheritable()", varName))); 182 | } 183 | 184 | method.Statements.Add( 185 | new CodeSnippetExpression(string.Format("{0}.Color(NodeColor.{1})", varName, nodeType.NodeColor))); 186 | 187 | 188 | 189 | foreach (var item in nodeType.SubNodes) 190 | { 191 | method.Statements.Add( 192 | new CodeSnippetExpression(string.Format("{0}.HasSubNode<{1}Node>()", varName, item.Name))); 193 | } 194 | 195 | } 196 | 197 | } 198 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellConfigPluginTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dee8c92bc9070d04a8f6ae42524011fe 3 | timeCreated: 1442108393 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellGraphTemplate.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Architect.Editor.Data; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | 6 | namespace uFrame.Architect.Editor.Generators 7 | { 8 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}Graph")] 9 | public class ShellGraphTemplate : GenericGraphData, IClassTemplate 10 | { 11 | public string OutputPath 12 | { 13 | get { return Path2.Combine("Editor", "Graphs"); } 14 | } 15 | 16 | public bool CanGenerate 17 | { 18 | get { return true; } 19 | } 20 | 21 | public void TemplateSetup() 22 | { 23 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 24 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 25 | Ctx.TryAddNamespace("uFrame.Editor.Core"); 26 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 27 | if (Ctx.IsDesignerFile) 28 | { 29 | #if UNITY_EDITOR 30 | Ctx.SetBaseType("GenericGraphData<{0}>", Ctx.Data.RootNode.ClassName); 31 | #else 32 | Ctx.SetBaseTypeArgument("{0}", Ctx.Data.RootNode.ClassName); 33 | #endif 34 | } 35 | } 36 | 37 | public TemplateContext Ctx { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellGraphTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee7a578fd8d346348b208e24dd862027 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeAsGraphTemplate.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Compiling.CodeGen; 2 | using uFrame.Editor.Configurations; 3 | using uFrame.Editor.Graphs.Data; 4 | 5 | namespace uFrame.Architect.Editor.Generators 6 | { 7 | using Data; 8 | 9 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}Graph")] 10 | public class ShellNodeAsGraphTemplate : GenericGraphData, IClassTemplate 11 | { 12 | public string OutputPath 13 | { 14 | get { return Path2.Combine("Editor", "Graphs"); } 15 | } 16 | 17 | public bool CanGenerate 18 | { 19 | get { return Ctx.Data.IsGraphType; } 20 | } 21 | 22 | public void TemplateSetup() 23 | { 24 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 25 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 26 | Ctx.TryAddNamespace("uFrame.Editor.Core"); 27 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 28 | if (Ctx.IsDesignerFile) 29 | { 30 | Ctx.SetBaseType("GenericGraphData<{0}>", Ctx.Data.ClassName); 31 | } 32 | } 33 | 34 | public TemplateContext Ctx { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeAsGraphTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9cc751830a09f9444aab22ce2ab34ba3 3 | timeCreated: 1442108390 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigChildItemTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.CodeDom; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | 6 | namespace uFrame.Architect.Editor.Generators 7 | { 8 | using Data; 9 | 10 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}ChildItem")] 11 | public class ShellNodeConfigChildItemTemplate : GenericNodeChildItem, 12 | IClassTemplate 13 | { 14 | public string OutputPath 15 | { 16 | get { return Path2.Combine("Editor", "ChildItems"); } 17 | } 18 | 19 | public bool CanGenerate 20 | { 21 | get { return Ctx.Data.SectionType == ShellNodeConfigSectionType.ChildItems; } 22 | } 23 | 24 | public void TemplateSetup() 25 | { 26 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 27 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 28 | Ctx.TryAddNamespace("uFrame.Editor.Core"); 29 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 30 | var i = new CodeTypeDeclaration(Ctx.Data.ReferenceClassName) 31 | { 32 | IsInterface = true, 33 | Attributes = MemberAttributes.Public, 34 | IsPartial = true, 35 | }; 36 | i.BaseTypes.Add(new CodeTypeReference(typeof(IDiagramNodeItem))); 37 | i.BaseTypes.Add(new CodeTypeReference(typeof(IConnectable))); 38 | Ctx.Namespace.Types.Add(i); 39 | if (Ctx.IsDesignerFile) 40 | { 41 | if (Ctx.Data.IsTyped) 42 | Ctx.SetBaseType(typeof(GenericTypedChildItem)); 43 | 44 | foreach (var item in Ctx.Data.IncludedInSections) 45 | { 46 | Ctx.AddInterface(item.ReferenceClassName); 47 | } 48 | } 49 | 50 | } 51 | 52 | public TemplateContext Ctx { get; set; } 53 | 54 | [GenerateProperty(TemplateLocation.DesignerFile)] 55 | public override bool AllowMultipleInputs 56 | { 57 | get 58 | { 59 | Ctx._("return {0}", Ctx.Data.AllowMultipleInputs ? "true" : "false"); 60 | return base.AllowMultipleInputs; 61 | } 62 | } 63 | 64 | [GenerateProperty(TemplateLocation.DesignerFile)] 65 | public override bool AllowMultipleOutputs 66 | { 67 | get 68 | { 69 | Ctx._("return {0}", Ctx.Data.AllowMultipleOutputs ? "true" : "false"); 70 | return base.AllowMultipleOutputs; 71 | } 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigChildItemTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 538e799825d1dff4a9a35fb64c89d5e2 3 | timeCreated: 1442108387 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigDrawerTemplate.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Architect.Editor.Data; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | using uFrame.Editor.GraphUI.Drawers; 6 | using uFrame.Editor.GraphUI.ViewModels; 7 | 8 | namespace uFrame.Architect.Editor.Generators 9 | { 10 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}NodeDrawer")] 11 | public class ShellNodeConfigDrawerTemplate : GenericNodeDrawer>, IClassTemplate 12 | { 13 | public string OutputPath 14 | { 15 | get { return Path2.Combine("Editor", "Drawers"); } 16 | } 17 | 18 | public bool CanGenerate 19 | { 20 | get { return true; } 21 | } 22 | 23 | public void TemplateSetup() 24 | { 25 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 26 | //Ctx.SetBaseTypeArgument(Ctx.Data.ClassName); 27 | Ctx.TryAddNamespace("uFrame.Editor.GraphUI.Drawers"); 28 | Ctx.SetBaseType("GenericNodeDrawer<{0},{1}>", Ctx.Data.ClassName, Ctx.Data.Name + "NodeViewModel"); 29 | } 30 | 31 | public TemplateContext Ctx { get; set; } 32 | 33 | // For templating 34 | public ShellNodeConfigDrawerTemplate() 35 | : base() 36 | { 37 | } 38 | 39 | public ShellNodeConfigDrawerTemplate(GenericNodeViewModel viewModel) 40 | : base(viewModel) 41 | { 42 | } 43 | 44 | [GenerateConstructor(TemplateLocation.Both, "viewModel"), Inside(TemplateLocation.Both)] 45 | public void DrawerConstructor(GenericNodeViewModel viewModel) 46 | { 47 | Ctx.CurrentConstructor.Parameters[0].Type = (Ctx.Data.Name + "NodeViewModel").ToCodeReference(); 48 | 49 | } 50 | 51 | } 52 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigDrawerTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 043f79d50fb6dcf45bfd38e631a27070 3 | timeCreated: 1442108383 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigReferenceSectionTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.CodeDom; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | 6 | namespace uFrame.Architect.Editor.Generators 7 | { 8 | using Data; 9 | 10 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}Reference")] 11 | public class ShellNodeConfigReferenceSectionTemplate : GenericReferenceItem, 12 | IClassTemplate 13 | { 14 | public string OutputPath 15 | { 16 | get { return Path2.Combine("Editor", "Sections"); } 17 | } 18 | 19 | public bool CanGenerate 20 | { 21 | get { return Ctx.Data.SectionType == ShellNodeConfigSectionType.ReferenceItems; } 22 | } 23 | 24 | public void TemplateSetup() 25 | { 26 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 27 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 28 | Ctx.TryAddNamespace("uFrame.Editor.Core"); 29 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 30 | var i = new CodeTypeDeclaration(Ctx.Data.ReferenceClassName) 31 | { 32 | IsInterface = true, 33 | Attributes = MemberAttributes.Public, 34 | IsPartial = true, 35 | }; 36 | i.BaseTypes.Add(new CodeTypeReference(typeof(IDiagramNodeItem))); 37 | i.BaseTypes.Add(new CodeTypeReference(typeof(IConnectable))); 38 | Ctx.Namespace.Types.Add(i); 39 | 40 | if (Ctx.IsDesignerFile) 41 | { 42 | Ctx.SetBaseTypeArgument(Ctx.Data.ReferenceClassName); 43 | 44 | foreach (var item in Ctx.Data.IncludedInSections) 45 | { 46 | Ctx.AddInterface(item.ReferenceClassName); 47 | } 48 | } 49 | } 50 | 51 | public TemplateContext Ctx { get; set; } 52 | 53 | [GenerateProperty(TemplateLocation.DesignerFile)] 54 | public override bool AllowMultipleInputs 55 | { 56 | get 57 | { 58 | Ctx._("return {0}", Ctx.Data.AllowMultipleInputs ? "true" : "false"); 59 | return base.AllowMultipleInputs; 60 | } 61 | } 62 | 63 | [GenerateProperty(TemplateLocation.DesignerFile)] 64 | public override bool AllowMultipleOutputs 65 | { 66 | get 67 | { 68 | Ctx._("return {0}", Ctx.Data.AllowMultipleOutputs ? "true" : "false"); 69 | return base.AllowMultipleOutputs; 70 | } 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigReferenceSectionTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98dda378fd095d5438ad2bfd0afa6480 3 | timeCreated: 1442108390 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.CodeDom; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using uFrame.Editor.Compiling.CodeGen; 5 | using uFrame.Editor.Configurations; 6 | using uFrame.Editor.Core; 7 | using uFrame.Editor.Graphs.Data; 8 | using uFrame.Json; 9 | 10 | namespace uFrame.Architect.Editor.Generators 11 | { 12 | using Data; 13 | 14 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}Node", AutoInherit = true)] 15 | public class ShellNodeConfigTemplate : GenericNode, IClassTemplate 16 | { 17 | public TemplateContext Ctx { get; set; } 18 | 19 | public string OutputPath 20 | { 21 | get { return Path2.Combine("Editor", "Nodes"); } 22 | } 23 | 24 | public bool CanGenerate 25 | { 26 | get { return true; } 27 | } 28 | 29 | public void TemplateSetup() 30 | { 31 | //Ctx.TryAddNamespace("Invert.Core"); 32 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 33 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 34 | Ctx.TryAddNamespace("uFrame.Editor.Core"); 35 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 36 | var i = new CodeTypeDeclaration(Ctx.Data.ReferenceClassName) 37 | { 38 | IsInterface = true, 39 | Attributes = MemberAttributes.Public, 40 | IsPartial = true, 41 | }; 42 | i.BaseTypes.Add(new CodeTypeReference(typeof(IDiagramNodeItem))); 43 | i.BaseTypes.Add(new CodeTypeReference(typeof(IConnectable))); 44 | Ctx.Namespace.Types.Add(i); 45 | if (Ctx.Data.Inheritable && Ctx.IsDesignerFile) 46 | { 47 | Ctx.CurrentDeclaration.BaseTypes.Clear(); 48 | Ctx.CurrentDeclaration.BaseTypes.Add(typeof(GenericInheritableNode)); 49 | } 50 | if (Ctx.IsDesignerFile && Ctx.Data.IsClass) 51 | { 52 | Ctx.CurrentDeclaration.BaseTypes.Add(typeof(IClassTypeNode)); 53 | } 54 | 55 | Ctx.AddIterator("PossibleReferenceItems", _ => _.Sections.Where(p => p.SectionType == ShellNodeConfigSectionType.ReferenceItems)); 56 | Ctx.AddIterator("ReferenceSectionItems", _ => _.Sections.Where(p => p.SectionType == ShellNodeConfigSectionType.ReferenceItems)); 57 | Ctx.AddIterator("SectionItems", _ => _.Sections.Where(p => p.SectionType == ShellNodeConfigSectionType.ChildItems)); 58 | Ctx.AddIterator("InputSlotId", _ => _.InputSlots); 59 | Ctx.AddIterator("InputSlot", _ => _.InputSlots); 60 | Ctx.AddIterator("OutputSlotId", _ => _.OutputSlots); 61 | Ctx.AddIterator("OutputSlot", _ => _.OutputSlots); 62 | Ctx.AddCondition("AllowMultipleOutputs", _ => !_.Inheritable); 63 | Ctx.AddCondition("ClassName", _ => Ctx.Data.IsClass); 64 | //Ctx.AddIterator("CustomSelectorItems", _ => _.CustomSelectors); 65 | foreach (var item in Ctx.Data.IncludedInSections) 66 | { 67 | Ctx.CurrentDeclaration.BaseTypes.Add(item.ReferenceClassName); 68 | } 69 | 70 | } 71 | [GenerateProperty(TemplateLocation.DesignerFile)] 72 | public virtual string ClassName 73 | { 74 | get 75 | { 76 | Ctx._("return this.Name"); 77 | return null; 78 | } 79 | } 80 | 81 | [GenerateProperty(TemplateLocation.DesignerFile)] 82 | public override bool AllowMultipleInputs 83 | { 84 | get 85 | { 86 | Ctx._("return {0}", Ctx.Data.AllowMultipleInputs ? "true" : "false"); 87 | return base.AllowMultipleInputs; 88 | } 89 | } 90 | 91 | [GenerateProperty(TemplateLocation.DesignerFile)] 92 | public override bool AllowMultipleOutputs 93 | { 94 | get 95 | { 96 | Ctx._("return {0}", Ctx.Data.AllowMultipleOutputs ? "true" : "false"); 97 | return base.AllowMultipleOutputs; 98 | } 99 | } 100 | 101 | [GenerateProperty("Possible{0}")] 102 | public virtual IEnumerable PossibleReferenceItems 103 | { 104 | get 105 | { 106 | var referenceName = Ctx.ItemAs().ReferenceClassName; 107 | Ctx.SetTypeArgument(typeof(IItem)); 108 | Ctx._("return this.Repository.AllOf<{0}>().Cast()", referenceName); 109 | //Ctx.AddAttribute(typeof (ReferenceSection), Ctx.Item.Name); 110 | return null; 111 | } 112 | } 113 | 114 | [GenerateProperty("{0}")] 115 | public virtual IEnumerable SectionItems 116 | { 117 | get 118 | { 119 | var item = Ctx.ItemAs(); 120 | 121 | Ctx.SetTypeArgument(item.ClassName); 122 | 123 | var attribute = Ctx.AddAttribute(typeof(Section)) 124 | .AddArgument(new CodePrimitiveExpression(Ctx.Item.Name)) 125 | .AddArgument("SectionVisibility.{0}", item.Visibility.ToString()) 126 | ; 127 | attribute.Arguments.Add(new CodeAttributeArgument("OrderIndex", new CodePrimitiveExpression(item.Row))); 128 | attribute.Arguments.Add(new CodeAttributeArgument("IsNewRow", new CodePrimitiveExpression(item.IsNewRow))); 129 | 130 | Ctx._("return PersistedItems.OfType<{0}>()", item.ClassName); 131 | return null; 132 | } 133 | } 134 | 135 | [GenerateProperty("{0}")] 136 | public virtual IEnumerable ReferenceSectionItems 137 | { 138 | get 139 | { 140 | var referenceSection = Ctx.ItemAs(); 141 | 142 | Ctx.SetTypeArgument(referenceSection.ClassName); 143 | //var attributes = 144 | Ctx.AddAttribute(typeof(ReferenceSection)) 145 | .AddArgument(new CodePrimitiveExpression(Ctx.Item.Name)) 146 | .AddArgument("SectionVisibility.{0}", referenceSection.Visibility.ToString()) 147 | .AddArgument(new CodePrimitiveExpression(referenceSection.AllowDuplicates)) 148 | .AddArgument(new CodePrimitiveExpression(referenceSection.IsAutomatic)) 149 | .AddArgument(string.Format("typeof({0})", referenceSection.ReferenceClassName)) 150 | .AddArgument(new CodePrimitiveExpression(referenceSection.IsEditable)) 151 | .AddArgument("OrderIndex", new CodePrimitiveExpression(referenceSection.Row)) 152 | .AddArgument("HasPredefinedOptions", new CodePrimitiveExpression(referenceSection.HasPredefinedOptions)) 153 | .AddArgument("IsNewRow", new CodePrimitiveExpression(referenceSection.IsNewRow)); 154 | 155 | Ctx._("return PersistedItems.OfType<{0}>()", referenceSection.ClassName); 156 | return null; 157 | } 158 | } 159 | 160 | 161 | public virtual IEnumerable InputItems 162 | { 163 | get { return null; } 164 | } 165 | 166 | public virtual IEnumerable OutputItems 167 | { 168 | get { return null; } 169 | } 170 | [GenerateProperty, WithLazyField(DefaultExpression = "Guid.NewGuid().ToString()"), WithNameFormat("{0}InputSlotId"), WithAttributes(typeof(JsonProperty))] 171 | public virtual string InputSlotId { get; set; } 172 | 173 | [GenerateProperty("{0}InputSlot")] 174 | public virtual GenericReferenceItem InputSlot 175 | { 176 | get 177 | { 178 | 179 | var item = Ctx.ItemAs(); 180 | var field = Ctx.CurrentDeclaration._private_(item.ClassName, "_" + item.Name.Clean()); 181 | 182 | Ctx.SetType(item.ClassName); 183 | var attribute = Ctx.AddAttribute(typeof(InputSlot)) 184 | .AddArgument(new CodePrimitiveExpression(item.Name)) 185 | .AddArgument(new CodePrimitiveExpression(item.AllowMultiple)) 186 | .AddArgument("SectionVisibility.{0}", item.Visibility.ToString()) 187 | 188 | ; 189 | attribute.Arguments.Add(new CodeAttributeArgument("OrderIndex", new CodePrimitiveExpression(item.Row))); 190 | attribute.Arguments.Add(new CodeAttributeArgument("IsNewRow", new CodePrimitiveExpression(item.IsNewRow))); 191 | 192 | Ctx._if("Repository == null", field.Name).TrueStatements._("return null"); 193 | Ctx._if("{0} != null", field.Name).TrueStatements._("return {0}", field.Name); 194 | 195 | Ctx._("return {0} ?? ({0} = new {1}() {{ Repository = Repository, Node = this, Identifier = {2}InputSlotId }})", field.Name, item.ClassName, Ctx.Item.Name.Clean()); 196 | //Ctx._("{0}.Node = this", field.Name); 197 | 198 | //Ctx._("return {0}", field.Name); 199 | return null; 200 | } 201 | //set { Ctx._("if (value != null) {0}InputSlotId = value.Identifier", Ctx.Item.Name.Clean()); } 202 | 203 | } 204 | 205 | [GenerateProperty, WithLazyField(DefaultExpression = "Guid.NewGuid().ToString()"), WithNameFormat("{0}OutputSlotId"), WithAttributes(typeof(JsonProperty))] 206 | public virtual string OutputSlotId { get; set; } 207 | 208 | [GenerateProperty("{0}OutputSlot")] 209 | public virtual GenericReferenceItem OutputSlot 210 | { 211 | get 212 | { 213 | var item = Ctx.ItemAs(); 214 | var field = Ctx.CurrentDeclaration._private_(item.ClassName, "_" + item.Name.Clean()); 215 | Ctx.SetType(item.ClassName); 216 | var attribute = Ctx.AddAttribute(typeof(OutputSlot)) 217 | .AddArgument(new CodePrimitiveExpression(item.Name)) 218 | .AddArgument(new CodePrimitiveExpression(item.AllowMultiple)) 219 | .AddArgument("SectionVisibility.{0}", item.Visibility.ToString()) 220 | ; 221 | attribute.Arguments.Add(new CodeAttributeArgument("OrderIndex", new CodePrimitiveExpression(item.Row))); 222 | attribute.Arguments.Add(new CodeAttributeArgument("IsNewRow", new CodePrimitiveExpression(item.IsNewRow))); 223 | 224 | Ctx._if("Repository == null", field.Name).TrueStatements._("return null"); 225 | Ctx._if("{0} != null", field.Name).TrueStatements._("return {0}", field.Name); 226 | 227 | Ctx._("return {0} ?? ({0} = new {1}() {{ Repository = Repository, Node = this, Identifier = {2}OutputSlotId }})", field.Name, item.ClassName, Ctx.Item.Name.Clean()); 228 | return null; 229 | } 230 | //set { Ctx._("if (value != null) {0}OutputSlotId = value.Identifier", Ctx.Item.Name.Clean()); } 231 | } 232 | 233 | //[GenerateMethod] 234 | //public override void RecordRemoved(IDataRecord record) 235 | //{ 236 | // foreach (var item in Ctx.Data.InputSlots) 237 | // { 238 | // Ctx._if("record.Identifier = {0}InputSlotId", item.Name ) 239 | // .TrueStatements._("Repository.Remove(this)"); 240 | // } 241 | // foreach (var item in Ctx.Data.OutputSlots) 242 | // { 243 | // Ctx._if("record.Identifier = {0}OutputSlotId", item.Name) 244 | // .TrueStatements._("Repository.Remove(this)"); 245 | // } 246 | //} 247 | 248 | } 249 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c41f69fd3a58a0f44abdc0e10a4204f8 3 | timeCreated: 1442108392 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigTemplateTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.CodeDom; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | 6 | namespace uFrame.Architect.Editor.Generators 7 | { 8 | using Data; 9 | 10 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}")] 11 | public class ShellNodeConfigTemplateTemplate : IClassTemplate 12 | { 13 | 14 | public string OutputPath 15 | { 16 | get { return Path2.Combine("Editor", "Templates"); } 17 | } 18 | 19 | [GenerateProperty(TemplateLocation.DesignerFile)] 20 | public virtual string OutputPathProperty 21 | { 22 | get 23 | { 24 | Ctx.CurrentProperty.Name = "OutputPath"; 25 | Ctx._("return \"{0}\"", Ctx.Data.OutputPath); 26 | return null; 27 | } 28 | } 29 | 30 | public bool CanGenerate 31 | { 32 | get { return true; } 33 | } 34 | 35 | [GenerateProperty(TemplateLocation.DesignerFile)] 36 | public virtual bool CanGenerateProperty 37 | { 38 | get 39 | { 40 | Ctx.CurrentProperty.Name = "CanGenerate"; 41 | Ctx._("return true"); 42 | return true; 43 | } 44 | } 45 | 46 | public void TemplateSetup() 47 | { 48 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 49 | Ctx.TryAddNamespace("System.CodeDom"); 50 | Ctx.TryAddNamespace("uFrame.Editor.Compiling.CodeGen"); 51 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 52 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 53 | //Ctx.CurrentDecleration.IsPartial = true; 54 | //Ctx.CurrentDecleration.Name = Ctx.Data.Name; 55 | if (Ctx.IsDesignerFile) 56 | { 57 | Ctx.CurrentDeclaration.BaseTypes.Clear(); 58 | Ctx.CurrentDeclaration.BaseTypes.Add(string.Format("IClassTemplate<{0}>", Ctx.Data.ShellNodeConfig.ClassName)); 59 | 60 | Ctx.CurrentDeclaration.CustomAttributes.Add(new CodeAttributeDeclaration( 61 | new CodeTypeReference(typeof(TemplateClass)), 62 | //new CodeAttributeArgument("OutputPath", new CodePrimitiveExpression(Ctx.Data.OutputPath)), 63 | new CodeAttributeArgument("Location", new CodeSnippetExpression(string.Format("TemplateLocation.{0}", Ctx.Data.Files))), 64 | new CodeAttributeArgument("AutoInherit", new CodePrimitiveExpression(Ctx.Data.AutoInherit)), 65 | new CodeAttributeArgument("ClassNameFormat", new CodePrimitiveExpression(Ctx.Data.ClassNameFormat)) 66 | )); 67 | } 68 | } 69 | 70 | [GenerateMethod(TemplateLocation.Both)] 71 | public virtual void TemplateSetupMethod() 72 | { 73 | Ctx.CurrentMethod.Name = "TemplateSetup"; 74 | if (Ctx.IsDesignerFile) 75 | { 76 | Ctx.PushStatements(Ctx._if("Ctx.IsDesignerFile").TrueStatements); 77 | Ctx._("Ctx.CurrentDecleration.BaseTypes.Clear()"); 78 | if (!string.IsNullOrEmpty(Ctx.Data.TemplateBaseClass)) 79 | { 80 | Ctx._("Ctx.CurrentDecleration.BaseTypes.Add(new CodeTypeReference(\"{0}\"))", Ctx.Data.TemplateBaseClass); 81 | } 82 | Ctx.PopStatements(); 83 | } 84 | 85 | } 86 | 87 | public TemplateContext Ctx { get; set; } 88 | 89 | [GenerateProperty("{0}"), WithField] 90 | public TemplateContext CtxProperty 91 | { 92 | get 93 | { 94 | Ctx.CurrentProperty.Name = "Ctx"; 95 | Ctx.SetTypeArgument(Ctx.Data.ShellNodeConfig.ClassName); 96 | return null; 97 | } 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigTemplateTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 912969e94cb472d4a8b56dcdfa80b070 3 | timeCreated: 1442108389 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigViewModelTemplate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Architect.Editor.Data; 4 | using uFrame.Editor.Configurations; 5 | using uFrame.Editor.Graphs.Data; 6 | using uFrame.Editor.GraphUI.ViewModels; 7 | using uFrame.Editor.Platform; 8 | 9 | namespace uFrame.Architect.Editor.Generators 10 | { 11 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}NodeViewModel", AutoInherit = false)] 12 | public class ShellNodeConfigViewModelTemplate : GenericNodeViewModel, IClassTemplate 13 | { 14 | public string OutputPath 15 | { 16 | get { return Path2.Combine("Editor", "ViewModels"); } 17 | } 18 | 19 | public bool CanGenerate 20 | { 21 | get { return true; } 22 | } 23 | 24 | public void TemplateSetup() 25 | { 26 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 27 | Ctx.TryAddNamespace("uFrame.Editor.GraphUI.ViewModels"); 28 | Ctx.TryAddNamespace("uFrame.Editor.Platform"); 29 | 30 | if (Ctx.IsDesignerFile) 31 | { 32 | if (Ctx.Data.BaseNode != null) 33 | { 34 | Ctx.SetBaseType(Ctx.Data.BaseNode.Name + "NodeViewModel"); 35 | } 36 | else 37 | { 38 | // Ctx.SetType(Ctx.Data.ClassName + "ViewModel"); 39 | } 40 | 41 | 42 | } 43 | 44 | } 45 | [GenerateProperty] 46 | public override NodeStyle NodeStyle 47 | { 48 | get 49 | { 50 | Ctx._("return NodeStyle.{0}", Enum.GetName(typeof(NodeStyle), Ctx.Data.NodeStyle)); 51 | return NodeStyle.Normal; 52 | } 53 | } 54 | 55 | public TemplateContext Ctx { get; set; } 56 | 57 | // For templating 58 | public ShellNodeConfigViewModelTemplate() 59 | : base() 60 | { 61 | } 62 | 63 | public ShellNodeConfigViewModelTemplate(GenericNode graphItemObject, DiagramViewModel diagramViewModel) 64 | : base(graphItemObject, diagramViewModel) 65 | { 66 | } 67 | 68 | [GenerateConstructor(TemplateLocation.Both, "graphItemObject", "diagramViewModel"), Inside(TemplateLocation.Both)] 69 | public void ViewModelConstructor(GenericNode graphItemObject, DiagramViewModel diagramViewModel) 70 | { 71 | Ctx.CurrentConstructor.Parameters[0].Type = Ctx.Data.ClassName.ToCodeReference(); 72 | 73 | } 74 | 75 | } 76 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeConfigViewModelTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab7be04ff4dd41d4688b742f81dc3c7c 3 | timeCreated: 1442108391 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeTypeDrawerTemplate.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Compiling.CodeGen; 2 | using uFrame.Architect.Editor.Data; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | using uFrame.Editor.GraphUI.Drawers; 6 | using uFrame.Editor.GraphUI.ViewModels; 7 | 8 | namespace uFrame.Architect.Editor.Generators 9 | { 10 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}NodeDrawer")] 11 | public class ShellNodeTypeDrawerTemplate : GenericNodeDrawer>, IClassTemplate 12 | { 13 | public string OutputPath 14 | { 15 | get { return Path2.Combine("Editor", "Drawers"); } 16 | } 17 | 18 | public bool CanGenerate 19 | { 20 | get { return true; } 21 | } 22 | 23 | public void TemplateSetup() 24 | { 25 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 26 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 27 | Ctx.TryAddNamespace("uFrame.Editor.Core"); 28 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 29 | //Ctx.SetBaseTypeArgument(Ctx.Data.ClassName); 30 | Ctx.SetBaseType("GenericNodeDrawer<{0},{1}>", Ctx.Data.ClassName, Ctx.Data.Name + "NodeViewModel"); 31 | } 32 | 33 | public TemplateContext Ctx { get; set; } 34 | 35 | // For templating 36 | public ShellNodeTypeDrawerTemplate() 37 | : base() 38 | { 39 | } 40 | 41 | public ShellNodeTypeDrawerTemplate(GenericNodeViewModel viewModel) 42 | : base(viewModel) 43 | { 44 | } 45 | 46 | [GenerateConstructor(TemplateLocation.Both, "viewModel")] 47 | public void DrawerConstructor(GenericNodeViewModel viewModel) 48 | { 49 | Ctx.CurrentConstructor.Parameters[0].Type = (Ctx.Data.Name + "NodeViewModel").ToCodeReference(); 50 | 51 | } 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeTypeDrawerTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50da0bdc02fab034985f1e44d389e64d 3 | timeCreated: 1442108387 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeTypeTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.CodeDom; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using uFrame.Editor.Compiling.CodeGen; 5 | using uFrame.Architect.Editor.Data; 6 | using uFrame.Editor.Configurations; 7 | using uFrame.Editor.Graphs.Data; 8 | 9 | namespace uFrame.Architect.Editor.Generators 10 | { 11 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}Node")] 12 | public class ShellNodeTypeTemplate : GenericNode, IClassTemplate 13 | { 14 | public TemplateContext Ctx { get; set; } 15 | 16 | public string OutputPath 17 | { 18 | get { return Path2.Combine("Editor", "Nodes"); } 19 | } 20 | 21 | public bool CanGenerate 22 | { 23 | get { return true; } 24 | } 25 | 26 | public void TemplateSetup() 27 | { 28 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 29 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 30 | Ctx.TryAddNamespace("uFrame.Editor.Core"); 31 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 32 | if (Ctx.Data.Inheritable && Ctx.IsDesignerFile) 33 | { 34 | Ctx.CurrentDeclaration.BaseTypes.Clear(); 35 | Ctx.CurrentDeclaration.BaseTypes.Add(typeof(GenericInheritableNode)); 36 | } 37 | Ctx.AddIterator("PossibleReferenceItems", _ => _.Sections.Where(p => p.SourceItem is ShellNodeTypeReferenceSection)); 38 | Ctx.AddIterator("ReferenceSectionItems", _ => _.Sections.Where(p => p.SourceItem is ShellNodeTypeReferenceSection)); 39 | Ctx.AddIterator("SectionItems", _ => _.Sections.Where(p => p.SourceItem is ShellSectionNode)); 40 | Ctx.AddIterator("InputSlot", _ => _.InputSlots); 41 | Ctx.AddIterator("OutputSlot", _ => _.OutputSlots); 42 | Ctx.AddCondition("AllowMultipleOutputs", _ => !_.Inheritable); 43 | //Ctx.AddIterator("CustomSelectorItems", _ => _.CustomSelectors); 44 | foreach (var item in Ctx.Data.IncludedInSections) 45 | { 46 | 47 | Ctx.CurrentDeclaration.BaseTypes.Add(item.ReferenceClassName); 48 | } 49 | 50 | } 51 | 52 | [GenerateProperty(TemplateLocation.DesignerFile)] 53 | public override bool AllowMultipleInputs 54 | { 55 | get 56 | { 57 | Ctx._("return {0}", Ctx.Data.AllowMultipleInputs ? "true" : "false"); 58 | return base.AllowMultipleInputs; 59 | } 60 | } 61 | 62 | [GenerateProperty(TemplateLocation.DesignerFile)] 63 | public override bool AllowMultipleOutputs 64 | { 65 | get 66 | { 67 | Ctx._("return {0}", Ctx.Data.AllowMultipleOutputs ? "true" : "false"); 68 | return base.AllowMultipleOutputs; 69 | } 70 | } 71 | 72 | [GenerateProperty("Possible{0}")] 73 | public virtual IEnumerable PossibleReferenceItems 74 | { 75 | get 76 | { 77 | var referenceName = Ctx.ItemAs().SourceItem.ReferenceClassName; 78 | Ctx.SetTypeArgument(referenceName); 79 | Ctx._("return this.Repository.AllOf<{0}>()", referenceName); 80 | //Ctx.AddAttribute(typeof (ReferenceSection), Ctx.Item.Name); 81 | return null; 82 | } 83 | } 84 | 85 | [GenerateProperty("{0}")] 86 | public virtual IEnumerable SectionItems 87 | { 88 | get 89 | { 90 | var item = Ctx.ItemAs(); 91 | var section = item.SourceItem as ShellSectionNode; 92 | Ctx.SetTypeArgument(section.ReferenceType.ClassName); 93 | 94 | Ctx.AddAttribute(typeof(Section)) 95 | .AddArgument(new CodePrimitiveExpression(Ctx.Item.Name)) 96 | .AddArgument("SectionVisibility.{0}", section.Visibility.ToString()) 97 | .Arguments.Add(new CodeAttributeArgument("OrderIndex", new CodePrimitiveExpression(item.Order))) 98 | ; 99 | 100 | Ctx._("return PersistedItems.OfType<{0}>()", section.ReferenceType.ClassName); 101 | return null; 102 | } 103 | } 104 | [GenerateProperty("{0}")] 105 | public virtual IEnumerable ReferenceSectionItems 106 | { 107 | get 108 | { 109 | var slot = Ctx.ItemAs(); 110 | var referenceSection = slot.SourceItem as ShellNodeTypeReferenceSection; 111 | Ctx.SetTypeArgument(referenceSection.ClassName); 112 | //var attributes = 113 | Ctx.AddAttribute(typeof(ReferenceSection)) 114 | .AddArgument(new CodePrimitiveExpression(Ctx.Item.Name)) 115 | .AddArgument("SectionVisibility.{0}", referenceSection.Visibility.ToString()) 116 | .AddArgument(new CodePrimitiveExpression(referenceSection.AllowDuplicates)) 117 | .AddArgument(new CodePrimitiveExpression(referenceSection.IsAutomatic)) 118 | .AddArgument(string.Format("typeof({0})", referenceSection.ReferenceClassName)) 119 | .AddArgument(new CodePrimitiveExpression(referenceSection.IsEditable)) 120 | .AddArgument("OrderIndex", new CodePrimitiveExpression(slot.Order)) 121 | .AddArgument("HasPredefinedOptions", new CodePrimitiveExpression(referenceSection.HasPredefinedOptions)); 122 | 123 | Ctx._("return PersistedItems.OfType<{0}>()", referenceSection.ClassName); 124 | return null; 125 | } 126 | } 127 | 128 | 129 | public virtual IEnumerable InputItems 130 | { 131 | get { return null; } 132 | } 133 | 134 | public virtual IEnumerable OutputItems 135 | { 136 | get { return null; } 137 | } 138 | 139 | //[TemplateProperty("{0}", AutoFillType.NameOnly, Location = TemplateLocation.Both)] 140 | //public virtual IEnumerable CustomSelectorItems 141 | //{ 142 | // get 143 | // { 144 | // Ctx.SetTypeArgument(Ctx.ItemAs().ReferenceClassName); 145 | // Ctx._("yield break"); 146 | // return null; 147 | // } 148 | //} 149 | 150 | [GenerateProperty("{0}InputSlot")] 151 | public virtual GenericReferenceItem InputSlot 152 | { 153 | get 154 | { 155 | 156 | var item = Ctx.ItemAs(); 157 | var field = Ctx.CurrentDeclaration._private_(item.SourceItem.ClassName, "_" + item.Name); 158 | 159 | Ctx.SetType(item.SourceItem.ClassName); 160 | Ctx.AddAttribute(typeof(InputSlot)) 161 | .AddArgument(new CodePrimitiveExpression(item.Name)) 162 | .AddArgument(new CodePrimitiveExpression(item.SourceItem.AllowMultiple)) 163 | .AddArgument("SectionVisibility.{0}", item.SourceItem.Visibility.ToString()) 164 | .Arguments.Add(new CodeAttributeArgument("OrderIndex", new CodePrimitiveExpression(item.Order))) 165 | ; 166 | Ctx._if("{0} == null", field.Name) 167 | .TrueStatements._("{0} = new {1}() {{ Repository = Repository, Node = this }}", field.Name); 168 | return null; 169 | } 170 | 171 | } 172 | 173 | [GenerateProperty("{0}OutputSlot")] 174 | public virtual GenericReferenceItem OutputSlot 175 | { 176 | get 177 | { 178 | var item = Ctx.ItemAs(); 179 | Ctx.SetType(item.SourceItem.ClassName); 180 | Ctx.AddAttribute(typeof(OutputSlot)) 181 | .AddArgument(new CodePrimitiveExpression(item.Name)) 182 | .AddArgument(new CodePrimitiveExpression(item.SourceItem.AllowMultiple)) 183 | .AddArgument("SectionVisibility.{0}", item.SourceItem.Visibility.ToString()) 184 | .Arguments.Add(new CodeAttributeArgument("OrderIndex", new CodePrimitiveExpression(item.Order))) 185 | ; 186 | 187 | return null; 188 | } 189 | } 190 | 191 | } 192 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeTypeTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca7e140320d022446bdb02124c963aad 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeTypeViewModelTemplate.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Compiling.CodeGen; 2 | using uFrame.Architect.Editor.Data; 3 | using uFrame.Editor.Configurations; 4 | using uFrame.Editor.Graphs.Data; 5 | using uFrame.Editor.GraphUI.ViewModels; 6 | 7 | namespace uFrame.Architect.Editor.Generators 8 | { 9 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}NodeViewModel", AutoInherit = false)] 10 | public class ShellNodeTypeViewModelTemplate : GenericNodeViewModel, IClassTemplate 11 | { 12 | public string OutputPath 13 | { 14 | get { return Path2.Combine("Editor", "ViewModels"); } 15 | } 16 | 17 | public bool CanGenerate 18 | { 19 | get { return true; } 20 | } 21 | 22 | public void TemplateSetup() 23 | { 24 | if (Ctx.IsDesignerFile) 25 | { 26 | if (Ctx.Data.BaseNode != null) 27 | { 28 | Ctx.SetBaseType(Ctx.Data.BaseNode.Name + "NodeViewModel"); 29 | } 30 | else 31 | { 32 | Ctx.SetBaseTypeArgument(Ctx.Data.ClassName); 33 | } 34 | 35 | } 36 | 37 | } 38 | 39 | public TemplateContext Ctx { get; set; } 40 | 41 | // For templating 42 | public ShellNodeTypeViewModelTemplate() 43 | : base() 44 | { 45 | } 46 | 47 | public ShellNodeTypeViewModelTemplate(GenericNode graphItemObject, DiagramViewModel diagramViewModel) 48 | : base(graphItemObject, diagramViewModel) 49 | { 50 | } 51 | 52 | [GenerateConstructor(TemplateLocation.Both, "graphItemObject", "diagramViewModel")] 53 | public void ViewModelConstructor(GenericNode graphItemObject, DiagramViewModel diagramViewModel) 54 | { 55 | Ctx.CurrentConstructor.Parameters[0].Type = Ctx.Data.ClassName.ToCodeReference(); 56 | 57 | } 58 | 59 | } 60 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellNodeTypeViewModelTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ac057d9a5a654d44a463507e0edcde4 3 | timeCreated: 1442108385 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellPluginClassGenerator.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Compiling.CodeGen; 2 | using uFrame.Architect.Editor.Data; 3 | 4 | namespace uFrame.Architect.Editor.Generators 5 | { 6 | public class ShellPluginClassGenerator : GenericNodeGenerator 7 | { 8 | public override void Initialize(CodeFileGenerator codeFileGenerator) 9 | { 10 | base.Initialize(codeFileGenerator); 11 | TryAddNamespace("System.IO"); 12 | 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellPluginClassGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 440cab173c7ec1b47b80abf991e89b79 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellPluginTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.CodeDom; 2 | using System.Linq; 3 | using uFrame.Editor.Compiling.CodeGen; 4 | using uFrame.Architect.Editor.Data; 5 | using uFrame.Editor; 6 | using uFrame.Editor.Configurations; 7 | using uFrame.Editor.Graphs.Data; 8 | using uFrame.Editor.TypesSystem; 9 | using uFrame.IOC; 10 | 11 | namespace uFrame.Architect.Editor.Generators 12 | { 13 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}")] 14 | public class ShellPluginTemplate : DiagramPlugin, IClassTemplate 15 | { 16 | #region Template Setup 17 | 18 | public string OutputPath 19 | { 20 | get { return Path2.Combine("Editor", "Plugins"); } 21 | } 22 | 23 | public bool CanGenerate 24 | { 25 | get { return true; } 26 | } 27 | 28 | public void TemplateSetup() 29 | { 30 | Ctx.AddIterator("NodeConfigProperty", _ => _.Graph.NodeItems.OfType()); 31 | Ctx.AddIterator("GetSelectionCommand", _ => _.Graph.NodeItems.OfType().Where(x => x["Typed"])); 32 | //Ctx.TryAddNamespace("Invert.Core"); 33 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 34 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 35 | Ctx.TryAddNamespace("uFrame.Editor.Core"); 36 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 37 | } 38 | 39 | [GenerateMethod("Get{0}SelectionCommand", TemplateLocation.Both, true)] 40 | public virtual SelectTypeCommand GetSelectionCommand() 41 | { 42 | Ctx._("return new SelectTypeCommand() {{ IncludePrimitives = true, AllowNoneType = false }}"); 43 | return null; 44 | } 45 | 46 | 47 | public TemplateContext Ctx { get; set; } 48 | #endregion 49 | 50 | public override bool Ignore 51 | { 52 | get 53 | { 54 | return true; 55 | } 56 | } 57 | 58 | [GenerateProperty("{0}"), WithField] 59 | public NodeConfig NodeConfigProperty 60 | { 61 | get 62 | { 63 | var item = Ctx.ItemAs().ClassName; 64 | Ctx.SetTypeArgument(item); 65 | return null; 66 | } 67 | set 68 | { 69 | 70 | } 71 | } 72 | 73 | [GenerateMethod(TemplateLocation.Both, true)] 74 | public override void Initialize(UFrameContainer container) 75 | { 76 | if (!Ctx.IsDesignerFile) return; 77 | Ctx.CurrentMethodAttribute.CallBase = false; 78 | var method = Ctx.CurrentMethod; 79 | //foreach (var item in Ctx.Data.Graph.NodeItems.OfType()) 80 | //{ 81 | // if (!item["Typed"]) continue; 82 | // method._( 83 | // "container.RegisterInstance(Get{0}SelectionCommand(), typeof({1}).Name + \"TypeSelection\");", item.Name, item.ClassName); 84 | 85 | //} 86 | foreach (var itemType in Ctx.Data.Graph.NodeItems.OfType().Where(p => p.IsValid)) 87 | { 88 | if (itemType is ShellNodeTypeNode) continue; 89 | if (itemType is ShellSectionNode) continue; 90 | if (itemType is ShellGraphTypeNode) continue; 91 | if (itemType["Typed"]) 92 | { 93 | method.Statements.Add( 94 | new CodeSnippetExpression(string.Format("container.AddTypeItem<{0},{1}ViewModel,{1}Drawer>()", itemType.ClassName, itemType.Name))); 95 | } 96 | else 97 | { 98 | //if (itemType.Flags.ContainsKey("Custom") && itemType["Custom"]) 99 | //{ 100 | // method.Statements.Add( 101 | // new CodeSnippetExpression(string.Format("container.AddItem<{0}, {1}ViewModel, {1}Drawer>()", itemType.ClassName, itemType.Name))); 102 | //} 103 | //else 104 | //{ 105 | method.Statements.Add( 106 | new CodeSnippetExpression(string.Format("container.AddItem<{0}>()", itemType.ClassName))); 107 | //} 108 | } 109 | } 110 | var graphTypes = Ctx.Data.Graph.NodeItems.OfType().Where(p => p.IsValid).ToArray(); 111 | foreach (var nodeType in Ctx.Data.Graph.NodeItems.OfType().Where(p => p.IsValid)) 112 | { 113 | InitializeNodeType(method, nodeType, graphTypes.FirstOrDefault(p => p.RootNode == nodeType)); 114 | } 115 | 116 | foreach (var nodeType in Ctx.Data.Graph.NodeItems.OfType().Where(p => p.IsValid)) 117 | { 118 | foreach (var item in nodeType.ConnectableTo) 119 | { 120 | method._("container.Connectable<{0},{1}>()", nodeType.ClassName, item.SourceItem.ClassName); 121 | } 122 | 123 | } 124 | foreach (var nodeType in Ctx.Data.Graph.NodeItems.OfType().Where(p => p.IsValid)) 125 | { 126 | 127 | 128 | if (nodeType["Output"]) 129 | { 130 | method._("container.Connectable<{0},{1}>()", nodeType.ClassName, nodeType.ReferenceClassName); 131 | } 132 | else 133 | { 134 | method._("container.Connectable<{0},{1}>()", nodeType.ReferenceClassName, nodeType.ClassName); 135 | } 136 | } 137 | } 138 | 139 | private static void InitializeNodeType(CodeMemberMethod method, ShellNodeTypeNode nodeType, ShellGraphTypeNode graphType) 140 | { 141 | var varName = nodeType.Name; 142 | var type = graphType == null ? "Node" : "Graph"; 143 | if (graphType != null) 144 | { 145 | method.Statements.Add( 146 | new CodeSnippetExpression(string.Format("{1} = container.AddGraph<{0}, {2}>(\"{0}\")", 147 | graphType.ClassName, varName, graphType.RootNode.ClassName))); 148 | } 149 | else 150 | { 151 | 152 | method.Statements.Add( 153 | new CodeSnippetExpression(string.Format("{1} = container.Add{2}<{0}Node,{0}NodeViewModel,{0}NodeDrawer>(\"{0}\")", nodeType.Name, varName, type))); 154 | 155 | } 156 | 157 | 158 | if (nodeType["Inheritable"]) 159 | { 160 | method.Statements.Add(new CodeSnippetExpression(string.Format("{0}.Inheritable()", varName))); 161 | } 162 | 163 | 164 | 165 | foreach (var item in nodeType.SubNodes) 166 | { 167 | method.Statements.Add( 168 | new CodeSnippetExpression(string.Format("{0}.HasSubNode<{1}Node>()", varName, item.Name))); 169 | } 170 | 171 | } 172 | 173 | } 174 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellPluginTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9f2bae1f106d2944a7d3308f6bd79c8 3 | timeCreated: 1442108394 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellReferenceSectionTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.CodeDom; 2 | using uFrame.Editor.Compiling.CodeGen; 3 | using uFrame.Architect.Editor.Data; 4 | using uFrame.Editor.Configurations; 5 | using uFrame.Editor.Graphs.Data; 6 | 7 | namespace uFrame.Architect.Editor.Generators 8 | { 9 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}Reference")] 10 | public class ShellReferenceSectionTemplate : GenericReferenceItem, 11 | IClassTemplate 12 | { 13 | public string OutputPath 14 | { 15 | get { return Path2.Combine("Editor", "Sections"); } 16 | } 17 | 18 | public bool CanGenerate 19 | { 20 | get { return true; } 21 | } 22 | 23 | public void TemplateSetup() 24 | { 25 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 26 | Ctx.TryAddNamespace("uFrame.Editor.Configurations"); 27 | Ctx.TryAddNamespace("uFrame.Editor.Core"); 28 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 29 | var i = new CodeTypeDeclaration("I" + Ctx.Data.Name) 30 | { 31 | IsInterface = true, 32 | Attributes = MemberAttributes.Public, 33 | IsPartial = true, 34 | }; 35 | i.BaseTypes.Add(new CodeTypeReference(typeof(IDiagramNodeItem))); 36 | i.BaseTypes.Add(new CodeTypeReference(typeof(IConnectable))); 37 | Ctx.Namespace.Types.Add(i); 38 | 39 | if (Ctx.IsDesignerFile) 40 | { 41 | Ctx.SetBaseTypeArgument(Ctx.Data.ReferenceClassName); 42 | 43 | foreach (var item in Ctx.Data.IncludedInSections) 44 | { 45 | Ctx.AddInterface(item.ReferenceClassName); 46 | } 47 | } 48 | } 49 | 50 | public TemplateContext Ctx { get; set; } 51 | [GenerateProperty(TemplateLocation.DesignerFile)] 52 | public override bool AllowMultipleInputs 53 | { 54 | get 55 | { 56 | Ctx._("return {0}", Ctx.Data.AllowMultipleInputs ? "true" : "false"); 57 | return base.AllowMultipleInputs; 58 | } 59 | } 60 | [GenerateProperty(TemplateLocation.DesignerFile)] 61 | public override bool AllowMultipleOutputs 62 | { 63 | get 64 | { 65 | Ctx._("return {0}", Ctx.Data.AllowMultipleOutputs ? "true" : "false"); 66 | return base.AllowMultipleOutputs; 67 | } 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellReferenceSectionTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad15fa9031e41884b8922bc821632b16 3 | timeCreated: 1442090355 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellSlotItemTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.CodeDom; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using uFrame.Editor.Compiling.CodeGen; 5 | using uFrame.Architect.Editor.Data; 6 | using uFrame.Editor.Database.Data; 7 | using uFrame.Editor.Graphs.Data; 8 | 9 | namespace uFrame.Architect.Editor.Generators 10 | { 11 | [TemplateClass(TemplateLocation.Both, ClassNameFormat = "{0}")] 12 | //[RequiresNamespace("Invert.Data")] 13 | public class ShellSlotItemTemplate : GenericSlot, IClassTemplate 14 | { 15 | [GenerateProperty] 16 | public override string Name 17 | { 18 | get 19 | { 20 | Ctx._("return \"{0}\"", Ctx.Data.Name); 21 | return null; 22 | } 23 | set { } 24 | } 25 | 26 | [GenerateProperty(TemplateLocation.DesignerFile)] 27 | public override bool AllowMultipleInputs 28 | { 29 | get 30 | { 31 | Ctx._("return {0}", Ctx.Data.AllowMultiple && Ctx.Data is ShellNodeConfigInput ? "true" : "false"); 32 | return base.AllowMultipleInputs; 33 | } 34 | } 35 | [GenerateProperty(TemplateLocation.DesignerFile)] 36 | public override bool AllowMultipleOutputs 37 | { 38 | get 39 | { 40 | Ctx._("return {0}", Ctx.Data.AllowMultiple && Ctx.Data is ShellNodeConfigOutput ? "true" : "false"); 41 | return base.AllowMultipleOutputs; 42 | } 43 | } 44 | [GenerateProperty(TemplateLocation.DesignerFile)] 45 | public override bool AllowSelection 46 | { 47 | get 48 | { 49 | Ctx._("return {0}", Ctx.Data.AllowSelection ? "true" : "false"); 50 | return false; 51 | } 52 | } 53 | public string OutputPath 54 | { 55 | get { return Path.Combine("Editor", "Slots"); } 56 | } 57 | 58 | public bool CanGenerate 59 | { 60 | get { return true; } 61 | } 62 | [GenerateMethod(CallBase = false)] 63 | public override IEnumerable GetAllowed() 64 | { 65 | Ctx._(string.Format("return Repository.AllOf<{0}>().OfType();", Ctx.Data.ReferenceClassName)); 66 | yield break; 67 | } 68 | 69 | public void TemplateSetup() 70 | { 71 | //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); 72 | Ctx.TryAddNamespace("uFrame.Editor.Database.Data"); 73 | Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); 74 | var i = new CodeTypeDeclaration(Ctx.Data.ReferenceClassName) 75 | { 76 | IsInterface = true, 77 | Attributes = MemberAttributes.Public, 78 | IsPartial = true, 79 | }; 80 | i.BaseTypes.Add(new CodeTypeReference(typeof(IDiagramNodeItem))); 81 | i.BaseTypes.Add(new CodeTypeReference(typeof(IConnectable))); 82 | Ctx.Namespace.Types.Add(i); 83 | 84 | if (Ctx.IsDesignerFile) 85 | { 86 | if (Ctx.Data.IsOutput) 87 | { 88 | if (Ctx.Data.AllowMultiple) 89 | { 90 | Ctx.SetBaseType("MultiOutputSlot<{0}>", Ctx.Data.ReferenceClassName); 91 | } 92 | else 93 | { 94 | Ctx.SetBaseType("SingleOutputSlot<{0}>", Ctx.Data.ReferenceClassName); 95 | } 96 | } 97 | else 98 | { 99 | if (Ctx.Data.AllowMultiple) 100 | { 101 | Ctx.SetBaseType("MultiInputSlot<{0}>", Ctx.Data.ReferenceClassName); 102 | } 103 | else 104 | { 105 | Ctx.SetBaseType("SingleInputSlot<{0}>", Ctx.Data.ReferenceClassName); 106 | } 107 | } 108 | 109 | foreach (var item in Ctx.Data.IncludedInSections) 110 | { 111 | Ctx.AddInterface(item.ReferenceClassName); 112 | } 113 | } 114 | 115 | 116 | } 117 | 118 | public TemplateContext Ctx { get; set; } 119 | } 120 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/Generators/ShellSlotItemTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f67ea6cab7bd18c4e96d7becd906d73a 3 | timeCreated: 1442090356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/PluginDesigner.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor; 2 | using uFrame.Editor.Attributes; 3 | using uFrame.Editor.Compiling.CodeGen; 4 | using uFrame.Editor.Compiling.CommonNodes; 5 | using uFrame.Editor.Core; 6 | using uFrame.Editor.Documentation; 7 | using uFrame.Editor.Graphs.Data; 8 | using uFrame.Editor.Workspaces.Data; 9 | using uFrame.IOC; 10 | using uFrame.Editor.GraphUI; 11 | using uFrame.Editor.GraphUI.Drawers; 12 | using uFrame.Editor.Workspaces; 13 | 14 | namespace uFrame.Architect.Editor 15 | { 16 | using Data; 17 | using Generators; 18 | 19 | 20 | [UnityEditor.InitializeOnLoad] 21 | public class PluginDesigner : DiagramPlugin 22 | { 23 | static PluginDesigner() 24 | { 25 | InvertApplication.CacheAssembly(typeof(PluginDesigner).Assembly); 26 | } 27 | public override void Initialize(UFrameContainer container) 28 | { 29 | #if DEBUG && UNITY_EDITOR 30 | //container.RegisterInstance(new PrintPlugins(), "Json"); 31 | 32 | #endif 33 | //container.RegisterInstance(new SelectColorCommand(), "SelectColor"); 34 | //var pluginConfig = 35 | container.AddItem() 36 | .AddItem() 37 | .AddItem() 38 | .AddItem() 39 | .AddItem() 40 | .AddItem() 41 | .AddItem() 42 | .AddItem() 43 | .AddItem() 44 | .AddTypeItem() 45 | .AddGraph("Shell Plugin") 46 | .Color(NodeColor.Green) 47 | 48 | .HasSubNode() 49 | .HasSubNode() 50 | .HasSubNode() 51 | .HasSubNode() 52 | #if UNITY_EDITOR 53 | // .AddCodeTemplate() 54 | #endif 55 | ; 56 | // container.AddNode("Screenshot"); 57 | container.AddWorkspaceConfig("Architect", "Create a uFrame Architect workspace for creating plugin graphs.") 58 | .WithGraph("Plugin", "Creates a new plugin graph for creating node configurations."); 59 | //var shellConfigurationNode = 60 | container.AddNode("Node Config") 61 | .HasSubNode() 62 | .HasSubNode() 63 | .HasSubNode() 64 | ; 65 | // shellConfigurationNode.AddFlag("Graph Type"); 66 | 67 | container.AddNode("Code Template") 68 | .Color(NodeColor.Purple); 69 | 70 | 71 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 72 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 73 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 74 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 75 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 76 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 77 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 78 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 79 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 80 | #if UNITY_EDITOR 81 | if (GenerateDocumentation) 82 | { 83 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 84 | RegisteredTemplateGeneratorsFactory.RegisterTemplate(); 85 | } 86 | #endif 87 | 88 | 89 | container.Connectable(); 90 | container.Connectable(); 91 | container.Connectable(); 92 | container.Connectable(); 93 | container.Connectable(); 94 | container.Connectable(); 95 | container.Connectable(); 96 | container.Connectable(); 97 | container.Connectable(); 98 | 99 | container.Connectable(); 100 | 101 | container.Connectable(); 102 | } 103 | 104 | public class ArchitectWorkspace : Workspace 105 | { 106 | 107 | } 108 | 109 | [InspectorProperty] 110 | public static bool GenerateDocumentation 111 | { 112 | get { return false; } 113 | // InvertGraphEditor.Prefs.GetBool("PLUGINDESIGNER_GENDOCS", true); } 114 | set 115 | { 116 | // InvertApplication.Prefs.SetBool("PLUGINDESIGNER_GENDOCS", value); 117 | } 118 | } 119 | } 120 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/PluginDesigner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1eaea371d4636e4bb8e0ab061d56598 3 | timeCreated: 1468206165 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/PluginGraphData.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Editor.Graphs.Data; 2 | 3 | namespace uFrame.Architect.Editor 4 | { 5 | using Data; 6 | public class PluginGraphData : GenericGraphData 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/PluginGraphData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d23e75080b5e29479400dbc5f3ada33 3 | timeCreated: 1468206165 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/ShellPropertySelectorItem.cs: -------------------------------------------------------------------------------- 1 | using uFrame.Architect.Editor.Data; 2 | using uFrame.Editor.Graphs.Data; 3 | 4 | namespace uFrame.Architect.Editor 5 | { 6 | public class ShellPropertySelectorItem : GenericTypedChildItem, IShellNodeItem 7 | { 8 | public IShellNode SelectorFor 9 | { 10 | get { return this.RelatedNode() as IShellNode; } 11 | } 12 | 13 | public string ReferenceClassName 14 | { 15 | get 16 | { 17 | if (SelectorFor == null) return null; 18 | return SelectorFor.ClassName; 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /uFrame.Architect/Source/Editor/ShellPropertySelectorItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3e888f9be9f9f94c937ec72ce98a1b5 3 | timeCreated: 1468206165 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | --------------------------------------------------------------------------------