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); } } } } } }
public MapNoteEventArgs(String mapId, MapNote mapNote) { MapID = mapId; MapNote = mapNote; }