Пример #1
0
        protected void ListMenuItemsSelected(List <string> Items)
        {
            if (Items == null)
            {
                return;
            }

            string Name;

            for (int I = 0; I < Items.Count; I++)
            {
                switch (ItemSelectionChoice)
                {
                case ItemSelectionChoices.Sprite:
                    if (Items[I].StartsWith("Content/Animations/Background Objects 2D/"))
                    {
                        Name = Items[I].Substring(0, Items[I].Length - 5).Substring(41);
                        TreeNode NewTreeNode = new TreeNode(Name);
                        NewTreeNode.Tag = AnimationBackgroundViewer.AddBackgroundObject(Name);
                        lstItemChoices.Nodes.Add(NewTreeNode);
                        lstItemChoices.SelectedNode = NewTreeNode;
                    }
                    else
                    {
                        Name = Items[I].Substring(0, Items[I].Length - 4).Substring(38);
                        TreeNode NewTreeNode = new TreeNode(Name);
                        NewTreeNode.Tag = AnimationBackgroundViewer.AddBackground(Name);
                        lstItemChoices.Nodes.Add(NewTreeNode);
                        lstItemChoices.SelectedNode = NewTreeNode;
                    }
                    break;
                }
            }
        }
        private void LoadAnimationBackground(string AnimationBackgroundPath)
        {
            string Name = AnimationBackgroundPath.Substring(0, AnimationBackgroundPath.Length - 5).Substring(19);

            this.Text = Name + " - Project Eternity Animation Background Editor";

            AnimationBackgroundViewer.Preload();

            AnimationBackgroundViewer.ActiveAnimationBackground = (AnimationBackground3D)AnimationBackground.LoadAnimationBackground(Name, AnimationBackgroundViewer.content,
                                                                                                                                     AnimationBackgroundViewer.GraphicsDevice);

            PropertiesDialog = new BackgroundProperties(AnimationBackgroundViewer.ActiveAnimationBackground);

            PropertiesDialog.txtBackgroundStartX.Value = (decimal)AnimationBackgroundViewer.ActiveAnimationBackground.DefaultCameraPosition.X;
            PropertiesDialog.txtBackgroundStartY.Value = (decimal)AnimationBackgroundViewer.ActiveAnimationBackground.DefaultCameraPosition.Y;
            PropertiesDialog.txtBackgroundStartZ.Value = (decimal)AnimationBackgroundViewer.ActiveAnimationBackground.DefaultCameraPosition.Z;

            PropertiesDialog.txtBackgroundYaw.Value   = (decimal)AnimationBackgroundViewer.ActiveAnimationBackground.DefaultCameraRotation.X;
            PropertiesDialog.txtBackgroundPitch.Value = (decimal)AnimationBackgroundViewer.ActiveAnimationBackground.DefaultCameraRotation.Y;
            PropertiesDialog.txtBackgroundRoll.Value  = (decimal)AnimationBackgroundViewer.ActiveAnimationBackground.DefaultCameraRotation.Z;

            foreach (AnimationBackground3DBase ActiveBackgroundSystem in AnimationBackgroundViewer.ActiveAnimationBackground.ListBackground)
            {
                TreeNode NewTreeNode = new TreeNode(ActiveBackgroundSystem.ToString());
                NewTreeNode.Tag = ActiveBackgroundSystem;
                lstItemChoices.Nodes.Add(NewTreeNode);
                foreach (string ActiveChild in ActiveBackgroundSystem.GetChild())
                {
                    NewTreeNode.Nodes.Add(ActiveChild);
                }
            }
        }
Пример #3
0
 private void btnRemoveSprite_Click(object sender, EventArgs e)
 {
     if (lstItemChoices.SelectedNode != null)
     {
         int SelectedNodeIndex = lstItemChoices.SelectedNode.Index;
         lstItemChoices.Nodes.RemoveAt(SelectedNodeIndex);
         AnimationBackgroundViewer.RemoveBackground(SelectedNodeIndex);
     }
 }
Пример #4
0
        private void LoadAnimationBackground(string AnimationBackgroundPath)
        {
            string Name = AnimationBackgroundPath.Substring(0, AnimationBackgroundPath.Length - 5).Substring(19);

            this.Text = Name + " - Project Eternity Animation Background Editor";

            AnimationBackgroundViewer.Preload();

            AnimationBackgroundViewer.ActiveAnimationBackground = (AnimationBackground2D)AnimationBackground.LoadAnimationBackground(Name,
                                                                                                                                     AnimationBackgroundViewer.content, AnimationBackgroundViewer.GraphicsDevice);

            foreach (AnimationBackground2DBase ActiveBackgroundSystem in AnimationBackgroundViewer.ActiveAnimationBackground.ListBackground)
            {
                TreeNode NewTreeNode = new TreeNode(ActiveBackgroundSystem.ToString());
                NewTreeNode.Tag = ActiveBackgroundSystem;
                lstItemChoices.Nodes.Add(NewTreeNode);
            }
        }
        private void btnRemoveSprite_Click(object sender, EventArgs e)
        {
            BillboardSystem ActiveParticleSystem = lstItemChoices.SelectedNode.Tag as BillboardSystem;

            if (ActiveParticleSystem != null)
            {
                int SelectedNodeIndex = lstItemChoices.SelectedNode.Index;
                lstItemChoices.Nodes.RemoveAt(SelectedNodeIndex);
                AnimationBackgroundViewer.RemoveBackgroundSystem(SelectedNodeIndex);
            }
            else if (ActiveParticleSystem == null && lstItemChoices.SelectedNode.Parent != null)
            {
                TreeNode SelectedNode      = lstItemChoices.SelectedNode.Parent;
                int      SelectedNodeIndex = SelectedNode.Index;
                ActiveParticleSystem = SelectedNode.Tag as BillboardSystem;

                ActiveParticleSystem.RemoveParticle(SelectedNodeIndex);
                lstItemChoices.Nodes.RemoveAt(SelectedNodeIndex);
            }
        }
        protected void ListMenuItemsSelected(List <string> Items)
        {
            if (Items == null)
            {
                return;
            }

            string Name;

            for (int I = 0; I < Items.Count; I++)
            {
                switch (ItemSelectionChoice)
                {
                case ItemSelectionChoices.Sprite:
                    Name = Items[I].Substring(0, Items[0].Length - 4).Substring(38);
                    TreeNode NewTreeNode = new TreeNode(Name);
                    NewTreeNode.Tag = AnimationBackgroundViewer.AddBackgroundSystem(Name);
                    lstItemChoices.Nodes.Add(NewTreeNode);
                    lstItemChoices.SelectedNode = NewTreeNode;
                    btnCreateNewProp_Click(null, null);
                    break;
                }
            }
        }
        private void AnimationBackgroundViewer_MouseDown(object sender, MouseEventArgs e)
        {
            AnimationBackgroundViewer.Focus();
            float MouseX = e.X;
            float MouseY = e.Y;

            float MinDistanceToTriangle = float.MaxValue;

            SelectedBackgroundSystem = null;
            int SelectedBackgroundIndex = -1;

            for (int P = 0; P < AnimationBackgroundViewer.ActiveAnimationBackground.ListBackground.Count; P++)
            {
                AnimationBackground3DBase ActiveBackgroundSystem = AnimationBackgroundViewer.ActiveAnimationBackground.ListBackground[P];
                float Distance = ActiveBackgroundSystem.GetDistance(MouseX, MouseY,
                                                                    AnimationBackgroundViewer.ActiveAnimationBackground.View,
                                                                    AnimationBackgroundViewer.ActiveAnimationBackground.Projection,
                                                                    AnimationBackgroundViewer.GraphicsDevice.Viewport);

                if (Distance < MinDistanceToTriangle)
                {
                    MinDistanceToTriangle    = Distance;
                    SelectedBackgroundSystem = ActiveBackgroundSystem;
                    SelectedBackgroundIndex  = P;
                }
            }

            pgAnimationProperties.SelectedObject = null;

            if (SelectedBackgroundSystem != null)
            {
                pgAnimationProperties.SelectedObject = SelectedBackgroundSystem.GetEditableObject(SelectedBackgroundIndex);
            }

            MousePositionOld = e;
        }