Inheritance: UIView, ICanvasRenderer
Example #1
0
        void AddChild(Node node)
        {
            if (ParentHandles(node))
            {
                return;
            }

            if (node.Renderer == null)
            {
                NodeUIView view = ViewForNode(node);
                node.Renderer = view;

                if (node.Parent != null)
                {
                    NodeUIView parentView = node.Parent.Renderer as NodeUIView;
                    parentView.AddSubview(view);
                }
                else
                {
                    AddSubview(view);
                }
            }
            else
            {
                Console.Error.WriteLine("Potential node double add");
            }

            if (node.Children != null)
            {
                foreach (Node child in node.Children)
                {
                    AddChild(child);
                }
            }
        }
Example #2
0
        public NodeTouchEvent(NodeUIView parent, UIPanGestureRecognizer pan)
        {
            switch (pan.State)
            {
            case UIGestureRecognizerState.Began:
                type = TouchType.Down;
                break;

            case UIGestureRecognizerState.Changed:
                type = TouchType.Move;
                break;

            case UIGestureRecognizerState.Ended:
                type = TouchType.Up;
                break;

            case UIGestureRecognizerState.Possible:
            case UIGestureRecognizerState.Cancelled:
            case UIGestureRecognizerState.Failed:
                break;
            }

            var p = pan.LocationInView(parent);

            point = new Point(p.X, p.Y);

            var velo = pan.VelocityInView(parent);

            velocity = new Vec2(velo.X / 1000, velo.Y / 1000);
        }
Example #3
0
 void RemoveChild(Node node)
 {
     if (node.Renderer != null)
     {
         NodeUIView view = node.Renderer as NodeUIView;
         view.RemoveFromSuperview();
     }
 }
Example #4
0
        public NodeTouchEvent(NodeUIView parent, UIPanGestureRecognizer pan)
        {
            switch (pan.State) {
            case UIGestureRecognizerState.Began:
                type = TouchType.Down;
                break;
            case UIGestureRecognizerState.Changed:
                type = TouchType.Move;
                break;
            case UIGestureRecognizerState.Ended:
                type = TouchType.Up;
                break;
            case UIGestureRecognizerState.Possible:
            case UIGestureRecognizerState.Cancelled:
            case UIGestureRecognizerState.Failed:
                break;
            }

            var p = pan.LocationInView (parent);
            point = new Point (p.X, p.Y);

            var velo = pan.VelocityInView (parent);
            velocity = new Vec2 (velo.X / 1000, velo.Y / 1000);
        }