@@ -34,6 +34,7 @@ public partial class WorldGeneratorDialog : Window
3434 {
3535 private InstanceManager _instanceManager ;
3636 private List < PremadeCheckpointItem > _checkpoints = new List < PremadeCheckpointItem > ( ) ;
37+ private List < string > _worldNames = new List < string > ( ) ;
3738 private PremadeCheckpointItem _currentItem ;
3839
3940 [ ReflectedStaticMethod ( Type = typeof ( ConfigForm ) , Name = "LoadLocalization" ) ]
@@ -67,7 +68,12 @@ public WorldGeneratorDialog(InstanceManager instanceManager)
6768 } ) ;
6869 }
6970
70- PremadeCheckpoints . ItemsSource = _checkpoints ;
71+ foreach ( var checkpoint in _checkpoints )
72+ {
73+ _worldNames . Add ( checkpoint . Name ) ;
74+ }
75+
76+ PremadeCheckpoints . ItemsSource = _worldNames ;
7177 }
7278
7379 private void ButtonBase_OnClick ( object sender , RoutedEventArgs e )
@@ -102,55 +108,36 @@ private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
102108
103109 private void PremadeCheckpoints_SelectionChanged ( object sender , SelectionChangedEventArgs e )
104110 {
105- var selected = ( PremadeCheckpointItem ) PremadeCheckpoints . SelectedItem ;
111+ var selected = _checkpoints . FirstOrDefault ( x => x . Name == PremadeCheckpoints . SelectedItem . ToString ( ) ) ;
106112 _currentItem = selected ;
113+ if ( _currentItem == null ) return ;
107114 SettingsView . DataContext = new SessionSettingsViewModel ( _currentItem . Checkpoint . Settings ) ;
115+ CheckpointImage . Source = new BitmapImage ( new Uri ( _currentItem . Icon ) ) ;
108116 }
109117
110118 private void GetWorldInfo ( string savesPath , List < Tuple < string , MyWorldInfo > > result )
111119 {
112120 foreach ( var saveDir in Directory . GetDirectories ( savesPath , "*" , SearchOption . TopDirectoryOnly ) )
113121 {
114- bool newScenario = Directory . GetFiles ( saveDir , "*.scf" , SearchOption . TopDirectoryOnly ) . Length == 1 ;
115-
116- if ( newScenario )
122+ bool isCompatible ;
123+ string platformSessionPath = null ;
124+
125+ platformSessionPath = MyLocalCache . GetSessionPathFromScenario ( saveDir , false , out isCompatible ) ;
126+ if ( platformSessionPath != null && isCompatible )
117127 {
118- bool isCompatible ;
119- string platformSessionPath = null ;
120-
121-
122- if ( ! Sandbox . Game . MyPlatformGameSettings . CONSOLE_COMPATIBLE )
123- {
124- platformSessionPath = MyLocalCache . GetSessionPathFromScenario ( saveDir , false , out isCompatible ) ;
125- if ( platformSessionPath != null && isCompatible )
126- {
127- AddWorldInfo ( result , platformSessionPath , saveDir , " [PC]" ) ;
128- }
129- }
130-
131- string xboxPlatformSessionPath = MyLocalCache . GetSessionPathFromScenario ( saveDir , true , out isCompatible ) ;
132- if ( xboxPlatformSessionPath != null && isCompatible )
133- {
134- AddWorldInfo ( result , xboxPlatformSessionPath , saveDir , " [XBOX]" ) ;
135- }
136-
137- if ( platformSessionPath == null && xboxPlatformSessionPath == null && isCompatible )
138- {
139- AddWorldInfo ( result , saveDir , saveDir , "" ) ;
140- }
128+ AddWorldInfo ( result , platformSessionPath , saveDir , " [PC]" ) ;
141129 }
142- else
130+
131+ string xboxPlatformSessionPath = MyLocalCache . GetSessionPathFromScenario ( saveDir , true , out isCompatible ) ;
132+ if ( xboxPlatformSessionPath != null && isCompatible )
143133 {
144- foreach ( var file in Directory . GetFiles ( saveDir , MyLocalCache . CHECKPOINT_FILE , SearchOption . AllDirectories ) )
145- {
146- var checkpointDir = Path . GetDirectoryName ( file ) ;
147- if ( checkpointDir . ToLower ( ) . Contains ( "backup" ) )
148- continue ;
149-
150- AddWorldInfo ( result , file , saveDir , "" ) ;
151- }
134+ AddWorldInfo ( result , xboxPlatformSessionPath , saveDir , " [XBOX]" ) ;
152135 }
153136
137+ if ( platformSessionPath == null && xboxPlatformSessionPath == null && isCompatible )
138+ {
139+ AddWorldInfo ( result , saveDir , saveDir , "" ) ;
140+ }
154141 }
155142 }
156143
0 commit comments