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); }
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 } }; }