//! Заполняет граф диалога нужными узлами
        void fillDialogGraphView(CDialog root)
        {
            // Initialize, and create a layer for the edges (always underneath the nodes)
            this.DialogShower.Layer.RemoveAllChildren();
            nodeLayer = new PNodeList();
            edgeLayer = new PLayer();

            this.DialogShower.Root.AddChild(edgeLayer);
            this.DialogShower.Camera.AddLayer(0, edgeLayer);

            // Show root node
            float rootx    = (float)(this.ClientSize.Width / 5);
            float rooty    = (float)(this.ClientSize.Height / 5);
            SizeF size     = CalcEllipsisSizeForNode(root.DialogID);
            PNode rootNode = PPath.CreateEllipse(rootx, rooty, size.Width, size.Height);

            rootNode.Brush = Brushes.Green;

            PText rootText = new PText(root.DialogID.ToString());

            rootText.Pickable = false;
            rootText.X        = rootNode.X + 15;
            rootText.Y        = rootNode.Y + 10;
            rootNode.Tag      = new ArrayList();

            //          ((ArrayList)rootNode.Tag).Add(root.DialogID);
            rootNode.AddChild(rootText);
            nodeLayer.Add(rootNode);
            if (!graphs.Keys.Contains(rootNode))
            {
                graphs.Add(rootNode, new GraphProperties(root.DialogID));
            }
            this.fillDialogSubgraphView(root, rootNode, 1, ref edgeLayer, ref nodeLayer, false);//, rootNode, edgeLayer);
            this.DialogShower.Layer.AddChildren(nodeLayer);
        }
Beispiel #2
0
        public override void Initialize()
        {
            PCanvas canvas = Canvas;

            PPath circle = PPath.CreateEllipse(0, 0, 100, 100);

            circle.Pen   = new Pen(Color.Yellow, 10);
            circle.Brush = Brushes.Yellow;

            PPath rectangle = PPath.CreateRectangle(-100, -50, 100, 100);

            rectangle.Pen   = new Pen(Color.Orange, 15);
            rectangle.Brush = Brushes.Orange;

            PNodeCache cache = new PNodeCache();

            cache.AddChild(circle);
            cache.AddChild(rectangle);

            cache.InvalidateCache();

            canvas.Layer.AddChild(cache);
            canvas.RemoveInputEventListener(canvas.PanEventHandler);
            canvas.AddInputEventListener(new PDragEventHandler());
        }
Beispiel #3
0
        public override void Initialize()
        {
            PPath n1 = PPath.CreateRectangle(0, 0, 100, 80);
            PPath n2 = PPath.CreateEllipse(100, 100, 200, 34);
            PPath n3 = new PPath();

            n3.AddLine(0, 0, 20, 40);
            n3.AddLine(20, 40, 10, 200);
            n3.AddLine(10, 200, 155.444f, 33.232f);
            n3.CloseFigure();
            n3.Brush = Color.Yellow;

            n1.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Red, 5);
            n2.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Black, 0); //Fixed width stroke
            n3.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Black, 0); //Fixed width stroke

            Canvas.Layer.AddChild(n1);
            Canvas.Layer.AddChild(n2);
            Canvas.Layer.AddChild(n3);

            // create a set of bounds handles for reshaping n3, and make them
            // sticky relative to the getCanvas().getCamera().
            PStickyHandleManager sm = new PStickyHandleManager(Canvas.Camera, n3);

            Canvas.RemoveInputEventListener(Canvas.PanEventHandler);
            Canvas.AddInputEventListener(new PDragEventHandler());
        }
Beispiel #4
0
        public Sector(PLayer layer, String name)
        {
            Random rnd      = new Random((int)DateTime.Now.Ticks); // seeded with ticks
            Color  penColor = Color.FromArgb((rnd.Next(0, 255)), (rnd.Next(0, 255)), (rnd.Next(0, 255)));

            Pen sigPen = new Pen(penColor, 2.0F);

            sigPen.DashStyle = DashStyle.DashDotDot;

            PPath sigCircle = PPath.CreateEllipse(100, 500, 100, 100);

            sigCircle.Pen   = sigPen;
            sigCircle.Brush = Brushes.Transparent;

            PText pname = new PText(name);

            pname.TextBrush     = Brushes.White;
            pname.TextAlignment = StringAlignment.Center;
            pname.X             = sigCircle.X;
            pname.Y             = sigCircle.Y;

            //Display Object by adding them to its layer
            layer.AddChild(pname);
            layer.AddChild(sigCircle);
        }
Beispiel #5
0
        public SplinePoint0Node(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            string         s          = export.ObjectName;
            StructProperty splineInfo = export.GetProperty <StructProperty>("SplineInfo");

            if (splineInfo != null)
            {
                ArrayProperty <StructProperty> pointsProp = splineInfo.GetProp <ArrayProperty <StructProperty> >("Points");
                StructProperty point0 = pointsProp[0];
                StructProperty point1 = pointsProp[1];
                a    = PathfindingEditor.GetVector2(point0.GetProp <StructProperty>("OutVal"));
                tan1 = PathfindingEditor.GetVector2(point0.GetProp <StructProperty>("LeaveTangent"));
                tan2 = PathfindingEditor.GetVector2(point1.GetProp <StructProperty>("ArriveTangent"));
                d    = PathfindingEditor.GetVector2(point1.GetProp <StructProperty>("OutVal"));
                // = getType(s);
                float w = 25;
                float h = 25;
                shape          = PPath.CreateEllipse(0, 0, w, h);
                outlinePen     = new Pen(color);
                shape.Pen      = outlinePen;
                shape.Brush    = pathfindingNodeBrush;
                shape.Pickable = false;
                this.AddChild(shape);
                this.Bounds       = new RectangleF(0, 0, w, h);
                val               = new SText(export.Index + "\nSpline Start");
                val.Pickable      = false;
                val.TextAlignment = StringAlignment.Center;
                val.X             = w / 2 - val.Width / 2;
                val.Y             = h / 2 - val.Height / 2;
                this.AddChild(val);
                var props = export.GetProperties();
                this.TranslateBy(x, y);
            }
        }
Beispiel #6
0
        public SplinePoint1Node(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            string s = export.ObjectName;

            // = getType(s);
            float w = 20;
            float h = 20;

            shape          = PPath.CreateEllipse(0, 0, w, h);
            outlinePen     = new Pen(color);
            shape.Pen      = outlinePen;
            shape.Brush    = pathfindingNodeBrush;
            shape.Pickable = false;
            this.AddChild(shape);
            this.Bounds       = new RectangleF(0, 0, w, h);
            val               = new SText(export.Index + "\nSpline End");
            val.Pickable      = false;
            val.TextAlignment = StringAlignment.Center;
            val.X             = w / 2 - val.Width / 2;
            val.Y             = h / 2 - val.Height / 2;
            this.AddChild(val);
            var props = export.GetProperties();

            this.TranslateBy(x, y);
        }
        public Starbase(PLayer layer, String name, float x, float y, float sigRadius, float rrRadius)
        {
            float sigDia = (sigRadius * 2) / 100;
            float rrDia  = (rrRadius * 2) / 100;

            string dataDirectory = "Images";
            string filePath      = Path.Combine("..", "..");

            if (File.Exists(Path.Combine(dataDirectory, "stations.gif")))
            {
                filePath = "";
            }

            Image  image        = Image.FromFile(Path.Combine(filePath, Path.Combine(dataDirectory, "stations.gif")));
            PImage stationImage = new PImage(image);

            stationImage.X = (x - (image.Width / 2)) / 100;
            stationImage.Y = (y - (image.Height / 2)) / 100;

            float sigX = (x / 100) - ((sigDia / 2) - (image.Width / 2));
            float sigY = (y / 100) - ((sigDia / 2) - (image.Height / 2));
            float rrX  = (x / 100) - ((rrDia / 2) - (image.Width / 2));
            float rrY  = (y / 100) - ((rrDia / 2) - (image.Height / 2));

            Pen sigPen = new Pen(Color.Yellow, 2.0F);

            sigPen.DashStyle = DashStyle.DashDotDot;
            Pen rrPen = new Pen(Color.LightGoldenrodYellow, 1.0F);

            PPath sigCircle = PPath.CreateEllipse(sigX, sigY, sigDia, sigDia);

            sigCircle.Pen = sigPen;
            PPath rrCircle = PPath.CreateEllipse(rrX, rrY, rrDia, rrDia);

            rrCircle.Pen = rrPen;

            PNode sigNode = sigCircle;

            sigNode.Brush = Brushes.Transparent;

            PNode rrNode = rrCircle;

            rrNode.Brush = Brushes.Transparent;

            PText pname = new PText(name);

            pname.TextBrush     = Brushes.White;
            pname.TextAlignment = StringAlignment.Center;
            pname.X             = (x / 100) - (pname.Width / 2);
            pname.Y             = (y / 100) - 20;

            stationImage.AddChild(sigNode);
            stationImage.AddChild(rrNode);
            stationImage.AddChild(pname);

            //Display Object by adding them to its layer
            layer.AddChild(stationImage);
        }
        public GraphEditor(int width, int height)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            this.Size = new Size(width, height);
            int numNodes = 50;
            int numEdges = 50;

            // Initialize, and create a layer for the edges (always underneath the nodes)
            PLayer nodeLayer = this.Layer;
            PLayer edgeLayer = new PLayer();

            Root.AddChild(edgeLayer);
            this.Camera.AddLayer(0, edgeLayer);
            Random rnd = new Random();

            // Create some random nodes
            // Each node's Tag has an ArrayList used to store associated edges
            for (int i = 0; i < numNodes; i++)
            {
                float x    = (float)(this.ClientSize.Width * rnd.NextDouble());
                float y    = (float)(this.ClientSize.Height * rnd.NextDouble());
                PPath path = PPath.CreateEllipse(x, y, 20, 20);
                path.Tag = new ArrayList();
                nodeLayer.AddChild(path);
            }

            // Create some random edges
            // Each edge's Tag has an ArrayList used to store associated nodes
            for (int i = 0; i < numEdges; i++)
            {
                int n1 = rnd.Next(numNodes);
                int n2 = n1;
                while (n2 == n1)
                {
                    n2 = rnd.Next(numNodes);                      // Make sure we have two distinct nodes.
                }

                PNode node1 = nodeLayer[n1];
                PNode node2 = nodeLayer[n2];
                PPath edge  = new PPath();
                ((ArrayList)node1.Tag).Add(edge);
                ((ArrayList)node2.Tag).Add(edge);
                edge.Tag = new ArrayList();
                ((ArrayList)edge.Tag).Add(node1);
                ((ArrayList)edge.Tag).Add(node2);
                edgeLayer.AddChild(edge);
                UpdateEdge(edge);
            }

            // Create event handler to move nodes and update edges
            nodeLayer.AddInputEventListener(new NodeDragHandler());
        }
        public override void Initialize()
        {
            Canvas.RemoveInputEventListener(Canvas.PanEventHandler);

            // Create a decorator group that is NOT volatile
            DecoratorGroup dg = new DecoratorGroup();

            dg.Brush = Brushes.Magenta;

            // Put some nodes under the group for it to decorate
            PPath p1 = PPath.CreateEllipse(25, 25, 75, 75);

            p1.Brush = Brushes.Red;
            PPath p2 = PPath.CreateRectangle(125, 75, 50, 50);

            p2.Brush = Brushes.Blue;

            // Add everything to the Piccolo hierarchy
            dg.AddChild(p1);
            dg.AddChild(p2);
            Canvas.Layer.AddChild(dg);

            // Create a decorator group that IS volatile
            VolatileDecoratorGroup vdg = new VolatileDecoratorGroup(Canvas.Camera);

            vdg.Brush = Brushes.Cyan;

            // Put some nodes under the group for it to decorate
            PPath p3 = PPath.CreateEllipse(275, 175, 50, 50);

            p3.Brush = Brushes.Blue;
            PPath p4 = PPath.CreateRectangle(175, 175, 75, 75);

            p4.Brush = Brushes.Green;

            // Add everything to the Piccolo hierarchy
            vdg.AddChild(p3);
            vdg.AddChild(p4);
            Canvas.Layer.AddChild(vdg);

            // Create a selection handler so we can see that the decorator actually works
            PNodeList selectableParents = new PNodeList();

            selectableParents.Add(dg);
            selectableParents.Add(vdg);

            PSelectionEventHandler ps = new PSelectionEventHandler(Canvas.Layer, selectableParents);

            Canvas.AddInputEventListener(ps);
        }
        // So far we have just been using PNode, but of course PNode has many
        // subclasses that you can try out to.
        public void CreateNodeUsingExistingClasses()
        {
            PLayer layer = Canvas.Layer;

            layer.AddChild(PPath.CreateEllipse(0, 0, 100, 100));
            layer.AddChild(PPath.CreateRectangle(0, 100, 100, 100));
            layer.AddChild(new PText("Hello World"));

            // Here we create an image node that displays a thumbnail
            // image of the root node. Note that you can easily get a thumbnail
            // of any node by using PNode.ToImage().
            PImage image = new PImage(layer.ToImage(300, 300, Color.Transparent));

            layer.AddChild(image);
        }
Beispiel #11
0
        public SplinePointControlNode(SplineActorNode actor, float x, float y, float z, SplineActorNode.UpdateMode updateMode)
        {
            UpdateMode  = updateMode;
            Z           = z;
            splineActor = actor;
            const float w     = 15;
            const float h     = 15;
            PPath       shape = PPath.CreateEllipse(0, 0, w, h);

            shape.Pen      = new Pen(color);
            shape.Brush    = PathfindingNodeMaster.pathfindingNodeBrush;
            shape.Pickable = false;
            AddChild(shape);
            Bounds = new RectangleF(0, 0, w, h);

            TranslateBy(x, y);
        }
        public override void Initialize()
        {
            Canvas.PanEventHandler = null;
            Canvas.AddInputEventListener(new PDragEventHandler());

            node1         = PPath.CreateEllipse(0, 0, 100, 100);
            node2         = PPath.CreateEllipse(0, 0, 100, 100);
            link          = PPath.CreateLine(50, 50, 50, 50);
            link.Pickable = false;
            Canvas.Layer.AddChild(node1);
            Canvas.Layer.AddChild(node2);
            Canvas.Layer.AddChild(link);

            node2.TranslateBy(200, 200);

            node1.FullBoundsChanged += new PPropertyEventHandler(node1_FullBoundsChanged);
            node2.FullBoundsChanged += new PPropertyEventHandler(node2_FullBoundsChanged);
        }
        public override void Initialize()
        {
            AutoScrollCanvas = true;
            windowSD         = ScrollControl.ScrollDirector;
            documentSD       = new DocumentScrollDirector();

            ToolBar       toolBar     = new ToolBar();
            ToolBarButton btnWindow   = new ToolBarButton(WINDOW_LABEL);
            ToolBarButton btnDocument = new ToolBarButton(DOCUMENT_LABEL);

            toolBar.Buttons.Add(btnWindow);
            toolBar.Buttons.Add(btnDocument);
            toolBar.ButtonClick += new ToolBarButtonClickEventHandler(toolBar_ButtonClick);
            this.Controls.Add(toolBar);

            ScrollControl.Bounds = new Rectangle(ClientRectangle.X, toolBar.Bottom, ScrollControl.Width, ScrollControl.Height - toolBar.Height);

            // Make some rectangles on the surface so we can see where we are
            for (int x = 0; x < 20; x++)
            {
                for (int y = 0; y < 20; y++)
                {
                    if (((x + y) % 2) == 0)
                    {
                        PPath path = PPath.CreateRectangle(50 * x, 50 * y, 40, 40);
                        path.Brush = Brushes.Blue;
                        path.Pen   = Pens.Black;
                        Canvas.Layer.AddChild(path);
                    }
                    else if (((x + y) % 2) == 1)
                    {
                        PPath path = PPath.CreateEllipse(50 * x, 50 * y, 40, 40);
                        path.Brush = Brushes.Blue;
                        path.Pen   = Pens.Black;
                        Canvas.Layer.AddChild(path);
                    }
                }
            }
        }
Beispiel #14
0
        public override void Initialize()
        {
            PLayer l = new PLayer();
            PPath  n = PPath.CreateEllipse(0, 0, 100, 80);

            n.Brush = Brushes.Red;
            n.Pen   = null;
            PBoundsHandle.AddBoundsHandlesTo(n);
            l.AddChild(n);
            n.TranslateBy(200, 200);

            PCamera c = new PCamera();

            c.SetBounds(0, 0, 100, 80);
            c.ScaleViewBy(0.1f);
            c.AddLayer(l);
            PBoundsHandle.AddBoundsHandlesTo(c);
            c.Brush = Brushes.Yellow;

            Canvas.Layer.AddChild(l);
            Canvas.Layer.AddChild(c);
        }
        public override void Initialize()
        {
            PComposite composite = new PComposite();

            PNode circle    = PPath.CreateEllipse(0, 0, 100, 100);
            PNode rectangle = PPath.CreateRectangle(50, 50, 100, 100);
            PNode text      = new PText("Hello world!");

            composite.AddChild(circle);
            composite.AddChild(rectangle);
            composite.AddChild(text);

            rectangle.RotateBy(45);
            rectangle.Brush = Color.Red;

            text.ScaleBy(2.0f);
            text.Brush = Color.Green;

            Canvas.Layer.AddChild(composite);
            Canvas.RemoveInputEventListener(Canvas.PanEventHandler);
            Canvas.AddInputEventListener(new PDragEventHandler());
        }
Beispiel #16
0
        public SectorSprite(PLayer layer, PropertyGrid pg, DataRow r, String name, float galaxy_x, float galaxy_y, float xmin, float xmax, float ymin, float ymax)
        {
            _pg = pg;
            dr  = r;

            setupData(r);

            float width  = (xmax - xmin) / 1000;
            float height = (ymax - ymin) / 1000;

            Color penColor = Color.Honeydew;

            Pen sigPen = new Pen(penColor, 2.0F);

            sigPen.DashStyle = DashStyle.Dash;

            PPath sigCircle = PPath.CreateEllipse(galaxy_x, galaxy_y, width, width);

            sigCircle.Pen   = sigPen;
            sigCircle.Brush = Brushes.Transparent;

            pname               = new PText(name);
            pname.TextBrush     = Brushes.White;
            pname.TextAlignment = StringAlignment.Center;
            pname.X             = sigCircle.X + ((sigCircle.Width / 2) - (pname.Width / 2));
            pname.Y             = sigCircle.Y + (sigCircle.Height / 2);

            sigCircle.Tag = this;

            //Display Object by adding them to its layer
            sigCircle.AddChild(pname);
            layer.AddChild(sigCircle);

            sigCircle.ChildrenPickable = false;

            // Attach event delegates directly to the node.
            sigCircle.MouseDown += new PInputEventHandler(Image_MouseDown);
        }
        public override void Initialize()
        {
            PNode n1 = PPath.CreateEllipse(0, 0, 100, 100);
            PNode n2 = PPath.CreateRectangle(300, 200, 100, 100);

            n1.Tag = "node 1";
            n2.Tag = "node 2";
            Canvas.Layer.AddChild(n1);
            Canvas.Layer.AddChild(n2);

            PCamera camera = Canvas.Camera;

            tooltipNode = new PText();

            tooltipNode.Pickable = false;
            camera.AddChild(tooltipNode);

            PBasicInputEventHandler tipEventHandler = new PBasicInputEventHandler();

            tipEventHandler.MouseMove = new MouseMoveDelegate(MouseMoveHandler);
            tipEventHandler.MouseDrag = new MouseDragDelegate(MouseDragHandler);
            camera.AddInputEventListener(tipEventHandler);
        }
        // Here a new "face" node is created. But instead of drawing the face directly
        // using Graphics we compose the face from other nodes.
        public void ComposeOtherNodes()
        {
            PNode myCompositeFace = PPath.CreateRectangle(0, 0, 100, 80);

            // create parts for the face.
            PNode eye1 = PPath.CreateEllipse(0, 0, 20, 20);

            eye1.Brush = Color.Yellow;
            PNode eye2  = (PNode)eye1.Clone();
            PNode mouth = PPath.CreateRectangle(0, 0, 40, 20);

            mouth.Brush = Color.Black;

            // add the face parts
            myCompositeFace.AddChild(eye1);
            myCompositeFace.AddChild(eye2);
            myCompositeFace.AddChild(mouth);

            // don't want anyone grabbing out our eye's.
            myCompositeFace.ChildrenPickable = false;

            // position the face parts.
            eye2.TranslateBy(25, 0);
            mouth.TranslateBy(0, 30);

            // set the face bounds so that it neatly contains the face parts.
            RectangleFx b = myCompositeFace.UnionOfChildrenBounds;

            b.Inflate(5, 5);
            myCompositeFace.Bounds = b;

            // opps it to small, so scale it up.
            myCompositeFace.ScaleBy(1.5f);

            Canvas.Layer.AddChild(myCompositeFace);
        }
Beispiel #19
0
        public BioStartLocation(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            string s = export.ObjectName;

            // = getType(s);
            float w = 50;
            float h = 50;

            shape          = PPath.CreateEllipse(0, 10, w, h - 10);
            outlinePen     = new Pen(color);
            shape.Pen      = outlinePen;
            shape.Brush    = actorNodeBrush;
            shape.Pickable = false;
            this.AddChild(shape);
            this.Bounds       = new RectangleF(0, 0, w, h);
            val               = new SText(idx.ToString());
            val.Pickable      = false;
            val.TextAlignment = StringAlignment.Center;
            val.X             = w / 2 - val.Width / 2;
            val.Y             = h / 2 - val.Height / 2;
            this.AddChild(val);
            this.TranslateBy(x, y);
        }
        //! @brief Отображает все дочерние узлы на графе диалогов
        //! @param root Старший диалог, экземпляр CDialog
        //! @param rootNode Старший узел, экземпляр PNode
        //! @param level Уровень наследования узлов
        //! @param edgeLayer
        //! @param nodeLayer
        //! @param stopAfterThat
        void fillDialogSubgraphView(CDialog root, PNode rootNode, float level, ref PLayer edgeLayer, ref PNodeList nodeLayer, bool stopAfterThat)//, PLayer main,  PLayer edge)
        {
            float ix         = rootNode.X;
            float iy         = rootNode.Y;
            float i          = 1;//Number of elements in string
            float localLevel = level;

            //System.Console.WriteLine("dialogID:" + root.DialogID + " toDialog:" + root.Actions.ToDialog);
            if (root.Actions.ToDialog != 0)
            {
                //System.Console.WriteLine("To dialog ID:"+root.Actions.ToDialog+" of "+root.DialogID);
                PNode toDialogNode = getNodeOnDialogID(root.Actions.ToDialog);

                if (toDialogNode == null)
                {
                    System.Console.WriteLine("Node is miss.");
                }
                else
                {
                    PPath edge = new PPath();
                    edge.Pickable = false;
                    ((ArrayList)toDialogNode.Tag).Add(edge);
                    ((ArrayList)rootNode.Tag).Add(edge);
                    edge.Tag = new ArrayList();
                    ((ArrayList)edge.Tag).Add(toDialogNode);
                    ((ArrayList)edge.Tag).Add(rootNode);
                    edgeLayer.AddChild(edge);
                    updateEdge(edge);
                    nodeLayer.Add(toDialogNode);
                    if (!stopAfterThat)
                    {
                        if (!isRoot(root.Actions.ToDialog))
                        {
                            if (this.dialogs.dialogs[currentNPC][root.Actions.ToDialog].Nodes.Any())
                            {
                                localLevel++;
                                this.fillDialogSubgraphView(this.dialogs.dialogs[currentNPC][root.Actions.ToDialog], toDialogNode, localLevel, ref edgeLayer, ref nodeLayer, false);
                            }
                            else if (this.dialogs.dialogs[currentNPC][root.Actions.ToDialog].Actions.ToDialog != 0)
                            {
                                this.fillDialogSubgraphView(this.dialogs.dialogs[currentNPC][root.Actions.ToDialog], toDialogNode, localLevel, ref edgeLayer, ref nodeLayer, true);
                            }
                        }
                    }
                }
            }
            else
            {
                foreach (int subdialogs in root.Nodes)
                {
                    PNode node = getNodeOnDialogID(subdialogs);

                    i++;
                    float x = (float)(ix) + (120 * i) - 40 * root.Nodes.Count - 100 * level;
                    float y = (float)(iy + 60) + 100 * level;

                    if (node == null)
                    {
                        SizeF size = CalcEllipsisSizeForNode(subdialogs);
                        node = PPath.CreateEllipse(x, y, size.Width, size.Height);
                        PText text = new PText(subdialogs.ToString());
                        text.Pickable = false;
                        text.X        = node.X + 15;
                        text.Y        = node.Y + 10;
                        node.Tag      = new ArrayList();
                        //((CMainDialog)node).DialogID = subdialogs;
                        //((ArrayList)node.Tag).Add(subdialogs);
                        node.AddChild(text);
                    }

                    PPath edge = new PPath();
                    edge.Pickable = false;
                    ((ArrayList)node.Tag).Add(edge);
                    ((ArrayList)rootNode.Tag).Add(edge);
                    edge.Tag = new ArrayList();
                    ((ArrayList)edge.Tag).Add(node);
                    ((ArrayList)edge.Tag).Add(rootNode);
                    edgeLayer.AddChild(edge);
                    updateEdge(edge);
                    nodeLayer.Add(node);
                    if (!graphs.Keys.Contains(node))
                    {
                        graphs.Add(node, new GraphProperties(subdialogs));
                    }
                    if (!stopAfterThat)
                    {
                        if (this.dialogs.dialogs[currentNPC][subdialogs].Nodes.Any())
                        {
                            localLevel++;
                            this.fillDialogSubgraphView(this.dialogs.dialogs[currentNPC][subdialogs], node, localLevel, ref edgeLayer, ref nodeLayer, false);
                        }
                        else if (this.dialogs.dialogs[currentNPC][subdialogs].Actions.ToDialog != 0)
                        {
                            this.fillDialogSubgraphView(this.dialogs.dialogs[currentNPC][subdialogs], node, localLevel, ref edgeLayer, ref nodeLayer, true);
                        }
                    }
                }
            }
        }
        public StargateSprite(PLayer layer, DataRow r, PropertyGrid pg, DataGridView dgv)
        {
            _pg = pg;
            setupData(r);
            dr     = r;
            _layer = layer;
            _dgv   = dgv;

            String name             = r["name"].ToString();
            float  x                = float.Parse(r["position_x"].ToString());
            float  y                = -(float.Parse(r["position_y"].ToString()));
            float  sigRadius        = float.Parse(r["signature"].ToString());
            float  rrRadius         = float.Parse(r["radar_range"].ToString());
            float  ExplorationRange = float.Parse(r["exploration_range"].ToString());

            appearsInRadar = (Boolean)r["appears_in_radar"];
            int  navType         = int.Parse(r["nav_type"].ToString());
            bool isClassSpecific = (Boolean)r["classSpecific"];
            int  factionID       = int.Parse(r["faction_id"].ToString());

            float sigDia = (sigRadius * 2) / 100;
            float rrDia  = (rrRadius * 2) / 100;
            float expDia = (ExplorationRange * 2) / 100;

            if (sigDia == 0)
            {
                sigDia = 5;
            }
            if (rrDia == 0)
            {
                rrDia = 5;
            }
            if (expDia == 0)
            {
                expDia = 5;
            }

            string dataDirectory = "Images";
            string filePath      = Path.Combine("..", "..");
            string imageName     = null;

            if (appearsInRadar == true)
            {
                imageName = "standardGate.gif";
            }
            else
            {
                imageName = "hiddenGate.gif";
            }

            if (isClassSpecific == true)
            {
                imageName = "classSpecificGate.gif";
            }

            if (factionID != -1)
            {
                imageName = "FactionSpecificGate.gif";
            }

            if (File.Exists(Path.Combine(dataDirectory, imageName)))
            {
                filePath = "";
            }

            Image image = Image.FromFile(Path.Combine(filePath, Path.Combine(dataDirectory, imageName)));

            stargateImage   = new PImage(image);
            stargateImage.X = (x - (image.Width / 2)) / 100;
            stargateImage.Y = (y - (image.Height / 2)) / 100;

            float sigX = (x / 100) - ((sigDia / 2) - (image.Width / 2));
            float sigY = (y / 100) - ((sigDia / 2) - (image.Height / 2));
            float rrX  = (x / 100) - ((rrDia / 2) - (image.Width / 2));
            float rrY  = (y / 100) - ((rrDia / 2) - (image.Height / 2));
            float expX = (x / 100) - ((expDia / 2) - (image.Width / 2));
            float expY = (y / 100) - ((expDia / 2) - (image.Height / 2));

            Pen sigPen = new Pen(Color.ForestGreen, 3.0F);
            Pen rrPen  = new Pen(Color.GreenYellow, 2.0F);

            rrPen.DashStyle = DashStyle.Dash;
            Pen expPen = new Pen(Color.LightGreen, 1.0F);

            expPen.DashStyle = DashStyle.DashDotDot;

            PPath sigCircle = PPath.CreateEllipse(sigX, sigY, sigDia, sigDia);

            sigCircle.Pen = sigPen;
            PPath rrCircle = PPath.CreateEllipse(rrX, rrY, rrDia, rrDia);

            rrCircle.Pen = rrPen;
            PPath expCircle = PPath.CreateEllipse(expX, expY, expDia, expDia);

            expCircle.Pen = expPen;

            PNode sigNode = sigCircle;

            sigNode.Brush = Brushes.Transparent;

            PNode rrNode = rrCircle;

            rrNode.Brush = Brushes.Transparent;

            PNode expNode = expCircle;

            expNode.Brush = Brushes.Transparent;

            pname               = new PText(name);
            pname.TextBrush     = Brushes.White;
            pname.TextAlignment = StringAlignment.Center;
            pname.X             = (x / 100) - (pname.Width / 2);
            pname.Y             = (y / 100) - 20;

            stargateImage.AddChild(sigNode);
            stargateImage.AddChild(rrNode);
            stargateImage.AddChild(expNode);
            stargateImage.AddChild(pname);

            //Add placeholder nodes for nav_type visualization lookup.
            for (int i = 0; i < navType; i++)
            {
                stargateImage.AddChild(new PNode());
            }

            stargateImage.ChildrenPickable = false;

            //Set the tag to this class for information retrieval later.
            stargateImage.Tag = this;

            // Attach event delegates directly to the node.
            stargateImage.MouseDown += new PInputEventHandler(Image_MouseDown);
            stargateImage.MouseUp   += new PInputEventHandler(Image_MouseUp);
            stargateImage.MouseDrag += new PInputEventHandler(Image_MouseDrag);

            //Display Object by adding them to its layer
            layer.AddChild(stargateImage);
        }
Beispiel #22
0
        public void SetShape(bool polygon, bool cylinder = false)
        {
            if (shape != null)
            {
                RemoveChild(shape);
            }
            bool addVal = val == null;

            if (val == null)
            {
                val = new SText(index.ToString())
                {
                    Pickable      = false,
                    TextAlignment = StringAlignment.Center
                };
            }

            ShowAsPolygon  = polygon;
            ShowAsCylinder = cylinder;
            outlinePen     = new Pen(GetDefaultShapeColor()); //Can't put this in a class variable becuase it doesn't seem to work for some reason.
            if (polygon)
            {
                PointF[] polygonShape     = get3DBrushShape();
                int      calculatedHeight = get3DBrushHeight();
                if (polygonShape != null)
                {
                    shape = PPath.CreatePolygon(polygonShape);
                    var AveragePoint = GetAveragePoint(polygonShape);
                    val.X = AveragePoint.X - val.Width / 2;
                    val.Y = AveragePoint.Y - val.Height / 2;
                    if (calculatedHeight >= 0)
                    {
                        SText brushText = new SText($"Brush total height: {calculatedHeight}");
                        brushText.X             = AveragePoint.X - brushText.Width / 2;
                        brushText.Y             = AveragePoint.Y + 20 - brushText.Height / 2;
                        brushText.Pickable      = false;
                        brushText.TextAlignment = StringAlignment.Center;
                        shape.AddChild(brushText);
                    }
                    shape.Pen      = Selected ? selectedPen : outlinePen;
                    shape.Brush    = actorNodeBrush;
                    shape.Pickable = false;
                }
                else
                {
                    SetDefaultShape();
                }
            }
            else if (cylinder)
            {
                Tuple <float, float, float> dimensions = getCylinderDimensions();
                if (dimensions != null)
                {
                    var cylinderX = this.X - dimensions.Item1;
                    var cylinderY = this.Y - dimensions.Item2;
                    shape = PPath.CreateEllipse(cylinderX, cylinderY, dimensions.Item1 * 2, dimensions.Item2 * 2);
                    if (dimensions.Item3 >= 0)
                    {
                        SText heightText = new SText($"Cylinder total height: {dimensions.Item3}");
                        var   tw         = heightText.Width / 2;
                        var   th         = heightText.Height / 2;
                        heightText.X             = this.X - tw;
                        heightText.Y             = this.Y - th;
                        heightText.Pickable      = false;
                        heightText.TextAlignment = StringAlignment.Center;
                        shape.AddChild(heightText);
                    }
                    shape.Pen      = Selected ? selectedPen : outlinePen;
                    shape.Brush    = new SolidBrush(Color.FromArgb(80, 80, 0, 0));
                    shape.Pickable = false;
                }
                else
                {
                    SetDefaultShape();
                }
            }
            else
            {
                SetDefaultShape();
            }
            AddChild(0, shape);
            if (addVal)
            {
                AddChild(val);
            }
        }
Beispiel #23
0
        public MobSprite(PLayer layer, DataRow r, PropertyGrid pg, DataGridView dgv)
        {
            _pg = pg;
            setupData(r);
            dr     = r;
            _layer = layer;
            _dgv   = dgv;

            String name             = r["name"].ToString();
            float  x                = float.Parse(r["position_x"].ToString());
            float  y                = -(float.Parse(r["position_y"].ToString()));
            float  sigRadius        = float.Parse(r["signature"].ToString());
            float  rrRadius         = float.Parse(r["radar_range"].ToString());
            float  ExplorationRange = float.Parse(r["exploration_range"].ToString());

            appearsInRadar = (Boolean)r["appears_in_radar"];
            int   navType     = int.Parse(r["nav_type"].ToString());
            float SpawnRadius = float.Parse(r["mob_spawn_radius"].ToString());


            float sigDia   = (sigRadius * 2) / 100;
            float rrDia    = (rrRadius * 2) / 100;
            float expDia   = (ExplorationRange * 2) / 100;
            float spawnDia = (SpawnRadius * 2) / 100;

            if (sigDia == 0)
            {
                sigDia = 5;
            }
            if (rrDia == 0)
            {
                rrDia = 5;
            }
            if (expDia == 0)
            {
                expDia = 5;
            }
            if (spawnDia == 0)
            {
                spawnDia = 5;
            }

            string dataDirectory = "Images";
            string filePath      = Path.Combine("..", "..");

            if (File.Exists(Path.Combine(dataDirectory, "hostileMob.gif")))
            {
                filePath = "";
            }

            Image image = Image.FromFile(Path.Combine(filePath, Path.Combine(dataDirectory, "hostileMob.gif")));

            mobImage   = new PImage(image);
            mobImage.X = (x - (image.Width / 2)) / 100;
            mobImage.Y = (y - (image.Height / 2)) / 100;

            float sigX   = (x / 100) - ((sigDia / 2) - (image.Width / 2));
            float sigY   = (y / 100) - ((sigDia / 2) - (image.Height / 2));
            float rrX    = (x / 100) - ((rrDia / 2) - (image.Width / 2));
            float rrY    = (y / 100) - ((rrDia / 2) - (image.Height / 2));
            float expX   = (x / 100) - ((expDia / 2) - (image.Width / 2));
            float expY   = (y / 100) - ((expDia / 2) - (image.Height / 2));
            float spawnX = (x / 100) - ((spawnDia / 2) - (image.Width / 2));
            float spawnY = (y / 100) - ((spawnDia / 2) - (image.Height / 2));

            Pen sigPen = new Pen(Color.Red, 3.0F);
            Pen rrPen  = new Pen(Color.MistyRose, 2.0F);

            rrPen.DashStyle = DashStyle.Dash;
            Pen expPen = new Pen(Color.Maroon, 1.0F);

            expPen.DashStyle = DashStyle.DashDotDot;
            Pen spawnPen = new Pen(Color.Fuchsia, 1.0F);

            spawnPen.DashStyle = DashStyle.Dot;

            PPath sigCircle = PPath.CreateEllipse(sigX, sigY, sigDia, sigDia);

            sigCircle.Pen = sigPen;
            PPath rrCircle = PPath.CreateEllipse(rrX, rrY, rrDia, rrDia);

            rrCircle.Pen = rrPen;
            PPath expCircle = PPath.CreateEllipse(expX, expY, expDia, expDia);

            expCircle.Pen = expPen;
            PPath spawnCircle = PPath.CreateEllipse(spawnX, spawnY, spawnDia, spawnDia);

            spawnCircle.Pen = spawnPen;

            PNode sigNode = sigCircle;

            sigNode.Brush = Brushes.Transparent;

            PNode rrNode = rrCircle;

            rrNode.Brush = Brushes.Transparent;

            PNode expNode = expCircle;

            expNode.Brush = Brushes.Transparent;

            PNode spawnNode = spawnCircle;

            spawnNode.Brush = Brushes.Transparent;

            pname               = new PText(name);
            pname.TextBrush     = Brushes.White;
            pname.TextAlignment = StringAlignment.Center;
            pname.X             = (x / 100) - (pname.Width / 2);
            pname.Y             = (y / 100) - 20;

            mobImage.AddChild(sigNode);
            mobImage.AddChild(rrNode);
            mobImage.AddChild(expNode);
            mobImage.AddChild(pname);

            //Add placeholder nodes for nav_type visualization lookup.
            for (int i = 0; i < navType; i++)
            {
                mobImage.AddChild(new PNode());
            }

            mobImage.AddChild(spawnNode);

            mobImage.ChildrenPickable = false;

            //Set the tag to this class for information retrieval later.
            mobImage.Tag = this;

            // Attach event delegates directly to the node.
            mobImage.MouseDown += new PInputEventHandler(Image_MouseDown);
            mobImage.MouseUp   += new PInputEventHandler(Image_MouseUp);
            mobImage.MouseDrag += new PInputEventHandler(Image_MouseDrag);

            //Display Object by adding them to its layer
            layer.AddChild(mobImage);
        }
        public DecorationSprite(PLayer layer, DataRow r, PropertyGrid pg, DataGridView dgv)
        {
            //Setup all of our property window data
            _pg = pg;
            setupData(r);
            dr     = r;
            _layer = layer;
            _dgv   = dgv;

            //Get our properties from our DataRow.
            String name             = r["name"].ToString();
            float  x                = float.Parse(r["position_x"].ToString());
            float  y                = -(float.Parse(r["position_y"].ToString()));
            float  sigRadius        = float.Parse(r["signature"].ToString());
            float  rrRadius         = float.Parse(r["radar_range"].ToString());
            float  ExplorationRange = float.Parse(r["exploration_range"].ToString());

            appearsInRadar = (Boolean)r["appears_in_radar"];
            int navType = int.Parse(r["nav_type"].ToString());

            float sigDia = (sigRadius * 2) / 100;
            float rrDia  = (rrRadius * 2) / 100;
            float expDia = (ExplorationRange * 2) / 100;

            if (sigDia == 0)
            {
                sigDia = 5;
            }
            if (rrDia == 0)
            {
                rrDia = 5;
            }
            if (expDia == 0)
            {
                expDia = 5;
            }

            //Setup our Image Path's based on our properties
            string dataDirectory = "Images";
            string filePath      = Path.Combine("..", "..");
            string imageName     = null;

            if (appearsInRadar == true)
            {
                imageName = "standardNav.gif";
            }
            else
            {
                imageName = "hiddenNav.gif";
            }

            if (File.Exists(Path.Combine(dataDirectory, imageName)))
            {
                filePath = "";
            }

            //Load our main icon.
            Image image = Image.FromFile(Path.Combine(filePath, Path.Combine(dataDirectory, imageName)));

            decorationImage = new PImage(image);

            //Extrapolate the new position taking into account the image size and scale property.
            decorationImage.X = (x - (image.Width / 2)) / 100;
            decorationImage.Y = (y - (image.Height / 2)) / 100;

            float sigX = (x / 100) - ((sigDia / 2) - (image.Width / 2));
            float sigY = (y / 100) - ((sigDia / 2) - (image.Height / 2));
            float rrX  = (x / 100) - ((rrDia / 2) - (image.Width / 2));
            float rrY  = (y / 100) - ((rrDia / 2) - (image.Height / 2));
            float expX = (x / 100) - ((expDia / 2) - (image.Width / 2));
            float expY = (y / 100) - ((expDia / 2) - (image.Height / 2));

            //Setup the geometry, style and colors of the sprite.
            Pen sigPen = new Pen(Color.DarkSlateGray, 3.0F);
            Pen rrPen  = new Pen(Color.Gray, 2.0F);

            rrPen.DashStyle = DashStyle.Dash;
            Pen expPen = new Pen(Color.LightGray, 1.0F);

            expPen.DashStyle = DashStyle.DashDotDot;

            PPath sigCircle = PPath.CreateEllipse(sigX, sigY, sigDia, sigDia);

            sigCircle.Pen = sigPen;
            PPath rrCircle = PPath.CreateEllipse(rrX, rrY, rrDia, rrDia);

            rrCircle.Pen = rrPen;
            PPath expCircle = PPath.CreateEllipse(expX, expY, expDia, expDia);

            expCircle.Pen = expPen;

            PNode sigNode = sigCircle;

            sigNode.Brush = Brushes.Transparent;

            PNode rrNode = rrCircle;

            rrNode.Brush = Brushes.Transparent;

            PNode expNode = expCircle;

            expNode.Brush = Brushes.Transparent;

            pname               = new PText(name);
            pname.TextBrush     = Brushes.White;
            pname.TextAlignment = StringAlignment.Center;
            pname.X             = (x / 100) - (pname.Width / 2);
            pname.Y             = (y / 100) - 20;

            //Add all the geometry to the image
            decorationImage.AddChild(sigNode);
            decorationImage.AddChild(rrNode);
            decorationImage.AddChild(expNode);
            decorationImage.AddChild(pname);

            //Add placeholder nodes for nav_type visualization lookup.
            for (int i = 0; i < navType; i++)
            {
                decorationImage.AddChild(new PNode());
            }

            //Set all the children of the image non-pickable.
            decorationImage.ChildrenPickable = false;

            //Set the tag to this class for information retrieval later.
            decorationImage.Tag = this;

            // Attach event delegates directly to the node.
            decorationImage.MouseDown += new PInputEventHandler(Image_MouseDown);
            decorationImage.MouseUp   += new PInputEventHandler(Image_MouseUp);
            decorationImage.MouseDrag += new PInputEventHandler(Image_MouseDrag);

            //Display Object by adding them to its layer
            layer.AddChild(decorationImage);
        }
        public HarvestableSprite(PLayer layer, DataRow r, PropertyGrid pg, DataGridView dgv)
        {
            _pg = pg;
            setupData(r);
            dr     = r;
            _layer = layer;
            _dgv   = dgv;

            String name             = r["name"].ToString();
            float  x                = float.Parse(r["position_x"].ToString());
            float  y                = -(float.Parse(r["position_y"].ToString()));
            float  sigRadius        = float.Parse(r["signature"].ToString());
            float  rrRadius         = float.Parse(r["radar_range"].ToString());
            float  ExplorationRange = float.Parse(r["exploration_range"].ToString());

            appearsInRadar = (Boolean)r["appears_in_radar"];
            int    navType = int.Parse(r["nav_type"].ToString());
            string mfrTest = r["max_field_radius"].ToString();
            string srTest  = r["spawn_radius"].ToString();
            float  MaxFieldRadius;
            float  MobSpawnRadius;

            if (mfrTest == "" || srTest == "")
            {
                MaxFieldRadius = 0.0f;
                MobSpawnRadius = 0.0f;
            }
            else
            {
                MaxFieldRadius = float.Parse(r["max_field_radius"].ToString());
                MobSpawnRadius = float.Parse(r["spawn_radius"].ToString());
            }

            int field = 0;

            try
            {
                field = int.Parse(r["field"].ToString());
            }
            catch (Exception)
            {
                field = 0;
            }


            float sigDia   = (sigRadius * 2) / 100;
            float rrDia    = (rrRadius * 2) / 100;
            float expDia   = (ExplorationRange * 2) / 100;
            float spawnDia = (MobSpawnRadius * 2) / 100;
            float fieldDia = (MaxFieldRadius * 2) / 100;

            if (sigDia == 0)
            {
                sigDia = 5;
            }
            if (rrDia == 0)
            {
                rrDia = 5;
            }
            if (expDia == 0)
            {
                expDia = 5;
            }
            if (spawnDia == 0)
            {
                spawnDia = 5;
            }
            if (fieldDia == 0)
            {
                fieldDia = 5;
            }

            string dataDirectory = "Images";
            string filePath      = Path.Combine("..", "..");
            string imageName     = null;

            if (appearsInRadar == true)
            {
                imageName = "resource.png";
            }
            else
            {
                imageName = "resource.png";
            }

            if (field > 0)
            {
                imageName = "resourceField.png";
            }

            if (File.Exists(Path.Combine(dataDirectory, imageName)))
            {
                filePath = "";
            }

            Image image = Image.FromFile(Path.Combine(filePath, Path.Combine(dataDirectory, imageName)));

            harvestableImage   = new PImage(image);
            harvestableImage.X = (x - (image.Width / 2)) / 100;
            harvestableImage.Y = (y - (image.Height / 2)) / 100;

            float sigX   = (x / 100) - ((sigDia / 2) - (image.Width / 2));
            float sigY   = (y / 100) - ((sigDia / 2) - (image.Height / 2));
            float rrX    = (x / 100) - ((rrDia / 2) - (image.Width / 2));
            float rrY    = (y / 100) - ((rrDia / 2) - (image.Height / 2));
            float expX   = (x / 100) - ((expDia / 2) - (image.Width / 2));
            float expY   = (y / 100) - ((expDia / 2) - (image.Height / 2));
            float spawnX = (x / 100) - ((spawnDia / 2) - (image.Width / 2));
            float spawnY = (y / 100) - ((spawnDia / 2) - (image.Height / 2));
            float fieldX = (x / 100) - ((fieldDia / 2) - (image.Width / 2));
            float fieldY = (y / 100) - ((fieldDia / 2) - (image.Height / 2));

            Pen sigPen = new Pen(Color.Violet, 3.0F);
            Pen rrPen  = new Pen(Color.Pink, 2.0F);

            rrPen.DashStyle = DashStyle.Dash;
            Pen expPen = new Pen(Color.LightPink, 1.0F);

            expPen.DashStyle = DashStyle.DashDotDot;
            Pen spawnPen = new Pen(Color.Red, 1.0F);

            spawnPen.DashStyle = DashStyle.Dot;
            Pen fieldPen = new Pen(Color.MediumPurple, 1.0F);

            fieldPen.DashStyle = DashStyle.Dot;

            PPath sigCircle = PPath.CreateEllipse(sigX, sigY, sigDia, sigDia);

            sigCircle.Pen = sigPen;
            PPath rrCircle = PPath.CreateEllipse(rrX, rrY, rrDia, rrDia);

            rrCircle.Pen = rrPen;
            PPath expCircle = PPath.CreateEllipse(expX, expY, expDia, expDia);

            expCircle.Pen = expPen;
            PPath spawnCircle = PPath.CreateEllipse(spawnX, spawnY, spawnDia, spawnDia);

            spawnCircle.Pen = spawnPen;
            PPath fieldCircle = PPath.CreateEllipse(fieldX, fieldY, fieldDia, fieldDia);

            fieldCircle.Pen = fieldPen;

            PNode sigNode = sigCircle;

            sigNode.Brush = Brushes.Transparent;
            PNode rrNode = rrCircle;

            rrNode.Brush = Brushes.Transparent;
            PNode expNode = expCircle;

            expNode.Brush = Brushes.Transparent;
            PNode spawnNode = spawnCircle;

            spawnNode.Brush = Brushes.Transparent;
            PNode fieldNode = fieldCircle;

            fieldNode.Brush = Brushes.Transparent;

            pname               = new PText(name);
            pname.TextBrush     = Brushes.White;
            pname.TextAlignment = StringAlignment.Center;
            pname.X             = (x / 100) - (pname.Width / 2);
            pname.Y             = (y / 100) - 20;

            harvestableImage.AddChild(sigNode);
            harvestableImage.AddChild(rrNode);
            harvestableImage.AddChild(expNode);
            harvestableImage.AddChild(pname);

            //Add placeholder nodes for nav_type visualization lookup.
            for (int i = 0; i < navType; i++)
            {
                harvestableImage.AddChild(new PNode());
            }

            harvestableImage.AddChild(spawnNode);
            harvestableImage.AddChild(fieldNode);

            harvestableImage.ChildrenPickable = false;

            //Set the tag to this class for information retrieval later.
            harvestableImage.Tag = this;

            // Attach event delegates directly to the node.
            harvestableImage.MouseDown += new PInputEventHandler(Image_MouseDown);
            harvestableImage.MouseUp   += new PInputEventHandler(Image_MouseUp);
            harvestableImage.MouseDrag += new PInputEventHandler(Image_MouseDrag);

            //Display Object by adding them to its layer
            layer.AddChild(harvestableImage);
        }
        void addNodeOnDialogGraphView(int dialogID, int parentDialogID)
        {
            PNode parentDialog = getNodeOnDialogID(parentDialogID);

            float x = new float();

            x = parentDialog.X + 10;
            float y = new float();

            y = parentDialog.Y + 10;

            SizeF size      = CalcEllipsisSizeForNode(dialogID);
            PNode newDialog = PPath.CreateEllipse(x, y, size.Width, size.Height);
            PText text      = new PText(dialogID.ToString());

            text.Pickable = false;
            text.X        = newDialog.X + 15;
            text.Y        = newDialog.Y + 10;
            newDialog.Tag = new ArrayList();
            newDialog.AddChild(text);

            PPath edge = new PPath();

            edge.Pickable = false;
            ((ArrayList)newDialog.Tag).Add(edge);
            ((ArrayList)parentDialog.Tag).Add(edge);
            edge.Tag = new ArrayList();
            ((ArrayList)edge.Tag).Add(newDialog);
            ((ArrayList)edge.Tag).Add(parentDialog);
            nodeLayer.Add(newDialog);
            edgeLayer.AddChild(edge);

            if ((!getDialogOnDialogID(dialogID).Actions.Exit) && (getDialogOnDialogID(dialogID).Actions.ToDialog != 0))
            {
                PNode target = getNodeOnDialogID(getDialogOnDialogID(dialogID).Actions.ToDialog);

                PPath edgeT = new PPath();
                edgeT.Pickable = false;
                ((ArrayList)newDialog.Tag).Add(edgeT);
                ((ArrayList)target.Tag).Add(edgeT);
                edgeT.Tag = new ArrayList();
                ((ArrayList)edgeT.Tag).Add(newDialog);
                ((ArrayList)edgeT.Tag).Add(target);
                edgeLayer.AddChild(edgeT);
            }

            updateEdge(edge);
            DialogShower.Layer.AddChildren(nodeLayer);

            if (!graphs.Keys.Contains(newDialog))
            {
                graphs.Add(newDialog, new GraphProperties(dialogID));
            }

            if (getDialogOnDialogID(dialogID).Nodes.Any())
            {
                foreach (int subdialog in getDialogOnDialogID(dialogID).Nodes)
                {
                    addNodeOnDialogGraphView(subdialog, dialogID);
                }
            }

            DialogSelected(false);
        }