示例#1
0
 /* -------------------------------------------------------------- *\
 *   picTiles_Click()
 *
 *   - Selects the active tile ID
 \* -------------------------------------------------------------- */
 private void picTiles_Click(object sender, System.EventArgs e)
 {
     m_ActiveTileID = m_TileLibrary.TileToTileID(m_ActiveTileXIndex, m_ActiveTileYIndex);
     tile           = m_TileLibrary.ObjMonde.FirstOrDefault(x => x.Value.X_Image == m_ActiveTileXIndex &&
                                                            x.Value.Y_Image == m_ActiveTileYIndex).Value;
     picActiveTile.Refresh();
 }
示例#2
0
        public frmNew()
        {
            InitializeComponent();
            this.DialogResult = DialogResult.Cancel;
            m_Width           = 32;
            m_Height          = 32;

            // Add tile names to combobox when the window is initialized
            CTileLibrary cTile = new CTileLibrary();

            cboDefaultTile.Items.Add("No tile");

            foreach (Tile t in cTile.ObjMonde.Values)
            {
                cboDefaultTile.Items.Add(cTile.TileToTileID(t.X_Image, t.Y_Image) + "-" + t.Name);
            }
        }
示例#3
0
        /// <summary>
        /// Auteure : Joëlle Boyer
        /// Description : Changes the id of the selected tile and add it as the default tile.
        /// Date : 2019/11/03
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cboDefaultTile_SelectedIndexChanged(object sender, EventArgs e)
        {
            CTileLibrary cTile = new CTileLibrary();
            Tile         t;
            string       myItem = cboDefaultTile.SelectedItem.ToString();

            if (myItem == "No tile")
            {
                m_DefaultTile = -1;
            }
            else
            {
                myItem = myItem.Substring(myItem.IndexOf('-')).Replace("-", "");
            }

            if (myItem != "No tile")
            {
                t             = cTile.ObjMonde.FirstOrDefault(x => x.Value.Name == myItem).Value;
                m_DefaultTile = cTile.TileToTileID(t.X_Image, t.Y_Image);
            }
        }
示例#4
0
 /* -------------------------------------------------------------- *\
 *   picTiles_Click()
 *
 *   - Selects the active tile ID
 \* -------------------------------------------------------------- */
 private void picTiles_Click(object sender, System.EventArgs e)
 {
     m_ActiveTileID = m_TileLibrary.TileToTileID(m_ActiveTileXIndex, m_ActiveTileYIndex);
     picActiveTile.Refresh();
 }
示例#5
0
        public void MapExistingWorld(int worldId)
        {
            List <HugoLand.Item> lstItems = new List <HugoLand.Item>();

            lstItems = m_GestionItem.LstItems.Where(x => x.MondeId == worldId).ToList();
            List <HugoLand.Monstre> lstMonstres = new List <HugoLand.Monstre>();

            lstMonstres = m_GestionMonstre.LstMonstres.Where(x => x.MondeId == worldId).ToList();
            List <HugoLand.ObjetMonde> lstObjMonde = new List <HugoLand.ObjetMonde>();

            lstObjMonde = m_GestionObjetMonde.LstObjetMondes.Where(x => x.MondeId == worldId).ToList();

            HugoLand.Monde m = m_GestionMonde.LstMondes.FirstOrDefault(x => x.Id == worldId);
            int            i, j;

            if (m.LimiteX > csteApplication.MAP_MAX_WIDTH)
            {
                return;
            }
            if (m.LimiteY > csteApplication.MAP_MAX_HEIGHT)
            {
                return;
            }

            // Build Backbuffer
            m_Width  = m.LimiteX;
            m_Height = m.LimiteY;
            int defaultTile = 32; // Grass

            try
            {
                m_Tiles = new int[m_Height, m_Width];

                for (i = 0; i < m_Height; i++)
                {
                    for (j = 0; j < m_Width; j++)
                    {
                        if (j == 0 && i == 0)
                        {
                            foreach (HugoLand.ObjetMonde obj in lstObjMonde)
                            {
                                m_Tiles[obj.x, obj.y] = m_TileLibrary.TileToTileID(obj.x, obj.y);
                            }
                            foreach (HugoLand.Monstre monster in lstMonstres)
                            {
                                m_Tiles[monster.x, monster.y] = m_TileLibrary.TileToTileID(monster.x, monster.y);
                            }
                            foreach (HugoLand.Item item in lstItems)
                            {
                                if (item.IdHero != null)
                                {
                                    m_Tiles[(int)item.x, (int)item.y] = m_TileLibrary.TileToTileID((int)item.x, (int)item.y);
                                }
                            }
                        }
                        if (m.DefaultTile != null && m_Tiles[i, j] == 0)
                        {
                            m_Tiles[i, j] = defaultTile;
                        }
                    }
                }

                m_BackBuffer   = new Bitmap(m_Width * csteApplication.TILE_WIDTH_IN_MAP, m_Height * csteApplication.TILE_HEIGHT_IN_MAP);
                m_BackBufferDC = Graphics.FromImage(m_BackBuffer);

                Refresh();
            }
            catch
            {
                return;
            }
        }