예제 #1
0
파일: MapData.cs 프로젝트: stsy/mappy
 private void m_replacements_Updated(MapReplacement rep)
 {
     if (rep.Permanent)
     {
         m_Empty = false;
         Dirty = true;
     }
     if (DataChanged != null)
         DataChanged();
 }
예제 #2
0
파일: MapData.cs 프로젝트: stsy/mappy
 /// <summary>Removes the hunt from the list.</summary>
 public void Remove(MapReplacement replacement)
 {
     Remove(replacement.Replacement.ToString());
 }
예제 #3
0
파일: MapData.cs 프로젝트: stsy/mappy
 /// <summary>Bind the hunt to the spawn collection. Additive only.</summary>
 public void Bind(MapReplacement replacement)
 {
     foreach (KeyValuePair<uint, GameSpawn> pair in m_data.Engine.Game.Spawns)
     {
         if (replacement.isMatch(pair.Value))
         {
             pair.Value.Replacement = true;
             pair.Value.RepName = replacement.ReplacedName;
         }
     }
 }
예제 #4
0
파일: MapData.cs 프로젝트: stsy/mappy
       /// <summary>Adds the pattern as a hunt.</summary>
       /// <param name="pattern">A regular expression to compare against the spawn name.</param>
       /// <param name="permanent">Determines if the hunt will be saved with the map data.</param>
       public MapReplacement Add(string pattern, string replacement, bool permanent)
       {
           if (pattern == "" || m_replacements.ContainsKey(pattern))
               return null;
           try
           {
               Regex.Match("", pattern);
           }
           catch (ArgumentException)
           {
               return null;
           }
           MapReplacement rep = new MapReplacement(pattern, replacement, permanent);
           m_replacements.Add(pattern, rep);
           Bind(rep);

           if (Updated != null)
               Updated(rep);
           if (DataChanged != null)
               DataChanged();

           return rep;
       }