예제 #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            // Hide PokeMenu panel just in case
            HidePokeMenuStoryboard.Begin();
            // See if we need to update the map
            if ((e.Parameter != null) && (e.NavigationMode != NavigationMode.Back))
            {
                GameMapNavigationModes mode =
                    ((JObject)JsonConvert.DeserializeObject((string)e.Parameter)).Last
                    .ToObject <GameMapNavigationModes>();
                if ((mode == GameMapNavigationModes.AppStart) || (mode == GameMapNavigationModes.SettingsUpdate))
                {
                    SetupMap();
                }
            }
            // Set first position if we shomehow missed it
            UpdateMap();
            await GameMapControl.TryRotateToAsync(SettingsService.Instance.MapHeading);

            await GameMapControl.TryTiltToAsync(SettingsService.Instance.MapPitch);

            SubscribeToCaptureEvents();
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
        }
예제 #2
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     // Hide PokeMenu panel just in case
     HidePokeMenuStoryboard.Begin();
     // See if we need to update the map
     if (e.Parameter != null && e.NavigationMode != NavigationMode.Back)
     {
         var mode =
             ((JObject)JsonConvert.DeserializeObject((string)e.Parameter)).Last
             .ToObject <GameMapNavigationModes>();
         if (mode == GameMapNavigationModes.AppStart || mode == GameMapNavigationModes.SettingsUpdate)
         {
             SetupMap();
         }
     }
     // Set first position if we shomehow missed it
     if (GameClient.Geoposition != null)
     {
         UpdateMap(GameClient.Geoposition);
     }
     SubscribeToCaptureEvents();
     SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
     AudioUtils.StopSounds();
 }
예제 #3
0
 private void ViewModelOnLevelUpRewardsAwarded(object sender, EventArgs eventArgs)
 {
     if (PokeMenuPanel.Opacity > 0)
     {
         HidePokeMenuStoryboard.Begin();
     }
     ShowLevelUpPanelStoryboard.Begin();
 }
예제 #4
0
 private void OnBackRequested(object sender, BackRequestedEventArgs backRequestedEventArgs)
 {
     if (!(PokeMenuPanel.Opacity > 0))
     {
         return;
     }
     backRequestedEventArgs.Handled = true;
     HidePokeMenuStoryboard.Begin();
 }
예제 #5
0
 private void ViewModelOnLevelUpRewardsAwarded(object sender, EventArgs eventArgs)
 {
     if (PokeMenuPanel.Opacity > 0)
     {
         HidePokeMenuStoryboard.Begin();
     }
     AudioUtils.StopSound(AudioUtils.GAMEPLAY);
     AudioUtils.PlaySound(AudioUtils.LEVELUP);
     ShowLevelUpPanelStoryboard.Begin();
 }
예제 #6
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                base.OnNavigatedTo(e);
                // Hide panels just in case
                HidePokeMenuStoryboard.Begin();
                CoverGrid.Opacity = 0;

                // See if we need to update the map
                if ((e.Parameter != null) && (e.NavigationMode != NavigationMode.Back))
                {
                    GameMapNavigationModes mode =
                        ((JObject)JsonConvert.DeserializeObject((string)e.Parameter)).Last
                        .ToObject <GameMapNavigationModes>();
                    if ((mode == GameMapNavigationModes.AppStart) || (mode == GameMapNavigationModes.SettingsUpdate))
                    {
                        SetupMap();
                    }
                }
                // Set first position if we shomehow missed it
                await UpdateMap();

                //Changed order of calls, this allow to have events registration before trying to move map
                //appears that for some reason TryRotate and/or TryTilt fails sometimes!
                SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
                SubscribeToCaptureEvents();

                AudioUtils.SoundEnded += AudioUtils_SoundEnded;
            }
            catch (Exception ex)
            {
                //because we are in "async void" unhandled exception might not be raised
                await ExceptionHandler.HandleException(ex);
            }
            try
            {
                await GameMapControl.TryRotateToAsync(SettingsService.Instance.MapHeading);

                await GameMapControl.TryTiltToAsync(SettingsService.Instance.MapPitch);
            }
            catch
            {
                //we don't care :)
            }
        }