Пример #1
0
 public static int CompareGraphics(GraphicElement g1, GraphicElement g2)
 {
     if (g1.Location.Y > g2.Location.Y)
         return 1;
     if (g1.Location.Y == g2.Location.Y)
         return 0;
     if (g1.Location.Y < g2.Location.Y)
         return -1;
     return 0;
 }
Пример #2
0
        public void UpdatePlayerLocation()
        {
            SortedList <int, int> PpL = new SortedList <int, int>();

            foreach (Place p in Places.AllPlaces.Values)
            {
                PpL.Add(p.ID, 0);
            }

            foreach (Player p in Players)
            {
                PpL[p.LocationID]++;
            }

            SortedList <int, int> PpL_left = new SortedList <int, int>(PpL);

            GraphicElement[] PlayerGraphics = new GraphicElement[Players.Length];

            int    locID;
            double angle;
            double startAngle = Math.PI / 2;
            double length     = 50;

            Point pos;

            for (int i = 0; i < Players.Length; i++)
            {
                locID = Players[i].LocationID;
                angle = 2 * Math.PI / (double)PpL[locID];

                if (angle == 2 * Math.PI)
                {
                    pos = Places.AllPlaces[locID].Location;
                }
                else
                {
                    pos    = new Point((int)(Math.Sin(PpL_left[locID] * angle + startAngle) * length), (int)(Math.Cos(PpL_left[locID] * angle + startAngle) * length));
                    pos.X += Places.AllPlaces[locID].Location.X;
                    pos.Y += Places.AllPlaces[locID].Location.Y;
//					Point.Add(pos,new Size(Places.AllPlaces[locID].Location));
                    PpL_left[locID]--;
                }

                pos = Point.Subtract(pos, new Size(Players[i].Image.Width / 2, Players[i].Image.Height));
                PlayerGraphics[i] = new GraphicElement(Players[i].Image, pos);
            }

            Map.ResetBackground();

            Map.AddGraphic(PlayerGraphics);

            Map.RedrawImage();
        }
Пример #3
0
 public static int CompareGraphics(GraphicElement g1, GraphicElement g2)
 {
     if (g1.Location.Y > g2.Location.Y)
     {
         return(1);
     }
     if (g1.Location.Y == g2.Location.Y)
     {
         return(0);
     }
     if (g1.Location.Y < g2.Location.Y)
     {
         return(-1);
     }
     return(0);
 }
Пример #4
0
        public void UpdatePlayerLocation()
        {
            SortedList<int,int> PpL = new SortedList<int, int>();
            foreach (Place p in Places.AllPlaces.Values)
            {
                PpL.Add(p.ID,0);
            }

            foreach(Player p in Players)
            {
                PpL[p.LocationID] ++;
            }

            SortedList<int,int> PpL_left = new SortedList<int, int>(PpL);

            GraphicElement[] PlayerGraphics = new GraphicElement[Players.Length];

            int locID;
            double angle;
            double startAngle = Math.PI/2;
            double length = 50;

            Point pos;

            for (int i = 0; i < Players.Length; i++)
            {
                locID = Players[i].LocationID;
                angle = 2*Math.PI/(double)PpL[locID];

                if (angle == 2*Math.PI)
                {
                    pos = Places.AllPlaces[locID].Location;
                }
                else
                {
                    pos = new Point((int)(Math.Sin(PpL_left[locID] * angle + startAngle)*length),(int)(Math.Cos(PpL_left[locID] * angle + startAngle)*length));
                    pos.X += Places.AllPlaces[locID].Location.X;
                    pos.Y += Places.AllPlaces[locID].Location.Y;
            //					Point.Add(pos,new Size(Places.AllPlaces[locID].Location));
                    PpL_left[locID] --;
                }

                pos = Point.Subtract(pos, new Size(Players[i].Image.Width/2, Players[i].Image.Height));
                PlayerGraphics[i] = new GraphicElement(Players[i].Image, pos);
            }

            Map.ResetBackground();

            Map.AddGraphic(PlayerGraphics);

            Map.RedrawImage();
        }
Пример #5
0
 static public void AddGraphic(GraphicElement g)
 {
     AddGraphic(g.Image, g.Location);
 }
Пример #6
0
 public static void AddGraphic(GraphicElement g)
 {
     AddGraphic(g.Image, g.Location);
 }
Пример #7
0
 public static void AddGraphic(GraphicElement[] gs)
 {
     Array.Sort(gs, GraphicElement.CompareGraphics);
     foreach (GraphicElement g in gs)
         AddGraphic(g);
 }