Beispiel #1
0
 public ExtraTileInfo (LayMapTile tile, OGLTextureManager manager)
 {
     Parent = tile;
     TextureManager = manager;
     Texture = TextureManager.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Tiles\" + tile.Id + ".png"));
     if (Texture == null)
         Texture = TextureManager.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Tiles\unknown.png"));
 }
Beispiel #2
0
        public LayMap(LayFile lf)
        {
            bool foundMap = false;
            string[] tempStrings;

            // Load the map
            for (int i = 0; i < lf.Properties.Count; i++)
            {
                LayProperty prop = lf.Properties[i];

                if (prop.Key == "GridDimensions")
                {
                    tempStrings = prop.Value.Explode(",");

                    if (tempStrings.Length != 2)
                        throw new Exception("Invalid map: size incorrect");


                    Size = new Size(int.Parse(tempStrings[0]), int.Parse(tempStrings[1]));
                    Tiles = new LayMapTile[Size.Width, Size.Height];
                    m_tmpTiles = new LayMapTile[Size.Width, Size.Height];
                    foundMap = true;
                    continue;
                }

                if (!foundMap)
                    continue;

                if (prop.Key == "")
                    continue;

                if (prop.Key == "DynamicATNData")
                {
                    break;
                }
                m_Y++;

                string[] parts = prop.Key.Explode(",");

                m_X = 0;

                try
                {
                    foreach (string part in parts)
                    {
                        Tiles[m_X, m_Y] = new LayMapTile(part, m_X, m_Y);
                        m_tmpTiles[m_X, m_Y] = Tiles[m_X, m_Y];

                        m_X++;
                        
                        LayEntity le = lf.FindEntityByGridLocation(m_X-1, m_Y);
                        if (le != null)
                        {
                            le.TilesGrid.Tiles.Add(Tiles[m_X-1, m_Y]);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ex = ex;
                }
                m_TileProperties.Add(prop);

                string mapPart = prop.Key;
                mapPart = mapPart.Replace("20006A", "20000A");
                prop.Key = mapPart;
            }

            if (!foundMap)
                throw new Exception("No map data found!");

            for (int x = 0; x < Size.Width; x++)
            {
                for (int y = 0; y < Size.Height; y++)
                {
                   // Tiles[x, y] = m_tmpTiles[Size.Width - x - 1, y];       // something for later :P             
                }

            }
        }
Beispiel #3
0
        private void oGL_MouseMove(object sender, MouseEventArgs e)
        {
            m_LastMouseMovement = e;

            if (m_Map == null)
                return;

            int x = GetPositionOnMap(e.X + m_PositionX);
            if (x < 0)
                return;

            int y = GetPositionOnMap(e.Y + m_PositionY);
            if (y < 0)
                return;

            if ((x < m_Map.Size.Width) && (y < m_Map.Size.Height))
                m_LastHoveredTile = m_Map.Tiles[x, y];
        }
Beispiel #4
0
        public LayMap(LayFile lf)
        {
            bool foundMap = false;

            string[] tempStrings;

            // Load the map
            for (int i = 0; i < lf.Properties.Count; i++)
            {
                LayProperty prop = lf.Properties[i];

                if (prop.Key == "GridDimensions")
                {
                    tempStrings = prop.Value.Explode(",");

                    if (tempStrings.Length != 2)
                    {
                        throw new Exception("Invalid map: size incorrect");
                    }


                    Size       = new Size(int.Parse(tempStrings[0]), int.Parse(tempStrings[1]));
                    Tiles      = new LayMapTile[Size.Width, Size.Height];
                    m_tmpTiles = new LayMapTile[Size.Width, Size.Height];
                    foundMap   = true;
                    continue;
                }

                if (!foundMap)
                {
                    continue;
                }

                if (prop.Key == "")
                {
                    continue;
                }

                if (prop.Key == "DynamicATNData")
                {
                    break;
                }
                m_Y++;

                string[] parts = prop.Key.Explode(",");

                m_X = 0;

                try
                {
                    foreach (string part in parts)
                    {
                        Tiles[m_X, m_Y]      = new LayMapTile(part, m_X, m_Y);
                        m_tmpTiles[m_X, m_Y] = Tiles[m_X, m_Y];

                        m_X++;

                        LayEntity le = lf.FindEntityByGridLocation(m_X - 1, m_Y);
                        if (le != null)
                        {
                            le.TilesGrid.Tiles.Add(Tiles[m_X - 1, m_Y]);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ex = ex;
                }
                m_TileProperties.Add(prop);

                string mapPart = prop.Key;
                mapPart  = mapPart.Replace("20006A", "20000A");
                prop.Key = mapPart;
            }

            if (!foundMap)
            {
                throw new Exception("No map data found!");
            }

            for (int x = 0; x < Size.Width; x++)
            {
                for (int y = 0; y < Size.Height; y++)
                {
                    // Tiles[x, y] = m_tmpTiles[Size.Width - x - 1, y];       // something for later :P
                }
            }
        }
Beispiel #5
0
 private void ProcessTile(LayMapTile tile)
 {
     Text += tile.Position.X.ToString() + "," + tile.Position.Y.ToString();
     txtTileId.Text = tile.Id + " (Raw id: " + tile.RawId + ")";
 }
Beispiel #6
0
        public frmTileDetail(LayMapTile tile)
        {
            InitializeComponent();

            ProcessTile(tile);
        }