22using Rampastring . XNAUI ;
33using Rampastring . XNAUI . XNAControls ;
44using System ;
5+ using System . Collections . Generic ;
6+ using System . Diagnostics ;
57using TSMapEditor . Models ;
68using TSMapEditor . Rendering ;
79using 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
0 commit comments