Exemplo n.º 1
0
        public FieldItemEditor(MainSave sav)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);

            SAV   = sav;
            Items = new FieldItemManager(SAV.GetFieldItems());

            var l1 = Items.Layer1;

            Scale1    = new int[l1.GridWidth * l1.GridHeight];
            ScaleX    = new int[Scale1.Length * AcreScale * AcreScale];
            ScaleAcre = new Bitmap(l1.GridWidth * AcreScale, l1.GridHeight * AcreScale);

            Map        = new int[l1.MapWidth * l1.MapHeight * MapScale * MapScale];
            MapReticle = new Bitmap(l1.MapWidth * MapScale, l1.MapHeight * MapScale);

            Terrain = new TerrainManager(sav.GetTerrain());
            PB_Map.BackgroundImage = TerrainSprite.CreateMap(Terrain, 2);

            foreach (var acre in MapGrid.Acres)
            {
                CB_Acre.Items.Add(acre.Name);
            }

            PG_Tile.SelectedObject = new FieldItem();
            CB_Acre.SelectedIndex  = 0;
            LoadGrid(X, Y);
        }
Exemplo n.º 2
0
        private void Menu_SavePNG_Click(object sender, EventArgs e)
        {
            var pb = WinFormsUtil.GetUnderlyingControl <PictureBox>(sender);

            if (pb?.Image == null)
            {
                WinFormsUtil.Alert("No picture loaded.");
                return;
            }

            const string name = "map";
            var          bmp  = TerrainSprite.CreateMap(Terrain);

            using var sfd = new SaveFileDialog
                  {
                      Filter   = "png file (*.png)|*.png|All files (*.*)|*.*",
                      FileName = $"{name}.png",
                  };
            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            bmp.Save(sfd.FileName, ImageFormat.Png);
        }
Exemplo n.º 3
0
 private void ReloadMap() => PB_Map.Image = TerrainSprite.CreateMap(Terrain, 2, AcreIndex);
Exemplo n.º 4
0
 private static void RefreshTile(Control button, TerrainTile tile)
 {
     button.Text      = TerrainSprite.GetTileName(tile);
     button.BackColor = TerrainSprite.GetTileColor(tile);
 }
Exemplo n.º 5
0
 private void ReloadMap() => PB_Map.Image = TerrainSprite.CreateMap(Terrain, MapScale, X, Y);
Exemplo n.º 6
0
 private void ReloadBackground(int topX, int topY)
 {
     PB_Acre.BackgroundImage = TerrainSprite.GetAcre(topX / 2, topY / 2, Terrain, AcreScale * 2);
 }
Exemplo n.º 7
0
 public Bitmap GetBackgroundAcre(Font f, byte tbuild, byte tterrain, int index = -1)
 {
     return(TerrainSprite.GetAcre(this, f, PixelsBackgroundAcre1, PixelsBackgroundAcreX, BackgroundAcre, index, tbuild, tterrain));
 }
Exemplo n.º 8
0
 public Bitmap GetBackgroundTerrain(int index = -1)
 {
     return(TerrainSprite.GetMapWithBuildings(Map, null, PixelsBackgroundMap1, PixelsBackgroundMapX, BackgroundMap, 2, index));
 }