Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            if (layerMap == null || original == null)
            {
                return(base.GetHashCode());
            }
            int hashCode = 1;

            hashCode = Loon.Core.LSystem.Unite(hashCode, flag);
            hashCode = Loon.Core.LSystem.Unite(hashCode,
                                               layerMap.PixelsToTilesWidth(original.X()));
            hashCode = Loon.Core.LSystem.Unite(hashCode,
                                               layerMap.PixelsToTilesHeight(original.Y()));
            hashCode = Loon.Core.LSystem.Unite(hashCode,
                                               layerMap.PixelsToTilesWidth(endLocation.X()));
            hashCode = Loon.Core.LSystem.Unite(hashCode,
                                               layerMap.PixelsToTilesHeight(endLocation.Y()));
            hashCode = Loon.Core.LSystem.Unite(hashCode, layerMap.GetWidth());
            hashCode = Loon.Core.LSystem.Unite(hashCode, layerMap.GetHeight());
            hashCode = Loon.Core.LSystem.Unite(hashCode, layerMap.GetTileWidth());
            hashCode = Loon.Core.LSystem.Unite(hashCode, layerMap.GetTileHeight());
            hashCode = Loon.Core.LSystem.Unite(hashCode,
                                               Loon.Utils.CollectionUtils.HashCode(layerMap.GetMap()));
            return(hashCode);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 设定Layer对应的二维数组地图
 /// </summary>
 ///
 /// <param name="map"></param>
 public void SetField2D(Field2D field)
 {
     if (isClose)
     {
         return;
     }
     if (field == null)
     {
         return;
     }
     if (tmpField != null)
     {
         if ((field.GetMap().Length == tmpField.GetMap().Length) &&
             (field.GetTileWidth() == tmpField.GetTileWidth()) &&
             (field.GetTileHeight() == tmpField.GetTileHeight()))
         {
             tmpField.Set(field.GetMap(), field.GetTileWidth(),
                          field.GetTileHeight());
         }
     }
     else
     {
         tmpField = field;
     }
 }