Esempio n. 1
0
 /// <summary>
 /// Terminate the current match / no winners
 /// </summary>
 public void TerminateMatch()
 {
     if (CurrentMatch != null)
     {
         CurrentMatch.Terminate();
     }
 }
Esempio n. 2
0
        private void OnMatchCompleted(object sender, OldMatchController e)
        {
            this.prefabs.MatchResultFrame.SetActive(true);
            switch (e.CurrentState)
            {
            case OldMatchController.MatchState.MatchEndedVictory:
                this.prefabs.VictoryFrame.SetActive(true);
                this.prefabs.DefeatFrame.SetActive(false);
                break;

            case OldMatchController.MatchState.MatchEndedDefeat:
                this.prefabs.VictoryFrame.SetActive(false);
                this.prefabs.DefeatFrame.SetActive(true);
                this.SetupNewGame();
                break;

            case OldMatchController.MatchState.MatchEndedDraw:
                this.prefabs.VictoryFrame.SetActive(true);
                this.prefabs.DefeatFrame.SetActive(false);
                break;
            }

            if (CurrentMatch != null)
            {
                CurrentMatch.Dispose();
                CurrentMatch = null;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Remove the current match from the stored matches in the local datastore
        /// </summary>
        public async void RemoveMatch()
        {
            if (CurrentMatch != null)
            {
                RemoveMatch(CurrentMatch.Match.ID);

                CurrentMatch.RemoveFromOneDrive();
            }
        }
Esempio n. 4
0
        private void SetNextMatch()
        {
            var textRange = new TextRange(TextBox.Document.ContentStart, TextBox.Document.ContentEnd);

            CurrentMatch = CurrentMatch?.NextMatch();
            if (CurrentMatch == null || !CurrentMatch.Success)
            {
                CurrentMatch = FindRegex.Match(textRange.Text);
            }
        }
Esempio n. 5
0
        private void OnReturnHomeClicked()
        {
            this.prefabs.MatchResultFrame.SetActive(false);
            this.prefabs.MatchSetupFrame.SetActive(true);
            if (CurrentMatch != null)
            {
                CurrentMatch.Dispose();
            }

            CurrentMatch = null;
        }
Esempio n. 6
0
        /// <summary>
        /// Store the current match to the local datastore
        /// </summary>
        public async void StoreMatch()
        {
            if (CurrentMatch != null)
            {
                await StoreMatch(CurrentMatch);

                await CurrentMatch.Save();

                await CurrentMatch.SaveToOneDrive();
            }
        }
Esempio n. 7
0
 public static List <CurrentMatch> GetMatches(IEnumerable <Match> MatchesDb)
 {
     return(MatchesDb.Select(m => new CurrentMatch()
     {
         Id = m.MatchId,
         Day = m.Day,
         Type = m.Type,
         Year = m.Year,
         Results = CurrentMatch.ResultsHelper(m)
     })
            .ToList());
 }
    /*public void FillUpWinScreen(MultiplayerWinScreen multik) {
     *      multik.SetReward (Pot);
     *      multik.CheckAdvertising ();
     *
     *      if (MultiplayerTutorialController.IsTutorInProgress ()) {
     *              multik.SetFakeLeftParticipant();
     *              multik.SetFakeRightParticipant();
     *              multik.CheckFakeMatchState ();
     *              WasFakeWin = multik.IsFakeWin;
     *
     *      } else {
     *              multik.SetLeftParticipant (CurrentMatch.LocalParticipant, MatchData.LocalPlayerTime);
     *              multik.CheckMatchState (MatchData);
     *
     *              if (CurrentMatch.Competitor != null) {
     *                      multik.SetRightParticipant (CurrentMatch.Competitor, MatchData.CompetitorTime);
     *              }
     *      }
     * }*/

    public void Quit()
    {
        ShowPreloader();
        WaitingForUpdate = true;

        if (CurrentMatch.IsLocalPlayerTurn)
        {
            CurrentMatch.QuitInTurn(matchData.Match.NextParticipant);
        }
        else
        {
            CurrentMatch.QuitOutOfTurn();
        }
    }
        public Highlight SelectPreviousMatch()
        {
            if (CurrentMatch != null)
            {
                CurrentMatch.Deselect();
            }

            Highlight h = PreviousMatch();

            if (h != null)
            {
                ignoreFocusChange = true;
                h.Select();
                ignoreFocusChange = false;
            }
            return(h);
        }
Esempio n. 10
0
        private async Task <PlayerModel[]> UpdatePlayers()
        {
            if (working)
            {
                return(null);
            }
            working = true;
            pbProgress.IsIndeterminate = true;

            CurrentMatch currentMatch = new CurrentMatch();

            PlayerModel[] result = await Task.Run(() => currentMatch.UpdateCurrentMatch());

            for (int i = 0; i < 10; i++)
            {
                PlayersViewmodel.PlayerModelsObservable[i] = result[i];
            }

            pbProgress.IsIndeterminate = false;
            return(result);
        }
Esempio n. 11
0
        public static string CheckLetter(char userGuess)
        {
            for (int i = 0; i < userGuesses.Count; i++)
            {
                if (userGuesses[i] == userGuess)
                {
                    return("You have already guess this word. Try another guess.");
                }
            }

            char[] charArray = CurrentMatch.ToCharArray();
            for (int i = 0; i < CurrentWord.Length; i++)
            {
                if (CurrentWord[i] == userGuess)
                {
                    charArray[i] = userGuess;
                }
            }

            CurrentMatch = new string(charArray);
            GameCount++;
            return(CurrentMatch);
        }
Esempio n. 12
0
        /// <summary>
        /// Replace the current match with <c>replacement</c>
        /// </summary>
        public void ReplaceMatch(string replacement)
        {
            int start = -replacement.Length;

            if (CurrentMatch != null)
            {
                //Because the replacement might cause another match, we will want to skip the next
                //CurrentMatch if it's within the scope of the replacement.
                start = CurrentMatch.AbsoluteStart;

                CurrentMatch.ReplaceText(Query.ProcessReplacementSyntax(replacement, CurrentMatch));
                CurrentMatch.Deselect();
                highlightHandlers.RemoveMatch(CurrentMatch);
            }

            SelectNextMatch();

            //incase we selected in the region that we just replaced, move on
            while (CurrentMatch != null && !(CurrentMatch.AbsoluteEnd <= start || CurrentMatch.AbsoluteStart >= start + replacement.Length))
            {
                SelectNextMatch();
            }
        }
 public void GoToMatchInfoPage()
 {
     CurrentMatch?.Click();
 }
Esempio n. 14
0
        public CurrentMatchLayout(CurrentMatch currentMatch, CurrentMatchPage page) : base(currentMatch)
        {
            this.page = page;
            this.Children.Add(new Label()
            {
                Text = currentMatch.HasWeighedIn() ? "You Have Weighed In" : "You Have Not Weighed In", Style = labelStyle
            });

            StackLayout buttons = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Margin = 10
            };

            Button weighInButton = new Button()
            {
                Text = "Weigh In", IsEnabled = !currentMatch.HasWeighedIn(), Style = buttonStyle
            };

            weighInButton.Clicked += OnWeighInClicked;
            buttons.Children.Add(weighInButton);

            if (App.User.IsAdmin)
            {
                Button endMatchButton = new Button()
                {
                    Text = "End Match", Style = buttonStyle
                };
                endMatchButton.Clicked += OnEndMatchClicked;
                buttons.Children.Add(endMatchButton);
            }

            this.Children.Add(buttons);

            ListView listView = new ListView
            {
                ItemsSource   = currentMatch.WeighIns,
                SelectionMode = ListViewSelectionMode.None,
                ItemTemplate  = new DataTemplate(() =>
                {
                    Label positionLabel = new Label()
                    {
                        FontSize = 17, TextColor = Color.LightGray, WidthRequest = 30, HorizontalTextAlignment = TextAlignment.End
                    };
                    positionLabel.SetBinding(Label.TextProperty, "Placement");

                    Label anglerLabel = new Label()
                    {
                        FontSize = 17, TextColor = Color.LightGray, WidthRequest = 180
                    };
                    anglerLabel.SetBinding(Label.TextProperty, "Angler");

                    Label weightLabel = new Label()
                    {
                        FontSize = 17, TextColor = Color.LightGray, WidthRequest = 95, HorizontalTextAlignment = TextAlignment.End
                    };
                    weightLabel.SetBinding(Label.TextProperty, "Weight");

                    return(new ViewCell
                    {
                        View = new StackLayout
                        {
                            Orientation = StackOrientation.Horizontal,
                            VerticalOptions = LayoutOptions.Center,
                            Spacing = 15,
                            Children = { positionLabel, anglerLabel, weightLabel }
                        }
                    });
                })
            };

            this.Children.Add(listView);
        }
Esempio n. 15
0
 private void Instance_onPlayerKill(string withWeapon, bool headShot, int round)
 {
     CurrentMatch.AddKill(withWeapon, headShot, round);
 }
Esempio n. 16
0
 private void UpdateReadonlyFields()
 {
     CurrentMatch.UpdateReadOnlyFields();
 }