Пример #1
0
        private void LoadMaps(ContentManager content)
        {
            //Loads all the map models from json textfiles
            mapModels = Serializing.LoadMaps();
            mapThumbs = new List <ImageController>();

            int row = 0, column = 0, i = 0;

            foreach (var map in mapModels)
            {
                ImageController thumb = new ImageController(Screen, map.thumbImage, 3, true);
                thumb.IsVisible     = false;
                thumb.ScaleDefault  = 0.1f;
                thumb.OriginDefault = new Vector2(300, 230) / 2;

                ImageModel img = thumb.SetPosition(300 * column + 200, row * 230 + 180);
                img.SetBoundBox(World, 280, 210, Vector2.Zero, Category.Cat5, Category.Cat4, true);
                img.BoundBox.IsSensor = true;
                img.BoundBox.Enabled  = false;
                img.BoundBox.UserData = i;

                AddController(thumb);
                mapThumbs.Add(thumb);

                if (column == 3)
                {
                    row++;
                    column = 0;
                }
                else
                {
                    column++;
                }

                i++;
            }
        }