protected virtual void Dispose(bool disposing)
{
if (!_isDisposed)
{
if (disposing)
{
// Dispose loaded game components
// for (int i = 0; i < _components.Count; i++)
// {
// var disposable = _components[i] as IDisposable;
// if (disposable != null)
// disposable.Dispose();
// }
// _components = null;
// if (_content != null)
// {
// _content.Dispose();
// _content = null;
// }
if (_graphicsDeviceManager != null)
{
(_graphicsDeviceManager as GraphicsDeviceManager).Dispose();
_graphicsDeviceManager = null;
}
if (Platform != null)
{
Platform.Activated -= OnActivated;
Platform.Deactivated -= OnDeactivated;
_services.RemoveService(typeof(GamePlatform));
Platform.Dispose();
Platform = null;
}
// ContentTypeReaderManager.ClearTypeCreators();
SoundEffect.PlatformShutdown();
}
#if ANDROID
Activity = null;
#endif
_isDisposed = true;
_instance = null;
}
}