Ejemplo n.º 1
0
        public InterpGroup(int idx, PCCObject pccobj)
            : base()
        {
            index = idx;
            pcc   = pccobj;

            title = new SText("");
            if (pcc.Exports[index].ClassName == "InterpGroupDirector")
            {
                GroupName = "DirGroup";
            }
            listEntry       = PPath.CreateRectangle(0, 0, Timeline.ListWidth, Timeline.TrackHeight);
            listEntry.Brush = GroupBrush;
            listEntry.Pen   = null;
            PPath p = PPath.CreatePolygon(7, 5, 12, 10, 7, 15);

            p.Brush = Brushes.Black;
            listEntry.AddChild(p);
            listEntry.AddChild(PPath.CreateLine(0, listEntry.Bounds.Bottom, Timeline.ListWidth, listEntry.Bounds.Bottom));
            colorAccent        = new PNode();
            colorAccent.Brush  = null;
            colorAccent.Bounds = new RectangleF(Timeline.ListWidth - 10, 0, 10, listEntry.Bounds.Bottom);
            listEntry.AddChild(colorAccent);
            title.TranslateBy(20, 3);
            listEntry.AddChild(title);
            listEntry.MouseDown += listEntry_MouseDown;
            collapsed            = true;
            InterpTracks         = new List <InterpTrack>();

            LoadData();
        }
Ejemplo n.º 2
0
 public void addTrack(InterpTrack t)
 {
     InterpTracks.Add(t);
     t.listEntry.TranslateBy(0, (int)InterpTracks.Count * (Timeline.TrackHeight + 1));
     //t.listEntry.Pickable = false;
     t.listEntry.ChildrenPickable = false;
     if (collapsed)
     {
         t.Visible = false;
     }
     listEntry.AddChild(t.listEntry);
 }
        public PNode CreateHierarchy(int level)
        {
            PPath result = PPath.CreateRectangle(0, 0, 100, 100);

            if (level > 0)
            {
                PNode child = CreateHierarchy(level - 1);
                child.ScaleBy(0.5f);
                result.AddChild(child);
                child.OffsetBy(25, 25);
            }

            return(result);
        }
Ejemplo n.º 4
0
        public DlgStart(int idx, float x, float y, ME3BioConversation bc, DialogVis dialogvis)
            : base(idx, x, y, bc, dialogvis)
        {
            outlinePen = new Pen(Color.Black);
            GetOutputLinks();
            SText title = new SText("Start: " + index, titleBrush);

            title.TextAlignment = StringAlignment.Center;
            title.X             = 5;
            title.Y             = 3;
            title.Pickable      = false;
            box       = PPath.CreateRectangle(0, 0, title.Width + 10, title.Height + 5);
            box.Pen   = outlinePen;
            box.Brush = nodeBrush;
            box.AddChild(title);
            this.AddChild(box);
            this.TranslateBy(x, y);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        protected float GetTitleBox(string s, float w)
        {
            DText title = new DText(s, titleColor)
            {
                TextAlignment             = StringAlignment.Center,
                ConstrainWidthToTextWidth = false,
                X        = 0,
                Y        = 3,
                Pickable = false
            };

            if (title.Width + 20 > w)
            {
                w = title.Width + 20;
            }
            title.Width    = w;
            titleBox       = PPath.CreateRectangle(0, 0, w, title.Height + 5);
            titleBox.Pen   = outlinePen;
            titleBox.Brush = titleBoxBrush;
            titleBox.AddChild(title);
            titleBox.Pickable = false;
            return(w);
        }
Ejemplo n.º 7
0
        public override void Initialize()
        {
            PPath n = PPath.CreateRectangle(0, 0, 100, 80);

            // add another node the the root as a reference point so that we can
            // tell that our node is getting dragged, as opposed the the canvas
            // view being panned.
            Canvas.Layer.AddChild(PPath.CreateRectangle(0, 0, 100, 80));

            Canvas.Layer.AddChild(n);

            // tell the node to show its default handles.
            PBoundsHandle.AddBoundsHandlesTo(n);

            // The default PBoundsHandle implementation doesn't work well with PPaths that have strokes. The reason
            // for this is that the default PBoundsHandle modifies the bounds of an PNode, but when adding handles to
            // a PPath we really want it to be modifying the underlying geometry of the PPath, the shape without the
            // stroke. The solution is that we need to create handles specific to PPaths that locate themselves on the
            // paths internal geometry, not the external bounds geometry...

            n.Pen   = new Pen(Color.Black, 10);
            n.Brush = Brushes.Green;

            // Here we create our own custom handle. This handle is located in the center of its parent
            // node and you can use it to drag the parent around. This handle also updates its color when
            // the is pressed/released in it.
            PHandle h = new PathHandle(new PNodeLocator(n));

            h.AddInputEventListener(new HandleEventHandler(h));

            // make this handle appear a bit different then the default handle appearance.
            h.Brush = Brushes.Red;
            h.SetBounds(-10, -10, 20, 20);

            // also add our new custom handle to the node.
            n.AddChild(h);
        }
Ejemplo n.º 8
0
        public SectorBoundsSprite(PLayer layer, float x_min, float y_min, float x_max, float y_max)
        {
            float width  = (x_max - x_min) / 100;
            float height = (y_max - y_min) / 100;
            float x      = -(width / 2);
            float y      = -(height / 2);

            Pen boundsPen = new Pen(Color.Red, 10.0F);

            boundsPen.DashStyle = DashStyle.DashDotDot;
            Pen xEdgePen = new Pen(Color.White, 2.5F);

            xEdgePen.DashStyle = DashStyle.Solid;
            Pen yEdgePen = new Pen(Color.White, 2.5F);

            yEdgePen.DashStyle = DashStyle.Solid;

            PPath boundsRectangle = PPath.CreateRectangle(x, y, width, height);

            boundsRectangle.Brush = Brushes.Transparent;
            boundsRectangle.Pen   = boundsPen;

            PPath xEdge = new PPath();

            xEdge.AddLine(-50, 0, 50, 0);
            xEdge.Pen = xEdgePen;

            PPath yEdge = new PPath();

            yEdge.AddLine(0, -50, 0, 50);
            yEdge.Pen = xEdgePen;

            PText xy = new PText();

            xy.TextBrush     = Brushes.White;
            xy.TextAlignment = StringAlignment.Center;
            xy.Text          = "0,0";
            xy.X             = 5;
            xy.Y             = 5;

            PText posX = new PText();

            posX.TextBrush     = Brushes.White;
            posX.TextAlignment = StringAlignment.Center;
            posX.Text          = "+X";
            posX.X             = 52;
            posX.Y             = -9;

            PText posY = new PText();

            posY.TextBrush     = Brushes.White;
            posY.TextAlignment = StringAlignment.Center;
            posY.Text          = "+Y";
            posY.X             = -12;
            posY.Y             = 52;

            boundsRectangle.AddChild(xy);
            boundsRectangle.AddChild(posX);
            boundsRectangle.AddChild(posY);
            boundsRectangle.AddChild(xEdge);
            boundsRectangle.AddChild(yEdge);
            boundsRectangle.Pickable = false;

            layer.AddChild(boundsRectangle);
        }
Ejemplo n.º 9
0
        public void LoadInterpData(int idx, PCCObject pccobject)
        {
            TimeScale.RemoveAllChildren();
            TimeScale.Width = 3600;
            TimelineView.RemoveAllChildren();
            TimelineView.Width = 3600;
            scrollbarH.Maximum = 3600;
            PPath line;
            SText text;

            for (int i = 0; i < TimeScale.Width; i += 60)
            {
                line          = PPath.CreateLine(i, 1, i, Timeline.InfoHeight);
                line.Pickable = false;
                line.Pen      = new Pen(Color.FromArgb(110, 110, 110));
                TimeScale.AddChild(line);
                text          = new SText(i / 60 - 1 + ".00", Color.FromArgb(175, 175, 175), false);
                text.Pickable = false;
                text.TranslateBy(i + 2, Timeline.InfoHeight - text.Height);
                TimeScale.AddChild(text);
            }

            pcc   = pccobject;
            index = idx;
            foreach (InterpGroup g in InterpGroups)
            {
                RemoveChild(g.listEntry);
            }
            InterpGroups.Clear();

            BitConverter.IsLittleEndian = true;
            List <PropertyReader.Property> props = PropertyReader.getPropList(pcc, pcc.Exports[index]);
            List <int> groups = new List <int>();

            foreach (PropertyReader.Property p in props)
            {
                if (pcc.getNameEntry(p.Name) == "InterpLength")
                {
                    InterpLength = BitConverter.ToSingle(p.raw, 24);
                }
                if (pcc.getNameEntry(p.Name) == "EdSectionStart")
                {
                    EdSectionStart = BitConverter.ToSingle(p.raw, 24);
                }
                if (pcc.getNameEntry(p.Name) == "EdSectionEnd")
                {
                    EdSectionEnd = BitConverter.ToSingle(p.raw, 24);
                }
                if (pcc.getNameEntry(p.Name) == "m_nBioCutSceneVersion")
                {
                    m_nBioCutSceneVersion = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "m_pSFXSceneData")
                {
                    m_pSFXSceneData = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "ObjInstanceVersion")
                {
                    ObjInstanceVersion = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "ParentSequence")
                {
                    ParentSequence = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "InterpGroups")
                {
                    for (int i = 0; i < p.Value.Array.Count; i += 4)
                    {
                        groups.Add(BitConverter.ToInt32(new byte[] { (byte)p.Value.Array[i].IntValue, (byte)p.Value.Array[i + 1].IntValue, (byte)p.Value.Array[i + 2].IntValue, (byte)p.Value.Array[i + 3].IntValue }, 0) - 1);
                    }
                }
            }
            foreach (int i in groups)
            {
                if (pcc.Exports[i].ClassName.StartsWith("InterpGroup"))
                {
                    addGroup(new InterpGroup(i, pcc));
                }
            }
            TimeScale.MoveToFront();
            PPath startmark = PPath.CreatePolygon(53, 1, 61, 1, 61, 9);

            startmark.Pen      = null;
            startmark.Brush    = new SolidBrush(Color.FromArgb(255, 80, 80));
            startmark.Pickable = false;
            TimeScale.AddChild(startmark);
            endmark       = PPath.CreatePolygon(InterpLength * 60 + 61, 1, InterpLength * 60 + 69, 1, InterpLength * 60 + 61, 9);
            endmark.Pen   = null;
            endmark.Brush = startmark.Brush;
            TimeScale.AddChild(endmark);
            foreach (InterpGroup g in InterpGroups)
            {
                foreach (InterpTrack t in g.InterpTracks)
                {
                    t.GetKeyFrames();
                    t.DrawKeyFrames();
                    TimelineView.AddChild(t.timelineEntry);
                }
            }
        }
Ejemplo n.º 10
0
        public DStart(DialogueEditorWPF editor, int orderKey, int StartNbr, float x, float y, ConvGraphEditor ConvGraphEditor)
            : base(ConvGraphEditor)
        {
            NodeUID = 2000 + StartNbr;
            Editor  = editor;
            Order   = orderKey;
            string ordinal = DialogueEditorWPF.AddOrdinal(orderKey + 1);

            StartNumber = StartNbr;
            outlinePen  = new Pen(EventColor);
            listname    = $"{ordinal} Start Node: {StartNbr}";;

            float starty = 0;
            float w      = 15;
            float midW   = 50;

            GetTitleBox(listname, 20);

            w += titleBox.Width;
            OutputLink l = new OutputLink
            {
                Links        = new List <int>(StartNbr),
                InputIndices = new int(),
                Edges        = new List <DiagEdEdge>(),
                Desc         = $"Out {StartNbr}",
                RCat         = EReplyCategory.REPLY_CATEGORY_DEFAULT
            };
            int linkedOp = StartNbr;

            l.Links.Add(linkedOp);
            l.InputIndices  = 0;
            l.node          = CreateActionLinkBox();
            l.node.Brush    = outputBrush;
            l.node.Pickable = false;

            PPath dragger = CreateActionLinkBox();

            dragger.Brush = mostlyTransparentBrush;
            dragger.X     = l.node.X;
            dragger.Y     = l.node.Y;
            dragger.AddInputEventListener(outputDragHandler);
            l.node.AddChild(dragger);
            Outlinks.Add(l);
            outLinkBox = new PPath();
            DText t2 = new DText($"{StartNbr} :");

            if (t2.Width + 10 > midW)
            {
                midW = t2.Width + 10;
            }
            t2.X        = 0 - t2.Width;
            t2.Y        = starty - 10;
            t2.Pickable = false;
            t2.AddChild(l.node);
            outLinkBox.AddChild(t2);
            outLinkBox.AddPolygon(new[] { new PointF(0, 0), new PointF(0, starty), new PointF(-0.5f * midW, starty + 30), new PointF(0 - midW, starty), new PointF(0 - midW, 0), new PointF(midW / -2, -30) });
            outLinkBox.Pickable = false;
            outLinkBox.Pen      = outlinePen;
            outLinkBox.Brush    = nodeBrush;
            float h = titleBox.Height + 1;

            outLinkBox.TranslateBy(titleBox.Width / 2 + midW / 2, h + 30);

            h     += outLinkBox.Height + 1;
            bounds = new RectangleF(0, 0, w, h);
            AddChild(titleBox);
            AddChild(outLinkBox);
            Pickable = true;
            SetOffset(x, y);
            MouseEnter += OnMouseEnter;
            MouseLeave += OnMouseLeave;
        }
Ejemplo n.º 11
0
        protected float GetTitlePlusLineBox(string s, string l, string n, float w)
        {
            DText title = new DText(s, titleColor)
            {
                TextAlignment             = StringAlignment.Center,
                ConstrainWidthToTextWidth = false,
                X        = 0,
                Y        = 3,
                Pickable = false
            };

            if (title.Width + 60 > w)
            {
                w = title.Width + 60;
            }
            title.Width = w;

            float lineX = w / LineScaleOption + 5;
            float lineY = 3;

            if (LinesAtTop)
            {
                lineX = 2;
                lineY = -title.Height + 2;
            }
            DText line = null;

            if (LineScaleOption > 0)
            {
                line = new DText(l, lineColor, false, LineScaleOption) //Add line string to right side
                {
                    TextAlignment               = StringAlignment.Near,
                    ConstrainWidthToTextWidth   = false,
                    ConstrainHeightToTextHeight = false,
                    X        = lineX,
                    Y        = lineY,
                    Pickable = false
                };
            }


            DText nodeID = new DText(n, titleColor) //Add node count to left side
            {
                TextAlignment             = StringAlignment.Near,
                ConstrainWidthToTextWidth = false,
                X        = 0,
                Y        = 3,
                Pickable = false
            };

            titleBox     = PPath.CreateRectangle(0, 0, w, title.Height + 5);
            titleBox.Pen = new Pen(entryPenColor);
            if (NodeUID < 1000)
            {
                titleBox.Brush = new SolidBrush(entryColor);;
            }
            else if (NodeUID < 2000)
            {
                titleBox.Brush = new SolidBrush(replyColor);;
            }
            else
            {
                titleBox.Brush = titleBoxBrush;
            }
            titleBox.AddChild(nodeID);
            titleBox.AddChild(title);
            if (LineScaleOption > 0)
            {
                titleBox.AddChild(line);
            }
            titleBox.Pickable = false;
            return(w);
        }
Ejemplo n.º 12
0
        public WEvent(WwiseBank.Event hircEvent, float x, float y, WwiseGraphEditor grapheditor)
            : base(hircEvent, grapheditor)
        {
            outlinePen = new Pen(EventColor);
            const string s      = "Event";
            float        starty = 0;
            float        w      = 15;
            float        midW   = 0;

            varLinkBox = new PPath();
            GetLinks();
            foreach (var varLink in Varlinks)
            {
                string d  = string.Join(",", varLink.Links.Select(l => $"#{l}"));
                SText  t2 = new SText(d + "\n" + varLink.Desc)
                {
                    X        = w,
                    Y        = 0,
                    Pickable = false
                };
                w += t2.Width + 20;
                varLink.node.TranslateBy(t2.X + t2.Width / 2, t2.Y + t2.Height);
                t2.AddChild(varLink.node);
                varLinkBox.AddChild(t2);
            }
            if (Varlinks.Count != 0)
            {
                varLinkBox.AddRectangle(0, 0, w, varLinkBox[0].Height);
            }
            varLinkBox.Pickable = false;
            varLinkBox.Pen      = outlinePen;
            varLinkBox.Brush    = nodeBrush;
            outLinkBox          = new PPath();
            for (int i = 0; i < Outlinks.Count; i++)
            {
                string linkDesc = Outlinks[i].Desc;
                if (OutputNumbers && Outlinks[i].Links.Any())
                {
                    linkDesc += $": {string.Join(",", Outlinks[i].Links.Select(l => $"#{l}"))}";
                }
                SText t2 = new SText(linkDesc);
                if (t2.Width + 10 > midW)
                {
                    midW = t2.Width + 10;
                }
                //t2.TextAlignment = StringAlignment.Far;
                //t2.ConstrainWidthToTextWidth = false;
                t2.X        = 0 - t2.Width;
                t2.Y        = starty + 3;
                starty     += t2.Height + 6;
                t2.Pickable = false;
                Outlinks[i].node.TranslateBy(0, t2.Y + t2.Height / 2);
                t2.AddChild(Outlinks[i].node);
                outLinkBox.AddChild(t2);
            }
            outLinkBox.AddPolygon(new[] { new PointF(0, 0), new PointF(0, starty), new PointF(-0.5f * midW, starty + 30), new PointF(0 - midW, starty), new PointF(0 - midW, 0), new PointF(midW / -2, -30) });
            outLinkBox.Pickable = false;
            outLinkBox.Pen      = outlinePen;
            outLinkBox.Brush    = nodeBrush;
            float tW = GetTitleBox(s, w);

            if (tW > w)
            {
                if (midW > tW)
                {
                    w = midW;
                    titleBox.Width = w;
                }
                else
                {
                    w = tW;
                }
                varLinkBox.Width = w;
            }
            float h = titleBox.Height + 1;

            outLinkBox.TranslateBy(titleBox.Width / 2 + midW / 2, h + 30);
            h += outLinkBox.Height + 1;
            varLinkBox.TranslateBy(0, h);
            h     += varLinkBox.Height;
            bounds = new RectangleF(0, 0, w, h);
            AddChild(titleBox);
            AddChild(varLinkBox);
            AddChild(outLinkBox);
            SetOffset(x, y);
        }