Beispiel #1
0
        internal WorldPart(MapItem data, MapInfo mapDataList, SencePart sencePart, int collusionLayer, MapManager.MapLoadingData loadingData)
        {
            m_data = loadingData;
            int count = data.List.Count;
            m_manager = WorldManager.GetInstance();
            m_mapData = sencePart;
            m_collusionLayer = collusionLayer;

            //m_filepath = new string[count];
            m_layers = new MapDrawer[count +1];
            string path = "Maps/" + mapDataList.Name + "/";
            m_locate = new Vector2(data.X * ImageSize, data.Y * ImageSize);

            foreach( var textureInfo in data.List)
            {
                DataReader.LoadAsync<Texture2D>( path + textureInfo.Texture, LoadingItemCallback, textureInfo.Layer );
                m_data.LoadingLeft++;
            }
        }
Beispiel #2
0
 public SencePart CreatePart(int x, int y)
 {
     SencePart part = new SencePart( x, y );
     m_sences[x, y] = part;
     return part;
 }
Beispiel #3
0
 private bool IntersectPartPixels(SencePart map, byte []itemInfo, Rectangle rect)
 {
     int xa = map.X * PartSize;
     int ya = map.Y * PartSize;
     int x0 = rect.Left - xa;
     int y0 = rect.Top - ya;
     int i = Math.Max(0, x0);
     int x2 = Math.Min( rect.Right - xa, PartSize );
     int j = Math.Max(0, y0);
     int y2 = Math.Min( rect.Bottom - ya, PartSize );
     byte[] mapInfo = map.CollusionTexture;
     int xn = rect.Width;
     for( ; i < x2; i++ )
     {
         for (; j < y2; j++)
         {
             if( ( mapInfo[( i + j * PartSize ) >> 3] & ( 1 << ( i & 0x7 ) ) ) != 0 &&
                 ( itemInfo[( ( i + x0 ) + ( j + y0 ) * xn ) >> 3] & ( 1 << ( i & 0x7 ) ) ) != 0 ) return true;
         }
     }
     return false;
 }