Example #1
0
        public bool Search(string[] terms, MatchType matchType)
        {
            int count = 0;

            foreach (string term in terms)
            {
                if (this.rawItem.Contains(term))
                {
                    count++;
                }
            }

            if (matchType.Equals(MatchType.And) && count.Equals(terms.Length)) return true;
            if (matchType.Equals(MatchType.Or) && ((count > 0) && (count <= terms.Length))) return true;
            return false;
        }
Example #2
0
 public int getExpectedTeamPlayerNumber()
 {
     if (MatchType.Equals(Constants.FFA) || MatchType.Equals(Constants.V1))
     {
         return(Constants.TeamPlayers_FFA);
     }
     else if (MatchType.Equals(Constants.V2))
     {
         return(Constants.TeamPlayers_V2);
     }
     else if (MatchType.Equals(Constants.V22))
     {
         return(Constants.TeamPlayers_V22);
     }
     else if (MatchType.Equals(Constants.V222))
     {
         return(Constants.TeamPlayers_V222);
     }
     else if (MatchType.Equals(Constants.V3))
     {
         return(Constants.TeamPlayers_V3);
     }
     else if (MatchType.Equals(Constants.V33))
     {
         return(Constants.TeamPlayers_V33);
     }
     else if (MatchType.Equals(Constants.V4))
     {
         return(Constants.TeamPlayers_V4);
     }
     return(-1);
 }
Example #3
0
 public int getExpectedTeamNumber()
 {
     if (MatchType.Equals(Constants.FFA) || MatchType.Equals(Constants.V1))
     {
         return(CheckedHumanPlayers.Count);
     }
     else if (MatchType.Equals(Constants.V2))
     {
         return(Constants.TeamNumber_V2);
     }
     else if (MatchType.Equals(Constants.V22))
     {
         return(Constants.TeamNumber_V22);
     }
     else if (MatchType.Equals(Constants.V222))
     {
         return(Constants.TeamNumber_V222);
     }
     else if (MatchType.Equals(Constants.V3))
     {
         return(Constants.TeamNumber_V3);
     }
     else if (MatchType.Equals(Constants.V33))
     {
         return(Constants.TeamNumber_V33);
     }
     else if (MatchType.Equals(Constants.V4))
     {
         return(Constants.TeamNumber_V4);
     }
     return(-1);
 }
Example #4
0
        public bool Equals(MatchModel other)
        {
            bool areEqual = Id.Equals(other.Id) &&
                            Name.Equals(other.Name) &&
                            StartDate.Equals(other.StartDate) &&
                            MatchType.Equals(other.MatchType);

            if (HasBets)
            {
                return(areEqual && (Bets.Except(other.Bets, new GenericComparer <BetModel>()).Count() == 0));
            }

            return(areEqual);
        }
Example #5
0
        public void checkMatch()
        {
            if (CheckedHumanPlayers.Count < 2)
            {
                throw new Exception("Not enough players");
            }
            int countPlayers = 0;

            if (MatchType.Equals(Constants.FFA))
            {
                return;
            }
            if (MatchType.Equals(Constants.V1))
            {
                countPlayers = Constants.TotalPlayers_V1;
            }
            if (MatchType.Equals(Constants.V2))
            {
                countPlayers = Constants.TotalPlayers_V2;
            }
            if (MatchType.Equals(Constants.V22))
            {
                countPlayers = Constants.TotalPlayers_V22;
            }
            if (MatchType.Equals(Constants.V222))
            {
                countPlayers = Constants.TotalPlayers_V222;
            }
            if (MatchType.Equals(Constants.V3))
            {
                countPlayers = Constants.TotalPlayers_V3;
            }
            if (MatchType.Equals(Constants.V33))
            {
                countPlayers = Constants.TotalPlayers_V33;
            }
            if (MatchType.Equals(Constants.V4))
            {
                countPlayers = Constants.TotalPlayers_V4;
            }
            if (CheckedHumanPlayers.Count != countPlayers)
            {
                throw new Exception("You must select exactly " + countPlayers + " players");
            }
        }
Example #6
0
        // Starts a match with the players and type specified
        public void StartMatch(MatchType mt, List<PlayerIndex> index)
        {
            this.matchType = mt;

            // Reset
            Initialize();
            Reset();
            ResetBackground();

            if (matchType.Equals(MatchType.Arcade) || matchType.Equals(MatchType.Zones) || matchType.Equals(MatchType.Travel) || matchType.Equals(MatchType.Survival) || matchType.Equals(MatchType.ThinkFast))
            {
                int i = 0;
                PlayerCount = index.Count;

                // Add each player
                foreach (PlayerIndex pi in index)
                {
                    Pod Player = new Pod(pi, this);
                    if (i == 0)
                    {
                        if (PlayerCount == 1)
                        {
                            Player.Position = new Vector2(640, 360);
                        }
                        else
                        if (PlayerCount == 2)
                        {
                            Player.Position = new Vector2(640, 310);
                        }
                        else
                        {
                            Player.Position = new Vector2(640, 210);
                        }
                    }
                    else if (i == 1)
                    {
                        if (PlayerCount == 2)
                        {
                            Player.Position = new Vector2(640, 410);
                        }
                        else
                        {
                            Player.Position = new Vector2(640, 310);
                        }
                    }
                    else if (i == 2)
                    {
                        Player.Position = new Vector2(640, 410);
                    }
                    else if (i == 3)
                    {
                        Player.Position = new Vector2(640, 510);
                    }
                    Pods.Add(Player);
                    i++;
                }
            }
            else if (matchType.Equals(MatchType.Versus))
            {
                int i = 0;
                PlayerCount = index.Count;
                // Add each player
                foreach (PlayerIndex pi in index)
                {
                    Pod Player = new Pod(pi, this);
                    if (i == 0)
                    {
                        if (PlayerCount == 2)
                        {
                            Player.Position = new Vector2(640, 310);
                        }
                        else
                        {
                            Player.Position = new Vector2(640, 210);
                        }
                    }
                    else if (i == 1)
                    {
                        if (PlayerCount == 2)
                        {
                            Player.Position = new Vector2(640, 410);
                        }
                        else
                        {
                            Player.Position = new Vector2(640, 310);
                        }
                    }
                    else if (i == 2)
                    {
                        Player.Position = new Vector2(640, 410);
                    }
                    else if (i == 3)
                    {
                        Player.Position = new Vector2(640, 510);
                    }
                    Pods.Add(Player);
                    i++;

                    Player.Lives = 10;
                    Player.Energy = 100;
                }
            }

            StartEnemyWaves();

            // Start music
            MediaPlayer.Play(gameSong);

            // Temporarily disable high score connectivity (to avoid lag in the middle of a match)
            HighscoreComponent.Global.Enabled = false;
        }