상속: MonoBehaviour
예제 #1
0
    // Set when we've detected impending impact and have spawned an impact warning instance


    void Awake()
    {
        emitter     = GetComponentInChildren <ParticleEmitter> ();
        demoControl = FindObjectOfType(typeof(DemoControl)) as DemoControl;
        // Meteorites get spawned by demo control, so we can assume that it exists
        rigidbody.isKinematic = true;
        rigidbody.useGravity  = false;
    }
 // Set when we've detected impending impact and have spawned an impact warning instance
 void Awake()
 {
     emitter = GetComponentInChildren<ParticleEmitter> ();
     demoControl = FindObjectOfType (typeof (DemoControl)) as DemoControl;
         // Meteorites get spawned by demo control, so we can assume that it exists
     rigidbody.isKinematic = true;
     rigidbody.useGravity = false;
 }
예제 #3
0
        public IshikawaDiagramViewModel(DemoControl demo)
        {
            View = demo;
            //create Ishikawa diagram sample
            CreateNodesAndConnectors();

            //Draggable and Selectable Constraints used to enable/disable the Dragging and Selection.
            Constraints = Constraints.Remove(GraphConstraints.Selectable, GraphConstraints.Draggable);
        }
    IEnumerator DoRestart()
    {
        yield return(null);

        restarting = true;
        yield return(null);

        DemoControl.Restart();
    }
        public SequenceDiagramViewModel(DemoControl demo)
        {
            View = demo;

            //Create Nodes and Connections
            CreateNodesandConnections();

            ViewPortChangedCommand = new DelegateCommand(OnViewPortChanged);
        }
예제 #6
0
    public static void Restart()
    {
        DemoControl instance = (DemoControl)FindObjectOfType(typeof(DemoControl));

        if (instance != null)
        {
            Destroy(instance.gameObject);
        }
        Time.timeScale = 1.0f;
        Application.LoadLevel(0);
    }
예제 #7
0
        /// <summary>
        /// Initializes the new instance of <see cref="SnappingViewModel"/> class.
        /// </summary>
        public SnappingViewModel(DemoControl demo)
        {
            View = demo;

            //Intialize the nodes and connectors collection
            this.Nodes      = new NodeCollection();
            this.Connectors = new ConnectorCollection();

            //Enable the ports visibility
            this.PortVisibility = PortVisibility.Collapse;


            //Initialize the selector view model and disbale the quick coammnds.
            this.SelectedItems = new SelectorViewModel();
            (this.SelectedItems as SelectorViewModel).SelectorConstraints &= ~(SelectorConstraints.QuickCommands);
            //Initialize the command to show gridlines and enable the snapping on gridlines
            ShowGridlinesCommand       = new DelegateCommand(OnShowGridlinesCommandExecute);
            SnappingToGridlinesCommand = new DelegateCommand(OnSnappingCommandExecute);
            ItemAddedCommand           = new DelegateCommand(OnItemAddedCommandExecute);

            this.SnapSettings = new SnapSettings()
            {
                SnapToObject    = SnapToObject.All,
                SnapConstraints = SnapConstraints.All,
            };

            #region Nodes

            node1 = CreateNodes(350, 250, 100, 100, "Shape 1", "Rectangle");
            node2 = CreateNodes(650, 250, 100, 100, "Shape 2", "Rectangle");
            node3 = CreateNodes(500, 400, 100, 100, "Shape 3", "Rectangle");
            node4 = CreateNodeforLabel("Rectangle", "");
            (this.Nodes as NodeCollection).Add(node1);
            (this.Nodes as NodeCollection).Add(node2);
            (this.Nodes as NodeCollection).Add(node3);
            (this.Nodes as NodeCollection).Add(node4);
            CreateNodePorts(node1);
            CreateNodePorts(node2);
            connector1 = CreateConnectors(node1, node3);
            DockPortViewModel dockPort = new DockPortViewModel()
            {
                SourcePoint = new Point(0, 0),
                TargetPoint = new Point(0, 1),
            };
            dockPort.Constraints &= ~PortConstraints.InheritHitPadding;
            dockPort.HitPadding   = 20;
            (node2.Ports as PortCollection).Add(dockPort);
            (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector1);
            this.PortVisibility = PortVisibility.Visible;
            (this.SelectedItems as SelectorViewModel).SelectorConstraints |= (SelectorConstraints.QuickCommands);
            #endregion
        }
예제 #8
0
파일: Form1.cs 프로젝트: yashbajra/samples
        //The constructor associates the control
        //with the smart tag list.
        public DemoActionList(IComponent component)
            : base(component)
        {
            this.relatedControl = component as DemoControl;

            this.host =
                this.Component.Site.GetService(typeof(IDesignerHost))
                as IDesignerHost;

            IDesigner dcd = host.GetDesigner(this.Component);

            this.relatedDesigner = dcd as DemoControlDesigner;
        }
예제 #9
0
        public DrawingToolsViewModel(DemoControl demo)
        {
            View               = demo;
            this.Nodes         = new NodeCollection();
            this.Connectors    = new ConnectorCollection();
            this.DrawingTool   = DrawingTool.Rectangle;
            this.Tool          = Tool.ContinuesDraw;
            this.SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands,
            };

            this.GetDrawTypeCommand = new DelegateCommand(OnGetDrawTypeCommandExecute);
            this.ItemAddedCommand   = new DelegateCommand(OnItemAddedCommandExecute);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            InitialControlOccurance.BorderThickness = new Thickness(10);

            var demoControl = new DemoControl
            {
                Width           = 100,
                Height          = MyCanvas.ActualHeight,
                BorderThickness = new Thickness(4),
                BorderBrush     = new SolidColorBrush(Color.FromRgb(255, 0, 0)),
                Background      = new SolidColorBrush(Color.FromRgb(0, 255, 0)),
                Margin          = new Thickness(0, 0, 0, 0)
            };

            MyCanvas.Children.Add(demoControl);
        }
예제 #11
0
        public FlowExectionViewModel(DemoControl demo)
        {
            View = demo;

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands,
            };

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            FlowCommand = new DelegateCommand(FlowExecution);

            NodeViewModel Node1 = CreateNode(200, 100, "Ellipse", "Begin");
            NodeViewModel Node2 = CreateNode(400, 100, "Rectangle", "Specify collection");
            NodeViewModel Node3 = CreateNode(600, 100, "Diamond", "Particulars required");

            Node3.IsSelected = true;
            NodeViewModel Node4 = CreateNode(800, 100, "Rectangle", "Specify particulars");
            NodeViewModel Node5 = CreateNode(600, 250, "Rectangle", "Design collection");
            NodeViewModel Node6 = CreateNode(600, 400, "Rectangle", "Cluster of events");
            NodeViewModel Node7 = CreateNode(800, 400, "Rectangle", "Record and analyze results");
            NodeViewModel Node8 = CreateNode(600, 550, "Rectangle", "Start the process");
            NodeViewModel Node9 = CreateNode(800, 550, "Ellipse", "End");

            ConnectorViewModel Con1 = CreateConnector(Node1, Node2, "");
            ConnectorViewModel Con2 = CreateConnector(Node2, Node3, "");
            ConnectorViewModel Con3 = CreateConnector(Node3, Node4, "Yes");
            ConnectorViewModel Con4 = CreateConnector(Node3, Node5, "No");
            ConnectorViewModel Con5 = CreateConnector(Node4, Node5, "Seg");
            ConnectorViewModel Con6 = CreateConnector(Node5, Node6, "");
            ConnectorViewModel Con7 = CreateConnector(Node7, Node6, "");
            ConnectorViewModel Con8 = CreateConnector(Node6, Node8, "");
            ConnectorViewModel Con9 = CreateConnector(Node8, Node9, "");

            ItemSelectedCommand   = new DelegateCommand(ItemselectedExecution);
            ItemUnSelectedCommand = new DelegateCommand(ItemUnselectedExecution);
        }
예제 #12
0
        public FlowChartViewModel(DemoControl demo)
        {
            View = demo;
            //This command will get invoked when an item is added to the diagram.
            ItemAddedCommand = new DelegateCommand(args => OnItemAdded((ItemAddedEventArgs)args));


            Constraints = Constraints.Remove(GraphConstraints.PageEditing, GraphConstraints.PanRails);

            //Initialize Context menu for diagram.
            Menu = null;

            // Initialize DataSourceSettings for SfDiagram
            DataSourceSettings = new FlowchartDataSourceSettings()
            {
                ParentId             = "ParentId",
                Id                   = "Id",
                DataSource           = GetData(),
                ConnectorTextMapping = "Label",
                ContentMapping       = "Name",
                ShapeMapping         = "_Shape",
                WidthMapping         = "_Width",
                HeightMapping        = "_Height"
            };

            // Initialize LayoutSettings for SfDiagram
            LayoutManager = new LayoutManager()
            {
                Layout = new FlowchartLayout()
                {
                    Orientation     = FlowchartOrientation.TopToBottom,
                    YesBranchValues = new List <string> {
                        "Yes", "True", "Y", "s"
                    },
                    YesBranchDirection = BranchDirection.LeftInFlow,
                    NoBranchValues     = new List <string> {
                        "No", "N", "False", "no"
                    },
                    NoBranchDirection = BranchDirection.RightInFlow,
                    HorizontalSpacing = 50,
                    VerticalSpacing   = 50,
                },
            };
        }
예제 #13
0
 private void InitializeComponent()
 {
     this.demoControl2 = new DemoControl();
     this.demoControl1 = new DemoControl();
     this.SuspendLayout();
     //
     // demoControl2
     //
     this.demoControl2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                       | System.Windows.Forms.AnchorStyles.Left)
                                                                      | System.Windows.Forms.AnchorStyles.Right)));
     this.demoControl2.BackColor = System.Drawing.Color.LightBlue;
     this.demoControl2.Location  = new System.Drawing.Point(40, 40);
     this.demoControl2.Margin    = new System.Windows.Forms.Padding(20);
     this.demoControl2.Name      = "demoControl2";
     this.demoControl2.Padding   = new System.Windows.Forms.Padding(20);
     this.demoControl2.Size      = new System.Drawing.Size(284, 177);
     this.demoControl2.TabIndex  = 1;
     //
     // demoControl1
     //
     this.demoControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                      | System.Windows.Forms.AnchorStyles.Left)));
     this.demoControl1.BackColor = System.Drawing.Color.LightBlue;
     this.demoControl1.Location  = new System.Drawing.Point(354, 21);
     this.demoControl1.Margin    = new System.Windows.Forms.Padding(10);
     this.demoControl1.Name      = "demoControl1";
     this.demoControl1.Padding   = new System.Windows.Forms.Padding(10);
     this.demoControl1.Size      = new System.Drawing.Size(184, 207);
     this.demoControl1.TabIndex  = 0;
     //
     // Form1
     //
     this.ClientSize = new System.Drawing.Size(594, 352);
     this.Controls.Add(this.demoControl2);
     this.Controls.Add(this.demoControl1);
     this.Name    = "Form1";
     this.Padding = new System.Windows.Forms.Padding(20);
     this.Text    = "a";
     this.ResumeLayout(false);
 }
예제 #14
0
    void Start()
    // Verify setup and additional setup
    {
        Setup();
        // Retry setup if references were cleared post-add

        if (actionController == null)
        {
            Debug.LogError("No action controller assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        if (player == null)
        {
            Debug.LogError("No player assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        demoControl = GetComponent <DemoControl> ();
    }
예제 #15
0
        public ConstraintsViewModel(DemoControl demo)
        {
            View = demo;

            // Initializing Properties for DiagramViewModel

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default | SelectorConstraints.HideDisabledResizer,
            };

            ItemSelectedCommand = new DelegateCommand(OnItemSelected);
            ItemAddedCommand    = new DelegateCommand(OnItemAddedCommand);
            first = true;

            #region Nodes and Connectors

            Nodes      = new NodeCollection();
            Connectors = new ConnectorCollection();

            CreateNode(90, "Rectangle", "Selection = False", "Selection");
            CreateNode(290, "Ellipse", "Dragging = False", "Drag");
            CreateNode(490, "Heptagon", "Delete = False", "Delete");
            CreateNode(690, "Cylinder", "Rotate = False", "Rotate");
            CreateNode(890, "Plus", "TextEdit = False", "Edit");
            CreateNode(1090, "Diamond", "Resizing = False", "Resize");
            CreateNodeforLabel("Rectangle", "Node");
            CreateNodeforLabel("Rectangle", "Connector");

            CreateConnector(new Point(40, 500), new Point(190, 600), "Selection = False", "Selection");
            CreateConnector(new Point(240, 500), new Point(390, 600), "Dragging = True", "Drag");
            CreateConnector(new Point(440, 500), new Point(590, 600), "Delete = False", "Delete");
            CreateConnector(new Point(640, 500), new Point(790, 600), "EndThumb = False", "EndThumb");
            CreateConnector(new Point(840, 500), new Point(990, 600), "EndDraggable = False", "EndDraggable");
            CreateConnector(new Point(1040, 500), new Point(1190, 600), "SegmentThumb = False", "SegmentThumb");

            #endregion
        }
예제 #16
0
파일: Form1.cs 프로젝트: yashbajra/samples
 private void InitializeComponent()
 {
     this.demoControl1 = new DemoControl();
     this.SuspendLayout();
     //
     // demoControl1
     //
     this.demoControl1.AutoSize  = true;
     this.demoControl1.BackColor = System.Drawing.Color.Chartreuse;
     this.demoControl1.Location  = new System.Drawing.Point(0, 0);
     this.demoControl1.Name      = "demoControl1";
     this.demoControl1.Size      = new System.Drawing.Size(232, 14);
     this.demoControl1.TabIndex  = 0;
     this.demoControl1.Text      = "This text was set by CreateComponentsCore.";
     //
     // Form1
     //
     this.ClientSize = new System.Drawing.Size(492, 482);
     this.Controls.Add(this.demoControl1);
     this.Name = "Form1";
     this.Text = "r";
     this.ResumeLayout(false);
     this.PerformLayout();
 }
    // Verify setup and additional setup
    void Start()
    {
        Setup ();
            // Retry setup if references were cleared post-add

        if (actionController == null)
        {
            Debug.LogError ("No action controller assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        if (player == null)
        {
            Debug.LogError ("No player assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        demoControl = GetComponent<DemoControl> ();
    }
예제 #18
0
        /// <summary>
        /// Created the new instances of the <see cref="ConnectorsViewModel"/> class.
        /// </summary>

        public ConnectorsViewModel(DemoControl demo)
        {
            View = demo;
            //Initialize the nodes and connectors collection
            this.Nodes      = new ObservableCollection <CustomNodeVM>();
            this.Connectors = new ObservableCollection <CustomConnectorVM>();

            //Initialize the port visibility as collapse
            this.PortVisibility = PortVisibility.Collapse;

            //Initialize the default connector type.
            this.DefaultConnectorType = ConnectorType.CubicBezier;

            //Enable the routing to the connectors.
            this.Constraints |= GraphConstraints.Routing;

            //Initialize the shape selection command.
            SelectShapeCommand = new DelegateCommand(OnSelectShapeCommandExecute);

            //Initialize the item added command.
            ItemAddedCommand = new DelegateCommand(OnItemAddedCommandExecute);

            //Initialize the view port chnaged command.
            ViewPortChangedCommand = new DelegateCommand(OnViewPortChangedCommandExecute);

            //Create and add nodes
            CustomNodeVM promotion   = CreateNodes(140, 350, 30, "Promotion");
            CustomNodeVM lead        = CreateNodes(300, 350, 70, "Lead");
            CustomNodeVM account     = CreateNodes(500, 270, 30, "Account");
            CustomNodeVM information = CreateNodes(500, 350, 30, "Information");
            CustomNodeVM opportunity = CreateNodes(500, 430, 30, "Opportunity");
            CustomNodeVM template    = CreateNodes(700, 350, 204, "");

            template.ContentTemplate = View.Resources["ConnectorsContentTemplateforNodeContent"] as DataTemplate;

            //Create node ports
            CreateNodePort(promotion, "promotion", 1, 0.5);

            CreateNodePort(lead, "lead1", 0, 0.5);
            CreateNodePort(lead, "lead2", 1, 0.5);
            CreateNodePort(lead, "lead3", 1, 0.75);
            CreateNodePort(lead, "lead4", 1, 0.25);

            CreateNodePort(information, "information1", 0, 0.5);
            CreateNodePort(information, "information2", 1, 0.5);

            CreateNodePort(account, "account1", 0, 0.5);
            CreateNodePort(account, "account2", 1, 0.5);

            CreateNodePort(opportunity, "opportunity1", 0, 0.5);
            CreateNodePort(opportunity, "opportunity2", 1, 0.5);

            CreateNodePort(template, "template1", 0, 0.5);
            CreateNodePort(template, "template2", 0, 0.4);
            CreateNodePort(template, "template3", 0, 0.6);

            //Add nodes to Nodes property of the Diagram
            (this.Nodes as ObservableCollection <CustomNodeVM>).Add(promotion);
            (this.Nodes as ObservableCollection <CustomNodeVM>).Add(lead);
            (this.Nodes as ObservableCollection <CustomNodeVM>).Add(account);
            (this.Nodes as ObservableCollection <CustomNodeVM>).Add(information);
            (this.Nodes as ObservableCollection <CustomNodeVM>).Add(opportunity);
            (this.Nodes as ObservableCollection <CustomNodeVM>).Add(template);

            //Create and add connectors
            CreateConnectors("promotion", "lead1");
            CreateConnectors("lead4", "account1");
            CreateConnectors("lead2", "information1");
            CreateConnectors("lead3", "opportunity1");
            CreateConnectors("template2", "account2");
            CreateConnectors("template1", "information2");
            CreateConnectors("template3", "opportunity2");
            this.CreateDecoraorsCollection();

            this.SelectedItems = new SelectorViewModel();
            (this.SelectedItems as SelectorViewModel).SelectorConstraints &= ~(SelectorConstraints.QuickCommands);
        }
예제 #19
0
 //The constructor associates the control
 //with the designer action list.
 public AnchorActionList(IComponent component) : base(component)
 {
     this.relatedControl = component as DemoControl;
 }