コード例 #1
0
 public PlayerSetupPageViewModel(INavigationService navigationService)
 {
     NavigationService = navigationService;
     PlayersA          = new ObservableCollection <PlayerSetupPlayerViewModel>();
     PlayersB          = new ObservableCollection <PlayerSetupPlayerViewModel>();
     CommandStart      = ReactiveCommand.Create(async() =>
     {
         var ptA = PlayersA.Select(a => new PlayerStandalone(Guid.NewGuid(), a.Name, Players.Gender.Unidentified,
                                                             170, 65, Players.Hands.Right, a.Color.ToVolleyColor())).ToArray();
         var ptB = PlayersB.Select(a => new PlayerStandalone(Guid.NewGuid(), a.Name, Players.Gender.Unidentified,
                                                             170, 65, Players.Hands.Right, a.Color.ToVolleyColor())).ToArray();
         var teamA = new GenericTeam(ptA, ptA.First(), Guid.NewGuid(), "Team A");
         var teamB = new GenericTeam(ptB, ptB.First(), Guid.NewGuid(), "Team B");
         RuleSetupParameters rsp = RuleSetupParameters;
         MatchSetupParameters rp = rsp.RuleParameters;
         var rule = new MatchRuleStandalone(rp.IsDoubles,
                                            rsp.SetCounter.CurrentGameCounter.CurrentPointCounter is FifteenBasedPointCounter fbpc && fbpc.HasDeuce
                                            , rp.SetsPerMatch, rp.GamesPerSet, rsp.SetCounter.CurrentGameCounter is TieBreakSetGameCounter tbsgc);
         var match = new MatchStandalone <GenericTeam>(teamA, teamB, rule, Matches.EnumTeams.TeamA, rsp.SetCounter);
         var n     = new MatchStartParameters(match);
         var par   = new NavigationParameters()
         {
             { "P", n }
         };
         await navigationService.NavigateAsync(nameof(MainPage), par);
     });
 }
コード例 #2
0
ファイル: StandardGameTest.cs プロジェクト: KokiOishi/Volley
        private static void PrepareStandardMatch(MatchRuleStandalone matchRule, out PlayerStandalone playerA,
                                                 out PlayerStandalone playerB, out SinglesTeam teamA, out SinglesTeam teamB,
                                                 out MatchStandalone <SinglesTeam> match)
        {
            playerA = new PlayerStandalone(Guid.NewGuid(), "Nozomi Tojo", Gender.Female, 159.0, 60, Hands.Right, new Color(1.0f, 1.0f, 0.0f));
            playerB = new PlayerStandalone(Guid.NewGuid(), "Kotori Minami", Gender.Female, 159.0, 54, Hands.Right, new Color(0.0f, 1.0f, 1.0f));
            teamA   = new SinglesTeam(playerA, Guid.NewGuid());
            teamB   = new SinglesTeam(playerB, Guid.NewGuid());
            var pcf = FifteenBasedPointCounter.CreateFactory(true);
            var gcf = AdvantageSetGameCounter.CreateFactory(pcf, matchRule.GamesPerSet, 2);

            match = new MatchStandalone <SinglesTeam>(teamA, teamB, matchRule, EnumTeams.TeamA, new StandardSetCounter(gcf, matchRule.Sets, EnumTeams.TeamA));
        }
コード例 #3
0
ファイル: MainModel.cs プロジェクト: KokiOishi/Volley
        public void OnLoad()
        {
            matchRule = new MatchRuleStandalone(false, true, 2, 7, true);

            playerA = new PlayerStandalone(Guid.NewGuid(), "Nozomi Tojo", Gender.Female, 159.0, 60, Hands.Right, new Color(Vector3.Zero));
            playerB = new PlayerStandalone(Guid.NewGuid(), "Kotori Minami", Gender.Female, 159.0, 54, Hands.Right, new Color(Vector3.Zero));
            teamA   = new SinglesTeam(playerA, Guid.NewGuid());
            teamB   = new SinglesTeam(playerB, Guid.NewGuid());

            match = new MatchStandalone <SinglesTeam>(teamA, teamB, matchRule, EnumTeams.TeamA,
                                                      new StandardSetCounter(new SimpleFactory <AdvantageSetGameCounter>(() =>
            {
                return(new AdvantageSetGameCounter(new SimpleFactory <FifteenBasedPointCounter>(() =>
                {
                    return new FifteenBasedPointCounter(true);
                }), 6, 2));
            }), 5));
            match.StartMatch();
            match.CurrentSet.StartSet();
            match.CurrentSet.CurrentGame.StartGame();
            RefreshPoints();
        }
コード例 #4
0
ファイル: Utilities.cs プロジェクト: KokiOishi/Volley
 public static (IEnumerable <PlayerModel> A, IEnumerable <PlayerModel> B) GeneratePlayerModels <TTeam>(this MatchStandalone <TTeam> match)
コード例 #5
0
 public MatchStartParameters(MatchStandalone <GenericTeam> match)
 {
     Match = match ?? throw new ArgumentNullException(nameof(match));
 }