public void PostTeamPosition([FromBody] TeamPosition position) { ////broadcast to all signalR client var context = GlobalHost.ConnectionManager.GetHubContext <SignalRHub>(); context.Clients.All.broadcast(position.eventId, position.TeamId, position.x, position.y, position.ptStpPass); }
private string GetCharacterDescriptionOnPosition(FormationTemplate template, TeamPosition position) { switch (position) { case TeamPosition.Front_1: return(template.F1); case TeamPosition.Front_2: return(template.F2); case TeamPosition.Front_3: return(template.F3); case TeamPosition.Middle_1: return(template.M1); case TeamPosition.Middle_2: return(template.M2); case TeamPosition.Middle_3: return(template.M3); case TeamPosition.Middle_4: return(template.M4); case TeamPosition.Rear_1: return(template.R1); case TeamPosition.Rear_2: return(template.R2); case TeamPosition.Rear_3: return(template.R3); } return(""); }
public async Task CreateAsync(TeamPositionViewModel teamPositionViewModel) { var doesTeamPositionExist = teamPositionRepository.All() .Any(c => c.Season.Id == teamPositionViewModel.SeasonId && c.Club.Id == teamPositionViewModel.ClubId); if (doesTeamPositionExist) { throw new Exception($"Combination of Season and Club already exists."); } var teamPosition = new TeamPosition { Points = teamPositionViewModel.Points, Won = teamPositionViewModel.Won, Drawn = teamPositionViewModel.Drawn, Lost = teamPositionViewModel.Lost, GoalsFor = teamPositionViewModel.GoalsFor, GoalsAgainst = teamPositionViewModel.GoalsAgainst, Season = seasonRepository.Get(teamPositionViewModel.SeasonId), Club = clubRepository.Get(teamPositionViewModel.ClubId) }; await teamPositionRepository.AddAsync(teamPosition); await teamPositionRepository.SaveChangesAsync(); }
public void SetCharacterToPosition(string characterID, TeamPosition position, string accountID) { var positions = GetAll(accountID); positions.First(x => x.Position == position).Character_ID = characterID; SaveAll(positions, accountID, _directoryPath); }
private void UpdatePosition(TeamPosition position) { if (listCharacters.SelectedItems.Count == 1) { var character = (Character)listCharacters.SelectedItems[0].Tag; _packFormationBuilder.SetCharacterToPosition(character.ID, position); } }
private void DrawCommands(Graphics ctx, Pen pen, TeamPosition teamPosition) { foreach (KeyValuePair<Player, PlayerPosition> position in teamPosition) { PlayerPosition playerPosition = position.Value; ctx.DrawEllipse(pen, playerPosition.x - 10, playerPosition.y - 10, playerPosition.x + 10, playerPosition.y + 10); } }
bool DetermineOutOfPosition(Character character) { TeamPosition curPosition = character.PositionHandler.Position; return((preferMelee && curPosition != TeamPosition.Melee) || (preferSupport && curPosition != TeamPosition.Support) || (!preferSupport && !preferMelee)); }
public GamePosition(Field field, TeamPosition firstTeamPosition, TeamPosition secondTeamPosition, BallPosition ballPosition) { Contract.Requires<ArgumentNullException>(firstTeamPosition != null); Contract.Requires<ArgumentNullException>(secondTeamPosition != null); _field = field; _firstTeamPosition = firstTeamPosition; _secondTeamPosition = secondTeamPosition; _ballPosition = ballPosition; }
private static TeamPosition GetNewTeamPosition(TeamPosition currentTeamPosition, TeamAction secondTeamAction) { IDictionary<Player, PlayerPosition> firstTeamPositions = new Dictionary<Player, PlayerPosition>(); foreach (KeyValuePair<Player, PlayerPosition> playerPosition in currentTeamPosition) { firstTeamPositions.Add(playerPosition.Key, new PlayerPosition()); } return new TeamPosition(firstTeamPositions); }
private void m_btnStart_Click(object sender, System.EventArgs e) { var field = new Field(100, 50, 0.12f); var firstTeamPosition = new TeamPosition(new Dictionary<Player, PlayerPosition>()); var secondTeamPosition = new TeamPosition(new Dictionary<Player, PlayerPosition>()); var ballPosition = new BallPosition(); var gamePosition = new GamePosition(field, firstTeamPosition, secondTeamPosition, ballPosition); m_imgTopView.Image = new BitmapVisualizer(m_imgTopView.Width, m_imgTopView.Height).Draw(gamePosition); }
public void SetCharacterToPosition(string characterID, TeamPosition position) { var charactersPositions = _packFormationRepository.GetAll(_accountManagement.GetLoggedAccount().ID); foreach (var character in charactersPositions) { if (character.Character_ID == characterID) { _packFormationRepository.SetCharacterToPosition("", character.Position, _accountManagement.GetLoggedAccount().ID); } } _packFormationRepository.SetCharacterToPosition(characterID, position, _accountManagement.GetLoggedAccount().ID); }
public RobotPlanner AddPlannerComponentToRobot(TeamPosition teamPosition, GameObject robotObject) { return(null); // switch (teamPosition) // { // case TeamPosition.Keeper: // return robotObject.AddComponent<KeeperPlannerBehaviour>(); // case TeamPosition.Midfielder: // return robotObject.AddComponent<MidfielderPlannerBehaviour>(); // case TeamPosition.Defender: // return robotObject.AddComponent<DefenderPlannerBehaviour>(); // case TeamPosition.Attacker: // return robotObject.AddComponent<AttackerPlannerBehaviour>(); // default: // return null; // } }
private void SetCharacterInfo(List <ICharacterInTeam> team, TeamPosition position, TextBox textBox) { var character = team.FirstOrDefault(x => x.GetPosition() == position); if (character == null) { textBox.Text = "NONE"; textBox.BackColor = Color.Gray; } else { textBox.Text = character.GetCharacter().ToCharacterString(); if (character.GetCharacter().Hp == 0) { textBox.BackColor = Color.Orange; } else { textBox.BackColor = Color.LightGreen; } if (currentActions != null) { foreach (var action in currentActions) { if (character.getID() == action.Attacker_ID) { textBox.BackColor = Color.Green; } if (character.getID() == action.Defender_ID) { textBox.BackColor = Color.Red; } } } } }
/// <summary> /// Callback method to be called from the game play object upon /// completion of the game. This method calculates the score and /// updates the match score and moves to the next state /// </summary> internal void GameComplete() { TeamPosition bidTeamPosition = GetTeamPosition(GetPlayerPosition(CurrentBid.Player)); TeamPosition otherTeamPosition = (bidTeamPosition == TeamPosition.NorthSouth) ? TeamPosition.EastWest : TeamPosition.NorthSouth; int bidTeamTricks = gamePlay.TricksWon[bidTeamPosition]; int otherTeamTricks = 13 - bidTeamTricks; int bidTeamScore = 0; int otherTeamScore = 0; if (bidTeamTricks >= CurrentBid.Tricks + 6) { bidTeamScore = bidTeamTricks; } else { bidTeamScore -= (CurrentBid.Tricks + 6); otherTeamScore = otherTeamTricks; } //TODO: handle double and re-double int nsScore = (bidTeamPosition == TeamPosition.NorthSouth) ? bidTeamScore : otherTeamScore; int ewScore = (bidTeamPosition == TeamPosition.EastWest) ? bidTeamScore : otherTeamScore; MatchScore.AddGameScore(new GameScore(CurrentBid, nsScore, ewScore)); if (MatchScore.Winner != null) { //Match completed Status = GameSessionStatus.Score; } else { Status = GameSessionStatus.Bidding; } }
public void GivenCharacterIsAssignedToTeamOnPositionF(string charID, string teamName, TeamPosition position) { int before = charactersInTeams.Count(x => x.GetTeam() == teamName); characters[charID].SetTeam(teamName); characters[charID].SetPosition(position); charactersInTeams.Add(characters[charID]); Assert.AreEqual(before + 1, charactersInTeams.Count(x => x.GetTeam() == teamName)); }
public string GetCharacterIdOnPosition(TeamPosition position) { return(_packFormationRepository.GetCharacterIdOnPosition(position, _accountManagement.GetLoggedAccount().ID)); }
public TeamPosition SetRank(TeamPosition newPosition) { return(new TeamPosition(_teamStats, newPosition.LeaguePosition)); }
public void SetPosition(TeamPosition position) { _teamPosition = position; }
public CharacterPositionHandler(Character character, TeamPosition startingPosition) { Character = character; position.Value = startingPosition; RegisterCanRepositionListeners(); }
public void WhenPlayerWillSetCharacterWithIDToPosition(string characterID, TeamPosition position) { var packFormationBuilder = objectContainer.Resolve <IPackFormationBuilder>(); packFormationBuilder.SetCharacterToPosition(characterID, position); }
private Character GenerateCharacterForPositionBaseOnTempalte(FormationTemplate template, TeamPosition position) { if (string.IsNullOrEmpty(GetCharacterDescriptionOnPosition(template, position))) { return(null); } var splited = GetCharacterDescriptionOnPosition(template, position).Split('@'); var character = _mercenaryManagement.GetMercenaryBaseOnTemplate(splited[0], Int32.Parse(splited[1])).CreateCharacter(); character.ID = $"{position}_{splited[0]}_{splited[1]}"; character.SetPosition(position); return(character); }
private string GetCharacterInfo(List <CharacterInThePack> positions, List <Character> characters, TeamPosition position) { var id = positions.First(x => x.Position == position).Character_ID; if (id != "") { return(characters.First(x => x.ID == id).ToPositionFormatString()); } else { return(""); } }
public string GetOpponentCharacterIdOnPosition(TeamPosition position) { return(_team[position] == null ? "" : _team[position].ID); }
public string GetCharacterIdOnPosition(TeamPosition position, string accountID) { return(GetAll(accountID).First(x => x.Position == position).Character_ID); }