public MapNoteCollection GetMapNotes(String mapId) { MapNoteCollection result; if (!m_MapNotes.TryGetValue(mapId, out result)) { m_MapNotes.Add(mapId, result = new MapNoteCollection()); } return(result); }
public void RemoveMapNote(String mapId, Position position) { MapNoteCollection mapNotes = GetMapNotes(mapId); MapNote mapNote; if (mapNotes.TryGetValue(position, out mapNote) && mapNotes.Remove(position) && RemovedMapNote != null) { RemovedMapNote(this, new MapNoteEventArgs(mapId, mapNote)); } }
public MapNote FindMapNote(String mapId, Position position) { MapNoteCollection mapNoteCollection = FindMapNotes(mapId); MapNote result; if (mapNoteCollection != null && mapNoteCollection.TryGetValue(position, out result)) { return(result); } return(null); }
public MapNote GetMapNote(String mapId, Position position) { MapNoteCollection mapNotes = GetMapNotes(mapId); MapNote mapNote; if (!mapNotes.TryGetValue(position, out mapNote)) { mapNote = new MapNote(mapId, position, null); mapNotes.Add(position, mapNote); if (AddedMapNote != null) { AddedMapNote(this, new MapNoteEventArgs(mapId, mapNote)); } } return(mapNote); }
public void SetMapNoteText(String mapId, Position position, String text) { MapNoteCollection mapNotes = GetMapNotes(mapId); MapNote mapNote; Boolean flag; if (!mapNotes.TryGetValue(position, out mapNote)) { mapNote = new MapNote(mapId, position, text); mapNotes.Add(position, mapNote); flag = true; } else { flag = (mapNote.Note != text); mapNote.Note = text; } if (flag && UpdatedMapNoteText != null) { UpdatedMapNoteText(this, new MapNoteEventArgs(mapId, mapNote)); } }
internal void Load(SaveGameData mapdata) { Clear(); if (mapdata == null) { return; } MapNoteEventArgs mapNoteEventArgs = new MapNoteEventArgs(null, null); Int32 num = mapdata.Get <Int32>("MapCount", 0); for (Int32 i = 0; i < num; i++) { String text = mapdata.Get <String>("Map" + i, null); SaveGameData saveGameData = mapdata.Get <SaveGameData>("Notes" + i, null); if (text != null && saveGameData != null) { MapNoteCollection mapNoteCollection = new MapNoteCollection(); m_MapNotes.Add(text, mapNoteCollection); Int32 num2 = saveGameData.Get <Int32>("Count", 0); for (Int32 j = 0; j < num2; j++) { Int32 num3 = saveGameData.Get <Int32>("Nx" + j, -1); Int32 num4 = saveGameData.Get <Int32>("Ny" + j, -1); String text2 = saveGameData.Get <String>("Nt" + j, null); if (num3 != -1 && num4 != -1 && !String.IsNullOrEmpty(text2)) { MapNote mapNote = new MapNote(text, new Position(num3, num4), text2); mapNoteCollection.Add(new Position(num3, num4), mapNote); if (AddedMapNote != null) { mapNoteEventArgs.MapID = text; mapNoteEventArgs.MapNote = mapNote; AddedMapNote(this, mapNoteEventArgs); } } } } } }
private void RemoveAllNotes(String mapId, MapNoteCollection collection) { MapNoteEventArgs mapNoteEventArgs = new MapNoteEventArgs(null, null); while (collection.Count > 0) { Dictionary <Position, MapNote> .Enumerator enumerator = collection.GetEnumerator(); if (enumerator.MoveNext()) { KeyValuePair <Position, MapNote> keyValuePair = enumerator.Current; collection.Remove(keyValuePair.Key); if (RemovedMapNote != null) { mapNoteEventArgs.MapID = mapId; MapNoteEventArgs mapNoteEventArgs2 = mapNoteEventArgs; KeyValuePair <Position, MapNote> keyValuePair2 = enumerator.Current; mapNoteEventArgs2.MapNote = keyValuePair2.Value; RemovedMapNote(this, mapNoteEventArgs); } } } collection.Clear(); }