public Area(dPoint p)
 {
     this.top_right = p;
     this.top_left  = p;
     this.bot_right = p;
     this.bot_left  = p;
 }
 public override void MoveCamera(dPoint p)
 {
     if (this.running)
     {
         base.MoveCamera(this.camera);
     }
     else
     {
         base.MoveCamera(p);
     }
 }
        public override bool ChangeSize(ScreenSize size)
        {
            if (this.sequences.Count != 0)
            {
                return(false);
            }
            if (!base.ChangeSize(size))
            {
                return(false);
            }
            double num4 = (this.margins.right - this.camera_center.X) / base.Cood2PixelRatio;
            double x    = (this.camera_center.Y - this.margins.top) / base.Cood2PixelRatio;
            double a    = Math.Atan(base.camera_dist / x);

            this.top_right   = new dPoint();
            this.top_right.Y = (x / Math.Sin((a + base.camera_angle) - 1.5707963267948966)) * Math.Sin(3.1415926535897931 - a);
            double num2 = Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(base.camera_dist, 2.0));
            double num3 = (x / Math.Sin((a + base.camera_angle) - 1.5707963267948966)) * Math.Sin(1.5707963267948966 - base.camera_angle);

            this.top_right.X = (num4 / num2) * (num2 + num3);
            num4             = (this.margins.left - this.camera_center.X) / base.Cood2PixelRatio;
            x                = (this.camera_center.Y - this.margins.top) / base.Cood2PixelRatio;
            a                = Math.Atan(base.camera_dist / x);
            this.top_left    = new dPoint();
            this.top_left.Y  = (x / Math.Sin((a + base.camera_angle) - 1.5707963267948966)) * Math.Sin(3.1415926535897931 - a);
            num2             = Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(base.camera_dist, 2.0));
            num3             = (x / Math.Sin((a + base.camera_angle) - 1.5707963267948966)) * Math.Sin(1.5707963267948966 - base.camera_angle);
            this.top_left.X  = (num4 / num2) * (num2 + num3);
            num4             = (this.margins.right - this.camera_center.X) / base.Cood2PixelRatio;
            x                = (this.margins.bot - this.camera_center.Y) / base.Cood2PixelRatio;
            a                = Math.Atan(base.camera_dist / x);
            this.bot_right   = new dPoint();
            this.bot_right.Y = (-x / Math.Sin((1.5707963267948966 + base.camera_angle) - a)) * Math.Sin(a);
            num2             = Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(base.camera_dist, 2.0));
            num3             = (x / Math.Sin((1.5707963267948966 + base.camera_angle) - a)) * Math.Sin(1.5707963267948966 - base.camera_angle);
            this.bot_right.X = (num4 / num2) * (num2 - num3);
            num4             = (this.margins.left - this.camera_center.X) / base.Cood2PixelRatio;
            x                = (this.margins.bot - this.camera_center.Y) / base.Cood2PixelRatio;
            a                = Math.Atan(base.camera_dist / x);
            this.bot_left    = new dPoint();
            this.bot_left.Y  = (-x / Math.Sin((1.5707963267948966 + base.camera_angle) - a)) * Math.Sin(a);
            num2             = Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(base.camera_dist, 2.0));
            num3             = (x / Math.Sin((1.5707963267948966 + base.camera_angle) - a)) * Math.Sin(1.5707963267948966 - base.camera_angle);
            this.bot_left.X  = (num4 / num2) * (num2 - num3);
            this.right_slope = (this.top_right.Y - this.bot_right.Y) / (this.top_right.X - this.bot_right.X);
            this.left_slope  = (this.top_left.Y - this.bot_left.Y) / (this.top_left.X - this.bot_left.X);
            this.top_length  = this.top_right.X - this.top_left.X;
            this.bot_length  = this.bot_right.X - this.bot_left.X;
            this.height      = this.top_right.Y - this.bot_right.Y;
            return(true);
        }
        public void Run()
        {
            this.running = true;
            int index = 0;
            int num2  = index;
            int num3  = index;
            int num4  = index + 1;

            while ((num2 < this.sequences.Count) && (num4 < this.sequences.Count))
            {
                Sequence sequence;
                Area     area;
                if (this.CompareArea(this.sequences[num3].areas[this.sequences[num3].areas.Count - 1], this.sequences[num4].areas[this.sequences[num4].areas.Count - 1], out area))
                {
                    this.sequences[num3].areas[this.sequences[num3].areas.Count - 1] = area;
                    if (this.sequences[num4].change_cam.Count != 1)
                    {
                        num3 = num2 + 1;
                    }
                    this.sequences[num4].change_cam[0] = -1;
                    sequence = this.sequences[num4];
                    this.sequences.RemoveAt(num4);
                    this.sequences.Insert(++num2, sequence);
                }
                else if (this.CompareArea(this.sequences[num4].areas[this.sequences[num4].areas.Count - 1], this.sequences[index].areas[this.sequences[index].areas.Count - 1], out area))
                {
                    this.sequences[num4].areas[this.sequences[num4].areas.Count - 1] = area;
                    this.sequences[index].change_cam[0] = -1;
                    sequence = this.sequences[num4];
                    this.sequences.RemoveAt(num4);
                    this.sequences.Insert(index, sequence);
                    num2++;
                }
                num4++;
                if (num4 == this.sequences.Count)
                {
                    num2++;
                    index = num2;
                    num3  = num2;
                    num4  = num2 + 1;
                }
            }
            for (num4 = 0; num4 < this.sequences.Count; num4++)
            {
                int num5 = -1;
                num3 = 0;
                while ((num5 == -1) && (num3 < this.sequences[num4].change_cam.Count))
                {
                    num5 = this.sequences[num4].change_cam[num3++];
                }
                for (int i = 0; i < this.sequences[num4].sequence.Count; i++)
                {
                    if (i == num5)
                    {
                        Area area2 = this.sequences[num4].areas[num3 - 1];
                        this.camera = new dPoint(area2.bot_left.X + (((area2.bot_right.X - area2.bot_left.X) * this.bot_right.X) / this.bot_length), area2.bot_left.Y + (((area2.top_left.Y - area2.bot_left.Y) * Math.Abs(this.bot_left.Y)) / this.height));
                        for (num5 = -1; (num5 == -1) && (num3 < this.sequences[num4].change_cam.Count); num5 = this.sequences[num4].change_cam[num3++])
                        {
                        }
                    }
                    this.ParseAndRun(this.sequences[num4].sequence[i]);
                }
            }
            for (num4 = 0; num4 < this.run_list.Count; num4++)
            {
                this.ParseAndRun(this.run_list[num4]);
            }
            this.sequences.Clear();
            this.run_list.Clear();
            this.running = false;
        }
        private bool CheckArea(Area a, dPoint p, out Area result)
        {
            double num;

            if (((a.top_right.Y >= p.Y) && (p.Y >= (a.top_right.Y - this.height))) && ((p.X >= ((a.top_right.X - this.top_length) + ((p.Y - a.top_right.Y) / this.left_slope))) && (p.X <= (a.top_right.X + ((p.Y - a.top_right.Y) / this.right_slope)))))
            {
                if (p.Y < a.bot_right.Y)
                {
                    num            = p.Y - a.bot_right.Y;
                    a.bot_right.X += num / this.right_slope;
                    a.bot_left.X  += num / this.left_slope;
                    a.bot_right.Y  = p.Y;
                    a.bot_left.Y   = p.Y;
                }
                if (p.X < (a.top_left.X + ((p.Y - a.top_left.Y) / this.left_slope)))
                {
                    a.top_left.X = ((a.top_left.Y - p.Y) / this.left_slope) + p.X;
                    a.bot_left.X = ((a.bot_left.Y - p.Y) / this.left_slope) + p.X;
                }
                result = a;
                return(false);
            }
            if (((a.top_left.Y >= p.Y) && (p.Y >= (a.top_left.Y - this.height))) && ((p.X >= (a.top_left.X + ((p.Y - a.top_left.Y) / this.left_slope))) && (p.X <= ((a.top_left.X + this.top_length) + ((p.Y - a.top_left.Y) / this.right_slope)))))
            {
                if (p.Y < a.bot_left.Y)
                {
                    num            = p.Y - a.bot_left.Y;
                    a.bot_right.X += num / this.right_slope;
                    a.bot_left.X  += num / this.left_slope;
                    a.bot_right.Y  = p.Y;
                    a.bot_left.Y   = p.Y;
                }
                if (p.X > (a.top_right.X + ((p.Y - a.top_right.Y) / this.right_slope)))
                {
                    a.top_right.X = ((a.top_right.Y - p.Y) / this.right_slope) + p.X;
                    a.bot_right.X = ((a.bot_right.Y - p.Y) / this.right_slope) + p.X;
                }
                result = a;
                return(false);
            }
            if ((((a.bot_right.Y + this.height) >= p.Y) && (p.Y >= a.bot_right.Y)) && ((p.X >= ((a.bot_right.X - this.top_length) + ((p.Y - a.bot_right.Y) / this.left_slope))) && (p.X <= (a.bot_right.X + ((p.Y - a.bot_right.Y) / this.right_slope)))))
            {
                if (p.Y > a.top_right.Y)
                {
                    num            = p.Y - a.top_right.Y;
                    a.top_right.X += num / this.right_slope;
                    a.top_left.X  += num / this.left_slope;
                    a.top_right.Y  = p.Y;
                    a.top_left.Y   = p.Y;
                }
                if (p.X < (a.bot_left.X + ((p.Y - a.bot_left.Y) / this.left_slope)))
                {
                    a.top_left.X = ((a.top_left.Y - p.Y) / this.left_slope) + p.X;
                    a.bot_left.X = ((a.bot_left.Y - p.Y) / this.left_slope) + p.X;
                }
                result = a;
                return(false);
            }
            if ((((a.bot_left.Y + this.height) >= p.Y) && (p.Y <= a.bot_left.Y)) && ((p.X >= (a.bot_left.X + ((p.Y - a.bot_left.Y) / this.left_slope))) && (p.X <= ((a.bot_left.X + this.top_length) + ((p.Y - a.bot_left.Y) / this.right_slope)))))
            {
                if (p.Y > a.top_left.Y)
                {
                    num            = p.Y - a.top_left.Y;
                    a.top_right.X += num / this.right_slope;
                    a.top_left.X  += num / this.left_slope;
                    a.top_right.Y  = p.Y;
                    a.top_left.Y   = p.Y;
                }
                if (p.X > (a.bot_right.X + ((p.Y - a.bot_right.Y) / this.right_slope)))
                {
                    a.top_right.X = ((a.top_right.Y - p.Y) / this.right_slope) + p.X;
                    a.bot_right.X = ((a.bot_right.Y - p.Y) / this.right_slope) + p.X;
                }
                result = a;
                return(false);
            }
            result = a;
            return(true);
        }
 public virtual void MoveCamera(dPoint p)
 {
     this.MoveCamera(p.X, p.Y);
 }
 public void GameRightClick(dPoint p, bool doubleclick = false)
 {
     this.GameRightClick(p.X, p.Y, doubleclick);
 }