Beispiel #1
0
 private void btnSplitTriangle_CheckedChanged(object sender, EventArgs e)
 {
     if (btnSplitTriangle.Checked)
     {
         SelectionChoice = SelectionChoices.SplitTriangle;
     }
 }
Beispiel #2
0
        private void MouseMoveSpawn(MouseEventArgs e, int RealX, int RealY)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (SelectionChoice == SelectionChoices.Move)
                {
                    LayerViewer.SelectedSpawn.SpawnLocation += new Vector2(e.X - MouseEventOld.X, e.Y - MouseEventOld.Y);
                }
            }
            else
            {
                LayerViewer.SelectedSpawn = null;
                SelectionChoice           = SelectionChoices.None;

                foreach (SpawnPoint ActiveSpawn in ActiveLayer.ListSpawnPointTeam)
                {
                    bool CollideWithMouse = new Rectangle((int)ActiveSpawn.SpawnLocation.X, (int)ActiveSpawn.SpawnLocation.Y, 32, 32).Intersects(new Rectangle(RealX, RealY, 1, 1));

                    if (CollideWithMouse)
                    {
                        LayerViewer.SelectedSpawn = ActiveSpawn;
                        SelectionChoice           = SelectionChoices.Move;
                        break;
                    }
                }
            }
        }
Beispiel #3
0
        private void MouseGroundLevel(MouseEventArgs e, int RealX, int RealY)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (SelectionChoice == SelectionChoices.Move)
                {
                    LayerViewer.SelectedPolygonTriangle.Move(e.X - MouseEventOld.X, e.Y - MouseEventOld.Y);
                }
            }
            else
            {
                LayerViewer.SelectedPolygonTriangle = null;
                SelectionChoice = SelectionChoices.None;

                if (LayerViewer.SelectedPolygonTriangle == null)
                {
                    for (int V = 0; V < ActiveLayer.GroundLevelCollision.ArrayVertex.Length; V++)
                    {
                        if (RealX >= ActiveLayer.GroundLevelCollision.ArrayVertex[V].X - 2 && RealX <= ActiveLayer.GroundLevelCollision.ArrayVertex[V].X + 2 &&
                            RealY >= ActiveLayer.GroundLevelCollision.ArrayVertex[V].Y - 2 && RealY <= ActiveLayer.GroundLevelCollision.ArrayVertex[V].Y + 2)
                        {
                            LayerViewer.SelectedPolygonTriangle = PolygonTriangle.VertexSelection(ActiveLayer.GroundLevelCollision, V);
                            SelectionChoice = SelectionChoices.Move;
                            break;
                        }
                    }
                }
                if (Control.ModifierKeys == Keys.Control && LayerViewer.SelectedPolygonTriangle != null)
                {
                    LayerViewer.SelectedPolygonTriangle.SelectionType = PolygonTriangle.SelectionTypes.Polygon;
                }
            }
        }
Beispiel #4
0
        private void LayerViewer_MouseDown(object sender, MouseEventArgs e)
        {
            if (ActiveLayer == null)
            {
                return;
            }

            if (tabControl1.SelectedIndex == 5)//Scripts
            {
                LayerViewer.Helper.Select(e.Location);
            }
            else
            {
                if (Control.ModifierKeys == Keys.Alt)
                {
                    SelectionChoice = SelectionChoices.Camera;
                }

                if (tabControl1.SelectedIndex == 1 && e.Button == MouseButtons.Left && LayerViewer.SelectedPolygonTriangle != null)
                {
                    pgCollisionBox.SelectedObject = LayerViewer.SelectedPolygonTriangle.ActivePolygon;
                }

                MouseEventOld = e;
            }
        }
Beispiel #5
0
 private void btnMultiTool_CheckedChanged(object sender, EventArgs e)
 {
     if (btnMultiTool.Checked)
     {
         SelectionChoice = SelectionChoices.None;
     }
 }
Beispiel #6
0
        private void MouseMoveCollisions(MouseEventArgs e, int RealX, int RealY)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (SelectionChoice == SelectionChoices.Move)
                {
                    LayerViewer.SelectedPolygonTriangle.Move(e.X - MouseEventOld.X, e.Y - MouseEventOld.Y);
                }
            }
            else
            {
                LayerViewer.SelectedPolygonTriangle = null;
                SelectionChoice = SelectionChoices.None;

                foreach (Polygon ActivePolygon in ActiveLayer.ListWorldCollisionPolygon)
                {
                    PolygonTriangle Result = ActivePolygon.PolygonCollisionWithMouse(RealX, RealY);

                    if (Result.ActivePolygon != null)
                    {
                        LayerViewer.SelectedPolygonTriangle = Result;
                        SelectionChoice = SelectionChoices.Move;
                        break;
                    }
                }

                if (Control.ModifierKeys == Keys.Control && LayerViewer.SelectedPolygonTriangle != null)
                {
                    LayerViewer.SelectedPolygonTriangle.SelectionType = PolygonTriangle.SelectionTypes.Polygon;
                }
            }
        }
Beispiel #7
0
        private void MouseMoveImage(MouseEventArgs e, int RealX, int RealY)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (SelectionChoice == SelectionChoices.Move)
                {
                    LayerViewer.SelectedAnimation.Position.X += e.X - MouseEventOld.X;
                    LayerViewer.SelectedAnimation.Position.Y += e.Y - MouseEventOld.Y;
                }
            }
            else
            {
                LayerViewer.SelectedAnimation = null;
                SelectionChoice = SelectionChoices.None;

                foreach (SimpleAnimation ActiveBackground in ActiveLayer.ListImages)
                {
                    bool CollideWithMouse = ActiveBackground.PositionRectangle.Intersects(new Rectangle(RealX, RealY, 1, 1));

                    if (CollideWithMouse)
                    {
                        LayerViewer.SelectedAnimation = ActiveBackground;
                        SelectionChoice = SelectionChoices.Move;
                        break;
                    }
                }
            }
        }
Beispiel #8
0
        private void MouseMoveProp(MouseEventArgs e, int RealX, int RealY)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (SelectionChoice == SelectionChoices.Move)
                {
                    LayerViewer.SelectedProp._Position.X += e.X - MouseEventOld.X;
                    LayerViewer.SelectedProp._Position.Y += e.Y - MouseEventOld.Y;
                }
            }
            else
            {
                LayerViewer.SelectedProp = null;
                SelectionChoice          = SelectionChoices.None;

                foreach (Prop ActiveProp in ActiveLayer.ListProp)
                {
                    bool CollideWithMouse = new Rectangle((int)ActiveProp._Position.X, (int)ActiveProp._Position.Y, 32, 32).Intersects(new Rectangle(RealX, RealY, 1, 1));

                    if (CollideWithMouse)
                    {
                        LayerViewer.SelectedProp = ActiveProp;
                        SelectionChoice          = SelectionChoices.Move;
                        break;
                    }
                }
            }
        }
Beispiel #9
0
 private void btnSelectPolygon_CheckedChanged(object sender, EventArgs e)
 {
     if (btnSelectPolygon.Checked)
     {
         SelectionChoice = SelectionChoices.SelectPolygon;
     }
 }
Beispiel #10
0
 private void btnSplitPolygonTool_CheckedChanged(object sender, EventArgs e)
 {
     if (btnSplitPolygonTool.Checked)
     {
         SelectionChoice = SelectionChoices.SplitPolygon;
         PolygonCutterViewer.SplittingPoint2 = PolygonCutterViewer.SplittingPoint1 = Vector2.Zero;
     }
 }
        private void LayerViewer_MouseDown(object sender, MouseEventArgs e)
        {
            if (Control.ModifierKeys == Keys.Alt)
            {
                SelectionChoice = SelectionChoices.Camera;
            }

            MouseEventOld = e;
        }
        private void LayerViewer_MouseUp(object sender, MouseEventArgs e)
        {
            Point Offset = LayerViewer.ActiveFightingZone.Camera.Location;

            int RealX = e.X + Offset.X;
            int RealY = e.Y + Offset.Y;

            SelectionChoice = SelectionChoices.None;
            switch (tabControl1.SelectedIndex)
            {
            case 0:    //Collisions
                if (e.Button == MouseButtons.Right && LayerViewer.SelectedPolygonTriangle != null)
                {
                    LayerViewer.ActiveFightingZone.ListWorldCollisionPolygon.Remove(LayerViewer.SelectedPolygonTriangle.ActivePolygon);
                    lstCollisionBox.Items.Clear();

                    for (int C = 0; C < LayerViewer.ActiveFightingZone.ListWorldCollisionPolygon.Count; C++)
                    {
                        lstCollisionBox.Items.Add("Collision box " + (lstCollisionBox.Items.Count + 1));
                    }
                }
                break;

            case 1:    //Images
                if (LayerViewer.SelectedAnimation != null)
                {
                    if (e.Button == MouseButtons.Right)
                    {
                        LayerViewer.ActiveFightingZone.ListImages.Remove(LayerViewer.SelectedAnimation);
                    }
                    pgImage.SelectedObject        = LayerViewer.SelectedAnimation;
                    LayerViewer.SelectedAnimation = null;
                }
                break;

            case 2:    //Props
                if (e.Button == MouseButtons.Left && LayerViewer.SelectedProp != null)
                {
                    pgProps.SelectedObject = LayerViewer.SelectedProp;
                }
                else if (e.Button == MouseButtons.Right && LayerViewer.SelectedProp != null)
                {
                    LayerViewer.ActiveFightingZone.ListProp.Remove(LayerViewer.SelectedProp);
                }
                LayerViewer.SelectedProp = null;
                break;
            }

            MouseEventOld = e;
        }
Beispiel #13
0
 public void SetToComposition(Composition comp)
 {
     this.name                        = comp.name;
     this.mode                        = comp.mode;
     this.compare_offset              = comp.compare_offset;
     this.show_diff_afterbefore       = comp.show_diff_afterbefore;
     this.show_diff_beforeafter       = comp.show_diff_beforeafter;
     this.show_intersect_beforeafter  = comp.show_intersect_beforeafter;
     this.show_after                  = comp.show_after;
     this.show_end                    = comp.show_end;
     this.separateviewports_use       = comp.separateviewports_use;
     this.selections                  = comp.selections;
     this.intervals_use               = comp.intervals_use;
     this.intervals_count             = comp.intervals_count;
     this.show_provenance             = comp.show_provenance;
     this.show_annotations_transforms = comp.show_annotations_transforms;
     FireChangeHandler();
 }
Beispiel #14
0
        //public void WriteBinary(BinaryWriter bw)
        //{
        //    bw.WriteT(name);
        //    bw.WriteT(mode);
        //    bw.WriteT(compare_offset);
        //    bw.WriteParams(show_diff_afterbefore, show_diff_beforeafter, show_intersect_beforeafter);
        //    bw.WriteParams(show_before, show_after, show_end);
        //    bw.WriteT(separateviewports_use);
        //    bw.WriteT(selections);
        //    bw.WriteT(intervals_use);
        //    bw.WriteT(intervals_count);
        //    bw.WriteT(show_provenance);
        //    bw.WriteT(show_annotations_transforms);
        //}

        public void ReadBinary(BinaryReader br)
        {
            this.name                        = br.ReadString();
            this.mode                        = br.ReadEnum <ComparisonModes>();
            this.compare_offset              = br.ReadVec3f();
            this.show_diff_afterbefore       = br.ReadBoolean();
            this.show_diff_beforeafter       = br.ReadBoolean();
            this.show_intersect_beforeafter  = br.ReadBoolean();
            this.show_before                 = br.ReadBoolean();
            this.show_after                  = br.ReadBoolean();
            this.show_end                    = br.ReadBoolean();
            this.separateviewports_use       = br.ReadBoolean();
            this.selections                  = br.ReadEnum <SelectionChoices>();
            this.intervals_use               = br.ReadBoolean();
            this.intervals_count             = br.ReadInt32();
            this.show_provenance             = br.ReadBoolean();
            this.show_annotations_transforms = br.ReadBoolean();
            FireChangeHandler();
        }
Beispiel #15
0
        private void AnimationBackgroundViewer_MouseDown(object sender, MouseEventArgs e)
        {
            MouseEventOld = e;

            if (Control.ModifierKeys == Keys.Alt)
            {
                SelectionChoice = SelectionChoices.Camera;
            }
            else
            {
                for (int B = 0; B < AnimationBackgroundViewer.ActiveAnimationBackground.ListBackground.Count; B++)
                {
                    AnimationBackground2DBase ActiveBackgroundSystem = AnimationBackgroundViewer.ActiveAnimationBackground.ListBackground[B];
                    if (ActiveBackgroundSystem.CollideWith(new Microsoft.Xna.Framework.Vector2(e.X, e.Y), 0f, 0f, AnimationBackgroundViewer.Width, AnimationBackgroundViewer.Height))
                    {
                        SelectionChoice         = SelectionChoices.Move;
                        SelectedBackgroundIndex = B;
                        break;
                    }
                }
            }
        }
Beispiel #16
0
 public Composition()
 {
     name = ""; selections = SelectionChoices.After;
 }
Beispiel #17
0
        private void PolygonCutterViewer_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Polygon ActivePolygon = null;

                PolygonTriangle SelectedPolygonTriangle = PolygonCutterViewer.SelectedPolygonTriangle;

                if (SelectedPolygonTriangle.SelectionType != PolygonTriangle.SelectionTypes.None)
                {
                    ActivePolygon = SelectedPolygonTriangle.ActivePolygon;
                }

                switch (SelectionChoice)
                {
                case SelectionChoices.Move:
                    if (Control.ModifierKeys == Keys.Alt && SelectedPolygonTriangle.VertexIndex >= 0 && ReplaceVertexIndex >= 0 &&
                        SelectedPolygonTriangle.SelectionType == PolygonTriangle.SelectionTypes.Vertex)
                    {
                        ActivePolygon.ReplaceVertex(SelectedPolygonTriangle.VertexIndex, (short)ReplaceVertexIndex);
                        ActivePolygon.UpdateWorldPosition(Vector2.Zero, 0f);
                    }

                    SelectionChoice = SelectionChoices.None;
                    break;

                case SelectionChoices.SplitPolygon:
                    List <Polygon> ListNewPolygons = new List <Polygon>();
                    for (int P = PolygonCutterViewer.ListPolygon.Count - 1; P >= 0; --P)
                    {
                        Polygon NewPolygon = PolygonCutterViewer.ListPolygon[P].SplitPolygon(PolygonCutterViewer.SplittingPoint1, PolygonCutterViewer.SplittingPoint2);
                        if (NewPolygon != null)
                        {
                            ListNewPolygons.Add(NewPolygon);
                        }
                    }

                    PolygonCutterViewer.ListPolygon.AddRange(ListNewPolygons);
                    for (int P = PolygonCutterViewer.ListPolygon.Count - 1; P >= 0; --P)
                    {
                        PolygonCutterViewer.ListPolygon[P].FuseOverlappingVertex();
                        PolygonCutterViewer.ListPolygon[P].UpdateWorldPosition(Vector2.Zero, 0f);
                    }
                    PolygonCutterViewer.SplittingPoint2 = PolygonCutterViewer.SplittingPoint1 = Vector2.Zero;
                    break;

                case SelectionChoices.SplitTriangle:
                    ActivePolygon.SplitTriangle(new Vector2(e.X, e.Y), SelectedPolygonTriangle.TriangleIndex);
                    break;

                case SelectionChoices.SelectPolygon:
                    if (Control.ModifierKeys != Keys.Shift)
                    {
                        PolygonCutterViewer.ListSelectedPolygon.Clear();
                        SelectionChoice = SelectionChoices.None;
                    }
                    SelectedPolygonTriangle.SelectionType = PolygonTriangle.SelectionTypes.Polygon;
                    PolygonCutterViewer.ListSelectedPolygon.Add(ActivePolygon);
                    break;
                }
            }

            if (PolygonCutterViewer.EditOrigin)
            {
                for (int P = PolygonCutterViewer.ListPolygon.Count - 1; P >= 0; --P)
                {
                    PolygonCutterViewer.ListPolygon[P].ComputeColorAndUVCoordinates(PolygonCutterViewer.sprSource.Width, PolygonCutterViewer.sprSource.Height);
                }
            }
        }
Beispiel #18
0
        private void LayerViewer_MouseUp(object sender, MouseEventArgs e)
        {
            if (ActiveLayer == null)
            {
                return;
            }

            SelectionChoice = SelectionChoices.None;
            switch (tabControl1.SelectedIndex)
            {
            case 0:    //Layers
                break;

            case 1:    //Collisions
                if (e.Button == MouseButtons.Right && LayerViewer.SelectedPolygonTriangle != null)
                {
                    ActiveLayer.ListWorldCollisionPolygon.Remove((WorldPolygon)LayerViewer.SelectedPolygonTriangle.ActivePolygon);
                    lstCollisionBox.Items.Clear();

                    for (int C = 0; C < ActiveLayer.ListWorldCollisionPolygon.Count; C++)
                    {
                        lstCollisionBox.Items.Add("Collision box " + (lstCollisionBox.Items.Count + 1));
                    }
                }
                break;

            case 2:    //Backgrounds
                if (LayerViewer.SelectedAnimation != null)
                {
                    if (e.Button == MouseButtons.Right)
                    {
                        ActiveLayer.ListImages.Remove(LayerViewer.SelectedAnimation);
                    }
                    pgBackground.SelectedObject   = LayerViewer.SelectedAnimation;
                    LayerViewer.SelectedAnimation = null;
                }
                break;

            case 3:    //Props
                if (e.Button == MouseButtons.Left && LayerViewer.SelectedProp != null)
                {
                    pgProps.SelectedObject = LayerViewer.SelectedProp;
                }
                else if (e.Button == MouseButtons.Right && LayerViewer.SelectedProp != null)
                {
                    ActiveLayer.ListProp.Remove(LayerViewer.SelectedProp);
                }
                LayerViewer.SelectedProp = null;
                break;

            case 4:    //Spawn
                if (e.Button == MouseButtons.Left && LayerViewer.SelectedSpawn != null)
                {
                    pgSpawn.SelectedObject = LayerViewer.SelectedSpawn;
                }
                else if (e.Button == MouseButtons.Right && LayerViewer.SelectedSpawn != null)
                {
                    ActiveLayer.ListSpawnPointTeam.Remove(LayerViewer.SelectedSpawn);
                }
                LayerViewer.SelectedSpawn = null;
                break;

            case 5:    //Scripts
                LayerViewer.Helper.Scripting_MouseUp(e.Location, (e.Button & MouseButtons.Left) == MouseButtons.Left, (e.Button & MouseButtons.Right) == MouseButtons.Right);
                break;
            }

            MouseEventOld = e;
        }
Beispiel #19
0
 private void AnimationBackgroundViewer_MouseUp(object sender, MouseEventArgs e)
 {
     SelectionChoice = SelectionChoices.None;
 }
Beispiel #20
0
        private void PolygonCutterViewer_MouseDown(object sender, MouseEventArgs e)
        {
            MouseEventOld = e;
            int             RealX = MouseEventOld.X;
            int             RealY = MouseEventOld.Y;
            PolygonTriangle SelectedPolygonTriangle = PolygonCutterViewer.SelectedPolygonTriangle;

            switch (SelectionChoice)
            {
                #region None

            case SelectionChoices.None:
                if (PolygonCutterViewer.SelectedPolygonTriangle.SelectionType != PolygonTriangle.SelectionTypes.None)
                {
                    Polygon ActivePolygon = PolygonCutterViewer.SelectedPolygonTriangle.ActivePolygon;

                    if (e.Button == MouseButtons.Left)
                    {
                        SelectionChoice = SelectionChoices.Move;

                        if (SelectedPolygonTriangle.SelectionType == PolygonTriangle.SelectionTypes.Edge)
                        {
                            if (Control.ModifierKeys == Keys.Shift)
                            {
                                SelectedPolygonTriangle.VertexIndex = (short)ActivePolygon.ArrayVertex.Length;

                                ActivePolygon.AddVertexOnEdge(new Vector2(RealX, RealY), SelectedPolygonTriangle.EdgeIndex1, SelectedPolygonTriangle.EdgeIndex2);
                                ActivePolygon.UpdateWorldPosition(Vector2.Zero, 0f);
                            }
                            else if (Control.ModifierKeys == Keys.Alt)
                            {
                                SelectedPolygonTriangle.VertexIndex = (short)ActivePolygon.ArrayVertex.Length;

                                ActivePolygon.SplitEdge(new Vector2(RealX, RealY), SelectedPolygonTriangle.TriangleIndex, SelectedPolygonTriangle.EdgeIndex1, SelectedPolygonTriangle.EdgeIndex2);
                                ActivePolygon.UpdateWorldPosition(Vector2.Zero, 0f);
                            }
                        }
                        else if (SelectedPolygonTriangle.SelectionType == PolygonTriangle.SelectionTypes.Triangle)
                        {
                            if (Control.ModifierKeys == Keys.Shift)
                            {
                                ActivePolygon.SplitTriangle(new Vector2(e.X, e.Y), SelectedPolygonTriangle.TriangleIndex);
                                ActivePolygon.UpdateWorldPosition(Vector2.Zero, 0f);
                            }
                        }
                    }
                    else if (e.Button == MouseButtons.Right)
                    {
                        if (SelectedPolygonTriangle.SelectionType == PolygonTriangle.SelectionTypes.Vertex && SelectedPolygonTriangle.VertexIndex >= 0)    //Delete Vertex.
                        {
                            SelectedPolygonTriangle.ActivePolygon.RemoveVertex(SelectedPolygonTriangle.VertexIndex);
                        }
                        else if (SelectedPolygonTriangle.SelectionType == PolygonTriangle.SelectionTypes.Triangle && SelectedPolygonTriangle.TriangleIndex >= 0)    //Delete Triangle.
                        {
                        }
                    }
                }
                break;

                #endregion

            case SelectionChoices.SplitPolygon:
                PolygonCutterViewer.SplittingPoint1 = new Vector2(e.X, e.Y);
                break;
            }
        }