private void m_replacements_Updated(MapReplacement rep) { if (rep.Permanent) { m_Empty = false; Dirty = true; } if (DataChanged != null) DataChanged(); }
/// <summary>Removes the hunt from the list.</summary> public void Remove(MapReplacement replacement) { Remove(replacement.Replacement.ToString()); }
/// <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; } } }
/// <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; }