/// <summary> /// 销毁 /// </summary> protected override void OnDestroy() { UnregisterReceiver(_screenReciever); ScreenReciever.ScreenLocked = false; _orientationListener = null; if (Game != null) { Game.Dispose(); } Game = null; base.OnDestroy(); }
/// <summary> /// 创建 /// </summary> /// <param name="savedInstanceState"></param> protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); IntentFilter filter = new IntentFilter(); filter.AddAction(Intent.ActionScreenOn); filter.AddAction(Intent.ActionScreenOff); filter.AddAction(Intent.ActionUserPresent); _screenReciever = new ScreenReciever(); RegisterReceiver(_screenReciever, filter); _orientationListener = new OrientationListener(this); Game.Activity = this; }