@@ -104,12 +104,14 @@ public GameViewModel(IMpqService mpqService,
104
104
Game . TimeManager . SetTime ( Time . FromMinutes ( settings . CurrentTime ) ) ;
105
105
Game . TimeManager . TimeSpeedMultiplier = settings . TimeSpeedMultiplier ;
106
106
Game . ChunkManager . RenderGrid = settings . ShowGrid ;
107
+ Game . Engine . RenderManager . ViewDistanceModifier = settings . ViewDistanceModifier ;
107
108
108
109
RaisePropertyChanged ( nameof ( OverrideLighting ) ) ;
109
110
RaisePropertyChanged ( nameof ( DisableTimeFlow ) ) ;
110
111
RaisePropertyChanged ( nameof ( TimeSpeedMultiplier ) ) ;
111
112
RaisePropertyChanged ( nameof ( ShowGrid ) ) ;
112
113
RaisePropertyChanged ( nameof ( CurrentTime ) ) ;
114
+ RaisePropertyChanged ( nameof ( ViewDistance ) ) ;
113
115
} ;
114
116
AutoDispose ( new ActionDisposable ( ( ) =>
115
117
{
@@ -137,7 +139,8 @@ public GameViewModel(IMpqService mpqService,
137
139
} ) ) ;
138
140
139
141
ToggleMapVisibilityCommand = new DelegateCommand ( ( ) => IsMapVisible = ! IsMapVisible ) ;
140
-
142
+ ToggleStatsVisibilityCommand = new DelegateCommand ( ( ) => DisplayStats = ! DisplayStats ) ;
143
+
141
144
cameraViewModel = new GameCameraViewModel ( this ) ;
142
145
Items . Add ( cameraViewModel ) ;
143
146
@@ -149,6 +152,9 @@ public GameViewModel(IMpqService mpqService,
149
152
150
153
Game . UpdateLoop . Register ( d =>
151
154
{
155
+ if ( ! DisplayStats )
156
+ return ;
157
+
152
158
ref var counters = ref Game . Engine . StatsManager . Counters ;
153
159
ref var stats = ref Game . Engine . StatsManager . RenderStats ;
154
160
float w = Game . Engine . StatsManager . PixelSize . X ;
@@ -235,6 +241,16 @@ public bool ShowGrid
235
241
}
236
242
}
237
243
244
+ public float ViewDistance
245
+ {
246
+ get => Game . Engine . RenderManager . ViewDistanceModifier ;
247
+ set
248
+ {
249
+ Game . Engine . RenderManager . ViewDistanceModifier = value ;
250
+ RaisePropertyChanged ( nameof ( ViewDistance ) ) ;
251
+ }
252
+ }
253
+
238
254
public int CurrentTime
239
255
{
240
256
get => Game . TimeManager ? . Time . TotalMinutes ?? 0 ;
@@ -245,13 +261,22 @@ public int CurrentTime
245
261
RaisePropertyChanged ( nameof ( CurrentTime ) ) ;
246
262
}
247
263
}
248
-
264
+
265
+ public bool DisplayStats
266
+ {
267
+ get => displayStats ;
268
+ set => SetProperty ( ref displayStats , value ) ;
269
+ }
270
+
249
271
public bool IsMapVisible
250
272
{
251
273
get => isMapVisible ;
252
274
set => SetProperty ( ref isMapVisible , value ) ;
253
275
}
276
+
254
277
public ICommand ToggleMapVisibilityCommand { get ; }
278
+ public ICommand ToggleStatsVisibilityCommand { get ; }
279
+
255
280
256
281
public string UniqueId => "game_view" ;
257
282
@@ -282,6 +307,7 @@ public void Initialized()
282
307
283
308
private GameCameraViewModel cameraViewModel ;
284
309
private bool visibility ;
310
+ private bool displayStats ;
285
311
public ObservableCollection < GameCameraViewModel > Items { get ; } = new ( ) ;
286
312
public IEnumerable < GameCameraViewModel > VisibleItems => Items ;
287
313
public GameCameraViewModel ? SelectedItem { get ; set ; }
0 commit comments