//private Handler CTF; //public GenericActionList<DelayedActionType> DelayedActions; public Team(TeamType us, ushort X, ushort Y, uint FlagUID) { //DelayedActions = new GenericActionList<DelayedActionType>(); TeamName = us; Flag = new SobNpcSpawn { Name = TeamName.ToString() + "Flag", UID = FlagUID, MapID = 2060, X = X, Y = Y, MaxHitpoints = 5000, Hitpoints = 5000, Mesh = 8684, //Sort = 21, Type = Enums.NpcType.Stake, }; GroundFlag = new SobNpcSpawn { Name = TeamName.ToString() + "Flag", UID = FlagUID + 10, MapID = 2060, X = X, Y = Y, MaxHitpoints = 20000, Hitpoints = 20000, Mesh = 8910, //Sort = 21, Type = Enums.NpcType.Stake, }; Map.AddNpc(Flag); }
public PlayerInformation(Byte slot, String callsign, String tag, TeamType team) { this.Slot = slot; this.Callsign = callsign; this.Tag = tag; this.Team = team; }
/// <summary> /// Adds or updates a team /// </summary> /// <param name="team"> team </param> /// <returns> false if update is impossible </returns> public bool AddOrUpdateTeam(TeamType team) { if (!(team is TeamType)) { throw new System.InvalidOperationException("Invalid team"); } foreach (MatchType m in backend.MatchList) { if (!(m is TeamMatch)) { continue; } TeamMatch t = (TeamMatch)m; if (t.Teams.Contains(team)) { // already played a match => no update return false; } } if (backend.Teams.Contains(team)) { backend.Teams.Remove(team); } backend.Teams.Add(team); backend.SubmitTeamListChanges(); return true; }
public static PlayerInfo Create(Common.Player player, Common.Ball ball, TeamType team, IEnumerable<Common.Player> other) { Guard.NotNull(player, "player"); Guard.NotNull(ball, "ball"); var tackled = other.Where(o => player.CanTackle(o)).ToList(); if (tackled.Count > 0) { } var info = new PlayerInfo() { Id = PlayerMapping.GetId(player.PlayerType, team), Position = player.Position, Velocity = player.Velocity, IsBallOwner = player == ball.Owner, CanPickUpBall = player.CanPickUpBall(ball), CanBeTackled = tackled.Select(p => PlayerMapping.GetId(p.PlayerType, TeamType.Other)).ToList(), FallenTimer = player.FallenTimer, TackleTimer = player.TackleTimer, }; info.DistanceToOwnGoal = Goal.Own.GetDistance(info); info.DistanceToOtherGoal = Goal.Other.GetDistance(info); return info; }
public List<ConfigItem> GetTeamNames(TeamType teamType) { using (var session = NHibernateHelper.OpenSession()) { var itemCriteria = session.CreateCriteria(typeof(TeamName)); var teamList = new List<TeamName>(); switch (teamType) { case TeamType.Home: { itemCriteria.Add(Expression.Like("Type", 1)); itemCriteria.Add(Expression.Eq("IsActive", (byte)1)); teamList = itemCriteria.List<TeamName>().OrderBy(x => x.Name).ToList(); break; } case TeamType.Opposition: { itemCriteria.Add(Expression.Like("Type", 2)); itemCriteria.Add(Expression.Eq("IsActive", (byte)1)); teamList = itemCriteria.List<TeamName>().OrderBy(x => x.Name).ToList(); break; } default: itemCriteria.Add(Expression.Eq("IsActive", (byte)1)); teamList = itemCriteria.List<TeamName>().OrderBy(x=>x.Name).ToList(); break; } return (from item in teamList where !string.IsNullOrEmpty(item.Name) select new ConfigItem {Id = item.Id, Name = item.Name}).ToList(); } }
public void AddScore(TeamType team, Score score) { if (score != null) { score.Team = team; ScoresInMatch.Add(score); } }
public void LoadStats(EventTypeStats stats, TeamType team) { Visible = false; UpdateTags (stats.GetFieldCoordinates (team, FieldPositionType.Field), field); UpdateTags (stats.GetFieldCoordinates (team, FieldPositionType.HalfField), hfield); UpdateTags (stats.GetFieldCoordinates (team, FieldPositionType.Goal), goal); field.Tagger.ObjectsCanMove = false; hfield.Tagger.ObjectsCanMove = false; goal.Tagger.ObjectsCanMove = false; }
public void AddTeam(TeamType team, string teamName) { if (!string.IsNullOrWhiteSpace(teamName)) { TeamNames[(int)team] = teamName; } else { TeamNames[(int)team] = string.Empty; } }
public List<Coordinates> GetFieldCoordinates(TeamType team, FieldPositionType pos) { List<TimelineEvent> evts = EventsForTeam (team); switch (pos) { case FieldPositionType.Field: return evts.Where (e => e.FieldPosition != null).Select (e => e.FieldPosition).ToList (); case FieldPositionType.HalfField: return evts.Where (e => e.HalfFieldPosition != null).Select (e => e.HalfFieldPosition).ToList (); default: return evts.Where (e => e.GoalPosition != null).Select (e => e.GoalPosition).ToList (); } }
public void AddSortedBySlot(Player p) { for(int i=0; i<players.Count; i++) if (p.SlotNo < players[i].SlotNo) { players.Insert(i, p); goto SETTYPE; } players.Add(p); SETTYPE: ; this.type = p.TeamType; }
public void TestTeamType() { PlayerType player1 = new PlayerType() { Name = "testplayer1", Mail = "*****@*****.**", Tag = "Tagname1" }; PlayerType player2 = new PlayerType() { Name = "testplayer2", Mail = "*****@*****.**", Tag = "Tagname2" }; PlayerType player3 = new PlayerType() { Name = "testplayer3", Mail = "*****@*****.**", Tag = "Tagname3" }; TeamType team1 = new TeamType() { Name = "team1", Members = new List<PlayerType>() { player1, player2 } }; TeamType team2 = new TeamType() { Name = "team1", Members = new List<PlayerType>() { player1, player2 } }; Assert.AreEqual(team1, team2, " - TeamType Equals does not return true for cloned team"); Assert.IsTrue(team1 == team2, " - TeamType '==' does not return true for cloned team"); team2 = new TeamType() { Name = "team2", Members = new List<PlayerType>() { player2, player3 } }; Assert.AreNotEqual(team1, team2, " - TeamType Equals returns true for different teams"); Assert.IsTrue(team1 != team2, " - TeamType '!=' does not return true for different teams"); }
public Player(GameKeeper gameKeeper, Byte slot, NetConnection connection, PlayerInformation playerInfo) { this.Slot = slot; this.Connection = connection; this.Team = playerInfo.Team; this.Callsign = playerInfo.Callsign; this.Tag = playerInfo.Tag; this.gameKeeper = gameKeeper; this.playerState = PlayerState.Joining; Log.InfoFormat("Player #{0} \"{1}\" <{2}> created and joined to {3}", Slot, Callsign, Tag, Team); }
/// <summary> /// Returns all filtered matches for a team /// </summary> /// <param name="game"> game </param> /// <param name="team"> team </param> /// <returns> filtered matches for a team </returns> public List<MatchType> GetGameMatchesForTeam(GameType game, TeamType team) { List<MatchType> matches = new List<MatchType>(); foreach (TeamMatch t in backend.MatchList) { if (t.GameID == game && t.Teams.Contains(team)) { if (!matches.Contains(t)) { matches.Add(t); } } } return matches; }
public TeamStats(ProjectLongoMatch project, EventsFilter filter, TeamType team) { this.project = project; this.filter = filter; this.team = team; if (team == TeamType.LOCAL) { this.template = project.LocalTeamTemplate; } else { this.template = project.VisitorTeamTemplate; } PlayersStats = new List<PlayerStats> (); foreach (PlayerLongoMatch p in this.template.List) { PlayersStats.Add (new PlayerStats (project, filter, p)); } }
// Start is called before the first frame update public void SpawnAttack(Vector3 attackPosition, Vector3 sourcePosition, TeamType sourceTeam, Unit target, Unit source) { if (areaDamage) { LayerMask targetLayerMask = LayerMask.GetMask(sourceTeam == TeamType.Player ? "Opponent" : "Player"); RaycastHit2D[] hits = Physics2D.CircleCastAll(attackPosition, attackRange, Vector2.zero, 0f, targetLayerMask); for (int i = 0; i < hits.Length; ++i) { Unit unit = hits[i].transform.GetComponent <Unit>(); Assert.IsTrue(unit != null); Assert.IsTrue(unit.IsAlive() == true); //if (unit != null) { if (unit.ReceiveDamage((int)CalculateDamage(unit, attackPosition))) { // source unit might be already killed //Debug.Log(unit.name + " killed by " + invocator.name); } //Debug.Log("Unit " + unit.name + " receive " + damage + " damage."); } } } // target still alive, do instant damage else if (target != null && target.IsAlive()) { if (target.ReceiveDamage((int)CalculateDamage(target, attackPosition))) { // source unit might be already killed //Debug.Log(target.name + " killed by " + invocator.name); } } if (effectPrefab != null) { GameObject inst = Instantiate(effectPrefab); inst.transform.position = attackPosition; inst.transform.up = (attackPosition - sourcePosition).normalized; inst.transform.localScale *= attackRange * 2; } if (suicide_attack && source != null) { source.Kill(); } }
private SmartEntity DeployTroop() { if (Service.Get<SimTimeEngine>().IsPaused()) { return null; } BattleController battleController = Service.Get<BattleController>(); if (battleController.BattleEndProcessing) { return null; } if (battleController.GetPlayerDeployableTroopCount(this.currentTroopType.Uid) == 0) { Service.Get<EventManager>().SendEvent(EventId.TroopNotPlacedInvalidTroop, this.currentWorldPosition); return null; } if (this.currentTroopType == null) { return null; } TeamType teamType = TeamType.Attacker; if (battleController.GetCurrentBattle().Type == BattleType.PveDefend) { teamType = TeamType.Defender; } IntPosition intPosition = Units.WorldToBoardIntDeployPosition(this.currentWorldPosition); intPosition += TroopDeployer.OFFSETS[this.currentOffsetIndex] * this.currentTroopType.AutoSpawnSpreadingScale; intPosition = Units.NormalizeDeployPosition(intPosition); int num = this.currentOffsetIndex + 1; this.currentOffsetIndex = num; if (num == TroopDeployer.OFFSETS.Length) { this.currentOffsetIndex = 0; } SmartEntity smartEntity = Service.Get<TroopController>().SpawnTroop(this.currentTroopType, teamType, intPosition, (teamType == TeamType.Defender) ? TroopSpawnMode.LeashedToBuilding : TroopSpawnMode.Unleashed, true); if (smartEntity == null) { return null; } base.PlaySpawnEffect(smartEntity); battleController.OnTroopDeployed(this.currentTroopType.Uid, teamType, intPosition); Service.Get<EventManager>().SendEvent(EventId.TroopDeployed, smartEntity); return smartEntity; }
/// <summary> /// Gets value indicating whether the cell reachable for enemy, depending on the situation on the board /// </summary> /// <param name="cell">Cell instance</param> /// <param name="team">Player team</param> /// <param name="board">Game board</param> /// <returns>Value indicating whether the cell reachable for enemy or not</returns> public static bool IsCellReachableForEnemy(Cell cell, TeamType team, Board.Board board) { if (cell.Piece != null && cell.Piece.Team != team) { return(true); } List <Cell> cells = new List <Cell>(); foreach (var c in board) { if (c.Piece != null && c.Piece.Team != team) { cells.AddRange(PieceCanMove(c.Piece, board)); } } return(cells.Contains(cell) ? true : false); }
private void OnSpawnTimer(uint id, object cookie) { TroopTypeVO troopVO = this.spawnQueue[0]; TeamType teamType = (TeamType)cookie; Entity entity = Service.TroopController.DeployTroopWithOffset(troopVO, ref this.currentOffsetIndex, this.spawnPosition, false, teamType); if (entity != null) { this.spawnQueue.RemoveAt(0); if (this.spawnQueue.Count > 0) { this.CreateSpawnTimer(teamType); } else { this.Spawning = false; } } }
public CampFire(TeamType team, string region, Vector2 location, ContentManager content, GraphicsDevice graphics) : base(team, content, graphics) { craftSet = "cookT1"; Texture2D texture = content.Load <Texture2D>("CampFire"); Texture2D textureBB = null; if (Gusto.GameOptions.ShowBoundingBox) { textureBB = new Texture2D(graphics, texture.Width, texture.Height); } Asset asset = new Asset(texture, textureBB, 6, 1, 0.3f, "campFire", region); Light lanternLight = new Light(content, graphics, 1.0f, Color.OrangeRed); emittingLight = lanternLight; SetSpriteAsset(asset, location); }
public void RunGame(TeamType tt) { TeamBuilder tb = new TeamBuilder(); Team teamOne = tb.buildTeam(tt); Team teamTwo = tb.buildTeam(tt); BaseGame game = GetGame(); Team winner = game.RunSpecificGame(teamOne, teamTwo); Boolean draw = false; if (winner is null) { draw = true; OnGameFinished(teamOne, teamTwo, draw); return; } Team loser = (teamOne == winner)? teamTwo : teamOne; OnGameFinished(winner, loser, draw); }
/// <summary> /// Initializes a new instance of the <see cref="T:HospitalAllocation.Data.Allocation.StaffGroups.Pod"/> class. /// Sets the beds to an empty dictionary /// </summary> public Pod(TeamType teamType, IDictionary <int, Position> beds, Position consultant, Position teamLeader, Position registrar, Position resident, Position podCa, Position caCleaner ) : base(teamType) { Beds = beds != null ? new Dictionary <int, Position>(beds) : new Dictionary <int, Position>(); Consultant = consultant; TeamLeader = teamLeader; Registrar = registrar; Resident = resident; PodCa = podCa; CaCleaner = caCleaner; }
private Ship CreateShip(TeamType type, int size) { var constraints = new List <Ship.ShipMovement> { Ship.ShipMovement.Vertical, Ship.ShipMovement.Horizontal, Ship.ShipMovement.Vertical, Ship.ShipMovement.Horizontal }; var positions = new List <Position>(4) { new Position(0, size / 2), new Position(size / 2, 0), new Position(size - 1, size / 2), new Position(size / 2, size - 1) }; return(new Ship(this, new WaterCell(positions[(int)type]), constraints[(int)type])); }
// which adjacent tiles mismatch team public int GetBorderFlag(Vector2Int coord) { Assert.IsTrue(IsInsideGrid(coord) == true); int flag = 0; int idx = coord.x + coord.y * grid_size.x; TeamType team = GetTeam(m_team_grid[idx]); // check mismatches with adjacents // north // west // south // east return(flag); }
string TeamName(TeamType team) { if (team == TeamType.LOCAL) { return(project.LocalTeamTemplate.TeamName); } else if (team == TeamType.VISITOR) { return(project.VisitorTeamTemplate.TeamName); } else if (team == TeamType.BOTH) { return("ALL"); } else { return(""); } }
public Pickaxe(TeamType team, string region, Vector2 location, ContentManager content, GraphicsDevice graphics) : base(team, content, graphics) { timeSinceLastFrame = 0; millisecondsPerFrame = 100; damage = 0.1f; itemKey = "pickaxe"; msCraftTime = 10000; Texture2D texture = content.Load <Texture2D>("pickaxe"); Texture2D textureBB = null; if (Gusto.GameOptions.ShowBoundingBox) { textureBB = new Texture2D(graphics, texture.Width, texture.Height); } Asset baseSwordAsset = new Asset(texture, textureBB, 3, 4, 1.0f, itemKey, region); SetSpriteAsset(baseSwordAsset, location); }
public TeamStats(LMProject project, EventsFilter filter, TeamType team) { this.project = project; this.filter = filter; this.team = team; if (team == TeamType.LOCAL) { this.template = project.LocalTeamTemplate; } else { this.template = project.VisitorTeamTemplate; } PlayersStats = new List <PlayerStats> (); foreach (LMPlayer p in this.template.List) { PlayersStats.Add(new PlayerStats(project, filter, p)); } }
public TeePee(TeamType team, string region, Vector2 location, ContentManager content, GraphicsDevice graphics) : base(team, content, graphics) { string objKey = "teePee"; //MapModelMovementVectorValues(); Texture2D texture = content.Load <Texture2D>("TeePee"); Texture2D textureBB = null; if (Gusto.GameOptions.ShowBoundingBox) { textureBB = new Texture2D(graphics, texture.Width, texture.Height); } Asset asset = new Asset(texture, textureBB, 4, 1, 0.5f, objKey, region); // inventory List <Sprite> interiorObjs = null; if (team != TeamType.Player) { List <Tuple <string, int> > itemDrops = RandomEvents.RandomNPDrops(objKey, 5); interiorObjs = ItemUtility.CreateInteriorItems(itemDrops, team, region, location, content, graphics); } structureInterior = new Interior("teePee", this, content, graphics); // set the random drops as interior objects if (interiorObjs != null) { foreach (var obj in interiorObjs) { structureInterior.interiorObjects.Add(obj); // need to do this for containers so they drop items within ship if (obj is IContainer) { Container c = (Container)obj; c.inInteriorId = structureInterior.interiorId; } } } SetSpriteAsset(asset, location); }
public static void TurnOnUnitSelection(TeamType teamType) { foreach (UnitSelection unitSelection in unitSelectionsStatic) { if (unitSelection.team == teamType) { unitSelection.gameObject.SetActive(true); //unitSelection.frontCard.SetActive(true); } else /* * unitSelection.frontCard.SetActive(false); * unitSelection.vbbCancel.gameObject.SetActive(false); * unitSelection.vbbMove.gameObject.SetActive(false); * unitSelection.vbbBoost.gameObject.SetActive(false);*/ { unitSelection.frontCard.GetComponent <ImageTargetBehaviour>().enabled = false; } } }
public static int GetTotalHeroKill(TeamType team) { int num = 0; if (GameManager.Instance.AchieveManager == null) { return(num); } Dictionary <int, AchieveData> achieveDatasByTeam = GameManager.Instance.AchieveManager.GetAchieveDatasByTeam((int)team); if (achieveDatasByTeam != null) { foreach (KeyValuePair <int, AchieveData> current in achieveDatasByTeam) { num += current.Value.TotalKill; } } return(num); }
public static string GetFormattedTeamType(TeamType teamType) { switch (teamType) { case TeamType.CrossfunctionalTeam: return("Universal team"); case TeamType.DevelopmentTeam: return("Development team"); case TeamType.MarketingTeam: return("Marketing team"); case TeamType.MergeAndAcquisitionTeam: return("M&A team"); case TeamType.SupportTeam: return("Support team"); case TeamType.ServersideTeam: return("Serverside team"); default: return(teamType.ToString()); } }
public void setTeam(int team) { if (team == 0) { currentTeam = TeamType.player; GetComponent <SpriteRenderer>().color = Color.red; GameManager.instance.tokenCount++; } else if (team == 1) { currentTeam = TeamType.AI_One; GetComponent <SpriteRenderer>().color = Color.green; } else { currentTeam = TeamType.AI_Two; GetComponent <SpriteRenderer>().color = Color.yellow; } }
public void ReadFromStream(MStreamReader sr) { MatchId = sr.ReadInt16(); InProgress = sr.ReadBoolean(); MatchType = (MatchType)sr.ReadByte(); ActiveMods = (Mod)sr.ReadUInt32(); Name = sr.ReadString(); Password = sr.ReadString(); BeatmapName = sr.ReadString(); BeatmapId = sr.ReadInt32(); BeatmapMd5 = sr.ReadString(); for (var i = 0; i < MaxPlayers; i++) { Slots[i].Status = (MultiSlotStatus)sr.ReadByte(); } for (var i = 0; i < MaxPlayers; i++) { Slots[i].Team = (MultiSlotTeam)sr.ReadByte(); } for (var i = 0; i < MaxPlayers; i++) { Slots[i].UserId = (Slots[i].Status & (MultiSlotStatus)124) > 0 ? sr.ReadInt32() : -1; } HostId = sr.ReadInt32(); PlayMode = (PlayMode)sr.ReadByte(); ScoringType = (ScoringType)sr.ReadByte(); TeamType = (TeamType)sr.ReadByte(); SpecialModes = (MatchSpecialModes)sr.ReadByte(); if (SpecialModes == MatchSpecialModes.Freemods) { for (var i = 0; i < MaxPlayers; i++) { Slots[i].Mods = (Mod)sr.ReadUInt32(); } } Seed = sr.ReadInt32(); }
public Arrow(TeamType team, string region, Vector2 location, ContentManager content, GraphicsDevice graphics) : base(location, team) { timeSinceLastFrame = 0; millisecondsPerFrame = 100; baseMovementSpeed = 2.0f; structureDamage = 1.0f; groundDamage = 6.0f; Texture2D texture = content.Load <Texture2D>("Arrow"); Texture2D textureBB = null; if (Gusto.GameOptions.ShowBoundingBox) { textureBB = new Texture2D(graphics, texture.Width, texture.Height); } Asset basePistolShotAsset = new Asset(texture, textureBB, 2, 1, 1.0f, "arrow", region); SetSpriteAsset(basePistolShotAsset, location); }
public void ChangeLeadingTeam(TeamType team) { this._leaderTeam = new TeamType?(team); foreach (KeyValuePair <Units, PlayEffectAction> current in this._leadingUnitEffects) { if (current.Key && current.Value != null) { current.Value.Destroy(); } } this._leadingUnitEffects.Clear(); foreach (Units current2 in MapManager.Instance.GetAllHeroes()) { if (current2.TeamType == team) { this._leadingUnitEffects.Add(new KeyValuePair <Units, PlayEffectAction>(current2, this.CreateEffect(current2))); } } }
// --------------------------------------------------------------------------------------------------- // Public Function public void ResetArena() { // Arena scoreA.SetValueAndForceNotify(0); scoreB.SetValueAndForceNotify(0); AgentATransform.Transfer(AgentA.transform); AgentBTransform.Transfer(AgentB.transform); MaxScore = (int)academy.resetParameters["MaxScore"]; focusTeam = RandomTeamOn ? focusTeam.RandomTeam() : TeamType.A; time = 0f; winTeam = TeamType.None; // Agent AgentA.Done(); AgentB.Done(); // Restart Game isPlaying = true; }
private void SetReward(TeamType _team, float _reward) { if (focusTeam == _team && focusTeam == TeamType.A) { AgentA.SetReward(_reward); } else if (focusTeam == _team && focusTeam == TeamType.B) { AgentB.SetReward(_reward); } else if (focusTeam != _team && focusTeam == TeamType.A) { AgentA.SetReward(-_reward); } else if (focusTeam != _team && focusTeam == TeamType.B) { AgentB.SetReward(-_reward); } }
static public Character FindRandomEnemy(Character me, TeamType team) { //Debug.Log("finding enemies"); int randNum = Random.Range(0, _spawnedCharacters.Count); try { while (me == _spawnedCharacters[randNum] || _spawnedCharacters[randNum].IsDead || _spawnedCharacters[randNum].Team == team) { randNum = Random.Range(0, _spawnedCharacters.Count); } } catch { //Debug.Log("died in finding"); } return(_spawnedCharacters[randNum]); }
private void RpcSetEggParent(TeamType teamType, Vector3 position) { if (teamType == TeamType.Null) { egg.transform.parent = baseCore.transform; egg.transform.localPosition = position; } else { for (int i = 0; i < warriors.Count; i++) { if (warriors[i].GetComponentInChildren <Humanoid>().team == teamType) { egg.transform.parent = warriors[i].GetComponentInChildren <Humanoid>().transform; egg.transform.localPosition = position; } } } }
public BaseCannonBall(TeamType team, string region, Vector2 location, ContentManager content, GraphicsDevice graphics) : base(location, team) { timeSinceLastFrame = 0; millisecondsPerFrame = 100; baseMovementSpeed = 2.0f; structureDamage = 5.0f; groundDamage = 10.0f; Texture2D textureBaseCannonBall = content.Load <Texture2D>("CannonBall"); Texture2D textureBaseCannonBallBB = null; if (Gusto.GameOptions.ShowBoundingBox) { textureBaseCannonBallBB = new Texture2D(graphics, textureBaseCannonBall.Width, textureBaseCannonBall.Height); } Asset baseCannonBallAsset = new Asset(textureBaseCannonBall, textureBaseCannonBallBB, 2, 1, 1.0f, "baseCannonBall", region); SetSpriteAsset(baseCannonBallAsset, location); }
public void TestTeamType() { PlayerType player1 = new PlayerType() { Name = "testplayer1", Mail = "*****@*****.**", Tag = "Tagname1" }; PlayerType player2 = new PlayerType() { Name = "testplayer2", Mail = "*****@*****.**", Tag = "Tagname2" }; PlayerType player3 = new PlayerType() { Name = "testplayer3", Mail = "*****@*****.**", Tag = "Tagname3" }; TeamType team1 = new TeamType() { Name = "team1", Members = new List <PlayerType>() { player1, player2 } }; TeamType team2 = new TeamType() { Name = "team1", Members = new List <PlayerType>() { player1, player2 } }; Assert.AreEqual(team1, team2, " - TeamType Equals does not return true for cloned team"); Assert.IsTrue(team1 == team2, " - TeamType '==' does not return true for cloned team"); team2 = new TeamType() { Name = "team2", Members = new List <PlayerType>() { player2, player3 } }; Assert.AreNotEqual(team1, team2, " - TeamType Equals returns true for different teams"); Assert.IsTrue(team1 != team2, " - TeamType '!=' does not return true for different teams"); }
public void SetPlayers(int roomId, int myUserId, ReadyPlayerSampleInfo[] players, string summonerIdObserverd) { this.RoomId = roomId; this.MyUserId = myUserId; this.SummIdObserved = summonerIdObserverd; this.WinTeam = null; this.IsRoomReady = true; this._heroExtras.Clear(); for (int i = 0; i < players.Length; i++) { this._heroExtras[players[i].newUid] = new HeroExtraInRoom(); } this._pvpPlayers.Clear(); this._pvpPlayers.AddRange(players); ReadyPlayerSampleInfo readyPlayerSampleInfo; if (myUserId == -2147483648) { readyPlayerSampleInfo = this._pvpPlayers.Find((ReadyPlayerSampleInfo x) => x.SummerId.ToString() == summonerIdObserverd); } else { readyPlayerSampleInfo = this._pvpPlayers.Find((ReadyPlayerSampleInfo x) => x.newUid == myUserId); } if (readyPlayerSampleInfo != null) { TeamType team = readyPlayerSampleInfo.GetTeam(); if (team == TeamType.Neutral) { this.MyUserId = -2147483648; this.SelfTeam = TeamType.LM; } else { this.SelfTeam = team; } } else { ClientLogger.Error("cannot found related playerinfo"); } }
protected override void Update(uint dt) { this.HandleDeferredUserInuput(); this.battleController.UpdateBattleTime(dt); if (this.audioResetDeltaAccumulator >= this.audioResetDeltaMax) { this.audioManager.ResetBattleAudioFlags(); this.audioResetDeltaAccumulator = 0u; } else { this.audioResetDeltaAccumulator += dt; } int num = 0; for (BuildingNode buildingNode = this.buildingNodeList.Head; buildingNode != null; buildingNode = buildingNode.Next) { num += this.battleController.GetHealth(buildingNode.BuildingComp.BuildingType.Type, buildingNode.HealthComp); } bool flag = true; for (TroopNode troopNode = this.troopNodeList.Head; troopNode != null; troopNode = troopNode.Next) { if (troopNode.TeamComp.TeamType == TeamType.Attacker && !troopNode.HealthComp.IsDead() && !troopNode.TroopComp.TroopType.IsHealer) { flag = false; break; } } if (flag && this.specialAttackController.HasUnexpendedSpecialAttacks()) { flag = false; } this.battleController.UpdateCurrentHealth(num); if (flag) { this.battleController.OnAllTroopsDead(); } TeamType type = (!this.battleController.GetCurrentBattle().IsRaidDefense()) ? TeamType.Attacker : TeamType.Defender; this.squadTroopAttackController.UpdateSquadTroopSpawnQueue(type); }
public void ChangeSettings(Match room) { MatchType = room.MatchType; Name = room.Name; BeatmapName = room.BeatmapName; BeatmapId = room.BeatmapId; BeatmapMd5 = room.BeatmapMd5; HostId = room.HostId; PlayMode = room.PlayMode; ScoringType = room.ScoringType; TeamType = room.TeamType; Seed = room.Seed; SpecialModes = room.SpecialModes; ActiveMods = room.ActiveMods; if (SpecialModes == MatchSpecialModes.Normal) { SetMods(ActiveMods, GetSlotByUserId(HostId)); } }
public void ConvertTile(TeamType thisNewOwner) { if (convertedTile.currentOwner == thisNewOwner && convertedTile.currentControlLevel == 0) { return; } if (!tileConquerable) { return; } if (BattlefieldSystemsManager.GetInstance.unitsInCamp) { return; } isConverting = true; convertingTo = thisNewOwner; convertedTile.potentialOwner = convertingTo; }
public static Color TeamTypeToColor(TeamType team) { switch (team) { case TeamType.AutomaticTeam: return Color.White; case TeamType.RogueTeam: return Color.Yellow; case TeamType.RedTeam: return Color.Red; case TeamType.GreenTeam: return Color.Green; case TeamType.BlueTeam: return Color.Blue; case TeamType.PurpleTeam: return Color.Purple; case TeamType.ObserverTeam: return Color.White; default: // WTF? throw new ArgumentOutOfRangeException("team", team, "team must be automatic, rogue, red, green, blue, purple, or observer team"); } }
public int CalculateScore(TeamType team) { var teamScores = from scores in ScoresInMatch where scores.Team == team select scores; int scoreTotal = 0; foreach (var score in teamScores) { switch (score.TypeOfScore) { case ScoreType.Point: { if (score.ScoreAmount > 0) { scoreTotal += 1; } } break; case ScoreType.Goal: { if (score.ScoreAmount > 0) { scoreTotal += 3; } } break; default: break; } } return scoreTotal; }
public void TestTeamMatchType() { PlayerType player1 = new PlayerType() { Name = "test1", Mail = "test1", Tag = "test1" }; PlayerType player2 = new PlayerType() { Name = "test2", Mail = "test2", Tag = "test2" }; PlayerType player3 = new PlayerType() { Name = "test3", Mail = "test3", Tag = "test3" }; PlayerType player4 = new PlayerType() { Name = "test4", Mail = "test4", Tag = "test4" }; var team1 = new TeamType() { Name = "team1", Members = new List<PlayerType>() { player1, player2 } }; var team2 = new TeamType() { Name = "team2", Members = new List<PlayerType>() { player3, player4 } }; var teamMatch1 = new TeamMatch() { GameID = new GameType() { Name = "testTeamGame", ParticipantType = ParticipantTypes.Team }, Category = MatchCategories.Competition, dateTime = DateTime.Now, Teams = new List<TeamType>() { team1, team2 }, Scores = new List<int>() { 1, 2 } }; var teamMatch2 = new TeamMatch() { GameID = new GameType() { Name = "testTeamGame", ParticipantType = ParticipantTypes.Team }, Category = MatchCategories.Competition, dateTime = teamMatch1.dateTime, Teams = new List<TeamType>() { team1, team2 }, Scores = new List<int>() { 1, 2 } }; Assert.AreEqual(teamMatch1, teamMatch2, " - TeamMatch Equals does not return true for cloned matches"); Assert.IsTrue(teamMatch1 == teamMatch2, " - TeamMatch '==' does not return true for cloned matches"); player3 = new PlayerType() { Name = "test5", Mail = "test5", Tag = "test5" }; player4 = new PlayerType() { Name = "test5", Mail = "test6", Tag = "test6" }; team2 = new TeamType() { Name = "team3", Members = new List<PlayerType>() { player3, player4 } }; teamMatch2 = new TeamMatch() { GameID = new GameType() { Name = "testTeamGame", ParticipantType = ParticipantTypes.Team }, Category = MatchCategories.Training, dateTime = DateTime.Now, Teams = new List<TeamType>() { team1, team2 }, Scores = new List<int>() { 3, 4 } }; Assert.AreNotEqual(teamMatch1, teamMatch2, " - TeamMatch Equals returns true for different teammatches"); Assert.IsTrue(teamMatch1 != teamMatch2, " - TeamMatch '!=' does not return true for different teammatches"); }
private void Connect(String host, UInt16? port, String callsign, String tag, TeamType team) { Disconnect("player disconnected"); if (world != null) { world.Dispose(); world = null; } world = new World(this, serverLink); Components.Add(world); world.UpdateOrder = 100; world.DrawOrder = 100; Console.WriteLine("Connecting to server."); serverLink.Connect(host, port, callsign, tag, team); }
public void EmitNewEvent(EventType eventType, List<Player> players = null, TeamType team = TeamType.NONE, List<Tag> tags = null, Time start = null, Time stop = null, Time eventTime = null, Score score = null, PenaltyCard card = null) { if (NewEventEvent != null) NewEventEvent (eventType, players, team, tags, start, stop, eventTime, score, card, null); }
public void TestSimpleTeamMatchManipulations() { ClearAllData(); var playerLogic = (IPlayerManipulations)getInterfaceImplementation(typeof(IPlayerManipulations)); var teamLogic = (ITeamManipulations)getInterfaceImplementation(typeof(ITeamManipulations)); var gameLogic = (IGameManipulations)getInterfaceImplementation(typeof(IGameManipulations)); var matchLogic = (IMatchManipulations)getInterfaceImplementation(typeof(IMatchManipulations)); PlayerType player1 = new PlayerType() { Name = "test1", Mail = "test1", Tag = "test1" }; PlayerType player2 = new PlayerType() { Name = "test2", Mail = "test2", Tag = "test2" }; PlayerType player3 = new PlayerType() { Name = "test3", Mail = "test3", Tag = "test3" }; PlayerType player4 = new PlayerType() { Name = "test4", Mail = "test4", Tag = "test4" }; playerLogic.AddOrUpdatePlayer(player1); playerLogic.AddOrUpdatePlayer(player2); playerLogic.AddOrUpdatePlayer(player3); playerLogic.AddOrUpdatePlayer(player4); var game1 = new GameType() { Name = "game1", ParticipantType = ParticipantTypes.Team }; var game2 = new GameType() { Name = "game2", ParticipantType = ParticipantTypes.All }; gameLogic.AddOrUpdateGame(game1); gameLogic.AddOrUpdateGame(game2); var team1 = new TeamType() { Name = "team1", Members = new List<PlayerType>() { player1, player2 } }; var team2 = new TeamType() { Name = "team2", Members = new List<PlayerType>() { player3, player4 } }; var match1 = new TeamMatch() { GameID = game1, Category = MatchCategories.Competition, dateTime = DateTime.Now, Teams = new List<TeamType>() { team1, team2 }, Scores = new List<int>() { 1, 2 } }; matchLogic.AddOrUpdateTeamMatch(match1); matchLogic = null; matchLogic = (IMatchManipulations)getInterfaceImplementation(typeof(IMatchManipulations)); Assert.IsTrue(matchLogic.GetMatchesAll(game1).Contains(match1), " - MatchManipulator does not persist new TeamMatch"); var match = matchLogic.GetMatchesAll(game1).First() as TeamMatch; match.Scores = new List<int>() { 2, 3 }; matchLogic.AddOrUpdateTeamMatch(match); matchLogic = null; matchLogic = (IMatchManipulations)getInterfaceImplementation(typeof(IMatchManipulations)); Assert.IsTrue((((matchLogic.GetMatchesAll(game1).First() as TeamMatch).Scores.Contains(2)) && ((matchLogic.GetMatchesAll(game1).First() as TeamMatch).Scores.Contains(2))), " - MatchManipulator does not persist TeamMatch changes"); }
void HandleNewTagEvent(EventType evntType, List<Player> players, TeamType team, List<Tag> tags, Time start, Time stop, Time eventTime, Score score, PenaltyCard card, DashboardButton btn) { /* Forward event until we have players integrted in the dashboard layout */ if (NewTagEvent != null) { NewTagEvent (evntType, players, team, tags, start, stop, eventTime, score, card, btn); } //Config.EventsBroker.EmitNewTag (button, players, tags, start, stop); }
public void DashboardKeyListener(KeyPressedEvent e) { KeyAction action; DashboardButton button; if (openedProject == null) { return; } try { action = App.Current.Config.Hotkeys.ActionsHotkeys.GetKeyByValue (e.Key); } catch { return; } if (action == KeyAction.LocalPlayer || action == KeyAction.VisitorPlayer) { if (inPlayerTagging) { TagPlayer (); } if (pendingButton != null) { analysisWindow.ClickButton (pendingButton); } inPlayerTagging = true; taggedTeam = action == KeyAction.LocalPlayer ? TeamType.LOCAL : TeamType.VISITOR; playerNumber = ""; analysisWindow.TagTeam (taggedTeam); timer.Change (TIMEOUT_MS, 0); } else if (action == KeyAction.None) { if (pendingButton != null) { Tag tag = pendingButton.AnalysisEventType.Tags.FirstOrDefault (t => t.HotKey == e.Key); if (tag != null) { analysisWindow.ClickButton (pendingButton, tag); timer.Change (TIMEOUT_MS, 0); } } else if (dashboardHotkeys.TryGetValue (e.Key, out button)) { if (inPlayerTagging) { TagPlayer (); } if (button is AnalysisEventButton) { AnalysisEventButton evButton = button as AnalysisEventButton; /* Finish tagging for the pending button */ if (pendingButton != null) { analysisWindow.ClickButton (pendingButton); } if (evButton.AnalysisEventType.Tags.Count == 0) { analysisWindow.ClickButton (button); } else { pendingButton = evButton; timer.Change (TIMEOUT_MS, 0); } } else { analysisWindow.ClickButton (button); } } else if (inPlayerTagging) { int number; string name = App.Current.Keyboard.NameFromKeyval ((uint)e.Key.Key); if (name.StartsWith ("KP_")) { name = name.Replace ("KP_", ""); } if (int.TryParse (name, out number)) { playerNumber += number.ToString (); timer.Change (TIMEOUT_MS, 0); } return; } } }
public void AddPoint(TeamType team) { AddScore(team, new Score { Team = team, Time = DateTime.Now, ScoreAmount = 1, TypeOfScore = ScoreType.Point }); }
void UpdateTeam(List<PlayerObject> players, int[] formation, TeamType team) { int index = 0, offsetX; int width, colWidth; Color color; width = Width / NTeams; colWidth = width / formation.Length; if (team == TeamType.LOCAL) { color = Config.Style.HomeTeamColor; offsetX = 0; } else { color = Config.Style.AwayTeamColor; offsetX = Width; } /* Columns */ for (int col = 0; col < formation.Length; col++) { double colX, rowHeight; if (players.Count == index) break; if (team == TeamType.LOCAL) { colX = offsetX + colWidth * col + colWidth / 2; } else { colX = offsetX - colWidth * col - colWidth / 2; } rowHeight = Height / formation [col]; for (int row = 0; row < formation [col]; row++) { double rowY; PlayerObject po = players [index]; if (team == TeamType.LOCAL) { rowY = rowHeight * row + rowHeight / 2; } else { rowY = Height - (rowHeight * row + rowHeight / 2); } po.Position = new Point (colX, rowY); po.Size = playerSize; index++; if (players.Count == index) break; } } }
PlotModel GetPie(SubCategoryStat stats, TeamType team) { PlotModel model = new PlotModel (); PieSeries ps = new PieSeries (); foreach (PercentualStat st in stats.OptionStats) { double count = GetCount (st, team); if (count == 0) continue; ps.Slices.Add (new PieSlice (st.Name, count)); } ps.InnerDiameter = 0; ps.ExplodedDistance = 0.0; ps.Stroke = OxyColors.White; ps.StrokeThickness = 2.0; ps.InsideLabelPosition = 0.8; ps.AngleSpan = 360; ps.StartAngle = 0; if (team == TeamType.LOCAL) { ps.Title = HomeName; } else if (team == TeamType.VISITOR) { ps.Title = AwayName; } OxyColor text_color = OxyColor.FromArgb (LongoMatch.App.Current.Style.PaletteText.A, LongoMatch.App.Current.Style.PaletteText.R, LongoMatch.App.Current.Style.PaletteText.G, LongoMatch.App.Current.Style.PaletteText.B); model.TextColor = text_color; model.TitleColor = text_color; model.SubtitleColor = text_color; model.Series.Add (ps); return model; }
double GetCount(PercentualStat stats, TeamType team) { switch (team) { case TeamType.NONE: case TeamType.BOTH: return stats.TotalCount; case TeamType.LOCAL: return stats.LocalTeamCount; case TeamType.VISITOR: return stats.VisitorTeamCount; } return 0; }
void LoadTemplate(string name, TeamType team) { Team template; if (name != null) { template = Config.TeamTemplatesProvider.Load (name); LoadTemplate (template, team, false); } }
public void TestGetMatches() { ClearAllData(); var playerLogic = (IPlayerManipulations)getInterfaceImplementation(typeof(IPlayerManipulations)); var gameLogic = (IGameManipulations)getInterfaceImplementation(typeof(IGameManipulations)); var matchLogic = (IMatchManipulations)getInterfaceImplementation(typeof(IMatchManipulations)); PlayerType player1 = new PlayerType() { Name = "test1", Mail = "test1", Tag = "test1" }; PlayerType player2 = new PlayerType() { Name = "test2", Mail = "test2", Tag = "test2" }; PlayerType player3 = new PlayerType() { Name = "test3", Mail = "test3", Tag = "test3" }; PlayerType player4 = new PlayerType() { Name = "test4", Mail = "test4", Tag = "test4" }; PlayerType player5 = new PlayerType() { Name = "test5", Mail = "test5", Tag = "test5" }; PlayerType player6 = new PlayerType() { Name = "test6", Mail = "test6", Tag = "test6" }; playerLogic.AddOrUpdatePlayer(player1); playerLogic.AddOrUpdatePlayer(player2); playerLogic.AddOrUpdatePlayer(player3); playerLogic.AddOrUpdatePlayer(player4); playerLogic.AddOrUpdatePlayer(player5); playerLogic.AddOrUpdatePlayer(player6); var game1 = new GameType() { Name = "game1", ParticipantType = ParticipantTypes.Solo }; var game2 = new GameType() { Name = "game2", ParticipantType = ParticipantTypes.All }; gameLogic.AddOrUpdateGame(game1); gameLogic.AddOrUpdateGame(game2); var team1 = new TeamType() { Name = "team1", Members = new List<PlayerType>() { player1, player2 } }; var team2 = new TeamType() { Name = "team2", Members = new List<PlayerType>() { player3, player4 } }; var team3 = new TeamType() { Name = "team3", Members = new List<PlayerType>() { player5, player6 } }; var match1 = new SoloMatch() { GameID = game1, Category = MatchCategories.Training, dateTime = DateTime.Now, Players = new List<PlayerType>() { player1, player2 }, Scores = new List<int>() { 1, 2 } }; var match2 = new SoloMatch() { GameID = game2, Category = MatchCategories.Training, dateTime = DateTime.Now, Players = new List<PlayerType>() { player1, player3 }, Scores = new List<int>() { 1, 2 } }; var match3 = new TeamMatch() { GameID = game2, Category = MatchCategories.Training, dateTime = DateTime.Now, Teams = new List<TeamType>() { team1, team2 }, Scores = new List<int>() { 1, 2 } }; matchLogic.AddOrUpdateSoloMatch(match1); matchLogic.AddOrUpdateSoloMatch(match2); matchLogic.AddOrUpdateTeamMatch(match3); var matches = matchLogic.GetMatches(game2, ParticipantTypes.All, MatchCategories.Training); Assert.IsTrue( ((matches.Count == 2) && (matches.Contains(match2)) && (matches.Contains(match3))), " - MatchManipulator \"GetMatches\" Not OK"); matches = matchLogic.GetMatches(game2, ParticipantTypes.Solo, MatchCategories.Training); Assert.IsTrue( ((matches.Count == 1) && (matches.Contains(match2))), " - MatchManipulator \"GetMatches\" Not OK"); matches = matchLogic.GetMatches(game2, ParticipantTypes.Team, MatchCategories.Training); Assert.IsTrue( ((matches.Count == 1) && (matches.Contains(match3))), " - MatchManipulator \"GetMatches\" Not OK"); matches = matchLogic.GetMatches(game2, ParticipantTypes.All, MatchCategories.Competition); Assert.IsTrue((matches.Count == 0), " - MatchManipulator \"GetMatches\" Not OK"); }
void LoadTemplate(Team template, TeamType team, bool forceColor) { if (team == TeamType.LOCAL) { hometemplate = template; hometacticsentry.Text = hometemplate.FormationStr; SetButtonColor (homecolor1, hometemplate.Colors [0]); SetButtonColor (homecolor2, hometemplate.Colors [1]); homecolor1button.Active = homecolor2button.Active = false; if ((forceColor && template.ActiveColor == 1) || (awaytemplate != null && awaytemplate.Color.Equals (hometemplate.Color))) { homecolor2button.Click (); } else { homecolor1button.Click (); } } else { awaytemplate = template; awaytacticsentry.Text = awaytemplate.FormationStr; SetButtonColor (awaycolor1, awaytemplate.Colors [0]); SetButtonColor (awaycolor2, awaytemplate.Colors [1]); awaycolor1button.Active = awaycolor2button.Active = false; if ((forceColor && template.ActiveColor == 1) || (hometemplate != null && hometemplate.Color.Equals (awaytemplate.Color))) { awaycolor2button.Click (); } else { awaycolor1button.Click (); } } teamtagger.LoadTeams (hometemplate, awaytemplate, analysisTemplate.FieldBackground); }
protected override object this[string index] { get { #region switch (index) { case "TeamID": return TeamID; case "UserID": return UserID; case "PlotID": return PlotID; case "TeamType": return TeamType; case "Location": return Location; default: throw new ArgumentException(string.Format("UserPlotTeam index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "TeamID": _TeamID = value.ToNotNullString(); break; case "UserID": _UserID = value.ToNotNullString(); break; case "PlotID": _PlotID = value.ToInt(); break; case "TeamType": _TeamType = value.ToEnum<TeamType>(); break; case "Location": _Location = value.ToInt(); break; default: throw new ArgumentException(string.Format("UserPlotTeam index[{0}] isn't exist.", index)); } #endregion } }