Exemplo n.º 1
0
 // Expecting a line like "KR1,CB2"
 private void SetSpecialTeamPlayer(string line)
 {
     string[] parts = line.Split(",".ToCharArray());
     if (parts.Length == 2)
     {
         try
         {
             SpecialTeamer guy   = (SpecialTeamer)Enum.Parse(typeof(SpecialTeamer), parts[0]);
             Positions     pos   = (Positions)Enum.Parse(typeof(Positions), parts[1].Substring(0, parts[1].Length - 1));
             int           depth = 1;
             Int32.TryParse(parts[1].Substring(parts[1].Length - 1), out depth);
             Tool.SetSpecialTeamPosition(mTracker.Team, guy, pos, depth);
         }
         catch
         {
             StaticUtils.AddError(string.Format("Team:{0} Error adding special team player {1}", mTracker.Team, line));
         }
     }
     else if (parts.Length == 3)
     {
         try
         {
             SpecialTeamer guy = (SpecialTeamer)Enum.Parse(typeof(SpecialTeamer), parts[0]);
             Tool.SetSpecialTeamPosition(mTracker.Team, guy, parts[1], parts[2]);
         }
         catch
         {
             StaticUtils.AddError(string.Format("Team:{0} Error adding special team player {1}", mTracker.Team, line));
         }
     }
 }
Exemplo n.º 2
0
 public string GetSpecialTeamPosition(string team, SpecialTeamer guy)
 {
     int teamIndex = GetTeamIndex(team);
     int teamPlayerPointersStart = teamIndex * cTeamDiff + m49ersPlayerPointersStart;
     List<int> playerIndexes = GetPlayerIndexesForTeam(team);
     int playerIndex = GameSaveData[teamPlayerPointersStart + (int)guy];
     String pos = "ERROR";
     int depth = 0;
     if (playerIndex < playerIndexes.Count)
     {
         pos = GetPlayerPosition(playerIndexes[playerIndex]);
         for (int i = 0; i <= playerIndex; i++)
         {
             if (pos == GetPlayerPosition(playerIndexes[i]))
                 depth++;
         }
     }
     string retVal = String.Format("{0},{1}{2}", guy.ToString(), pos.ToString(), depth);
     return retVal;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="team"></param>
 /// <param name="stPosition"></param>
 /// <param name="firstName"></param>
 /// <param name="lastName"></param>
 public void SetSpecialTeamPosition(string team, SpecialTeamer stPosition, string firstName, string lastName)
 {
     string theName = firstName + " " + lastName;
     int index = -1;
     int teamIndex = GetTeamIndex(team);
     int teamPlayerPointersStart = teamIndex * cTeamDiff + m49ersPlayerPointersStart;
     List<int> playerIndexes = GetPlayerIndexesForTeam(team);
     for (int i = 0; i < playerIndexes.Count; i++)
     {
         if (theName == GetPlayerName(playerIndexes[i], ' '))
         {
             index = i;
             break;
         }
     }
     if (index > -1)
     {
         SetByte(teamPlayerPointersStart + (int)stPosition, (byte)index);
     }
     else
     {
         throw new InvalidOperationException("Error setting special teamer! '"+ theName + "' is not on the team!");
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="team"></param>
        /// <param name="stPosition"></param>
        /// <param name="pos"></param>
        /// <param name="depth">Depth 1-based (CB1 ==> first CB)</param>
        public void SetSpecialTeamPosition(string team, SpecialTeamer stPosition, Positions pos, int depth)
        {
            int index = -1;
            int teamIndex = GetTeamIndex(team);
            int teamPlayerPointersStart = teamIndex * cTeamDiff + m49ersPlayerPointersStart;
            List<int> playerIndexes = GetPlayerIndexesForTeam(team);
            int testDepth = 0;
            string position = pos.ToString();
            for (int i = 0; i < playerIndexes.Count; i++)
            {
                if (GetPlayerPosition(playerIndexes[i]) == position)
                {
                    testDepth++;
                    if (testDepth == depth)
                    {
                        index = i;
                        break;
                    }
                }
            }

            if (index > -1)
            {
                SetByte(teamPlayerPointersStart + (int)stPosition, (byte)index);
            }
            else
            {
                throw new InvalidOperationException(string.Format("Depth {0} at position {1} does not exist", depth, pos.ToString()));
            }
        }