Skip to content

Commit c33414d

Browse files
committed
Reorder sidebar object list categories
1 parent 1a0d4d4 commit c33414d

File tree

2 files changed

+40
-25
lines changed

2 files changed

+40
-25
lines changed

src/TSMapEditor/UI/Sidebar/EditorSidebar.cs

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using Rampastring.XNAUI;
33
using Rampastring.XNAUI.XNAControls;
44
using System;
5+
using System.Collections.Generic;
6+
using System.Diagnostics;
57
using TSMapEditor.Models;
68
using TSMapEditor.Rendering;
79
using TSMapEditor.UI.CursorActions;
@@ -33,6 +35,18 @@ public EditorSidebar(WindowManager windowManager, EditorState editorState, Map m
3335

3436
private ICursorActionTarget cursorActionTarget;
3537

38+
static List<string> sidebarModeNames = new List<string>
39+
{
40+
"Infantry",
41+
"Vehicles",
42+
"Aircraft",
43+
"Naval",
44+
"Buildings",
45+
"Terrain Objects",
46+
"Overlays",
47+
"Smudges"
48+
};
49+
3650
public override void Initialize()
3751
{
3852
Name = nameof(EditorSidebar);
@@ -44,35 +58,37 @@ public override void Initialize()
4458
lbSelection.Width = Width;
4559
lbSelection.FontIndex = Constants.UIBoldFont;
4660

47-
for (int i = 1; i < (int)SidebarMode.SidebarModeCount; i++)
61+
Debug.Assert(sidebarModeNames.Count == (int)SidebarMode.SidebarModeCount);
62+
63+
for (int i = 0; i < (int)SidebarMode.SidebarModeCount; i++)
4864
{
4965
SidebarMode sidebarMode = (SidebarMode)i;
50-
lbSelection.AddItem(new XNAListBoxItem() { Text = sidebarMode.ToString(), Tag = sidebarMode });
66+
lbSelection.AddItem(new XNAListBoxItem() { Text = sidebarModeNames[i], Tag = sidebarMode });
5167
}
5268

5369
lbSelection.Height = lbSelection.Items.Count * lbSelection.LineHeight + 5;
5470
AddChild(lbSelection);
5571
lbSelection.EnableScrollbar = false;
5672

57-
var aircraftListPanel = new AircraftListPanel(WindowManager, editorState, map, theaterGraphics, cursorActionTarget);
58-
aircraftListPanel.Name = nameof(aircraftListPanel);
59-
InitPanel(aircraftListPanel);
60-
61-
var buildingListPanel = new BuildingListPanel(WindowManager, editorState, map, theaterGraphics, cursorActionTarget);
62-
buildingListPanel.Name = nameof(buildingListPanel);
63-
InitPanel(buildingListPanel);
73+
var infantryListPanel = new InfantryListPanel(WindowManager, editorState, map, theaterGraphics, cursorActionTarget);
74+
infantryListPanel.Name = nameof(infantryListPanel);
75+
InitPanel(infantryListPanel);
6476

6577
var unitListPanel = new UnitListPanel(WindowManager, editorState, map, theaterGraphics, cursorActionTarget, false);
6678
unitListPanel.Name = nameof(unitListPanel);
6779
InitPanel(unitListPanel);
6880

81+
var aircraftListPanel = new AircraftListPanel(WindowManager, editorState, map, theaterGraphics, cursorActionTarget);
82+
aircraftListPanel.Name = nameof(aircraftListPanel);
83+
InitPanel(aircraftListPanel);
84+
6985
var navalUnitListPanel = new UnitListPanel(WindowManager, editorState, map, theaterGraphics, cursorActionTarget, true);
7086
navalUnitListPanel.Name = nameof(navalUnitListPanel);
7187
InitPanel(navalUnitListPanel);
7288

73-
var infantryListPanel = new InfantryListPanel(WindowManager, editorState, map, theaterGraphics, cursorActionTarget);
74-
infantryListPanel.Name = nameof(infantryListPanel);
75-
InitPanel(infantryListPanel);
89+
var buildingListPanel = new BuildingListPanel(WindowManager, editorState, map, theaterGraphics, cursorActionTarget);
90+
buildingListPanel.Name = nameof(buildingListPanel);
91+
InitPanel(buildingListPanel);
7692

7793
var terrainObjectListPanel = new TerrainObjectListPanel(WindowManager, editorState, map, theaterGraphics, cursorActionTarget);
7894
terrainObjectListPanel.Name = nameof(terrainObjectListPanel);
@@ -88,11 +104,11 @@ public override void Initialize()
88104

89105
modePanels = new XNAPanel[]
90106
{
91-
aircraftListPanel,
92-
buildingListPanel,
107+
infantryListPanel,
93108
unitListPanel,
109+
aircraftListPanel,
94110
navalUnitListPanel,
95-
infantryListPanel,
111+
buildingListPanel,
96112
terrainObjectListPanel,
97113
overlayListPanel,
98114
smudgeListPanel
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
namespace TSMapEditor.UI.Sidebar
1+
namespace TSMapEditor.UI.Sidebar
22
{
33
/// <summary>
44
/// Lists the sidebar modes of the editor.
55
/// </summary>
66
public enum SidebarMode
77
{
8-
None = 0,
9-
Aircraft = 1,
10-
Buildings = 2,
11-
Vehicles = 3,
12-
Naval = 4,
13-
Infantry = 5,
14-
TerrainObjects = 6,
15-
Overlay = 7,
16-
Smudges = 8,
8+
Infantry,
9+
Vehicles,
10+
Aircraft,
11+
Naval,
12+
Buildings,
13+
TerrainObjects,
14+
Overlay,
15+
Smudges,
1716
SidebarModeCount
1817
}
1918
}

0 commit comments

Comments
 (0)