public PeriodStartEvent(Alpaca pac) : base(pac) { apiCall = "periodStart"; period = pac.Period; this.location = new Point(-1, -1); }
/** * Adds the alpaca model to world. Alpaca object declares itself in its constructor. * * @param {a} Alpaca */ public void AddAlpaca(Alpaca a) { if (map == null) { map = new Map(100, 100); } alpaca = a; }
public DeleteEvent(Alpaca pac, Event eventToDelete) : base(pac) { this.eventToDelete = eventToDelete; deletionId = eventToDelete.EventId; apiCall = "deleteEvent/" + deletionId; Console.WriteLine("i will delete: " + deletionId); this.location = new Point(-1, -1); }
public TurnoverEvent(Alpaca pac, string committedBy, string forcedBy, string turnoverType, Point location) : base(pac) { this.committedBy = committedBy; this.forcedBy = forcedBy; this.turnoverType = turnoverType; this.location = location; apiCall = "turnover"; }
public JumpballEvent(Alpaca pac, string homePlayerId, string awayPlayerId, string winner, Point location) : base(pac) { this.homePlayerId = homePlayerId; this.awayPlayerId = awayPlayerId; this.winner = winner; this.location = location; apiCall = "jumpBall"; }
public SubstitutionEvent(Alpaca pac, string idGoingIn, string idGoingOut, string teamId) : base(pac) { this.idGoingIn = idGoingIn; this.idGoingOut = idGoingOut; this.teamId = teamId; this.location = new Point(-1, -1); apiCall = "substitution"; }
public ReboundEvent(Alpaca pac, string rebounder, string reboundType, Point location) : base(pac) { apiCall = "rebound"; this.rebounder = rebounder; this.reboundType = reboundType; this.location = location; rebounderName = pac.getPlayer(rebounder).DisplayName; }
public FoulEvent(Alpaca pac, string team, string committedBy, string drewBy, string foulType, Boolean ejected, Point location) : base(pac) { this.committedBy = committedBy; this.committedByPlayer = pac.getPlayer(committedBy); this.drewBy = drewBy; this.drewByPlayer = pac.getPlayer(drewBy); this.foulType = foulType; this.ejected = ejected; this.location = location; this.team = team; apiCall = "foul"; }
public DataForm(Alpaca pac, string type, int start, Point loc) { InitializeComponent(); this.type = type; this.iteration = start; this.cancelled = false; this.Location = loc; this.pac = pac; events = new Dictionary<string, EventHandler>(); events["madeShot"] = new EventHandler(this.madeShot_Click); events["missedShot"] = new EventHandler(this.missedShot_Click); events["turnover"] = new EventHandler(this.turnover_Click); events["foul"] = new EventHandler(this.foul_Click); events["tech"] = new EventHandler(this.tech_Click); }
// The input is an alpaca, the team, and the type of timeout (can "team", "offical", or "media") public TimeoutEvent(Alpaca pac, string inputTeam, string inputType) : base(pac) { this.inputTeam = inputTeam; this.inputType = inputType; apiCall = "timeout"; this.location = new Point(-1, -1); if (inputTeam != null) { teamName = pac.getTeamById(inputTeam).Name; } else { teamName = inputType; } }
/// <summary> /// Adds an alpaca to the herd. /// </summary> /// <param name="name">Name</param> /// <param name="sex">Sex</param> /// <param name="dateOfBirth">Date of birth</param> /// <param name="marketValue">Market value, in euros</param> /// <returns>The ID of the newly added alpaca</returns> public Guid AddAlpaca(string name, Sex sex, DateTime dateOfBirth, decimal marketValue) { Guid newAlpacaId = Guid.NewGuid(); var alpaca = new Alpaca() { Id = newAlpacaId, Name = name, Sex = sex, DateOfBirth = dateOfBirth, MarketValue = marketValue }; using (var dbContext = _dbContextFactory.CreateDbContext()) { dbContext.Alpacas.Add(alpaca); dbContext.SaveChanges(); }; return(newAlpacaId); }
private void GameForm_Load(object sender, EventArgs e) { pac = new Alpaca(); confirmScore(false); pac.OnStateChange += update; waitingForReboundClick = false; GameDataResponse gameData = pac.getGameData(pac.GameID); for (int i = 0; i < awayPlayerLabels.Count; i++) { if (i < 5) { homePlayerContexts[i].Click += new EventHandler(this.playerSelect_click); awayPlayerContexts[i].Click += new EventHandler(this.playerSelect_click); } homePlayerLabels[i].Click += new EventHandler(this.playerSelect_click); awayPlayerLabels[i].Click += new EventHandler(this.playerSelect_click); } //jumpBallContextMenuStrip.Items.Add("Possession to Home Team (" + pac.HomeTeam.Name + ")"); //jumpBallContextMenuStrip.Items.Add("Possession to Away Team (" + pac.AwayTeam.Name + ")"); //jumpBallContextMenuStrip.Items[0].Click += new EventHandler(this.jumpball_Click); //jumpBallContextMenuStrip.Items[1].Click += new EventHandler(this.jumpball_Click); update(); }
static void Main() { int num; Console.WriteLine("Elija una opcion"); Console.WriteLine("1 Mamiferos"); Console.WriteLine("2 Aves"); Console.WriteLine("3 Acuaticos"); num = Convert.ToInt32(Console.ReadLine()); switch (num) { case 1: { Console.Clear(); Leon l = new Leon(); l.Grupo = "Mamiferos"; l.Nombre = "Leon"; l.NombreC = "Panthera leo"; l.Melena = "Su melena Color Marron"; Console.WriteLine("Nombre Comun:" + l.Nombre); Console.WriteLine("Nombre Cientifico: " + l.NombreC); Console.WriteLine("Grupo: " + l.Grupo); l.funcionesmamiferos(); l.rugido(); Console.WriteLine("Distintivo de un leon :" + l.Melena); Console.ReadKey(); Console.WriteLine(""); Lobo b = new Lobo(); b.Grupo = "Mamiferos"; b.Nombre = "Lobo"; b.NombreC = "Canis lupus"; b.Sentido = "Tiene un gran sentido del olfato"; Console.WriteLine("Nombre Comun:" + b.Nombre); Console.WriteLine("Nombre Cientifico: " + b.NombreC); Console.WriteLine("Grupo: " + b.Grupo); b.funcionesmamiferos(); b.aullido(); Console.WriteLine("Distintivo de un Lobo:" + b.Sentido); Console.ReadKey(); Console.WriteLine(""); Alpaca c = new Alpaca(); c.Grupo = "Mamiferos"; c.Nombre = "Alpaca"; c.NombreC = "Vicugna pacos"; c.Lana = "Poseen Lana"; Console.WriteLine("Nombre Comun:" + c.Nombre); Console.WriteLine("Nombre Cientifico: " + c.NombreC); Console.WriteLine("Grupo: " + c.Grupo); c.escupir(); c.defensasdealpaca(); Console.WriteLine("Distintivo de una Alpaca: " + c.Lana); Console.ReadKey(); Console.WriteLine(""); break; } case 2: { Console.Clear(); Cuervo k = new Cuervo(); k.Grupo = "Aves"; k.Nombre = "Corvo"; k.NombreC = "Corvus corax "; Console.WriteLine("Nombre Comun:" + k.Nombre); Console.WriteLine("Nombre Cientifico: " + k.NombreC); Console.WriteLine("Grupo: " + k.Grupo); k.hablar(); Console.ReadKey(); Console.WriteLine(""); Guacamaya p = new Guacamaya(); p.Grupo = "Aves"; p.Nombre = "Guacamaya"; p.NombreC = "Ara macao"; Console.WriteLine("Nombre Comun:" + p.Nombre); Console.WriteLine("Nombre Cientifico: " + p.NombreC); Console.WriteLine("Grupo: " + p.Grupo); p.pico(); Console.ReadKey(); Console.WriteLine(""); break; } case 3: { Console.Clear(); AnguilaElectrica k = new AnguilaElectrica(); k.Grupo = "Pez"; k.Nombre = "Anguila Electrica"; k.NombreC = "Electrophorus electricus"; k.Aleta = 0; Console.WriteLine("Nombre Comun:" + k.Nombre); Console.WriteLine("Nombre Cientifico: " + k.NombreC); Console.WriteLine("Grupo: " + k.Grupo); Console.WriteLine("Numero de Aletas: " + k.Aleta); k.Elctriciad(); Console.ReadKey(); Console.WriteLine(""); PezGlobo p = new PezGlobo(); p.Grupo = "Aves"; p.Nombre = "Pez Globo"; p.NombreC = "Arothron nigropunctatus"; p.Aleta = 2; Console.WriteLine("Nombre Comun:" + p.Nombre); Console.WriteLine("Nombre Cientifico: " + p.NombreC); Console.WriteLine("Grupo: " + p.Grupo); Console.WriteLine("Numero de Aletas: " + p.Aleta); p.Picotazovenenozo(); Console.ReadKey(); Console.WriteLine(""); break; } default: break; } }
public List<Event> Events(Alpaca pac) { List<Event> events = gameSetupData.getEvents(pac); return events; }
public List<Event> getEvents(Alpaca pac) { List<Event> events = new List<Event>(); if (gameEvents == null) return events; foreach(Dictionary<string, object> dict in gameEvents) { Event e = null; string eventType = dict["eventType"].ToString().Split(new char[] { '/' })[1]; Console.WriteLine("Found eventType: " + eventType); Context context = JsonConvert.DeserializeObject<Context>(dict["context"].ToString()); if (eventType.Equals("gameEnd")) { e = new GameEndEvent(pac); } else if (eventType.Equals("periodStart")) { Console.WriteLine("Found a periodStart event"); e = new PeriodStartEvent(pac); } else if (eventType.Equals("periodEnd")) { e = new PeriodEndEvent(pac); } else if (eventType.Equals("madeShot")) { string shooter = dict["shooter"].ToString(); object assisted; dict.TryGetValue("assistedBy", out assisted); string assistedBy = null; if (assisted != null) assistedBy = assisted.ToString(); string shotType = dict["shotType"].ToString(); int pointsScored = int.Parse(dict["pointsScored"].ToString()); bool fastBreak = bool.Parse(dict["fastBreakOpportunity"].ToString()); bool goaltending = bool.Parse(dict["goaltending"].ToString()); int[] location = JsonConvert.DeserializeObject<int[]>(dict["location"].ToString()); Point locPt = new Point(location[0], location[1]); Console.WriteLine("made shot"); Console.WriteLine(shooter); Console.WriteLine(location[0] + " " + location[1]); e = new MadeShotEvent(pac, shooter, pac.getPlayer(shooter).TeamId, assistedBy, shotType, pointsScored, fastBreak, goaltending, locPt); } else if (eventType.Equals("missedShot")) { string shooter = dict["shooter"].ToString(); object blocked; dict.TryGetValue("blockedBy", out blocked); string blockedBy = null; if (blocked != null) blockedBy = blocked.ToString(); string shotType = dict["shotType"].ToString(); int pointsAttempted = int.Parse(dict["pointsAttempted"].ToString()); bool fastBreak = bool.Parse(dict["fastBreakOpportunity"].ToString()); int[] location = JsonConvert.DeserializeObject<int[]>(dict["location"].ToString()); Point locPt = new Point(location[0], location[1]); e = new MissedShotEvent(pac, shooter, pac.getPlayer(shooter).TeamId, blockedBy, shotType, pointsAttempted, fastBreak, locPt); } else if (eventType.Equals("jumpBall")) { string homePlayer = dict["homePlayer"].ToString(); string awayPlayer = dict["awayPlayer"].ToString(); string winner = dict["winner"].ToString(); int[] location = JsonConvert.DeserializeObject<int[]>(dict["location"].ToString()); Point locPt = new Point(location[0], location[1]); e = new JumpballEvent(pac, homePlayer, awayPlayer, winner, locPt); } else if (eventType.Equals("rebound")) { object rebound; dict.TryGetValue("rebounder", out rebound); string rebounder = null; if (rebound != null) { rebounder = rebound.ToString(); } string reboundType = dict["reboundType"].ToString(); int[] location = JsonConvert.DeserializeObject<int[]>(dict["location"].ToString()); Point locPt = new Point(location[0], location[1]); e = new ReboundEvent(pac, rebounder, reboundType, locPt); } else if (eventType.Equals("substitution")) { string exitingPlayer = dict["exitingPlayer"].ToString(); string enteringPlayer = dict["enteringPlayer"].ToString(); e = new SubstitutionEvent(pac, enteringPlayer, exitingPlayer, pac.getPlayer(enteringPlayer).TeamId); } else if (eventType.Equals("turnover")) { string committedBy = dict["committedBy"].ToString(); object forced; dict.TryGetValue("forcedBy", out forced); string forcedBy = null; if (forced != null) { forcedBy = forced.ToString(); } string turnoverType = dict["turnoverType"].ToString(); int[] location = JsonConvert.DeserializeObject<int[]>(dict["location"].ToString()); Point locPt = new Point(location[0], location[1]); e = new TurnoverEvent(pac, committedBy, forcedBy, turnoverType, locPt); } else if (eventType.Equals("timeout")) { object team; dict.TryGetValue("timeoutTeam", out team); string timeoutTeam = null; if (team != null) { timeoutTeam = team.ToString(); } string timeoutType = dict["timeoutType"].ToString(); e = new TimeoutEvent(pac, timeoutTeam, timeoutType); } else if (eventType.Equals("foul")) { string committedBy = dict["committedBy"].ToString(); object drew; dict.TryGetValue("drewBy", out drew); string drewBy = null; if (drew != null) { drewBy = drew.ToString(); } string foulType = dict["foulType"].ToString(); bool ejected = bool.Parse(dict["ejected"].ToString()); int[] location = JsonConvert.DeserializeObject<int[]>(dict["location"].ToString()); Point locPt = new Point(location[0], location[1]); e = new FoulEvent(pac, pac.getPlayer(committedBy).TeamId, committedBy, drewBy, foulType, ejected, locPt); } if (e != null) { e.EventId = dict["eventId"].ToString(); e.setContext(context); e.resolve(); events.Add(e); } } return events; }