예제 #1
0
        private async void nextTrack()
        {
            trackSound.Stop();
            dispatcherTimer.Tick -= dispatcherTimer_Tick;
            dispatcherTimer.Stop();
            parameter.points += pointTrack;
            parameter.beforeTrack.Add(parameter.trackGuessed);
            parameter.listBeforeTrack.Items.Add(parameter.trackGuessed);
            if (parameter.listTrack.IndexOf(parameter.trackGuessed) != parameter.listTrack.Count - 1)
            {
                NextContentDialog dialog = new NextContentDialog();
                await dialog.ShowAsync();
            }
            for (int i = 0; i < parameter.textGuess.Count; i++)
            {
                parameter.textGuess[i].Foreground = new SolidColorBrush((Color)Application.Current.Resources["ExitColor"]);
                if (parameter.textGuess[i].Tag.ToString() == "track")
                {
                    parameter.textGuess[i].Text = "Name of track: NOT YET FOUND";
                }
                else if (parameter.textGuess[i].Tag.ToString() == "artist")
                {
                    parameter.textGuess[i].Text = "Name of artist: NOT YET FOUND";
                }
                else if (parameter.textGuess[i].Tag.ToString() == "album")
                {
                    parameter.textGuess[i].Text = "Title of album: NOT YET FOUND";
                }
            }
            if (parameter.listTrack.IndexOf(parameter.trackGuessed) != parameter.listTrack.Count - 1)
            {
                parameter.trackGuessed = parameter.listTrack[parameter.listTrack.IndexOf(parameter.trackGuessed) + 1];
                if (parameter.connectedUser != null)
                {
                    parameter.gameFrame.Navigate(typeof(TrackSoloGame), new GameFrame(parameter.rootFrame, parameter.gameFrame, parameter.connectedUser, parameter.trackGuessed, parameter.listTrack, parameter.beforeTrack, parameter.listBeforeTrack, parameter.textGuess, parameter.classType, parameter.points, parameter.players, parameter.party), new SlideNavigationTransitionInfo()
                    {
                        Effect = SlideNavigationTransitionEffect.FromRight
                    });
                }
                else
                {
                    parameter.gameFrame.Navigate(typeof(TrackSoloGame), new GameFrame(parameter.rootFrame, parameter.gameFrame, null, parameter.trackGuessed, parameter.listTrack, parameter.beforeTrack, parameter.listBeforeTrack, parameter.textGuess, parameter.classType, parameter.points, parameter.players, null), new SlideNavigationTransitionInfo()
                    {
                        Effect = SlideNavigationTransitionEffect.FromRight
                    });
                }
                parameter.gameFrame.BackStack.RemoveAt(parameter.gameFrame.BackStack.Count - 1);
            }
            else
            {
                if (parameter.connectedUser != null)
                {
                    if (parameter.party.points != 0)
                    {
                        List <string> infoParameter = new List <string>()
                        {
                            parameter.party.party_id.ToString(), parameter.connectedUser.username, parameter.points.ToString()
                        };
                        string response = await apiConnect.PostAsJsonAsync(infoParameter, "http://localhost/api/party/addduel.php");

                        var message = new MessageDialog(response);
                        await message.ShowAsync();

                        EndUserContentDialogSolo dialog;
                        if (parameter.points > parameter.party.points)
                        {
                            dialog = new EndUserContentDialogSolo(parameter.connectedUser, parameter.points, parameter.rootFrame, 1);
                        }
                        else if (parameter.points == parameter.party.points)
                        {
                            dialog = new EndUserContentDialogSolo(parameter.connectedUser, parameter.points, parameter.rootFrame, 2);
                        }
                        else
                        {
                            dialog = new EndUserContentDialogSolo(parameter.connectedUser, parameter.points, parameter.rootFrame, 3);
                        }
                        await dialog.ShowAsync();
                    }
                    else
                    {
                        parameter.party.points = parameter.points;
                        await apiConnect.PostAsJsonAsync(parameter.party, "http://localhost/api/party/updateparty.php");

                        EndUserContentDialogSolo dialog = new EndUserContentDialogSolo(parameter.connectedUser, parameter.points, parameter.rootFrame);
                        await dialog.ShowAsync();
                    }
                }
                else
                {
                    EndGuestContentDialogSolo dialog = new EndGuestContentDialogSolo(parameter.rootFrame);
                    await dialog.ShowAsync();
                }
            }
        }
예제 #2
0
 private async void nextTrack()
 {
     trackSound.Stop();
     dispatcherTimer.Tick -= dispatcherTimer_Tick;
     dispatcherTimer.Stop();
     parameter.points += pointTrack;
     parameter.beforeTrack.Add(parameter.trackGuessed);
     parameter.listBeforeTrack.Items.Add(parameter.trackGuessed);
     if (parameter.listTrack.IndexOf(parameter.trackGuessed) != parameter.listTrack.Count - 1)
     {
         NextContentDialog dialog = new NextContentDialog();
         await dialog.ShowAsync();
     }
     for (int i = 0; i < parameter.textGuess.Count; i++)
     {
         parameter.textGuess[i].Foreground = new SolidColorBrush((Color)Application.Current.Resources["ExitColor"]);
         if (parameter.textGuess[i].Tag.ToString() == "track")
         {
             parameter.textGuess[i].Text = "Name of track: NOT YET FOUND";
         }
         else if (parameter.textGuess[i].Tag.ToString() == "artist")
         {
             parameter.textGuess[i].Text = "Name of artist: NOT YET FOUND";
         }
         else if (parameter.textGuess[i].Tag.ToString() == "album")
         {
             parameter.textGuess[i].Text = "Title of album: NOT YET FOUND";
         }
     }
     if (parameter.listTrack.IndexOf(parameter.trackGuessed) != parameter.listTrack.Count - 1)
     {
         parameter.trackGuessed = parameter.listTrack[parameter.listTrack.IndexOf(parameter.trackGuessed) + 1];
         if (parameter.connectedUser != null)
         {
             parameter.gameFrame.Navigate(typeof(TrackMultiGame), new GameFrame(parameter.rootFrame, parameter.gameFrame, parameter.connectedUser, parameter.trackGuessed, parameter.listTrack, parameter.beforeTrack, parameter.listBeforeTrack, parameter.textGuess, parameter.classType, parameter.points, parameter.players, null), new SlideNavigationTransitionInfo()
             {
                 Effect = SlideNavigationTransitionEffect.FromRight
             });
         }
         else
         {
             parameter.gameFrame.Navigate(typeof(TrackMultiGame), new GameFrame(parameter.rootFrame, parameter.gameFrame, null, parameter.trackGuessed, parameter.listTrack, parameter.beforeTrack, parameter.listBeforeTrack, parameter.textGuess, parameter.classType, parameter.points, parameter.players, null), new SlideNavigationTransitionInfo()
             {
                 Effect = SlideNavigationTransitionEffect.FromRight
             });
         }
         parameter.gameFrame.BackStack.RemoveAt(parameter.gameFrame.BackStack.Count - 1);
     }
     else
     {
         if (parameter.connectedUser != null)
         {
             EndUserContentDialogMulti dialog = new EndUserContentDialogMulti(parameter.connectedUser, parameter.points, parameter.rootFrame, WinnerPlayer());
             await dialog.ShowAsync();
         }
         else
         {
             EndGuestContentDialogMulti dialog = new EndGuestContentDialogMulti(parameter.rootFrame, WinnerPlayer());
             await dialog.ShowAsync();
         }
     }
 }