Example #1
0
 public void SetLevel(string level)
 {
     if (level == "reflector") isTest = true;
     else isTest = false;
     workingArea = WorkingArea.Create(level, Game.Content);
     workingArea.LevelFinish += workingArea_LevelFinish;
 }
Example #2
0
        protected Lens(WorkingArea father,int x, int y)
            : base(x,y,60,60)
        {
            this.Father = father;
            Background = father.Content.Load<Texture2D>("Images/MirrorMenu/circle");
            Background2 = father.Content.Load<Texture2D>("Images/MirrorMenu/circle_red");

            m_backRectangle = new Rectangle(X - 90, Y - 90, 180, 180);
            //Origin = new Vector2(30, 30);
        }
Example #3
0
 public Hole(WorkingArea father, int x1, int y1, int x2, int y2)
 {
     Father = father;
     hole1 = new m_Hole(Father.Content, x1, y1);
     hole2 = new m_Hole(Father.Content, x2, y2);
 }
Example #4
0
        public static WorkingArea Create(string level, ContentManager content)
        {
            string data = content.Load<string>("Level/" + level);
            try
            {
                WorkingArea area = new WorkingArea(content);
                Point pt1 = new Point(0,0), pt2 = new Point(0,0);

                string[] items = data.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                string[] sp = items[0].Split(',');

                area.ControlPanel = new ControlPanel(content, 0, 700, int.Parse(sp[0]), int.Parse(sp[1]));

                for(int i = 1;i<items.Length;i++)
                {
                    sp = items[i].Split(',');

                    int x = (int.Parse(sp[0]) - 1) * 60 + area.X;
                    int y = (int.Parse(sp[1]) - 1) * 60 + area.Y;
                    if (sp.Length < 5)
                    {
                        if(sp[2] == "8")
                            area.Walls.Add(new Wall(content, Colors.black, x, y));
                        else if(sp[2] == "6")
                        {
                            if (pt1.Y == 0)
                            {
                                pt1.X = x;
                                pt1.Y = y;
                            }
                            else if(pt2.Y == 0)
                            {
                                pt2.X = x;
                                pt2.Y = y;
                                area.Hole1 = new Hole(area, pt1.X, pt1.Y, pt2.X, pt2.Y);
                            }
                            else
                            {
                                throw new Exception("������������2,�������ڹؿ��ļ�" + level + "��");
                            }
                        }
                    }
                    else
                    {
                        Colors color = Colors.blue;
                        switch (sp[4])
                        {
                            case "1": color = Colors.blue; break;
                            case "2": color = Colors.yellow; break;
                            case "3": color = Colors.red; break;
                            case "4": color = Colors.green; break;
                            case "5": color = Colors.orange; break;
                            case "6": color = Colors.purple; break;
                        }

                        switch (sp[2])
                        {
                            case "7":
                                int angle = int.Parse(sp[3]) - 90;
                                area.Emitters.Add(new Emitter(content, color, x, y, -angle));
                                break;
                            case "3":
                                area.Receivers.Add(new Receiver(content, color, x, y));
                                break;
                            case "4":
                                area.Switches.Add(new Switch(content, color, x, y));
                                break;
                            case "5":
                                area.Walls.Add(new Wall(content, color, x, y));
                                break;
                        }

                    }
                }
                area.UpdateAllEmitter();
                area.CheckState();
                return area;
            }
            catch (Exception e)
            {
                return null;
            }
        }
Example #5
0
 public Prism(WorkingArea father, int x, int y)
     : base(father, x, y)
 {
     Foreground = Father.Content.Load<Texture2D>("Images/MirrorMenu/prism");
     this.Type = PrismType.Resolve;
     this.Origin = new Vector2(this.Foreground.Width / 2, this.Foreground.Height / 2);
 }
Example #6
0
 public Mirror(WorkingArea father, int x, int y)
     : base(father, x, y)
 {
     Foreground = Father.Content.Load<Texture2D>("Images/MirrorMenu/mirror");
     this.Origin = new Vector2(Foreground.Width / 2, Foreground.Height / 2);
 }