コード例 #1
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            TeamName = reader.ReadString();
            Action   = (TeamAction)reader.ReadByte();

            switch (Action)
            {
            case TeamAction.CreateTeam:
                Team = new TeamsCreateTeam().FromReader(reader);
                break;

            case TeamAction.RemoveTeam:
                Team = new TeamsRemoveTeam().FromReader(reader);
                break;

            case TeamAction.UpdateTeam:
                Team = new TeamsUpdateTeam().FromReader(reader);
                break;

            case TeamAction.AddPlayers:
                Team = new TeamsAddPlayers().FromReader(reader);
                break;

            case TeamAction.RemovePlayers:
                Team = new TeamsRemovePlayers().FromReader(reader);
                break;
            }

            return(this);
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: bolthar/ragg.io
 public Game(ITeam winningTeam, ITeam losingTeam, int multiplier, IGame previousGame)
 {
     _winningTeam = winningTeam;
     _losingTeam = losingTeam;
     _multiplier = multiplier;
     _previousGame = previousGame;
 }
コード例 #3
0
        public TacticViewModel(ITeam team)
        {
            // Initialisation des listes
            Players              = new List <PlayerViewModel>();
            LeftAttackPlayers    = new ObservableCollection <PlayerViewModel>();
            CenterAttackPlayers  = new ObservableCollection <PlayerViewModel>();
            RightAttackPlayers   = new ObservableCollection <PlayerViewModel>();
            LeftMiddlePlayers    = new ObservableCollection <PlayerViewModel>();
            CenterMiddlePlayers  = new ObservableCollection <PlayerViewModel>();
            RightMiddlePlayers   = new ObservableCollection <PlayerViewModel>();
            LeftDefensePlayers   = new ObservableCollection <PlayerViewModel>();
            CenterDefensePlayers = new ObservableCollection <PlayerViewModel>();
            RightDefensePlayers  = new ObservableCollection <PlayerViewModel>();

            foreach (var teamPlayer in team.Players)
            {
                PlayerViewModel playerViewModel = new PlayerViewModel();
                playerViewModel.Area                 = teamPlayer.Area;
                playerViewModel.Attack               = teamPlayer.Attack;
                playerViewModel.Defense              = teamPlayer.Defense;
                playerViewModel.Name                 = teamPlayer.Name;
                playerViewModel.Number               = teamPlayer.Number;
                playerViewModel.Position             = teamPlayer.Position;
                playerViewModel.PlayerSelectedEvent += playerSelectedEvent;
                Players.Add(playerViewModel);
            }
        }
コード例 #4
0
 void SetBlockInfo(int teamId, Vector3 location, Vector3 color)
 {
     this.team                    = Team.Team.GetTeam(teamId);
     this.transform.parent        = team.gameObject.transform.Transform;
     this.transform.localPosition = location;
     this.renderer.material.color = ColorModel.ConvertToUnityColor(color);
 }
コード例 #5
0
 public VSTournament(ITeam firstTeam, ITeam secondTeam)
     : base(new ITeam[] { firstTeam, secondTeam })
 {
     IsFinished = false;
     FirstTeam  = firstTeam;
     SecondTeam = secondTeam;
 }
コード例 #6
0
        public void AddTeam(ITeam newTeam)
        {
            List <ITeam> newTeamList = Teams.ToList();

            newTeamList.Add(newTeam);
            Teams = newTeamList.ToArray();
        }
コード例 #7
0
        private void MakeFinalistsToCompetitors()
        {
            for (int i = 0; i < MatchNodeFinalists.Count; i++)
            {
                if (MatchNodeRule.IsGameFull(this))
                {
                    break;
                }


                FinalistData finalist = MatchNodeFinalists[i];

                ITeam compeditor = finalist.GetCompeditor();


                if (!compeditor.Equals(DummyTeamCreator.DummyTeamInstance))
                {
                    if (!IsTeamACompetitor(compeditor))
                    {
                        CompetitorData toAdd = new CompetitorData(compeditor);
                        MatchNodeBattleResult.Add(toAdd);
                        MatchNodeConnectedFinalists.Add(finalist);
                    }
                }
            }
        }
コード例 #8
0
 public Match(ITeam homeTeam, ITeam foreignTeam, int homeScore, int foreignScore)
 {
     this.HomeTeam = homeTeam;
     this.ForeignTeam = foreignTeam;
     this.HomeScore = homeScore;
     this.ForeignScore = foreignScore;
 }
コード例 #9
0
 /// <summary>
 /// Retrieve a team's profile.
 /// <see href="https://api.slack.com/methods/team.profile.get" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `users.profile:read`
 /// </param>
 /// <param name='visibility'>
 /// Filter by visibility.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <GetOKResponse> GetAsync(this ITeam operations, string token = default(string), string visibility = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(token, visibility, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #10
0
 /// <summary>
 /// Gets billable users information for the current team.
 /// <see href="https://api.slack.com/methods/team.billableInfo" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `admin`
 /// </param>
 /// <param name='user'>
 /// A user to retrieve the billable information for. Defaults to all users.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <BillableInfoOKResponse> BillableInfoAsync(this ITeam operations, string token = default(string), string user = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BillableInfoWithHttpMessagesAsync(token, user, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        public string Execute()
        {
            Console.WriteLine("Please enter team for the board:");
            Console.WriteLine("List of teams:" + Environment.NewLine + HelperMethods.ListTeams(this.engine.Teams));
            string teamName     = Console.ReadLine();
            bool   ifTeamExists = HelperMethods.IfExists(teamName, engine.Teams);

            if (ifTeamExists == false)
            {
                return("Team with such name does not exist.");
            }
            ITeam teamToBeAssigned = HelperMethods.ReturnExisting(teamName, engine.Teams);

            Console.Clear();
            Console.WriteLine("Please enter the name of the board:");
            string name          = Console.ReadLine();
            bool   ifBoardExists = HelperMethods.IfExists(name, teamToBeAssigned.Boards);

            if (ifBoardExists == true)
            {
                return($"Board with name {name} already exists in team {teamToBeAssigned.Name}.");
            }
            var board = this.factory.CreateBoard(name);

            this.engine.Boards.Add(board);
            teamToBeAssigned.Boards.Add(board);
            string result = HelperMethods.TimeStamp() + board.ToString() + $" was created and added to team {teamToBeAssigned.Name}.";

            board.History.Add(result);
            teamToBeAssigned.History.Add(result);

            return(result);
        }
コード例 #12
0
 public virtual void MapToEntity(ITeamModel model, ref ITeam entity, int currentDepth = 1)
 {
     currentDepth++;
     // Assign Base properties
     NameableEntityMapper.MapToEntity(model, ref entity);
     // Team Properties
     // <None>
     // Related Objects
     entity.PrimaryImageFileId = model.PrimaryImageFileId;
     entity.PrimaryImageFile = (ImageFile)model.PrimaryImageFile?.MapToEntity();
     entity.FirstIssueAppearanceId = model.FirstIssueAppearanceId;
     entity.FirstIssueAppearance = (Issue)model.FirstIssueAppearance?.MapToEntity();
     entity.PublisherId = model.PublisherId;
     entity.Publisher = (Publisher)model.Publisher?.MapToEntity();
     // Associated Objects
     entity.TeamAliases = model.TeamAliases?.Where(i => i.Active).Select(TeamAliasMapperExtensions.MapToEntity).ToList();
     entity.TeamCharacterEnemies = model.TeamCharacterEnemies?.Where(i => i.Active).Select(TeamCharacterEnemyMapperExtensions.MapToEntity).ToList();
     entity.TeamCharacterFriends = model.TeamCharacterFriends?.Where(i => i.Active).Select(TeamCharacterFriendMapperExtensions.MapToEntity).ToList();
     entity.TeamIssuesAppearedIn = model.TeamIssuesAppearedIn?.Where(i => i.Active).Select(TeamAppearedInIssueMapperExtensions.MapToEntity).ToList();
     entity.TeamIssuesDisbandedIn = model.TeamIssuesDisbandedIn?.Where(i => i.Active).Select(TeamDisbandedInIssueMapperExtensions.MapToEntity).ToList();
     entity.TeamIssues = model.TeamIssues?.Where(i => i.Active).Select(TeamIssueMapperExtensions.MapToEntity).ToList();
     entity.TeamMembers = model.TeamMembers?.Where(i => i.Active).Select(TeamMemberMapperExtensions.MapToEntity).ToList();
     entity.TeamMovies = model.TeamMovies?.Where(i => i.Active).Select(TeamMovieMapperExtensions.MapToEntity).ToList();
     entity.TeamStoryArcs = model.TeamStoryArcs?.Where(i => i.Active).Select(TeamStoryArcMapperExtensions.MapToEntity).ToList();
     entity.TeamVolumes = model.TeamVolumes?.Where(i => i.Active).Select(TeamVolumeMapperExtensions.MapToEntity).ToList();
 }
コード例 #13
0
 public ClubHistoryController(IClubHistory historyService, ISeason seasonService, ApplicationDbContext db, ITeam teamService)
 {
     _historyService = historyService;
     _seasonService  = seasonService;
     _db             = db;
     _teamService    = teamService;
 }
コード例 #14
0
 public Result(ITeam homeTeam, ITeam awayTeam, int homeTeamGoals, int awayTeamGoals)
 {
     this.HomeTeam      = homeTeam;
     this.AwayTeam      = awayTeam;
     this.HomeTeamGoals = homeTeamGoals;
     this.AwayTeamGoals = awayTeamGoals;
 }
コード例 #15
0
ファイル: Match.cs プロジェクト: AbnerLimaa/design-patterns
 public Match(ITeam homeTeam, ITeam visitorTeam)
 {
     this.HomeTeam    = homeTeam;
     this.VisitorTeam = visitorTeam;
     this.Random      = new Random();
     this.Ended       = false;
 }
コード例 #16
0
        private void CreateTeam_Click(object sender, RoutedEventArgs e)
        {
            string teamName = teamNameTextBox.Text;

            ITeam newTeam      = new Team(teamName, selectedPersons);
            ITeam existingTeam = source.getTeam(teamName);
            bool  validate     = teamController.validateTeam(newTeam, existingTeam);

            if (displayListBox.Items.Count == 0)
            {
                errorMessages.Text = "Team must have atleast 1 player on it";
                return;
            }

            if (validate)
            {
                errorMessages.Text = "";
                ITeam            createdTeam      = source.createTeam(newTeam);
                CreateTournament createTournament = new CreateTournament(user);
                createTournament.Show();
                this.Close();
            }
            else
            {
                errorMessages.Text = "Team already exists";
            }
        }
コード例 #17
0
 public GameAttendanceModel(IGame game, ITeam team, IUser user, IAttendanceBLL attendance)
 {
     games         = game;
     teamBLL       = team;
     usersBLL      = user;
     attendanceBLL = attendance;
 }
コード例 #18
0
        public static ITeam CreateTeam(ITeam thisTeam)
        {
            if (Connect()) {
                try {
                    SqlCommand	Command = Connection.CreateCommand();
                    Command.CommandType = CommandType.StoredProcedure;
                    Command.CommandText = "fif_team_create";

                    Command.Parameters.AddWithValue("name", thisTeam.Name);
                    Command.Parameters.AddWithValue("price", thisTeam.Price);
                    Command.Parameters.AddWithValue("description", thisTeam.Description);
                    Command.Parameters.AddWithValue("start_period", thisTeam.StartPeriod);
                    Command.Parameters.AddWithValue("end_period", thisTeam.EndPeriod);
                    Command.Parameters.AddWithValue("max_number_of_participants", thisTeam.MaxNumberOfParticipants);
                    Command.Parameters.AddWithValue("schedule", thisTeam.TrainingSchedule);

                    Command.Parameters.Add("@activity_id", SqlDbType.Int, 0, "activity_id");
                    Command.Parameters["@activity_id"].Direction = ParameterDirection.Output;

                    Command.ExecuteNonQuery();

                    thisTeam.ActivityId = int.Parse(Command.Parameters["@activity_id"].Value.ToString());

                    Disconnect();
                    return thisTeam;
                }
                catch (Exception) {
                    Disconnect();
                    return null;
                }
            }
            return null;
        }
        public string Execute()
        {
            Console.WriteLine("Please type the name of the team whose boards you want to list:");
            Console.WriteLine("List of teams" + Environment.NewLine + HelperMethods.ListTeams(engine.Teams) + Environment.NewLine + "--------------------------------");
            Console.Write($"-Team name:");
            string teamName = Console.ReadLine();

            Console.WriteLine("--------------------------------");
            bool ifTeamExists = HelperMethods.IfExists(teamName, engine.Teams);

            if (ifTeamExists == false)
            {
                return($"Team with name {teamName} does not exist.");
            }
            ITeam         team = HelperMethods.ReturnExisting(teamName, engine.Teams);
            StringBuilder sb   = new StringBuilder();

            if (team.Boards.Count == 0)
            {
                return($"There are no existing boards in team {teamName}!");
            }
            foreach (var board in team.Boards)
            {
                sb.AppendLine(board.ToString());
            }

            Console.Clear();
            Console.WriteLine($"Boards in team {teamName}{Environment.NewLine}--------------------------------");
            return(sb.ToString().Trim());
        }
コード例 #20
0
        private Tuple <Match, Match> GeneratePairOfMatches(int round, ITeam team1, ITeam team2)
        {
            //each team must play both home and away
            Match m1 = new Match()
            {
                HomeTeam = team1,
                AwayTeam = team2,
                LeagueId = this.LoadedLeague.Id
            };


            Match m2 = new Match()
            {
                HomeTeam = team2,
                AwayTeam = team1,
                LeagueId = this.LoadedLeague.Id
            };

            //every even round switch every home & away team
            if (round % 2 != 0)
            {
                Match mTemp = m1;
                m1 = m2;
                m2 = mTemp;
            }

            //set dates
            m1.TimeOfPlay = this.DatesOfRoundsStarts.Item1.AddDays(7 * round);
            m2.TimeOfPlay = this.DatesOfRoundsStarts.Item2.AddDays(7 * round);

            return(new Tuple <Match, Match>(m1, m2));
        }
コード例 #21
0
 public HomeController(IPost postService, IApplicationUser userService, ApplicationDbContext db, ITeam teamService)
 {
     _postService = postService;
     _userService = userService;
     _db          = db;
     _teamService = teamService;
 }
コード例 #22
0
 /// <summary>
 /// Gets the integration logs for the current team.
 /// <see href="https://api.slack.com/methods/team.integrationLogs" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='changeType'>
 /// Filter logs with this change type. Defaults to all logs.
 /// </param>
 /// <param name='appId'>
 /// Filter logs to this Slack app. Defaults to all logs.
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `admin`
 /// </param>
 /// <param name='user'>
 /// Filter logs generated by this user’s actions. Defaults to all logs.
 /// </param>
 /// <param name='serviceId'>
 /// Filter logs to this service. Defaults to all logs.
 /// </param>
 /// <param name='page'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IntegrationLogsOKResponse> IntegrationLogsAsync(this ITeam operations, string count = default(string), string changeType = default(string), int?appId = default(int?), string token = default(string), string user = default(string), int?serviceId = default(int?), string page = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.IntegrationLogsWithHttpMessagesAsync(count, changeType, appId, token, user, serviceId, page, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #23
0
ファイル: GameController.cs プロジェクト: xul8tr/CSharp
        public bool isValidToMove(IField target, IGameBoard gameBoard, ITeam movingTeam)
        {
            if (!gameBoard.areFieldCoordinatesValid(target))
            {
                return(false);
            }
            if (target == null)
            {
                return(false);
            }
            if (movingTeam == null)
            {
                return(false);
            }
            if (movingTeam.FieldI == null)
            {
                return(false);
            }

            if (!movingTeam.FieldI.isNeighbour(target))
            {
                return(false);
            }

            if (target.isWall()) //if he target field is wall
            {
                return(false);
            }
            return(true);
        }
コード例 #24
0
 public PlayerHistoryController(IPlayerHistory playerHistoryService, ISeason seasonService, ApplicationDbContext db, IPlayer playerService, ITeam teamService)
 {
     _playerHistoryService = playerHistoryService;
     _db            = db;
     _playerService = playerService;
     _teamService   = teamService;
 }
コード例 #25
0
 public TrackEquipmentController(IEquipmentTracking EquipmentTrackingImp, ITeam TeamRepository, IEquipment EquipmentRepository, IRequestService ServiceRequestImp)
 {
     this.EquipmentTrackingImp = EquipmentTrackingImp;
     this.TeamRepository       = TeamRepository;
     this.EquipmentRepository  = EquipmentRepository;
     this.ServiceRequestImp    = ServiceRequestImp;
 }
コード例 #26
0
ファイル: RoleEntry.cs プロジェクト: war-man/Mafia.NET
 public RoleEntry(
     string id,
     ITeam team,
     IList <ICategory> categories,
     Color color,
     Color originalColor,
     bool natural,
     bool unique,
     IList <AbilityEntry> abilities,
     AttackStrength defaultDefense,
     bool defaultDetectionImmune,
     bool defaultRoleBlockImmune,
     HealProfileEntry defaultHealProfile)
 {
     Id      = id;
     Name    = new Key($"{id}name");
     Summary = new Key($"{id}summary");
     Goal    = new Key($"{id}goal");
     AbilitiesDescription = new Key($"{id}abilities");
     Team                   = team;
     Categories             = categories.ToImmutableList();
     Color                  = color;
     OriginalColor          = originalColor;
     Natural                = natural;
     Unique                 = unique;
     Abilities              = abilities.ToImmutableDictionary(x => x.Id, x => x);
     DefaultDefense         = defaultDefense;
     DefaultDetectionImmune = defaultDetectionImmune;
     DefaultRoleBlockImmune = defaultRoleBlockImmune;
     DefaultHealProfile     = defaultHealProfile;
 }
コード例 #27
0
 /// <summary>
 /// Gets the access logs for the current team.
 /// <see href="https://api.slack.com/methods/team.accessLogs" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `admin`
 /// </param>
 /// <param name='page'>
 /// </param>
 /// <param name='before'>
 /// End of time range of logs to include in results (inclusive).
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <AccessLogsOKResponse> AccessLogsAsync(this ITeam operations, string count = default(string), string token = default(string), string page = default(string), int?before = default(int?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.AccessLogsWithHttpMessagesAsync(count, token, page, before, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #28
0
 public ITeamProfile Create(ITeam team)
 {
     return(new TeamProfile
     {
         Name = team.Name,
     });
 }
コード例 #29
0
        public ITeam createTeam(ITeam entry)
        {
            ITeam team = TeamsTable.Create(entry, dbConn);

            if (team == null)
            {
                return(null);
            }

            team = TeamsTable.Get(team.TeamName, dbConn);
            if (team == null)
            {
                return(null);
            }

            entry.TeamId = team.TeamId;  //Quickfix for TeamsTable.Create() not setting the TeamId Correctly

            foreach (var participant in entry.TeamMembers)
            {
                TeamMembersTable.Create(new TeamMember()
                {
                    PersonId = participant.PersonId,
                    TeamId   = team.TeamId
                }, dbConn);
            }
            return(entry);
        }
コード例 #30
0
 public virtual void MapToEntity(ITeamModel model, ref ITeam entity, int currentDepth = 1)
 {
     currentDepth++;
     // Assign Base properties
     NameableEntityMapper.MapToEntity(model, ref entity);
     // Team Properties
     // <None>
     // Related Objects
     entity.PrimaryImageFileId     = model.PrimaryImageFileId;
     entity.PrimaryImageFile       = (ImageFile)model.PrimaryImageFile?.MapToEntity();
     entity.FirstIssueAppearanceId = model.FirstIssueAppearanceId;
     entity.FirstIssueAppearance   = (Issue)model.FirstIssueAppearance?.MapToEntity();
     entity.PublisherId            = model.PublisherId;
     entity.Publisher = (Publisher)model.Publisher?.MapToEntity();
     // Associated Objects
     entity.TeamAliases           = model.TeamAliases?.Where(i => i.Active).Select(TeamAliasMapperExtensions.MapToEntity).ToList();
     entity.TeamCharacterEnemies  = model.TeamCharacterEnemies?.Where(i => i.Active).Select(TeamCharacterEnemyMapperExtensions.MapToEntity).ToList();
     entity.TeamCharacterFriends  = model.TeamCharacterFriends?.Where(i => i.Active).Select(TeamCharacterFriendMapperExtensions.MapToEntity).ToList();
     entity.TeamIssuesAppearedIn  = model.TeamIssuesAppearedIn?.Where(i => i.Active).Select(TeamAppearedInIssueMapperExtensions.MapToEntity).ToList();
     entity.TeamIssuesDisbandedIn = model.TeamIssuesDisbandedIn?.Where(i => i.Active).Select(TeamDisbandedInIssueMapperExtensions.MapToEntity).ToList();
     entity.TeamIssues            = model.TeamIssues?.Where(i => i.Active).Select(TeamIssueMapperExtensions.MapToEntity).ToList();
     entity.TeamMembers           = model.TeamMembers?.Where(i => i.Active).Select(TeamMemberMapperExtensions.MapToEntity).ToList();
     entity.TeamMovies            = model.TeamMovies?.Where(i => i.Active).Select(TeamMovieMapperExtensions.MapToEntity).ToList();
     entity.TeamStoryArcs         = model.TeamStoryArcs?.Where(i => i.Active).Select(TeamStoryArcMapperExtensions.MapToEntity).ToList();
     entity.TeamVolumes           = model.TeamVolumes?.Where(i => i.Active).Select(TeamVolumeMapperExtensions.MapToEntity).ToList();
 }
コード例 #31
0
 public PaymentEntity(ITeam team, IMember member, int paymentId = 0)
 {
     this.PaymentId = paymentId;
     this.Team = team;
     this.Member = member;
     this.Date = DateTime.Now;
 }
コード例 #32
0
        public DetermineWinner(ITeam teamOne, ITeam teamTwo)
        {
            random = new Random();

            _teamOne = teamOne;
            _teamTwo = teamTwo;
        }
コード例 #33
0
        public CloudBallEngine(ITeam red, ITeam blue)
        {
            if (red == null) { throw new ArgumentNullException("red"); }
            if (red == null) { throw new ArgumentNullException("blue"); }

            this.InnerEngine = new b(red, blue);
        }
コード例 #34
0
ファイル: GameTests.cs プロジェクト: clmartel/analytics-101
        public void Game_Constructor()
        {
            ITeam team = this.NFL.GetTeam("NO");

            switch (this.LeagueDataFile.StripPath())
            {
            case "NFL_2016.xml":
                IGame oakGame = team.Games.Single(g => g.AwayTeam == "OAK");
                Assert.AreEqual(35, oakGame.AwayPoints);
                Assert.AreEqual(34, oakGame.HomePoints);
                Assert.IsInstanceOfType(oakGame.AwayStats, typeof(IGameStats));
                Assert.IsInstanceOfType(oakGame.HomeStats, typeof(IGameStats));
                Assert.AreEqual("OAK", oakGame.AwayTeam);
                Assert.AreEqual("NO", oakGame.HomeTeam);
                Assert.AreEqual("9/11/2016 1:00:00 PM", oakGame.Date.ToString());
                Assert.AreEqual(1, oakGame.Week);
                break;

            case "NFL_2017.xml":
                IGame minGame = team.Games.Single(g => g.HomeTeam == "MIN");
                Assert.AreEqual(19, minGame.AwayPoints);
                Assert.AreEqual(29, minGame.HomePoints);
                Assert.IsInstanceOfType(minGame.AwayStats, typeof(IGameStats));
                Assert.IsInstanceOfType(minGame.HomeStats, typeof(IGameStats));
                Assert.AreEqual("NO", minGame.AwayTeam);
                Assert.AreEqual("MIN", minGame.HomeTeam);
                Assert.AreEqual("9/11/2017 7:10:00 PM", minGame.Date.ToString());
                Assert.AreEqual(1, minGame.Week);
                break;

            default:
                break;
            }
        }
コード例 #35
0
 void ILeagueOperator.RemoveTeamFromLeague(ITeam teamToRemoveFromLeague)
 {
     if (!teams.TryRemove(teamToRemoveFromLeague.Name, out _))
     {
         throw new InvalidOperationException(Strings.TeamOfNameDoesNotExist);
     }
 }
コード例 #36
0
        public virtual ITeamModel MapToModel(ITeam entity, int currentDepth = 1)
        {
            currentDepth++;
            var model = NameableEntityMapper.MapToModel <ITeam, TeamModel>(entity);

            // Team Properties
            // <None>
            // Related Objects
            model.PrimaryImageFileId     = entity.PrimaryImageFileId;
            model.PrimaryImageFile       = entity.PrimaryImageFile?.MapToModel();
            model.FirstIssueAppearanceId = entity.FirstIssueAppearanceId;
            model.FirstIssueAppearance   = entity.FirstIssueAppearance?.MapToModel();
            model.PublisherId            = entity.PublisherId;
            model.Publisher = entity.Publisher?.MapToModel();
            // Associated Objects
            model.TeamAliases           = entity.TeamAliases?.Where(i => i.Active).Select(TeamAliasMapperExtensions.MapToModelLite).ToList();
            model.TeamCharacterEnemies  = entity.TeamCharacterEnemies?.Where(i => i.Active).Select(TeamCharacterEnemyMapperExtensions.MapToModelLite).ToList();
            model.TeamCharacterFriends  = entity.TeamCharacterFriends?.Where(i => i.Active).Select(TeamCharacterFriendMapperExtensions.MapToModelLite).ToList();
            model.TeamIssuesAppearedIn  = entity.TeamIssuesAppearedIn?.Where(i => i.Active).Select(TeamAppearedInIssueMapperExtensions.MapToModelLite).ToList();
            model.TeamIssuesDisbandedIn = entity.TeamIssuesDisbandedIn?.Where(i => i.Active).Select(TeamDisbandedInIssueMapperExtensions.MapToModelLite).ToList();
            model.TeamIssues            = entity.TeamIssues?.Where(i => i.Active).Select(TeamIssueMapperExtensions.MapToModelLite).ToList();
            model.TeamMembers           = entity.TeamMembers?.Where(i => i.Active).Select(TeamMemberMapperExtensions.MapToModelLite).ToList();
            model.TeamMovies            = entity.TeamMovies?.Where(i => i.Active).Select(TeamMovieMapperExtensions.MapToModelLite).ToList();
            model.TeamStoryArcs         = entity.TeamStoryArcs?.Where(i => i.Active).Select(TeamStoryArcMapperExtensions.MapToModelLite).ToList();
            model.TeamVolumes           = entity.TeamVolumes?.Where(i => i.Active).Select(TeamVolumeMapperExtensions.MapToModelLite).ToList();
            // Return Entity
            return(model);
        }
コード例 #37
0
 public Payment(ITeam team, IMember member, int paymentId = 0)
 {
     this.PaymentId = paymentId;
     this.Team = team;
     this.Member = member;
     this.Date = DateTime.Now;
     this.ActivityType = "team";
 }
コード例 #38
0
ファイル: SimpleCenter.cs プロジェクト: cupidshen/misc
 public Task AddTeam(ITeam team)
 {
     var id = team?.GetId().Result;
     if (id != null && !_teams.ContainsKey(id.Value))
     {
         _teams.Add(id.Value, team);
     }
     return ArrangeApplications();
 }
コード例 #39
0
 public TeamController(ITeamRepository repository, IUnitOfWork unitOfWork,ITeam team, ITeamManager manager)
 {
     _repository = repository;
     _unitOfWork = unitOfWork;
     _repository.UnitOfWork = unitOfWork;
     _team = team;
     _manager = manager;
     _manager.TeamRepository = _repository;
 }
コード例 #40
0
 /// <summary>
 /// </summary>
 /// <param name="player"></param>
 /// <param name="team"></param>
 /// <param name="otherTeam"></param>
 /// <param name="simulation"></param>
 /// <param name="passingLaneWidth"></param>
 /// <returns></returns>
 public static IEnumerable<IPointMass> GetOpenPlayers(
     PointMass player,
     ITeam team,
     ITeam otherTeam,
     ISimulation simulation,
     float passingLaneWidth)
     => from p in team.Players
         where p != player && IsPlayerOpenForPass(player, p, otherTeam.Players, passingLaneWidth)
         select p;
コード例 #41
0
ファイル: Result.cs プロジェクト: voqk/RankingSystem
        public Result(ITeam team, ITeam opponent, ITeam winner)
        {
            Contract.Requires(team != null && opponent != null);
            Contract.Requires(winner == null || winner.Equals(team) || winner.Equals(opponent));

            this.Team = team;
            this.Opponent = opponent;

            this.ActualScore = GetActualResult(team, winner);
        }
コード例 #42
0
ファイル: Twenty20Game.cs プロジェクト: djrhodes/CricketSim
        public Twenty20Game(ITeam HomeTeam, ITeam VisitingTeam)
        {
            _homeTeam = HomeTeam;
            _visitingTeam = VisitingTeam;
            IInning inning = new DeliveryConstrainedInning(_deliveriesPerInning, HomeTeam, VisitingTeam);
            _innings.Add(inning);

            inning = new DeliveryConstrainedInning(_deliveriesPerInning, VisitingTeam, HomeTeam);
            _innings.Add(inning);
        }
コード例 #43
0
 public virtual bool AreEqual(ITeamModel model, ITeam entity)
 {
     return NameableEntityMapper.AreEqual(model, entity)
         // Team Properties
         // <None>
         // Related Objects
         && model.PrimaryImageFileId == entity.PrimaryImageFileId
         && model.FirstIssueAppearanceId == entity.FirstIssueAppearanceId
         && model.PublisherId == entity.PublisherId
         ;
 }
コード例 #44
0
        public void AddTeam(
            int order,
            ITeam team
            )
        {
            if (order < 1 || order > this.BasketTeamCount)
                throw new ArgumentOutOfRangeException(nameof(order), "order is out of limit for basket");
            if (this.BasketInnitial.ContainsKey(order))
                throw new ArgumentException("This Order is already add");

            this.BasketInnitial.Add(order, team);
        }
コード例 #45
0
ファイル: ASWClient.cs プロジェクト: cupidshen/misc
        public ASWClient(Guid teamId, IASWCenter center)
        {
            _localMode = true;
            _center = center;
            if (_center == null)
            {
                return;
            }

            _team = new Team(teamId);
            _hasInited = true;

        }
コード例 #46
0
 internal void AddMatch(IMatch match, ITeam team)
 {
     if (match.HomeTeam == team)        // TODO ???? jestli staci
     {
         this.MyGoals += match.HomeScore;
         this.OtherGoals += match.ForeignScore;
         this.Points += match.HomePoint;
     }
     else
     {
         this.MyGoals += match.ForeignScore;
         this.OtherGoals += match.HomeScore;
         this.Points += match.ForeignPoint;
     }
 }
コード例 #47
0
ファイル: Result.cs プロジェクト: voqk/RankingSystem
        private static double GetActualResult(ITeam team, ITeam winner)
        {
            if (winner == null) // Draw
            {
                return 0.5;
            }

            if (winner.Equals(team)) // Win
            {
                return 1.0;
            }

            // Lose
            return 0.0;
        }
コード例 #48
0
        public static List<IMember> RetrieveTeamMemberList(ITeam thisTeam)
        {
            List<IMember> memberList = new List<IMember>();

            if (thisTeam != null)
            {
                if (thisTeam.PaymentList != null && thisTeam.PaymentList.Count > 0)
                {
                    foreach (IPayment thisPayment in thisTeam.PaymentList)
                    {
                        memberList.Insert(0, thisPayment.Member);
                    }
                }
            }
            return memberList;
        }
コード例 #49
0
ファイル: RiotClient.cs プロジェクト: Khalyss/RiotApi.NET
 /// <summary>
 /// Constructs a Riot Client with given implemented service for each Riot service group.
 /// </summary>
 /// <param name="champion">The champion.</param>
 /// <param name="currentGame">The current game.</param>
 /// <param name="featuredGames">The featured games.</param>
 /// <param name="game">The game.</param>
 /// <param name="league">The league.</param>
 /// <param name="lolStaticData">The lol static data.</param>
 /// <param name="lolStatus">The lol status.</param>
 /// <param name="match">The match.</param>
 /// <param name="matchHistory">The match history.</param>
 /// <param name="matchList">The match list.</param>
 /// <param name="stats">The stats.</param>
 /// <param name="summoner">The summoner.</param>
 /// <param name="team">The team.</param>
 public RiotClient(IChampion champion, ICurrentGame currentGame, IFeaturedGames featuredGames, IGame game, ILeague league, ILolStaticData lolStaticData,
     ILolStatus lolStatus, IMatch match, IMatchHistory matchHistory, IMatchList matchList, IStats stats, ISummoner summoner, ITeam team)
 {
     this.Champion = champion;
     this.CurrentGame = currentGame;
     this.FeaturedGames = featuredGames;
     this.Game = game;
     this.League = league;
     this.LolStaticData = lolStaticData;
     this.LolStatus = lolStatus;
     this.Match = match;
     this.MatchHistory = matchHistory;
     this.MatchList = matchList;
     this.Stats = stats;
     this.Summoner = summoner;
     this.Team = team;
 }
コード例 #50
0
        public static bool DeleteTeam(ITeam thisTeam)
        {
            if (Connect())
            {
                SqlCommand Command = Connection.CreateCommand();
                Command.CommandType = CommandType.StoredProcedure;
                Command.CommandText = "fif_activity_delete";

                Command.Parameters.AddWithValue("activity_id", thisTeam.ActivityId);

                Command.ExecuteNonQuery();

                Disconnect();
                return true;
            }
            return false;
        }
コード例 #51
0
 public bool DeleteTeam(ITeam thisTeam)
 {
     try
     {
         if (TeamPersistence.DeleteTeam(thisTeam))
         {
             PaymentController paymentController = PaymentController.GetPaymentControllerInstance();
             teamList.Remove(thisTeam);
             return true;
         }
         return false;
     }
     catch (Exception)
     {
         return false;
     }
 }
コード例 #52
0
ファイル: RiotClient.cs プロジェクト: rogin/RiotApi.NET
 /// <summary>
 /// Constructs a Riot Client with given implemented service for each Riot service group.
 /// </summary>
 /// <param name="champion">The champion.</param>
 /// <param name="currentGame">The current game.</param>
 /// <param name="featuredGames">The featured games.</param>
 /// <param name="game">The game.</param>
 /// <param name="league">The league.</param>
 /// <param name="lolStaticData">The lol static data.</param>
 /// <param name="lolStatus">The lol status.</param>
 /// <param name="match">The match.</param>
 /// <param name="matchHistory">The match history.</param>
 /// <param name="matchList">The match list.</param>
 /// <param name="stats">The stats.</param>
 /// <param name="summoner">The summoner.</param>
 /// <param name="team">The team.</param>
 public RiotClient(IChampion champion, ICurrentGame currentGame, IFeaturedGames featuredGames, IGame game, ILeague league, ILolStaticData lolStaticData,
     ILolStatus lolStatus, IMatch match, IMatchHistory matchHistory, IMatchList matchList, IStats stats, ISummoner summoner, ITeam team)
 {
     //we need to let Ninject know which concrete type to use to satisfy the interface.
     this.Champion = champion;
     this.CurrentGame = currentGame;
     this.FeaturedGames = featuredGames;
     this.Game = game;
     this.League = league;
     this.LolStaticData = lolStaticData;
     this.LolStatus = lolStatus;
     this.Match = match;
     this.MatchHistory = matchHistory;
     this.MatchList = matchList;
     this.Stats = stats;
     this.Summoner = summoner;
     this.Team = team;
 }
コード例 #53
0
ファイル: ASWClient.cs プロジェクト: cupidshen/misc
        public ASWClient(Guid teamId, string configFile)
        {
            _localMode = false;
            GrainClient.Initialize(configFile);
            _center = GrainClient.GrainFactory.GetGrain<IASWCenter>(0);
            if (_center == null)
            {
                return;
            }

            _team = GrainClient.GrainFactory.GetGrain<ITeam>(teamId);
            if (_team == null || _team.GetPrimaryKey() == Guid.Empty)
            {
                return;
            }

            //Guider.Start();

            _hasInited = true;
        }
コード例 #54
0
        public DeliveryConstrainedInning(int duration, ITeam battingTeam, ITeam bowlingTeam)
        {
            if (duration == 0)
            {
                throw new ArgumentOutOfRangeException("Duration should be greater than zero");
            }

            if (battingTeam == null)
            {
                throw new ArgumentNullException("battingTeam");
            }

            if (bowlingTeam == null)
            {
                throw new ArgumentNullException("bowlingTeam");
            }

            _duration = duration;
            _battingTeam = battingTeam;
            _bowlingTeam = bowlingTeam;
            IList<IPlayer> partnership = _battingTeam.StartingXI.Take(2).ToList();
            _currentPartnership = new Partnership(partnership[0], partnership[1]);
        }
コード例 #55
0
 public void AddTeam(
     int order,
     ITeam team,
     int? previousBasketOrder
     )
 {
     AddTeam(order, team);
     if (previousBasketOrder.HasValue)
     {
         this.PreviousBasketPlace.Add(team, previousBasketOrder.Value);
     }
 }
コード例 #56
0
 public bool AddTeamFromBottom(
     ITeam team,
     int? previousBasketOrder = null
     )
 {
     for (var order = this.BasketTeamCount; order >= 1; order--)
     {
         if (!this.BasketInnitial.ContainsKey(order))
         {
             this.BasketInnitial.Add(order, team);
             return true;
         }
     }
     return false;
 }
コード例 #57
0
 private void updateTeamProperties(ITeam teamInList, ITeam updatedTeam)
 {
     teamInList.Activated = updatedTeam.Activated;
     teamInList.Name = updatedTeam.Name;
     teamInList.Description = updatedTeam.Description;
     teamInList.Price = updatedTeam.Price;
     teamInList.StartPeriod = updatedTeam.StartPeriod;
     teamInList.EndPeriod = updatedTeam.EndPeriod;
     teamInList.MaxNumberOfParticipants = updatedTeam.MaxNumberOfParticipants;
     teamInList.TrainingSchedule = updatedTeam.TrainingSchedule;
 }
コード例 #58
0
 public bool BatFirst(ITeam coinTossWinner)
 {
     // default is to bat first
     return true;
 }
コード例 #59
0
        public IDeliveryOutcome NewDelivery(IPartnership partnership, IPlayer bowler, ITeam bowlingTeam)
        {
            // default algorithm does basic weighted result with no intelligence
            int outcome = _random.Next(1001);
            Debug.WriteLine(outcome);

            if (outcome < 150)
            {
                return new DeliveryOutcome(partnership.Striker, bowler, 0);
            }
            else if (outcome < 450)
            {
                return new DeliveryOutcome(partnership.Striker, bowler, 1);
            }
            else if (outcome < 575)
            {
                return new DeliveryOutcome(partnership.Striker, bowler, 2);
            }
            else if (outcome < 650)
            {
                return new DeliveryOutcome(partnership.Striker, bowler, 3);
            }
            else if (outcome < 710)
            {
                return new DeliveryOutcome(partnership.Striker, bowler, 4);
            }
            else if (outcome < 860)
            {
                return new DeliveryOutcome(partnership.Striker, bowler, 6);
            }
            else if (outcome < 880)
            {
                Random fielderSelector = new Random();
                int fielderIndex = fielderSelector.Next(1, 12);
                int count = 1;
                IPlayer fielder = null;
                foreach (IPlayer player in bowlingTeam.StartingXI)
                {
                    if (count == fielderIndex)
                    {
                        fielder = player;
                        break;
                    }
                    count++;
                }
                return new CaughtDeliveryOutcome(partnership.Striker, bowler, fielder, 0);
            }
            else if (outcome < 930)
            {
                // bowled
                return new BowledDeliveryOutcome(partnership.Striker, bowler, 0);
            }
            else if (outcome < 960)
            {
                // run out
                 Random fielderSelector = new Random();
                int fielderIndex = fielderSelector.Next(1, 12);
                int count = 1;
                IPlayer fielder = null;
                foreach (IPlayer player in bowlingTeam.StartingXI)
                {
                    if (count == fielderIndex)
                    {
                        fielder = player;
                        break;
                    }
                    count++;
                }
                return new RunOutDeliveryOutcome(partnership.Striker, bowler, fielder, 0);
            }
            else if (outcome < 980)
            {
                // lbw
                return new LBWDeliveryOutcome(partnership.Striker, bowler, 0);
            }
            else if (outcome < 990)
            {
                // stumped
                Random fielderSelector = new Random();
                int fielderIndex = fielderSelector.Next(1, 12);
                int count = 1;
                IPlayer fielder = null;
                foreach (IPlayer player in bowlingTeam.StartingXI)
                {
                    if (count == fielderIndex)
                    {
                        fielder = player;
                        break;
                    }
                    count++;
                }
                return new StumpedDeliveryOutcome(partnership.Striker, bowler, fielder, 0);
            }
            else if (outcome < 995)
            {
                // hit wicket
                return new HitWicketDeliveryOutcome(partnership.Striker, bowler, 0);
            }
            else // outcome 990 - 1000
            {
                // retired hurt
                return new RetiredHurtDeliveryOutcome(partnership.Striker, bowler, 0);
            }
        }
コード例 #60
0
 public TeamViewModel(ITeam team)
 {
     Team = team;
 }