示例#1
0
 public void setParticulars(NgMapObj[] maps, string imgFolder)
 {
     NgMaps = maps;
     ImageFolderRelativePath = imgFolder;
     var rootMapId = maps.FirstOrDefault().id;
     gotoMap(rootMapId);
     // ... fire map changed event for the first time
     if (MapChanged != null)
         MapChanged(rootMapId);
     Invalidate();
 }
 private string GetImageFileForMap(NgMapObj map)
 {
     return Path.Combine(FullResImageFolder, Path.GetFileName(map.img));
 }
示例#3
0
 private bool gotoMap(string mapId)
 {
     if (NgMaps == null)
     {
         curMap = null;
         curMapImage = null;
         curPoint = null;
         return false;
     }
     var map2b = NgMaps.FirstOrDefault(x => x.id == mapId);
     if (map2b == null)
         return false;
     curMap = map2b;
     var imgPath = Path.Combine(ImageFolderRelativePath, curMap.img);
     curMapImage = Image.FromFile(imgPath);
     return true;
 }
示例#4
0
 public static string MapObj2Json(NgMapObj obj)
 {
     var json = JsonConvert.SerializeObject(obj);
     return json;
 }