protected override void LoadContent() { base.LoadContent(); ContentHolder.Init(this, CustomContentLocations.TextureLocations); Levels.Init(); #if !ANDROID && !IOS Engine.SpawnInstance <ControlFullscreen>(); #endif Engine.SpawnInstance <ControlBack>(); Engine.SpawnInstance <Background>(); #if DEBUG Engine.SpawnInstance(new DebuggerWithTerminal(ContentHolder.Get(AvailableFonts.retro_computer))); #endif #if ADS #if ANDROID #if AMAZON Engine.SpawnInstance <AndroidAds>(); #endif #endif #endif #if XBOX_LIVE XboxLiveObject.SignOutCompleted += XboxLiveStatsManager.OnSignOutCompleted; XboxLiveObject.SignInCompleted += XboxLiveStatsManager.OnSignInCompleted; ExitEvent += XboxLiveStatsManager.OnExitGame; XboxLiveObject.SignIn(); #endif Engine.ChangeRoom <RoomInit>(); }
public override void onKeyDown(KeyboardEventArgs e) { base.onKeyDown(e); if ((XboxLiveObject.CurrentUser == null || !XboxLiveObject.CurrentUser.IsSignedIn) && e.Key == Keys.X) { XboxLiveObject.SignIn(false); } }
public override void onButtonDown(GamePadEventArgs e) { base.onButtonDown(e); if ((XboxLiveObject.CurrentUser == null || !XboxLiveObject.CurrentUser.IsSignedIn) && e.Button == Buttons.X) { XboxLiveObject.SignIn(false); } }
public static async void SignIn(bool attempt_silent = true) { if (!XboxLiveObject.SubscribedToEvents) { XboxLiveUser.SignOutCompleted += XboxLiveObject.OnSignOutCompleted; XboxLiveObject.SignInCompleted += XboxLiveObject.OnSignInCompleted; XboxLiveObject.SubscribedToEvents = true; } if (XboxLiveObject.CurrentlyAttemptingSignIn) { return; } XboxLiveObject.CurrentlyAttemptingSignIn = true; var users = await User.FindAllAsync(); try { XboxLiveObject.CurrentUser = new XboxLiveUser(users[0]); if (!XboxLiveObject.CurrentUser.IsSignedIn) { CoreDispatcher core_dispatcher = null; await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { core_dispatcher = Window.Current.CoreWindow.Dispatcher; }); if (attempt_silent) { try { await XboxLiveObject.CurrentUser.SignInSilentlyAsync(core_dispatcher); } catch { Debug.WriteLine("SignInSilentlyAsync Threw Exception"); } } if (!XboxLiveObject.CurrentUser.IsSignedIn) { Debug.WriteLine("Silent Sign-In failed, requesting sign in"); try { await XboxLiveObject.CurrentUser.SignInAsync(core_dispatcher); } catch { Debug.WriteLine("SingInAsync Threw Exception"); } } } if (XboxLiveObject.CurrentUser.IsSignedIn) { try { XboxLiveObject.CurrentContext = new XboxLiveContext(XboxLiveObject.CurrentUser); } catch {} if (XboxLiveObject.IsReady) { XboxLiveObject.SignInCompleted?.Invoke(typeof(XboxLiveObject), new SignInCompletedEventArgs(XboxLiveObject.CurrentUser, XboxLiveObject.CurrentContext)); } } XboxLiveObject.WriteInfo(); } catch { Debug.WriteLine("XboxLiveObject.SignIn() :: Unable to sign in for unknown reasons"); } XboxLiveObject.CurrentlyAttemptingSignIn = false; }