protected override void UpdateTileLayer(bool tileSourceChanged) { var update = false; if (ParentMap == null || !ParentMap.MapProjection.IsWebMercator) { TileMatrix = null; update = true; } else { if (tileSourceChanged) { Tiles.Clear(); update = true; } if (SetTileMatrix()) { SetRenderTransform(); update = true; } } if (update) { UpdateTiles(); } }
protected virtual void UpdateTiles(bool clearTiles) { if (Tiles.Count > 0) { TileImageLoader.CancelLoadTiles(this); } if (clearTiles) { Tiles.Clear(); } SelectTiles(); Children.Clear(); if (Tiles.Count > 0) { foreach (var tile in Tiles) { Children.Add(tile.Image); } var pendingTiles = Tiles.Where(t => t.Pending); if (LoadTilesDescending) { pendingTiles = pendingTiles.OrderByDescending(t => t.ZoomLevel); // higher zoom levels first } TileImageLoader.BeginLoadTiles(this, pendingTiles); } }
public unsafe bool BuildInputPerTile(List <NavMeshBuildInput> inputs) { HeightBounds = default; Tiles.Clear(); TilesToBuild.Clear(); BuildResult = new NavMeshBuildResult(); NormalizeInputHeights(inputs); SetGlobalBounds(inputs); foreach (NavMeshBuildInput input in inputs) { int result = BuildTile(input.TileBounds.Coord, BuildSettings, AgentSettings, input, 1, out NavMeshTile tile); if (result == 0) { Tiles[input.TileBounds.Coord] = tile; BuildResult.TilesBuilt++; } else if (result != 110) { BuildResult.Result = result; return(false); } } BuildResult.Result = 0; return(true); }
public bool GenerateTiles(MTileSettings settings) { // delete previous tiles Tiles.Clear(); double refWidth = Extents.Width + settings.XPadding; double refHeight = Extents.Height + settings.YPadding; int nRows = (int)Math.Ceiling(refHeight / settings.YSize); int nColumns = (int)Math.Ceiling(refWidth / settings.XSize); var _halfTileWidth = 0.5 * settings.XSize; var _halfTileHeight = 0.5 * settings.YSize; var _centre = Extents.Centre - new MarkGeometryPoint(0.5 * (nColumns * settings.XSize), 0.5 * (nRows * settings.YSize)); for (int row = 0; row < nRows; row++) { for (int col = 0; col < nColumns; col++) { var centrePoint = new MarkGeometryPoint( (col * settings.XSize) + _halfTileWidth, (row * settings.YSize) + _halfTileHeight ); GeometricArithmeticModule.Translate(centrePoint, _centre.X + settings.XOffset, _centre.Y + settings.YOffset); Tiles.Add(new MarkGeometryRectangle(centrePoint, settings.XSize, settings.YSize)); } } return(true); }
protected virtual void UpdateTiles(bool clearTiles) { if (Tiles.Count > 0) { TileImageLoader.CancelLoadTiles(this); } if (clearTiles) { Tiles.Clear(); } SelectTiles(); Children.Clear(); if (Tiles.Count > 0) { foreach (var tile in Tiles) { Children.Add(tile.Image); } TileImageLoader.BeginLoadTiles(this, Tiles.Where(t => t.Pending).OrderByDescending(t => t.ZoomLevel)); } }
private void LoadSelectedMapTilesImages() { Tiles.Clear(); foreach (var t in BlockSets.ElementAt((int)selectedMap.TileSetID).Tiles) { Tiles.Add(Bitmap2BitmapSource(t)); } }
public void Clear() { Tiles.Clear(); _tileDisc.Clear(); TileCount = 0; Discover(false); Discover(false); }
private void TileSourcePropertyChanged() { if (TileGrid != null) { Tiles.Clear(); UpdateTiles(); } }
public void DestroyTiles() { for (int i = 0; i < Tiles.Count; i++) { Tiles.Array[i].DestroyTile(); } Tiles.Clear(); }
public void Update(int count) { Tiles.Clear(); for (int i = 0; i < count; i++) { Tiles.Add(new Tile(this)); } }
public void ClearMall() { pathfindingNodeManager = PathfindingNodeManager.Instance; tiles = Tiles.Instance; objectSpawner.Clear(); pathfindingNodeManager.Clear(); tiles.Clear(); }
private void SetTiles() { int maxZoomLevel; if (TileSource == null || TileMatrix == null || (maxZoomLevel = Math.Min(TileMatrix.ZoomLevel, MaxZoomLevel)) < MinZoomLevel) { Tiles.Clear(); } else { var newTiles = new List <Tile>(); var minZoomLevel = maxZoomLevel; if (this == ParentMap.MapLayer) // load background tiles { minZoomLevel = Math.Max(TileMatrix.ZoomLevel - MaxBackgroundLevels, MinZoomLevel); } var oldTiles = Tiles.Where(t => t.ZoomLevel >= minZoomLevel && t.ZoomLevel <= maxZoomLevel).ToList(); Tiles.Clear(); for (var z = minZoomLevel; z <= maxZoomLevel; z++) { var tileSize = 1 << (TileMatrix.ZoomLevel - z); var x1 = (int)Math.Floor((double)TileMatrix.XMin / tileSize); // may be negative var x2 = TileMatrix.XMax / tileSize; var y1 = Math.Max(TileMatrix.YMin / tileSize, 0); var y2 = Math.Min(TileMatrix.YMax / tileSize, (1 << z) - 1); for (var y = y1; y <= y2; y++) { for (var x = x1; x <= x2; x++) { var tile = oldTiles.FirstOrDefault(t => t.ZoomLevel == z && t.X == x && t.Y == y); if (tile == null) { tile = new Tile(z, x, y); var equivalentTile = oldTiles.FirstOrDefault( t => t.ZoomLevel == z && t.XIndex == tile.XIndex && t.Y == y && !t.Pending); if (equivalentTile != null) { tile.SetImage(equivalentTile.Image.Source, false); // no fade-in animation } } Tiles.Add(tile); } } } } }
public void Reset() { Tiles.Clear(); for (int i = 0; i < Defaults.TileCount; i++) { Tiles.Add((TileEnum)i); } // Shuffle the TileBag Tiles.Shuffle(); }
private void InitializeGame() { ShowResult = false; Result = ""; Turn = Player.O; Tiles.Clear(); for (int i = 0; i < 9; i++) { Tiles.Add(new Tile { Position = i, PlayedBy = null, Enabled = true }); } }
private void ZoomGrid(int value) { mapZoom = value; TileSize = GetTileSize(value); Children.Clear(); foreach (MapTileVisual tile in Tiles) { tile.Fill = null; tile.Dispose(); } Tiles.Clear(); InitGrid(); }
protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { TotalMap = null; Tiles.Clear(); Tiles = null; } disposed = true; }
public void Dispose() { _timer.Dispose(); _timer = null; _gameMoveLogic.Dispose(); _gameMoveLogic = null; foreach (var player in Players) { player.Dispose(); } Players.Clear(); Tiles.Clear(); }
//---------------------------------------// //----- FUNÇÕES -----// //---------------------------------------// /// <summary> /// Lê o array contido no mapa e ordena as posições dos tiles. /// </summary> public override void Read() { IsRead = false; TotalMap = Map.GetMap(); Tiles.Clear(); //dimensões do array int d0 = TotalMap.GetLength(0); int d1 = TotalMap.GetLength(1); for (int row = 0; row < d0; row++) { for (int col = 0; col < d1; col++) { //O valor da posição no array T index = TotalMap[row, col]; //Recebe o Tile da tabela if (Map.Table.ContainsKey(index)) { IsoTile tile = new IsoTile(Map.Table[index]); //Atualiza todas as animações do tile //tile.UpdateBounds(); //largura e altura para cálculo //Usa as configuraçõs do tamanho do tile pela animação //int w = tile.Animation.Bounds.Width; //int h = tile.Animation.Bounds.Height; //Usa as configurações de tamanho geral int w = TileWidth; int h = TileHeight; float sx = StartPosition.X; float sy = StartPosition.Y; //O cálculo se dá na animação do topo //antes o valor de row era positivo tile.Actor.Transform.X = ((w / 2) * -row) + ((w / 2) * col) + sx; tile.Actor.Transform.Y = ((h / 2) * col) - ((h / 2) * -row) + sy; Tiles.Add(new Point(row, col), tile); } } } IsRead = true; }
private void ReadFinalMap() { IsRead = false; Tiles.Clear(); //dimensões do array int d0 = TotalMap.GetLength(0); int d1 = TotalMap.GetLength(1); for (int row = 0; row < d0; row++) { for (int col = 0; col < d1; col++) { //O valor da posição no array T index = TotalMap[row, col]; //Recebe o Tile da tabela Dictionary <T, IsoTile> table = point_sector[new Point(row, col)].Table; if (table.ContainsKey(index)) { IsoTile tile = new IsoTile(table[index]); //largura e altura para cálculo //int w = tile.Animation.Bounds.Width; //int h = tile.Animation.Bounds.Height; int w = TileWidth; int h = TileHeight; float sx = StartPosition.X; float sy = StartPosition.Y; //O cálculo se dá na animação do topo //com o valor de row positivo o mapa fica invertido tile.Actor.Transform.X = ((w / 2) * -row) + ((w / 2) * col) + sx; tile.Actor.Transform.Y = ((h / 2) * col) - ((h / 2) * -row) + sy; tile.UpdateBounds(); tile.MapPoint = new Point(row, col); Tiles.Add(new Point(row, col), tile); } } } IsRead = true; }
/// <summary> /// Sets this <see cref="ImageBox"/> with a previously created memento. /// </summary> /// <param name="memento">Memento to set.</param> /// <remarks> /// This method restores the state of a <see cref="ImageBox"/> with /// a memento previously created by <see cref="ImageBox.CreateMemento"/>. /// </remarks> public virtual void SetMemento(object memento) { Platform.CheckForNullReference(memento, "memento"); PrintImageBoxMemento imageBoxMemento = (PrintImageBoxMemento)memento; Tiles.Clear(); foreach (PrintViewTile tile in imageBoxMemento.TileCollection) { tile.Deselect(); Tiles.Add(tile); } _normalizedRectangle = RectangleF.Empty; this.TotleImageCount = imageBoxMemento.TotleTileCount; DisplaySetLocked = false; this.DisplaySet = imageBoxMemento.DisplaySet; if (this.DisplaySet != null) { this.DisplaySet.SetMemento(imageBoxMemento.DisplaySetMemento); } this.DisplaySetLocked = imageBoxMemento.DisplaySetLocked; this.NormalizedRectangle = imageBoxMemento.NormalizedRectangle; if (imageBoxMemento.TopLeftPresentationImageIndex != -1) { this.TopLeftPresentationImageIndex = imageBoxMemento.TopLeftPresentationImageIndex; } if (imageBoxMemento.IndexOfSelectedTile != -1) { ITile selectedTile = this.Tiles[imageBoxMemento.IndexOfSelectedTile]; selectedTile.Select(); } EventsHelper.Fire(_layoutCompletedEvent, this, EventArgs.Empty); if (_imageViewer != null) { _imageViewer.PropertyValueChanged(); } }
public void DestroyCurrentLevel() { Debug.Log("Destroying all tiles..."); List <TileScript> tilesToDestroy = new List <TileScript>(); if (Tiles != null) { tilesToDestroy.AddRange(GetAllTilesFromCurrentLevelDictionary()); Tiles.Clear(); } foreach (TileScript tile in tilesToDestroy) { Destroy(tile.gameObject); Destroy(tile); } // Destroy(currentLevelBG); }
public unsafe bool BuildAllFromSingleInput(NavMeshBuildInput single) { HeightBounds = default; Tiles.Clear(); TilesToBuild.Clear(); List <NavMeshBuildInput> inputs = new List <NavMeshBuildInput>() { single }; BuildResult = new NavMeshBuildResult(); NormalizeInputHeights(inputs); SetGlobalBounds(inputs); foreach (NavMeshBuildInput input in inputs) { var tiles = NavMeshBuildUtils.GetOverlappingTiles(BuildSettings, input.TileBounds.Bounds); foreach (var tileCoord in tiles) { int result = BuildTile(tileCoord, BuildSettings, AgentSettings, input, 1, out NavMeshTile tile); if (result == 0) { Tiles[tileCoord] = tile; BuildResult.TilesBuilt++; } else if (result != 110) { BuildResult.Result = result; return(false); } } } BuildResult.Result = 0; return(true); }
protected override void UpdateTileLayer(bool tileSourceChanged) { var update = false; if (ParentMap == null || !ParentMap.MapProjection.IsWebMercator) { TileMatrix = null; update = true; } else { if (tileSourceChanged) { Tiles.Clear(); update = true; } if (SetTileMatrix()) { SetRenderTransform(); update = true; } } if (update) { SetTiles(); Children.Clear(); foreach (var tile in Tiles) { Children.Add(tile.Image); } LoadTiles(Tiles, SourceName); } }
/// Clears the current state and displays the given state. public void Reset(GameState state) { if (state.BoardSize == BoardSize) { ResetDifferential(state); return; } Tiles.Clear(); CurrentState = state; BoardSize = state.BoardSize; var range = Enumerable.Range(0, BoardSize).ToList(); var tiles = range.SelectMany(x => range.Select(y => new TileViewModel(MessengerInstance, Position2D.New(x, y)))) .Cast <ITilePresenter>(); foreach (var tile in tiles) { tile.Update(state.PlayerOn(tile.Position), state.HasBall(tile.Position)); Tiles.Add(tile); } UnlockedPlayer = null; }
public void GenerateWorldVoronoi(int?seed = null) { Tiles.Clear(); Vor = new Voronoi(seed); Vor.Calculate(150, 300, 300); SetSpawnVoronoi(); var tileset = _engine.TileSetManager.Current; var rand = new Random(); foreach (var point in Vor.Points) { var tilesettile = tileset.GetRandomTile(point.Type, rand); var tile = new Tile(point, tileset.Texture, tilesettile.Rect, tilesettile.IsPassable); Tiles.Add(tile); if (point.Type == Tile.TileType.Spawn) { Spawn = tile; } } }
public static void ResetWorld() { mapper.Clear(); for (int i = 0; i < Tiles.Count; i++) { Tiles[i].gameObject.SetActive(false); } Tiles.Clear(); for (int i = 0; i < Objects.Count; i++) { Objects[i].gameObject.SetActive(false); } Objects.Clear(); Current.tileOffset.X = 0; Current.tileOffset.Y = 0; Current.GridSize.X = 0; Current.GridSize.Y = 0; Current.lastPlayerTileX = null; Current.lastPlayerTileY = null; }
/// <summary> /// Clear the tile dictionary and save. /// </summary> public void ClearTiles() { Tiles.Clear(); _gridBounds = null; Save(); }
public void ClearTiles() { _completeList = CharList.ToCustomBasicList(); Tiles.Clear(); HiddenValue += 1; // so it can repaint (?) }
/// <summary> /// Clears all spawn points, textures and tiles. /// </summary> public void Clear() { SpawnPoints.Clear(); Textures.Clear(); Tiles.Clear(); }
/// <summary> /// Clear this instance. /// </summary> public void Clear() { Tiles.Clear(); }