Пример #1
0
        /// <summary>
        /// Load all images in the specified directory as slides.
        /// </summary>
        public void LoadSlides(string folder)
        {
            hiliteSlide = null;
            slideBar.RemoveAllChildren();
            slides.Clear();
            Layer.AddChild(slideBar);

            if (folder == null)
            {
                AddDefaultSlides();
            }
            else
            {
                AddSlides(folder);
            }

            // Create visual indicator of current position in slide bar
            Bitmap arrowBitmap = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream(IMAGE_RESOURCE_STREAM + ".up-arrow.gif"));

            currentPosition          = new PImage(arrowBitmap);
            currentPosition.Pickable = false;
            slideBar.AddChild(currentPosition);

            slideActivities = new PActivity[slides.Count];

            LayoutSlides();
            GoToSlide((PMultiSizeImage)slideBar[0]);
        }
 /// <summary>
 /// Adds bounds handles to the given node.
 /// </summary>
 /// <param name="aNode">The node to add bounds handles to.</param>
 public static void AddBoundsHandlesTo(PNode aNode)
 {
     //aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateEastLocator(aNode)));
     //aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateWestLocator(aNode)));
     //aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthLocator(aNode)));
     //aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthLocator(aNode)));
     aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthEastLocator(aNode)));
     aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthWestLocator(aNode)));
     aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthEastLocator(aNode)));
     aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthWestLocator(aNode)));
 }
Пример #3
0
        //! Заполняет граф диалога нужными узлами
        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);
        }
Пример #4
0
        /// <summary>
        /// Fill the auxillary box with suggestions
        /// </summary>
        /// <param Name="suggestions">The suggestions to add to the box</param>
        protected void AddSuggestionsToAuxillaryBox(ICommand[] suggestions)
        {
            //For each suggestion, create a PText with the Name of the command in
            //Each beneath the other
            float curHeight = Background.Height;

            foreach (ICommand suggestion in suggestions)
            {
                PText text = new PText(suggestion.Name);
                text.Bounds = new RectangleF(Bounds.Left, curHeight, 0, 0);
                text.Font   = Entry.Font;
                text.Brush  = new SolidBrush(Color.Transparent);
                AuxillaryBox.AddChild(text);
                curHeight += text.Height;
            }
        }
        /// <summary>
        /// Sets some initial values for the marquee including it's brush and pen.
        /// </summary>
        /// <param name="e">A PInputEventArgs that contains the event data.</param>
        protected virtual void InitializeMarquee(PInputEventArgs e)
        {
            marquee       = PPath.CreateRectangle(presspt.X, presspt.Y, 0, 0);
            marquee.Brush = marqueeBrush;
            marquee.Pen   = pens[0];
            marqueeParent.AddChild(marquee);

            marqueeMap.Clear();
        }
        // 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);
        }
        // This method demonstrates the kinds of things that can be done with any node.
        public void NodeDemo()
        {
            PLayer layer = Canvas.Layer;
            PNode  aNode = PPath.CreateRectangle(0, 0, 100, 80);

            // A node needs to be a descendent of the root to be displayed on the screen.
            layer.AddChild(aNode);

            // The default color for a node is blue, but you can change that with
            // the setPaint method.
            aNode.Brush = Color.Red;

            // A node can have children nodes added to it.
            aNode.AddChild(PPath.CreateRectangle(0, 0, 100, 80));

            // The base bounds of a node is easy to change. Note that changing the base
            // bounds of a node will not change it's children.
            aNode.SetBounds(-10, -10, 200, 110);

            // Each node has a transform that can be used to transform the node, and
            // all its children on the screen.
            aNode.TranslateBy(100, 100);
            aNode.ScaleBy(1.5f);
            aNode.RotateBy(45);

            // The transparency of any node can be set, this transparency will be
            // applied to any of the nodes children as well.
            //aNode.setTransparency(0.75f);

            // Its easy to copy nodes.
            PNode aCopy = (PNode)aNode.Clone();

            // Make is so that the copies children are not pickable. For this example
            // that means you will not be able to grab the child and remove it from
            // its parent.
            aNode.ChildrenPickable = false;

            // Change the look of the copy
            aNode.Brush = Color.Green;
            //aNode.setTransparency(1.0f);

            // Let's add the copy to the root, and translate it so that it does not
            // cover the original node.
            layer.AddChild(aCopy);
            aCopy.SetOffset(0, 0);
            aCopy.RotateBy(-45);
        }
Пример #8
0
        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);
        }
Пример #9
0
        //! @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);
                        }
                    }
                }
            }
        }
Пример #10
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);
                }
            }
        }