Exemple #1
0
        private void panDrawingSurface_MouseDown(object sender, MouseEventArgs e)
        {
            Rectangle MouseRec = new Rectangle(e.X + ScriptStartingPos.X, e.Y + ScriptStartingPos.Y, 1, 1);

            MousePosOld = e.Location;

            for (int S = ActiveCutscene.DicActionScript.Count - 1; S >= 0; --S)
            {
                if (MouseRec.IntersectsWith(ActiveCutscene.DicActionScript[S].ScriptSize))
                {
                    SelectScript(ActiveCutscene.DicActionScript[S]);
                    ActiveScriptIndex = S;
                    ActiveScriptType  = ActiveScriptTypes.ActionScript;
                    return;
                }
                else if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
                {
                    //Triggers.
                    for (int T = ActiveCutscene.DicActionScript[S].NameTriggers.Length - 1; T >= 0; --T)
                    {
                        if (MouseRec.X >= ActiveCutscene.DicActionScript[S].ScriptSize.X - 10 && MouseRec.X <= ActiveCutscene.DicActionScript[S].ScriptSize.X - 5 &&
                            MouseRec.Y >= ActiveCutscene.DicActionScript[S].ScriptSize.Y + 19 + T * 12 && MouseRec.Y <= ActiveCutscene.DicActionScript[S].ScriptSize.Y + 24 + T * 12)
                        {
                            ScriptLink           = ActiveCutscene.DicActionScript[S];
                            ScriptLinkIndex      = S;
                            ScriptLinkType       = ScriptLinkTypes.Trigger;
                            ScriptLinkEventIndex = T;
                            ScriptLinkStartPos   = new Point(ActiveCutscene.DicActionScript[S].ScriptSize.X - 7, ActiveCutscene.DicActionScript[S].ScriptSize.Y + 21 + T * 12);
                            return;
                        }
                    }
                    //Events.
                    for (int E = ActiveCutscene.DicActionScript[S].NameEvents.Length - 1; E >= 0; --E)
                    {
                        if (MouseRec.X >= ActiveCutscene.DicActionScript[S].ScriptSize.X + ActiveCutscene.DicActionScript[S].ScriptSize.Width + 5 && MouseRec.X <= ActiveCutscene.DicActionScript[S].ScriptSize.X + ActiveCutscene.DicActionScript[S].ScriptSize.Width + 10 &&
                            MouseRec.Y >= ActiveCutscene.DicActionScript[S].ScriptSize.Y + ActiveCutscene.DicActionScript[S].ScriptSize.Height - ActiveCutscene.DicActionScript[S].NameEvents.Length * 12 + 1 + E * 12 && MouseRec.Y <= ActiveCutscene.DicActionScript[S].ScriptSize.Y + ActiveCutscene.DicActionScript[S].ScriptSize.Height - ActiveCutscene.DicActionScript[S].NameEvents.Length * 12 + 6 + E * 12)
                        {
                            ScriptLink           = ActiveCutscene.DicActionScript[S];
                            ScriptLinkIndex      = S;
                            ScriptLinkType       = ScriptLinkTypes.Event;
                            ScriptLinkEventIndex = E;
                            ScriptLinkStartPos   = new Point(ActiveCutscene.DicActionScript[S].ScriptSize.X + ActiveCutscene.DicActionScript[S].ScriptSize.Width + 7, ActiveCutscene.DicActionScript[S].ScriptSize.Y + ActiveCutscene.DicActionScript[S].ScriptSize.Height - ActiveCutscene.DicActionScript[S].NameEvents.Length * 12 + 3 + E * 12);
                            return;
                        }
                    }
                }
            }
            for (int D = ActiveCutscene.ListDataContainer.Count - 1; D >= 0; --D)
            {
                if (MouseRec.IntersectsWith(ActiveCutscene.ListDataContainer[D].ScriptSize))
                {
                    SelectScript(ActiveCutscene.ListDataContainer[D]);
                    ActiveScriptIndex = D;
                    ActiveScriptType  = ActiveScriptTypes.DataContainer;
                    return;
                }
            }
        }
Exemple #2
0
        private void panDrawingSurface_MouseUp(object sender, MouseEventArgs e)
        {
            Rectangle MouseRec = new Rectangle(e.X + ScriptStartingPos.X, e.Y + ScriptStartingPos.Y, 1, 1);

            #region Action Scripts

            for (int S = ActiveCutscene.DicActionScript.Count - 1; S >= 0; --S)
            {
                if (MouseRec.IntersectsWith(ActiveCutscene.DicActionScript[S].ScriptSize))
                {
                    if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
                    {
                        ActiveScriptIndex = -1;
                        return;
                    }
                    else if ((e.Button & MouseButtons.Right) == MouseButtons.Right)
                    {
                        cmsScriptMenu.Show(this, PointToClient(Cursor.Position));
                        return;
                    }
                }

                #region Linking

                else
                {
                    #region Triggers

                    for (int T = ActiveCutscene.DicActionScript[S].NameTriggers.Length - 1; T >= 0; --T)
                    {
                        if (MouseRec.X >= ActiveCutscene.DicActionScript[S].ScriptSize.X - 10 && MouseRec.X <= ActiveCutscene.DicActionScript[S].ScriptSize.X - 5 &&
                            MouseRec.Y >= ActiveCutscene.DicActionScript[S].ScriptSize.Y + 19 + T * 12 && MouseRec.Y <= ActiveCutscene.DicActionScript[S].ScriptSize.Y + 24 + T * 12)
                        {
                            EventInfo NewEvent = new EventInfo(S, T);
                            if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
                            {
                                if (ScriptLink != null && ScriptLink != ActiveCutscene.DicActionScript[S])
                                {//Event to Trigger.
                                    if (ScriptLinkType == ScriptLinkTypes.Event && !ScriptLink.ArrayEvents[ScriptLinkEventIndex].Contains(NewEvent))
                                    {
                                        ScriptLink.ArrayEvents[ScriptLinkEventIndex].Add(NewEvent);
                                    }
                                    ScriptLink           = null;
                                    ScriptLinkIndex      = -1;
                                    ScriptLinkEventIndex = -1;
                                    ScriptLinkType       = ScriptLinkTypes.None;
                                    DrawScripts();
                                    return;
                                }
                            }
                            else if ((e.Button & MouseButtons.Right) == MouseButtons.Right)
                            {
                                for (int i = ActiveCutscene.DicActionScript.Count - 1; i >= 0; --i)
                                {
                                    for (int E = ActiveCutscene.DicActionScript[i].ArrayEvents.Length - 1; E >= 0; --E)
                                    {
                                        ActiveCutscene.DicActionScript[i].ArrayEvents[E].Remove(NewEvent);
                                    }
                                }
                                DrawScripts();
                            }
                        }
                    }

                    #endregion

                    #region Events

                    for (int E = ActiveCutscene.DicActionScript[S].NameEvents.Length - 1; E >= 0; --E)
                    {
                        if (MouseRec.X >= ActiveCutscene.DicActionScript[S].ScriptSize.X + ActiveCutscene.DicActionScript[S].ScriptSize.Width + 5 && MouseRec.X <= ActiveCutscene.DicActionScript[S].ScriptSize.X + ActiveCutscene.DicActionScript[S].ScriptSize.Width + 10 &&
                            MouseRec.Y >= ActiveCutscene.DicActionScript[S].ScriptSize.Y + ActiveCutscene.DicActionScript[S].ScriptSize.Height - ActiveCutscene.DicActionScript[S].NameEvents.Length * 12 + 1 + E * 12 && MouseRec.Y <= ActiveCutscene.DicActionScript[S].ScriptSize.Y + ActiveCutscene.DicActionScript[S].ScriptSize.Height - ActiveCutscene.DicActionScript[S].NameEvents.Length * 12 + 6 + E * 12)
                        {
                            if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
                            {
                                if (ScriptLink != null && ScriptLink != ActiveCutscene.DicActionScript[S])
                                {//Trigger to Event.
                                    if (ScriptLinkType == ScriptLinkTypes.Trigger)
                                    {
                                        ActiveCutscene.DicActionScript[S].ArrayEvents[E].Add(new EventInfo(ScriptLinkIndex, ScriptLinkEventIndex));
                                    }
                                    ScriptLink           = null;
                                    ScriptLinkIndex      = -1;
                                    ScriptLinkEventIndex = -1;
                                    ScriptLinkType       = ScriptLinkTypes.None;
                                    DrawScripts();
                                    return;
                                }
                            }
                            else if ((e.Button & MouseButtons.Right) == MouseButtons.Right)
                            {
                                ActiveCutscene.DicActionScript[S].ArrayEvents[E].Clear();
                                DrawScripts();
                            }
                            return;
                        }
                    }

                    #endregion
                }

                #endregion
            }

            #endregion

            //Data containers
            for (int D = ActiveCutscene.ListDataContainer.Count - 1; D >= 0; --D)
            {
                if (MouseRec.IntersectsWith(ActiveCutscene.ListDataContainer[D].ScriptSize))
                {
                    if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
                    {
                        ActiveScriptIndex = -1;
                        return;
                    }
                    else if ((e.Button & MouseButtons.Right) == MouseButtons.Right)
                    {
                        cmsScriptMenu.Show(this, PointToClient(Cursor.Position));
                        return;
                    }
                }
            }
            ScriptLink           = null;
            ScriptLinkIndex      = -1;
            ScriptLinkEventIndex = -1;
            ScriptLinkType       = ScriptLinkTypes.None;
            ActiveScriptIndex    = -1;
            DrawScripts();
        }