private void DrawToolbar() { GUILayout.BeginHorizontal(EditorStyles.toolbar); if (GUILayout.Button(TileLang.OpensWindow(TileLang.ParticularText("Action", "Create Tile System")), EditorStyles.toolbarButton)) { CreateTileSystemWindow.ShowWindow(); GUIUtility.ExitGUI(); } GUILayout.FlexibleSpace(); if (GUILayout.Button(TileLang.OpensWindow(TileLang.ParticularText("Action", "Build")), RotorzEditorStyles.Instance.ToolbarButtonPadded)) { BuildUtility.BuildScene(); GUIUtility.ExitGUI(); } EditorGUILayout.Space(); if (GUILayout.Button(RotorzEditorStyles.Skin.SortAsc, EditorStyles.toolbarButton)) { EditorTileSystemUtility.SortTileSystemsAscending(); this.Repaint(); GUIUtility.ExitGUI(); } if (GUILayout.Button(RotorzEditorStyles.Skin.SortDesc, EditorStyles.toolbarButton)) { EditorTileSystemUtility.SortTileSystemsDescending(); this.Repaint(); GUIUtility.ExitGUI(); } GUILayout.EndHorizontal(); }
public void Move(int sourceIndex, int destIndex) { if (sourceIndex == destIndex) { return; } var movedEntry = this.entries[sourceIndex]; if (movedEntry.IsHeader) { return; } //!TODO: Fix/adjust scene order header offset here? int offsetIndex = 1 + this.entries.FindIndex(entry => entry.IsHeader && entry.Scene == movedEntry.Scene); destIndex -= offsetIndex; // Adjust scene order of tile systems. Undo.RecordObject(movedEntry.TileSystem, TileLang.ParticularText("Action", "Reorder Tile Systems")); foreach (var entry in this.entries) { if (entry.IsHeader) { continue; } if (entry.Scene != movedEntry.Scene) { continue; } if (entry.TileSystem.sceneOrder >= destIndex) { Undo.RecordObject(entry.TileSystem, TileLang.ParticularText("Action", "Reorder Tile Systems")); ++entry.TileSystem.sceneOrder; } } movedEntry.TileSystem.sceneOrder = destIndex; EditorTileSystemUtility.ApplySceneOrders( from x in this.entries where !x.IsHeader orderby x.SceneOrder select x.TileSystem ); }