/// <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; } }
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); }
public Field2D GetField2D(string name, int width, int height, Field2D fallback) { int[][] arrays = GetArray2D(name, (fallback == null) ? null : fallback.GetMap()); if (arrays != null) { return(new Field2D(arrays, width, height)); } return(null); }