public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUI.BeginChangeCheck(); serializedObject.UpdateIfRequiredOrScript(); EditorGUILayout.PropertyField(s_type, new GUIContent("Tile Type")); EditorGUILayout.PropertyField(s_owner, new GUIContent("Owner")); serializedObject.ApplyModifiedProperties(); if (GUILayout.Button("Update Tile")) { foreach (Object tar in targets) { Tile tile = null; TileEditor editor = tar as TileEditor; if (editor) { tile = editor.GetComponent <Tile>(); } if (tile) { tile.ChangeTile(editor.editor_type, editor.editor_owner); } editor.ready_to_delete = true; } Selection.activeObject = null; } }
/* Здесь такое вроде не нужно будет * public void SetOnClickListener(Predicate<string> onClickAction) * { * button.onClick.AddListener(delegate { onClickAction(inputField.text); }); * } */ public void ShowDialog(string[] elements, string buttonText = "Ok") { TileEditor te = GameObject.FindObjectOfType <TileEditor>(); if (te != null) { te.SetDefault(); } TilePlacer tp = GameObject.FindObjectOfType <TilePlacer>(); if (tp != null) { tp.CancelPlacing(); } dialogCanvas.SetActive(true); scrollRect.content.sizeDelta = new Vector2(0, 17 * elements.Length); contentText.rectTransform.sizeDelta = new Vector2(160 * 4, 16 * 5 * elements.Length); contentText.text = ""; foreach (string elem in elements) { contentText.text += elem + "\n"; } button.GetComponentInChildren <Text>().text = buttonText; }
private void TileEditorToolStripMenuItem_Click(object sender, EventArgs e) { if (tileEditor == null) { tileEditor = new TileEditor(); tileEditor.SetMemory(system.MemoryManager); system.GPU.TileEditorMode = true; //// Set Vicky into Tile mode //previousGraphicMode = system.VICKY.ReadByte(0); //system.VICKY.WriteByte(0, 0x10); //// Enable borders //system.VICKY.WriteByte(4, 1); // Set Vicky into Tile mode previousGraphicMode = FoenixSystem.Current.MemoryManager.ReadByte(MemoryMap.VICKY_BASE_ADDR); FoenixSystem.Current.MemoryManager.WriteByte(MemoryMap.VICKY_BASE_ADDR, 0x10); // Enable borders FoenixSystem.Current.MemoryManager.WriteByte(MemoryMap.VICKY_BASE_ADDR + 4, 1); tileEditor.Show(); tileEditor.FormClosed += new FormClosedEventHandler(EditorWindowClosed); // coordinate between the tile editor window and the GPU canvas this.TileClicked += new TileClickEvent(tileEditor.TileClicked_Click); } else { tileEditor.BringToFront(); } }
/// <summary> /// Creates new Tile editor GUI configurer. /// </summary> /// <param name="editor">tile editor instance that windows and user controls will need</param> public TileEditorGUIConfigurer(TileEditor editor) { this.editor = editor; tilesetsViewModel = new TilesetsViewModel(editor); brushesViewModel = new BrushesViewModel(editor, tilesetsViewModel); }
private void TileEditorToolStripMenuItem_Click(object sender, EventArgs e) { if (tileEditor == null) { tileEditor = new TileEditor(); tileEditor.SetMemory(kernel.MemMgr); tileEditor.SetResourceChecker(kernel.ResCheckerRef); gpu.TileEditorMode = true; // Set Vicky into Tile mode previousGraphicMode = kernel.MemMgr.VICKY.ReadByte(0); kernel.MemMgr.VICKY.WriteByte(0, 0x10); // Enable borders kernel.MemMgr.VICKY.WriteByte(4, 1); CenterForm(tileEditor); tileEditor.Show(); tileEditor.FormClosed += new FormClosedEventHandler(EditorWindowClosed); // coordinate between the tile editor window and the GPU canvas this.TileClicked += new TileClickEvent(tileEditor.TileClicked_Click); } else { tileEditor.BringToFront(); } }
static void Init() { TileEditor tEditor = (TileEditor)EditorWindow.GetWindow(typeof(TileEditor)); tEditor.Show(); tEditor.refreshSelection(); }
public TilesetsView(TileEditor editor, BrushesViewModel brushesViewModel, TilesetsViewModel tilesetsViewModel) { this.editor = editor; this.brushesViewModel = brushesViewModel; this.tilesetsViewModel = tilesetsViewModel; brushesViewModel.PropertyChanged += brushesViewModel_PropertyChanged; // Set data context. DataContext = tilesetsViewModel; InitializeComponent(); CollectionView collectionView = (CollectionView)CollectionViewSource.GetDefaultView(setsListView.ItemsSource); collectionView.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Descending)); tileGridManager = new TileGridManager(tileGrid, gridBorder); selectionGridManager = new TileGridManager(selectionGrid, selectionBorder); rectangles = new List <Rectangle>(); // Hide view by default. tilesetView.Visibility = Visibility.Hidden; }
public BrushesViewModel(TileEditor editor, TilesetsViewModel tilesetsViewModel) { this.editor = editor; this.tilesetsViewModel = tilesetsViewModel; tilesetsViewModel.PropertyChanged += tilesetsViewModel_PropertyChanged; }
// When the editor window is closed, exit the TileEditorMode private void EditorWindowClosed(object sender, FormClosedEventArgs e) { gpu.TileEditorMode = false; // Restore the previous graphics mode kernel.MemMgr.VICKY.WriteByte(0, previousGraphicMode); tileEditor.Dispose(); tileEditor = null; }
// When the editor window is closed, exit the TileEditorMode private void EditorWindowClosed(object sender, FormClosedEventArgs e) { system.GPU.TileEditorMode = false; // Restore the previous graphics mode //system.VICKY.WriteByte(0, previousGraphicMode); FoenixSystem.Current.MemoryManager.WriteByte(MemoryMap.VICKY_BASE_ADDR, previousGraphicMode); tileEditor.Dispose(); tileEditor = null; }
private void HideEditor() { engine.Camera.SelectedTileX = -1; engine.Camera.SelectedTileY = -1; if (editor != null) { editor.Cancel(); editor = null; } }
private void MakeEditor(int x, int y) { HideEditor(); editor = new TileEditor(this, screen, engine.Map, x, y) { CloseGadget = true, DepthGadget = true, WindowCloseEvent = (o, i) => { HideEditor(); } }; }
private void LoadTileEditor() { if (tileEditor == null) { tileEditor = new TileEditor(this, new TileUpdater(), tileset.Tileset_tiles[mouseDownTile], graphics); tileEditor.Owner = this; } else { tileEditor.Reload(tileset.Tileset_tiles[mouseDownTile], graphics); } }
public void LoadTileEditor() { if (tileEditor == null) { tileEditor = new TileEditor(this, new TileUpdater(), tileset.Tiles[mouseDownTile], tileset.Graphics); tileEditor.FormClosing += new FormClosingEventHandler(editor_FormClosing); } else { tileEditor.Reload(this.tileset.Tiles[mouseDownTile], tileset.Graphics); } }
public void LoadTileEditor() { if (tileEditor == null) { tileEditor = new TileEditor(this, new TileUpdater(), Tileset.Tileset_tiles[MouseDownTile], Tileset.Graphics, true); tileEditor.Owner = this; } else { tileEditor.Reload(Tileset.Tileset_tiles[MouseDownTile], Tileset.Graphics); } }
public void Setup(TileEditor editor, Sprite avatar, System.Action save, System.Action reset) { this.editor = editor; this.avatar = avatar; this.save = save; this.reset = reset; avatarImage.sprite = avatar; }
public static void SetTile(TileEditor tileEditor) { if (tileEditor == currentTileEditor) { return; } if (currentTileEditor != null) { currentTileEditor.UpdateHighLight(false); } currentTileEditor = tileEditor; currentTile = tileEditor.tile; }
/// <summary> /// Build new tile map project from given project properties. /// </summary> public static Project BuildTileMapProject(NewProjectProperties properties, IntPtr windowHandle) { TileEngine tileEngine = new TileEngine(new Point(properties.MapWidth, properties.MapHeight), new Point(properties.TileWidth, properties.TileHeight)); TileEditor editor = new TileEditor(tileEngine); EditorGame game = new EditorGame(windowHandle, editor); return(new Project(new TileEditorGUIConfigurer(editor), game, editor, properties.ProjectName, properties.MapName, properties.MapType.ToString())); }
public TilesetsViewModel(TileEditor editor) { this.editor = editor; editor.TilesetAdded += editor_TilesetAdded; editor.TilesetRemoved += editor_TilesetRemoved; // Generate view models. tilesetViewModels = new ObservableCollection <TilesetViewModel>(); foreach (Tileset tileset in editor.Tilesets) { tilesetViewModels.Add(new TilesetViewModel(tileset)); } }
public UIInputBox(Vector2 position) { TileEditor te = GameObject.FindObjectOfType <TileEditor>(); te.SetDefault(); TilePlacer tp = GameObject.FindObjectOfType <TilePlacer>(); tp.CancelPlacing(); dialogCanvas = GameObject.Instantiate(Resources.Load("Prefabs/InputBoxPrefab")) as GameObject; dialogCanvas.transform.position = new Vector3(position.x, position.y, 0); button = dialogCanvas.GetComponentInChildren <Button>(); inputField = dialogCanvas.GetComponentInChildren <InputField>(); title = dialogCanvas.GetComponentInChildren <Text>(); HideDialog(); }
public void NewTile(string name) { if (name == "" && !TilesContains(name)) { return; } TileEditor newTile = Instantiate(tilePrefab, transform); TileEditor[] newTiles = new TileEditor[tiles.Length + 1]; for (int i = 0; i < tiles.Length; i++) { newTiles[i] = tiles[i]; } newTiles[newTiles.Length - 1] = newTile; newTile.tile.TileData.name = name; newTile.SetUp(); }
public NewTileLayerDialog(TileEditor tileEditor) { this.tileEditor = tileEditor; // Initialize model and view. string[] takenNames = tileEditor.Layers .Select(s => s.Name) .ToArray(); newTileLayerProperties = new NewTileLayerProperties(takenNames, tileEditor.TileEngine.MaxLayerSizeInTiles.X, tileEditor.TileEngine.MaxLayerSizeInTiles.Y); newTileLayerPropertiesViewModel = new NewTileLayerPropertiesViewModel(newTileLayerProperties); // Set data context for this window. DataContext = newTileLayerPropertiesViewModel; InitializeComponent(); }
public NewTilesetDialog(TileEditor tileEditor) { this.tileEditor = tileEditor; // Get taken names. string[] takenNames = tileEditor.Tilesets .Select(s => s.Name) .ToArray(); // Initialize view model. newTilesetProperties = new MapEditorViewModels.NewTilesetProperties(takenNames); newTilesetPropertiesViewModel = new NewTilesetPropertiesViewModel(newTilesetProperties); // Set data context. DataContext = newTilesetPropertiesViewModel; InitializeComponent(); }
public override void OnInspectorGUI() { TileEditor myTileEditor = (TileEditor)target; SerializedObject editorInstance = new SerializedObject(myTileEditor); editorInstance.Update(); myTileEditor.MyWidth = EditorGUILayout.IntField("Width", myTileEditor.MyWidth); myTileEditor.MyHeight = EditorGUILayout.IntField("Height", myTileEditor.MyHeight); if (GUILayout.Button("Generate Level")) { myTileEditor.GenerateTiles(); } if (GUILayout.Button("Clear Level")) { myTileEditor.ClearTiles(); } editorInstance.ApplyModifiedProperties(); }
public void ShowDialog() { TileEditor te = GameObject.FindObjectOfType <TileEditor>(); te.SetDefault(); TilePlacer tp = GameObject.FindObjectOfType <TilePlacer>(); tp.CancelPlacing(); List <string> fileNames = GetFilesList(); dialogCanvas.SetActive(true); for (int i = 0; i < fileNames.Count; i++) { if (!buttons.ContainsKey(fileNames[i])) { GameObject newButton = GameObject.Instantiate(Resources.Load("Prefabs/ButtonPrefab")) as GameObject; newButton.transform.position = contentField.transform.position; newButton.transform.position += new Vector3(0.06f, -i * 0.55f - 0.06f, 0); newButton.GetComponent <RectTransform>().SetParent(contentField.transform); newButton.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); newButton.GetComponentInChildren <Text>().text = fileNames[i]; newButton.GetComponent <Button>().onClick.AddListener(delegate { ChooseLevelTask(newButton.GetComponentInChildren <Text>().text); }); buttons.Add(fileNames[i], newButton); } } scrollRect.content.sizeDelta = new Vector2(0, (float)Math.Max(25 * fileNames.Count, 100.1)); cancelButton.GetComponentInChildren <Text>().text = "Отмена"; cancelButton.onClick.AddListener(CancelTask); }
public MapEditor() { InitializeComponent(); tileEditor = new TileEditor(this); tileController = new EditController(tileEditor); createMapButton.Click += createMapButton_click; saveMapButton.Click += saveMapButton_Click; loadMapButton.Click += loadMapButton_Click; rotateRight.Click += tileEditor.rotateRight; rotateLeft.Click += tileEditor.rotateLeft; enterableTop.Click += tileEditor.enterable_click; enterableBottom.Click += tileEditor.enterable_click; enterableLeft.Click += tileEditor.enterable_click; enterableRight.Click += tileEditor.enterable_click; canGoUp.Click += tileEditor.enterable_click; canGoDown.Click += tileEditor.enterable_click; String t = Path.GetDirectoryName(Application.ExecutablePath) + @"\Tiles\"; if (Directory.Exists(Path.GetDirectoryName(Application.ExecutablePath) + @"\Tiles\")) { foreach (String file in Directory.GetFiles(Path.GetDirectoryName(Application.ExecutablePath) + @"\Tiles\")) { BackgroundPanel pane = new BackgroundPanel(Image.FromFile(file)); pane.Click += tileEditor.backgroundImageClick; BackgroundPanel.Controls.Add(pane); } } else { BackgroundPanel.BackColor = Color.Red; } }
/// <summary>Callback for drawing the Inspector GUI when there is an active GridSelection made in a Tilemap.</summary> public override void OnSelectionInspectorGUI() { BoundsInt selection = GridSelection.position; Tilemap tilemap = GridSelection.target.GetComponent <Tilemap>(); int cellCount = selection.size.x * selection.size.y * selection.size.z; if (tilemap != null && cellCount > 0) { base.OnSelectionInspectorGUI(); GUILayout.Space(10f); if (m_SelectionTiles == null || m_SelectionTiles.Length != cellCount) { m_SelectionTiles = new TileBase[cellCount]; m_SelectionColors = new Color[cellCount]; m_SelectionMatrices = new Matrix4x4[cellCount]; m_SelectionFlagsArray = new TileFlags[cellCount]; m_SelectionSprites = new Sprite[cellCount]; m_SelectionColliderTypes = new Tile.ColliderType[cellCount]; } int index = 0; foreach (var p in selection.allPositionsWithin) { m_SelectionTiles[index] = tilemap.GetTile(p); m_SelectionColors[index] = tilemap.GetColor(p); m_SelectionMatrices[index] = tilemap.GetTransformMatrix(p); m_SelectionFlagsArray[index] = tilemap.GetTileFlags(p); m_SelectionSprites[index] = tilemap.GetSprite(p); m_SelectionColliderTypes[index] = tilemap.GetColliderType(p); index++; } EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = m_SelectionTiles.Any(tile => tile != m_SelectionTiles.First()); var position = new Vector3Int(selection.xMin, selection.yMin, selection.zMin); TileBase newTile = EditorGUILayout.ObjectField(Styles.tileLabel, tilemap.GetTile(position), typeof(TileBase), false) as TileBase; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(tilemap, "Edit Tilemap"); foreach (var p in selection.allPositionsWithin) { tilemap.SetTile(p, newTile); } } using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = m_SelectionSprites.Any(sprite => sprite != m_SelectionSprites.First()); EditorGUILayout.ObjectField(Styles.spriteLabel, m_SelectionSprites[0], typeof(Sprite), false, GUILayout.Height(EditorGUI.kSingleLineHeight)); } bool colorFlagsAllEqual = m_SelectionFlagsArray.All(flags => (flags & TileFlags.LockColor) == (m_SelectionFlagsArray.First() & TileFlags.LockColor)); using (new EditorGUI.DisabledScope(!colorFlagsAllEqual || (m_SelectionFlagsArray[0] & TileFlags.LockColor) != 0)) { EditorGUI.showMixedValue = m_SelectionColors.Any(color => color != m_SelectionColors.First()); EditorGUI.BeginChangeCheck(); Color newColor = EditorGUILayout.ColorField(Styles.colorLabel, m_SelectionColors[0]); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(tilemap, "Edit Tilemap"); foreach (var p in selection.allPositionsWithin) { tilemap.SetColor(p, newColor); } } } using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = m_SelectionColliderTypes.Any(colliderType => colliderType != m_SelectionColliderTypes.First()); EditorGUILayout.EnumPopup(Styles.colliderTypeLabel, m_SelectionColliderTypes[0]); } bool transformFlagsAllEqual = m_SelectionFlagsArray.All(flags => (flags & TileFlags.LockTransform) == (m_SelectionFlagsArray.First() & TileFlags.LockTransform)); using (new EditorGUI.DisabledScope(!transformFlagsAllEqual || (m_SelectionFlagsArray[0] & TileFlags.LockTransform) != 0)) { EditorGUI.showMixedValue = m_SelectionMatrices.Any(matrix => matrix != m_SelectionMatrices.First()); EditorGUI.BeginChangeCheck(); Matrix4x4 newTransformMatrix = TileEditor.TransformMatrixOnGUI(m_SelectionMatrices[0]); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(tilemap, "Edit Tilemap"); foreach (var p in selection.allPositionsWithin) { tilemap.SetTransformMatrix(p, newTransformMatrix); } } } using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = !colorFlagsAllEqual; EditorGUILayout.Toggle(Styles.lockColorLabel, (m_SelectionFlagsArray[0] & TileFlags.LockColor) != 0); EditorGUI.showMixedValue = !transformFlagsAllEqual; EditorGUILayout.Toggle(Styles.lockTransformLabel, (m_SelectionFlagsArray[0] & TileFlags.LockTransform) != 0); } EditorGUI.showMixedValue = false; } }
void TileManagerTools() { if (Grid == null) { return; } if (Selection.activeGameObject != null && Selection.activeGameObject != Grid.gameObject && Selection.activeGameObject.GetComponent <TileManager>() != null && GUILayout.Button("Append Grid Test", GUILayout.Width(100)) ) { Grid.AppendGrid(Selection.activeGameObject.GetComponent <TileManager>()); } if (GUILayout.Button("Spawn Random Region")) { // WorldExtender.SpawnRegion( RegionLoader.GetWeightedRegionForLevel(0, new List<RegionConfig>()), Grid); if (CurrentTileSelection != null) { CurrentTileSelection.Clear(); } } if (GUILayout.Button("Spawn Next Region")) { WorldExtender.Instance.SpawnNext(); if (CurrentTileSelection != null) { CurrentTileSelection.Clear(); } } if (GUILayout.Button("Spawn Camp Region")) { // WorldExtender.SpawnRegion(RegionLoader.GetCamp(0), Grid); if (CurrentTileSelection != null) { CurrentTileSelection.Clear(); } } if (GUILayout.Button("Select All")) { CurrentTileSelection.Clear(); CurrentTileSelection.AddRange(Grid.GetTileList()); SelectCurrentTilesInEditor(); } if (GUILayout.Button("Select Border")) { List <Tile> border = TileManager.GetBorderTiles(CurrentTileSelection, Grid, true); CurrentTileSelection.Clear(); CurrentTileSelection.AddRange(border); SelectCurrentTilesInEditor(); } if (GUILayout.Button("Show Current Crumble Weights")) { if (weighted == null) { weighted = TileWeighted.GetWeightedTiles(Grid); } else { weighted = null; } SceneView.RepaintAll(); } if (GUILayout.Button("Reset Tile Visual States")) { foreach (Tile t in Grid.FetchTiles()) { t.SetBaseState(); } } if (Application.isPlaying && GUILayout.Button("Test Crumble")) { TileWeighted.GetCrumbleTiles(20, Grid).ForEach(t => t.StartCrumble()); // MDebug.Log(Grid.GetLastActiveRow()); Grid.GetTileList().ForEach(t => t.OnCrumbleTurn(0)); SceneView.RepaintAll(); } if (GUILayout.Button("Spawn Meshes")) { List <Tile> tiles = Grid.GetTileList(); foreach (Tile t in tiles) { TileEditor.SpawnMesh(t); } SceneView.RepaintAll(); } if (GUILayout.Button("Bake")) { BakeGrid.Bake(Grid); SceneView.RepaintAll(); } }
void OnEnable() { tileEditor = (TileEditor)target; }
void Start() { levelmanager = GameObject.Find("Level1Manager"); editor = levelmanager.GetComponent <TileEditor>(); }
private void EditButtonPressed(object sender, EventArgs e) { TileEditor form = new TileEditor(textureList.SelectedItems[0] as TextureItem); form.ShowDialog(); }
/// <summary>Callback for drawing the Inspector GUI when there is an active GridSelection made in a Tilemap.</summary> public override void OnSelectionInspectorGUI() { BoundsInt selection = GridSelection.position; Tilemap tilemap = GridSelection.target.GetComponent <Tilemap>(); int cellCount = selectionCellCount; if (tilemap != null && cellCount > 0) { base.OnSelectionInspectorGUI(); if (!EditorGUIUtility.editingTextField && Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Delete || Event.current.keyCode == KeyCode.Backspace)) { DeleteSelection(tilemap, selection); Event.current.Use(); } GUILayout.Space(10f); EditorGUILayout.LabelField(Styles.gridSelectionPropertiesLabel, EditorStyles.boldLabel); UpdateSelection(tilemap); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = m_SelectionTiles.Any(tile => tile != m_SelectionTiles.First()); var position = new Vector3Int(selection.xMin, selection.yMin, selection.zMin); TileBase newTile = EditorGUILayout.ObjectField(Styles.tileLabel, tilemap.GetTile(position), typeof(TileBase), false) as TileBase; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(tilemap, "Edit Tilemap"); foreach (var p in selection.allPositionsWithin) { tilemap.SetTile(p, newTile); } } using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = m_SelectionSprites.Any(sprite => sprite != m_SelectionSprites.First()); EditorGUILayout.ObjectField(Styles.spriteLabel, m_SelectionSprites[0], typeof(Sprite), false, GUILayout.Height(EditorGUI.kSingleLineHeight)); } bool colorFlagsAllEqual = m_SelectionFlagsArray.All(flags => (flags & TileFlags.LockColor) == (m_SelectionFlagsArray.First() & TileFlags.LockColor)); using (new EditorGUI.DisabledScope(!colorFlagsAllEqual || (m_SelectionFlagsArray[0] & TileFlags.LockColor) != 0)) { EditorGUI.showMixedValue = m_SelectionColors.Any(color => color != m_SelectionColors.First()); EditorGUI.BeginChangeCheck(); Color newColor = EditorGUILayout.ColorField(Styles.colorLabel, m_SelectionColors[0]); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(tilemap, "Edit Tilemap"); foreach (var p in selection.allPositionsWithin) { tilemap.SetColor(p, newColor); } } } using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = m_SelectionColliderTypes.Any(colliderType => colliderType != m_SelectionColliderTypes.First()); EditorGUILayout.EnumPopup(Styles.colliderTypeLabel, m_SelectionColliderTypes[0]); } bool transformFlagsAllEqual = m_SelectionFlagsArray.All(flags => (flags & TileFlags.LockTransform) == (m_SelectionFlagsArray.First() & TileFlags.LockTransform)); using (new EditorGUI.DisabledScope(!transformFlagsAllEqual || (m_SelectionFlagsArray[0] & TileFlags.LockTransform) != 0)) { EditorGUI.showMixedValue = m_SelectionMatrices.Any(matrix => matrix != m_SelectionMatrices.First()); EditorGUI.BeginChangeCheck(); Matrix4x4 newTransformMatrix = TileEditor.TransformMatrixOnGUI(m_SelectionMatrices[0]); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(tilemap, "Edit Tilemap"); foreach (var p in selection.allPositionsWithin) { tilemap.SetTransformMatrix(p, newTransformMatrix); } } } using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = !colorFlagsAllEqual; EditorGUILayout.Toggle(Styles.lockColorLabel, (m_SelectionFlagsArray[0] & TileFlags.LockColor) != 0); EditorGUI.showMixedValue = !transformFlagsAllEqual; EditorGUILayout.Toggle(Styles.lockTransformLabel, (m_SelectionFlagsArray[0] & TileFlags.LockTransform) != 0); } EditorGUI.showMixedValue = false; if (GUILayout.Button(Styles.deleteSelectionLabel)) { DeleteSelection(tilemap, selection); } EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.modifyTilemapLabel, EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); m_SelectedTransformTool = GUILayout.Toolbar(m_SelectedTransformTool, Styles.selectionTools); if (EditorGUI.EndChangeCheck()) { SceneView.RepaintAll(); } EditorGUILayout.Space(); GUILayout.BeginHorizontal(); m_ModifyCells = (ModifyCells)EditorGUILayout.EnumPopup(m_ModifyCells); m_CellCount = EditorGUILayout.IntField(m_CellCount); if (GUILayout.Button(Styles.modifyLabel)) { RegisterUndoForTilemap(tilemap, Enum.GetName(typeof(ModifyCells), m_ModifyCells)); switch (m_ModifyCells) { case ModifyCells.InsertRow: { tilemap.InsertCells(GridSelection.position.position, 0, m_CellCount, 0); break; } case ModifyCells.InsertRowBefore: { tilemap.InsertCells(GridSelection.position.position, 0, -m_CellCount, 0); break; } case ModifyCells.InsertColumn: { tilemap.InsertCells(GridSelection.position.position, m_CellCount, 0, 0); break; } case ModifyCells.InsertColumnBefore: { tilemap.InsertCells(GridSelection.position.position, -m_CellCount, 0, 0); break; } case ModifyCells.DeleteRow: { tilemap.DeleteCells(GridSelection.position.position, 0, m_CellCount, 0); break; } case ModifyCells.DeleteRowBefore: { tilemap.DeleteCells(GridSelection.position.position, 0, -m_CellCount, 0); break; } case ModifyCells.DeleteColumn: { tilemap.DeleteCells(GridSelection.position.position, m_CellCount, 0, 0); break; } case ModifyCells.DeleteColumnBefore: { tilemap.DeleteCells(GridSelection.position.position, -m_CellCount, 0, 0); break; } } } GUILayout.EndHorizontal(); } }