public void AddTile(Tile tile, ClickEventHandler onClick = null) { TileContainer tileContainer = new TileContainer(tile); tileContainer.Clicked += onClick; MultiBox.AddItem(tileContainer); RefreshScrollBars(); }
void TileSetCreateButton_Clicked(object sender, SFML.Window.MouseButtonEventArgs e) { if (TextureButton.Text == Button.EMPTY_LABEL) { CallInformationDialogBox(InformationDialogBox.EType.Error, new String[] { InformationDialogBox.Instance.GetTextureErrorStr() }); return; } CurrentTileList.Clear(); Int32 width = (Int32)(CurrentTileSetTexture.Dimension.X / GameData.TILE_SIZE); Int32 height = (Int32)(CurrentTileSetTexture.Dimension.Y / GameData.TILE_SIZE); Int32 count = 0; for (Int32 y = 0; y < height; ++y) { for (Int32 x = 0; x < width; ++x) { BlazeraLib.Texture tileTexture = new BlazeraLib.Texture(CurrentTileSetTexture); tileTexture.ImageSubRect = new BlazeraLib.IntRect( x * GameData.TILE_SIZE, y * GameData.TILE_SIZE, x * GameData.TILE_SIZE + GameData.TILE_SIZE, y * GameData.TILE_SIZE + GameData.TILE_SIZE); tileTexture.SetType("Tile_" + CurrentTileSetTexture.Type + "_" + count); //tileTexture.ToScript(); Tile tile = new Tile(); tile.SetType(CurrentTileSetTexture.Type + "_" + count); tile.Texture = tileTexture; //tile.ToScript(); ++count; AddTile(tile); } } TileSelector.SetTileSet(CurrentTileList, width, OnTextureModeTileClick); }
void AddTile(Tile tile) { CurrentTileList.Add(tile); }
public Tile(Tile copy) : base(copy) { Texture = new Texture(copy.Texture); Position = copy.Position; }
public void SetTile(UInt32 layer, Tile tile) { if (tile == null) return; tile.Position = Position; if (TileLayers.ContainsKey(layer)) TileLayers[layer] = tile; else TileLayers.Add(layer, tile); }
protected override Dictionary<String, Object> OnValidate() { Boolean typeIsValid = TypeTextBox.TextBox.TextIsValid(); Boolean textureIsValid = TextureButton.Text != Button.EMPTY_LABEL; if (!typeIsValid || !textureIsValid) { List<String> errorMessage = new List<String>(); if (!typeIsValid) errorMessage.Add(InformationDialogBox.Instance.GetTypeErrorStr()); if (!textureIsValid) errorMessage.Add(InformationDialogBox.Instance.GetTextureErrorStr()); CallInformationDialogBox(InformationDialogBox.EType.Error, errorMessage.ToArray()); return base.OnValidate(); } Tile tile = new Tile(); tile.SetType(TypeTextBox.TextBox.Text); tile.Texture = Create.Texture(TextureButton.Text); return new Dictionary<String, Object>() { { "Tile", tile }, { "TypeIsChanged", OldType != TypeTextBox.TextBox.Text }, { "OldTileType", OldType }, { "KeepOld", KeepOldCheckBox.IsChecked } }; }
public void FillWithTile(UInt32 layer, Tile tile) { for (Int32 y = 0; y < Height; ++y) for (Int32 x = 0; x < Width; ++x) GetCell(x, y).SetTile(layer, new Tile(tile)); }